/** * Return manager instance * * @access protected * @param void * @return I18nLocales */ function manager() { if (!$this->manager instanceof I18nLocales) { $this->manager = I18nLocales::instance(); } return $this->manager; }
/** * Delete locale logo * * @param void * @return null */ function delete_logo() { $locale = I18nLocales::findById(get_id()); if (!$locale instanceof I18nLocale) { flash_error(lang('locale dnx')); $this->redirectToReferer(get_url('i18n', 'index')); } // if if (!$locale->canEdit(logged_user())) { flash_error(lang('no access permissions')); $this->redirectTo('i18n', 'index'); } // if try { DB::beginWork(); $locale->deleteLogo(); $locale->save(); ApplicationLogs::createLog($locale, 0, ApplicationLogs::ACTION_EDIT); DB::commit(); flash_success(lang('success delete logo')); } catch (Exception $e) { DB::rollback(); flash_error(lang('error delete logo', $e)); } // try $this->redirectToUrl($locale->getEditLogoUrl()); }
/** * 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, 'I18nLocales')) { return parent::delete($condition); } else { return I18nLocales::instance()->delete($condition); } // if }
/** * Return edit locale value URL * * @param void * @return string */ function getDescriptionIn($language_code, $country_code) { $locale = I18nLocales::instance()->getLocale($language_code, $country_code); if ($locale instanceof I18nLocale) { $locale_value = $locale->getValue($this->getName()); if ($locale_value instanceof I18nLocaleValue) { return $locale_value->getDescription(); } } return ''; }