/**
  * Return manager instance
  *
  * @access protected
  * @param void
  * @return I18nLocaleValues
  */
 function manager()
 {
     if (!$this->manager instanceof I18nLocaleValues) {
         $this->manager = I18nLocaleValues::instance();
     }
     return $this->manager;
 }
Ejemplo n.º 2
0
 /**
  * Edit values
  *
  * @param void
  * @return null
  */
 function edit_values()
 {
     $locale = I18nLocales::findById(get_id());
     if (!$locale instanceof I18nLocale) {
         flash_error(lang('locale dnx'));
         $this->redirectTo('i18n', 'index');
     }
     // if
     if (!$locale->canEdit(logged_user())) {
         flash_error(lang('no access permissions'));
         $this->redirectTo('i18n', 'index');
     }
     // if
     $this->setTemplate('edit_values');
     tpl_assign('locale', $locale);
     tpl_assign('values', I18nLocaleValues::instance()->getLocaleValues(get_id()));
     //tpl_assign('categories', I18nLocaleValues::instance()->getCategories($locale));
     //$this->setSidebar(get_template_path('index_sidebar'));
 }
Ejemplo n.º 3
0
 /**
  * Return locale values as text
  *
  * @param string name
  * @return string
  */
 function getDownloadText($output = 'text')
 {
     $values = I18nLocaleValues::instance()->getLocaleValues($this->getId());
     if ($output == 'php') {
         $s = '';
         foreach ($values as $v) {
             $t = addslashes($v->getDescription());
             $s .= "'{$v->getName()}' => '{$t}',\n";
         }
         return "<?php\nreturn array(\n{$s});\n?>";
     }
     $s = '';
     foreach ($values as $v) {
         $t = addslashes($v->getDescription());
         $s .= "{$v->getName()}\t{$t}\n";
     }
     return $s;
 }
 /**
  * Delete rows that match specific conditions. If $conditions is NULL all rows from table will be deleted
  *
  * @access public
  * @param string $conditions Query conditions
  * @return boolean
  */
 function delete($condition = null)
 {
     if (isset($this) && instance_of($this, 'I18nLocaleValues')) {
         return parent::delete($condition);
     } else {
         return I18nLocaleValues::instance()->delete($condition);
     }
     // if
 }
 /**
  * loadValues
  *
  * @param boolean $replace Replace all values with the new values
  * @param integer $locale Locale to use
  * @return boolean
  */
 function loadValues($locale, $replace)
 {
     return I18nLocaleValues::instance()->import($this->getId(), $locale, $replace);
 }