AAAAhome/academiac/www/administrator/components/com_virtuemart/controllers/translate.php000060400000006504151372432160025375 0ustar00getDefault() == $lang ) $dblang =''; $dblang= strtr($lang,'-','_'); $id = JRequest::getInt('id',0); $viewKey = JRequest::getWord('editView'); // TODO temp trick for vendor if ($viewKey == 'vendor') $id = 1 ; $tables = array ('category' =>'categories','product' =>'products','manufacturer' =>'manufacturers','manufacturercategories' =>'manufacturercategories','vendor' =>'vendors', 'paymentmethod' =>'paymentmethods', 'shipmentmethod' =>'shipmentmethods'); if ( !array_key_exists($viewKey, $tables) ) { $json['msg'] ="Invalid view ". $viewKey; echo json_encode($json); jExit(); } $tableName = '#__virtuemart_'.$tables[$viewKey].'_'.$dblang; $db =JFactory::getDBO(); $q='select * FROM `'.$tableName.'` where `virtuemart_'.$viewKey.'_id` ='.$id; $db->setQuery($q); if ($json['fields'] = $db->loadAssoc()) { $json['structure'] = 'filled' ; $json['msg'] = jText::_('COM_VIRTUEMART_SELECTED_LANG').':'.$lang; } else { $json['structure'] = 'empty' ; $db->setQuery('SHOW COLUMNS FROM '.$tableName); $tableDescribe = $db->loadAssocList(); array_shift($tableDescribe); $fields=array(); foreach ($tableDescribe as $key =>$val) $fields[$val['Field']] = $val['Field'] ; $json['fields'] = $fields; $json['msg'] = JText::sprintf('COM_VIRTUEMART_LANG_IS_EMPTY',$lang ,jText::_('COM_VIRTUEMART_'.strtoupper( $viewKey)) ) ; } echo json_encode($json); jExit(); } } //pure php no tag