Пример #1
0
 /**
  * Update a unit
  *
  * @param array $unit Array with all unit information + with ISO code that we need
  * to update language dependent fields
  * @return int The total number of rows updated in different tables.
  */
 public function updateUnit($unit)
 {
     list($fields, $languageFields) = $this->_getFields($unit['id']);
     $unitArray = array();
     $languageArray = array();
     foreach ($fields as $field) {
         $unitArray[$field->column_name] = $unit[$field->column_name];
     }
     foreach ($languageFields as $field) {
         $languageArray[$field->column_name] = $unit[$field->column_name];
     }
     $languageArray['iso'] = $unit['iso'];
     $languageArray['unit_id'] = $unit['id'];
     $languageModel = new RM_UnitLanguageDetails();
     $updatedRows = $languageModel->update($languageArray);
     $updatedRows += parent::updateFromGUI($unitArray);
     return $updatedRows;
 }
Пример #2
0
 /**
  * Add language to the system, laguage files need to be in there places on language folder
  *
  * @param string $iso
  */
 public function installLanguage($iso, $name)
 {
     $model = new RM_Languages();
     $language = array('iso' => $iso, 'name' => $name, 'icon' => $this->getIconPath($iso));
     $model->insert($language);
     //Here is a list of multilingual code models
     $model = new RM_UnitTypes();
     $model->addLanguage($iso);
     $unitModel = new RM_UnitLanguageDetails();
     $unitModel->addLanguage($iso);
     $templatesModel = new RM_Templates();
     $templatesModel->addLanguage($iso);
     $manager = new RM_Module_Manager();
     $manager->addLanguage($iso);
     $pluginManager = new RM_Plugin_Manager();
     $pluginManager->addLanguage($iso);
 }