示例#1
0
 public function getAllWebSiteLanguage()
 {
     $languageSelect = new Languages();
     $select = $languageSelect->select();
     $languageData = $languageSelect->fetchAll($select);
     return $languageData;
 }
示例#2
0
文件: Cms.php 项目: hosivan90/toxotes
 /**
  * @param $id
  * @param array $parameters
  * @param string $domain
  * @param null $locale
  *
  * @return mixed|string
  */
 public static function t($id, array $parameters = array(), $domain = 'messages', $locale = null)
 {
     if (null == $locale && self::$currentLang) {
         $locale = self::$currentLang->getLangCode();
     }
     return t($id, $parameters, $domain, $locale);
 }
示例#3
0
 /**
  *
  */
 public function getMainform()
 {
     $this->setName('safinstances');
     $label = new Zend_Form_Element_Text('label');
     $label->setLabel('label');
     $label->setRequired(true);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Save');
     $submit->setAttrib('id', 'submitbuttona');
     $domain = new Zend_Form_Element_Text('domain');
     $domain->setLabel('Main domain name');
     $domain->setRequired(true);
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel('Description');
     $languagesId = new Zend_Form_Element_Select('languages_id');
     $options = new Languages();
     foreach ($options->fetchAlltoFlatArray() as $k => $v) {
         $languagesId->addMultiOption($k, $v['mlabel']);
     }
     $languagesId->setLabel('Main language');
     $creationdate = new Zend_Form_Element_Text('creationdate');
     $creationdate->setLabel('Creation date');
     $offlinedate = new Zend_Form_Element_Text('offlinedate');
     $offlinedate->setLabel('Offline date');
     $active = new Zend_Form_Element_Checkbox('active');
     $active->setLabel('Is Active?');
     $offlinemessage = new Zend_Form_Element_Textarea('offlinemessage');
     $offlinemessage->setLabel('Offline message');
     $this->addElements(array($this->idb, $this->hashb, $label, $domain, $description, $languagesId, $creationdate, $offlinedate, $active, $offlinemessage));
     $this->addElements(array($submit));
     return $this;
 }
示例#4
0
function constructRulesUsingCallBack($rules, \Languages $langs, $task)
{
    foreach ($rules as $fieldType => $rule) {
        foreach ($langs->all() as $lang) {
            $task($langRules, $fieldType, $lang, $rule);
        }
    }
    return $langRules;
}
示例#5
0
 public function Show($parameters)
 {
     $output = "";
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     $mainviewhelper = new Zend_View();
     $mainviewhelper->addBasePath(APPLICATION_PATH . '/modules/default/views/');
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     if (!empty($parameters['code'])) {
         $code = $parameters['code'];
     } else {
         return "";
     }
     // Get the products
     $data = Products::GetProductsByGroupCode($code, $languageID);
     // Check the existence of the mandatories attributes
     if (!empty($data['attributes'][0])) {
         $view->attributes = $data['attributes'];
     }
     // Check if there are values set for the group of the product selected
     if (!empty($data['attributes_values'][0])) {
         $view->values = $data['attributes_values'];
     }
     // Get the products
     if (!empty($data['products'][0])) {
         $view->products = $data['products'];
     }
     $view->mainviewhelper = $mainviewhelper;
     // Path of the template
     return $view->render('productsattributes.phtml');
 }
示例#6
0
 protected function _initLanguages()
 {
     $this->languages = \Languages::findByPublished(true);
     if (sizeof($this->languages) < 2) {
         $this->currentLang = $this->languages[0];
         return;
     }
     $currentLangCode = $this->request()->get('lang');
     if (!$currentLangCode) {
         $currentLangCode = Factory::getCookie()->read('lang');
     }
     if (!$currentLangCode) {
         $this->currentLang = \Languages::findOneByDefault(true);
         $currentLangCode = $this->currentLang->getLangCode();
     }
     Factory::getCookie()->write('lang', $currentLangCode);
     if (Factory::getRouter()->getUrl() == '/' && !$this->request()->get('lang')) {
         $this->redirect($currentLangCode);
     }
     if (!$this->currentLang) {
         $this->currentLang = \Languages::findOneByLangCode($currentLangCode);
     }
     $translator = Translator::getInstance();
     $translator->setLocale($currentLangCode);
     Cms::$currentLang = $this->currentLang;
 }
 /**
  * Show template details page
  *
  * @param void
  * @return null
  */
 function details()
 {
     if ($this->active_template->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     $template_data = $this->request->post('template');
     if (!is_array($template_data)) {
         $template_data = array('subject' => $this->active_template->getSubject(), 'body' => $this->active_template->getBody());
     }
     // if
     $this->smarty->assign(array('template' => $template, 'template_data' => $template_data, 'languages' => Languages::findAll()));
     if ($this->request->isSubmitted()) {
         $this->active_template->setAttributes($template_data);
         $save = $template->save();
         if ($save && !is_error($save)) {
             flash_success('Email template has been updated');
             $this->redirectTo('admin_settings_email_templates');
         } else {
             $this->smarty->assign('errors', $save);
         }
         // if
     }
     // if
 }
示例#8
0
 /**
  * Load all the resources
  * @see Zend_Controller_Action::preDispatch()
  */
 public function preDispatch()
 {
     $module = $this->getRequest()->getModuleName();
     $controller = $this->getRequest()->getControllerName();
     // Get all the resources set in the layout.xml file
     $css = Shineisp_Commons_Layout::getResources($module, $controller, "css", "base");
     $js = Shineisp_Commons_Layout::getResources($module, $controller, "js", "base");
     $template = Shineisp_Commons_Layout::getTemplate($module, $controller, "base");
     $this->view->doctype('XHTML1_TRANSITIONAL');
     $this->view->addBasePath(PUBLIC_PATH . "/skins/setup/base/");
     $this->view->headTitle("ShineISP Setup");
     $this->view->headMeta()->setName('robots', "INDEX, FOLLOW");
     $this->view->headMeta()->setName('author', "Shine Software Company");
     $this->view->headMeta()->setName('keywords', "shine software, isp software");
     $this->view->headMeta()->setName('description', "This is the ShineISP setup configuration");
     $this->view->headLink()->headLink(array('rel' => 'icon', 'type' => 'image/x-icon', 'href' => "/skins/{$module}/base/images/favicon.ico"));
     $this->view->headTitle()->setSeparator(' - ');
     foreach ($js as $item) {
         $this->view->headScript()->appendFile($item['resource']);
     }
     foreach ($css as $item) {
         $this->view->headLink()->appendStylesheet($item['resource']);
     }
     $this->getHelper('layout')->setLayout('1column');
     $session = new Zend_Session_Namespace('setup');
     Languages::setDefaultLanguage(PUBLIC_PATH, $session->locale);
     if (empty($session->db)) {
         $this->_helper->redirector('index', 'database', 'setup');
     }
     if (empty($session->permissions) || $session->permissions == false) {
         $this->_helper->redirector('index', 'checker', 'setup');
     }
 }
示例#9
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'title', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Title'), 'class' => 'form-control'));
     $this->addElement('textarea', 'body', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Body'), 'class' => 'form-control col-lg-12'));
     $this->addElement('text', 'var', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('URL-Key'), 'description' => $translate->_('This is the name of the page. For multilanguages website you can create more page with the same Url-key with different languages.'), 'rows' => 5, 'class' => 'form-control'));
     $this->addElement('textarea', 'keywords', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Keywords'), 'rows' => 5, 'description' => $translate->_('separate each keyword by a comma'), 'class' => 'col-lg-12 form-control'));
     $this->addElement('textarea', 'blocks', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Blocks'), 'class' => 'form-control'));
     $this->addElement('textarea', 'xmllayout', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('XML Layout'), 'class' => 'form-control'));
     $this->addElement('checkbox', 'blog', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('is Blog post'), 'class' => 'form-control'));
     $this->addElement('select', 'parent_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Parent'), 'class' => 'form-control'));
     $this->getElement('parent_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(CmsPages::getList(true));
     $this->addElement('select', 'layout', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Content layouts'), 'class' => 'form-control'));
     $this->getElement('layout')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(CmsPages::getLayouts());
     $this->addElement('select', 'pagelayout', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Page layouts'), 'class' => 'form-control'));
     $this->getElement('pagelayout')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(CmsPages::getPageLayouts());
     $this->addElement('multiselect', 'language_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Language'), 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 3', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4 col-sm-4'));
     $this->getElement('language_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Languages::getList());
     $this->addElement('checkbox', 'showinmenu', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Show in the navigation menu'), 'class' => 'form-control'));
     $this->addElement('checkbox', 'showonrss', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Publish on RSS Feed'), 'class' => 'form-control'));
     $this->addElement('checkbox', 'active', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Active'), 'class' => 'form-control'));
     $this->addElement('hidden', 'page_id');
 }
示例#10
0
 /**
  * Iterator
  * Get all the blocks and attach the content within the view called 
  * @param array $blocks
  * @param string $side
  */
 private function Iterator($blocks, $side)
 {
     $ns = new Zend_Session_Namespace('Admin');
     $languageID = Languages::get_language_id($ns->lang);
     if (!empty($blocks['side'])) {
         if ($blocks['side'] == $side) {
             $blocks = $blocks['block'];
             if (count($blocks) > 1) {
                 foreach ($blocks as $block) {
                     $block = CmsBlocks::findbyvar($block['name'], $languageID);
                     if (!empty($block[0]['body'])) {
                         echo $block[0]['body'];
                     }
                 }
             } else {
                 $block = CmsBlocks::findbyvar($blocks['name'], $languageID);
                 if (!empty($block[0]['body'])) {
                     echo $block[0]['body'];
                 } else {
                     echo $blocks['name'] . " block not found.";
                 }
             }
         }
     }
 }
示例#11
0
 private static function instance()
 {
     if (!self::$instance instanceof Languages) {
         self::$instance = new Languages();
     }
     return self::$instance;
 }
示例#12
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setAttrib('accept-charset', 'UTF-8');
     $this->setName('safinstances');
     $id = new Zend_Form_Element_Hidden('id');
     $hash = new Zend_Form_Element_Hash('no_csrf_foo', array('salt' => '4s564evzaSD64sf'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $label = new Zend_Form_Element_Text('label');
     $label->setLabel('label');
     $domain = new Zend_Form_Element_Text('domain');
     $domain->setLabel('domain');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel('description');
     $rootpath = new Zend_Form_Element_Text('rootpath');
     $rootpath->setLabel('rootpath');
     $languagesId = new Zend_Form_Element_Select('languages_id');
     $options = new Languages();
     $languagesId->addMultiOption('', '----------');
     foreach ($options->fetchAlltoFlatArray() as $k => $v) {
         $languagesId->addMultiOption($k, $v['mlabel']);
     }
     $languagesId->setLabel('languages_id');
     $database = new Zend_Form_Element_Text('database');
     $database->setLabel('database');
     $secdomains = new Zend_Form_Element_Text('secdomains');
     $secdomains->setLabel('secdomains');
     $creationdate = new Zend_Form_Element_Text('creationdate');
     $creationdate->setLabel('creationdate');
     $offlinedate = new Zend_Form_Element_Text('offlinedate');
     $offlinedate->setLabel('offlinedate');
     $active = new Zend_Form_Element_Checkbox('active');
     $active->setLabel('active');
     $offlinemessage = new Zend_Form_Element_Text('offlinemessage');
     $offlinemessage->setLabel('offlinemessage');
     $metatags = new Zend_Form_Element_Text('metakeywords');
     $metatags->setLabel('metakeywords');
     $pagMenusSafinstances = new PagmenuslistForm('PagmenusSafinstances');
     $pagMenusSafinstances->setLabel('PagmenusSafinstances');
     $safinstancesSafModules = new SafmoduleslistForm('SafinstancesSafmodules');
     $safinstancesSafModules->setLabel('SafinstancesSafmodules');
     $safinstancesUsers = new UserslistForm('SafinstancesUsers');
     $safinstancesUsers->setLabel('SafinstancesUsers');
     $this->addElements(array($id, $hash, $label, $domain, $description, $rootpath, $languagesId, $database, $secdomains, $creationdate, $offlinedate, $active, $offlinemessage, $safinstancestypeId, $metatags, $pagMenusSafinstances, $safinstancesSafModules, $safinstancesUsers));
     $this->addElements(array($submit));
 }
示例#13
0
 public function init()
 {
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $this->addElement('select', 'locale', array('decorators' => array('Bootstrap'), 'label' => 'Language', 'class' => 'form-control', 'multioptions' => Languages::getLanguageFiles(PUBLIC_PATH . "/languages")));
     $this->addElement('textarea', 'agreement', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'label' => 'Agreements', 'rows' => '10', 'value' => Shineisp_Commons_Utilities::readfile(PUBLIC_PATH . "/../LICENSE")));
     $this->addElement('select', 'chkagreement', array('decorators' => array('Bootstrap'), 'label' => 'I agree with the legal terms', 'class' => 'form-control', 'multioptions' => array(1 => 'YES, I agree with the legal terms', 0 => 'NO, I disagree with these legal terms')));
     $this->addElement('submit', 'submit', array('label' => 'Continue', 'decorators' => array('Bootstrap'), 'class' => 'btn btn-primary btn-lg'));
 }
示例#14
0
 public static function DropDown()
 {
     $res = array();
     foreach (Languages::model()->findAll() as $record) {
         $res[$record->idLanguages] = $record->LanguagesName;
     }
     return $res;
 }
示例#15
0
 public function execute()
 {
     if (!function_exists('memory_get_usage')) {
         $this->error("You must compile PHP with --enable-memory-limit", true);
     }
     $langtool = new Languages();
     $memlast = $memstart = memory_get_usage();
     $this->output("Base memory usage: {$memstart}\n");
     foreach ($langtool->getLanguages() as $langcode) {
         Language::factory($langcode);
         $memstep = memory_get_usage();
         $this->output(sprintf("%12s: %d\n", $langcode, $memstep - $memlast));
         $memlast = $memstep;
     }
     $memend = memory_get_usage();
     $this->output(' Total Usage: ' . ($memend - $memstart) . "\n");
 }
示例#16
0
 /**
  * Get the list of the languages by page_id
  * 
  *  
  * @param integer $index
  */
 public static function getTranslations($pageid)
 {
     $items = array();
     $records = Doctrine_Query::create()->from('CmsPagesData')->where("page_id = ?", $pageid)->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     foreach ($records as $record) {
         $items[] = Languages::getLanguageLabel($record['language_id']);
     }
     return implode(", ", $items);
 }
示例#17
0
 public function executeLogin()
 {
     $this->document()->title = t('Login');
     $this->setLayout('login');
     $this->setView('Login/default');
     /** @var CMSBackendAuth $backendAuth */
     $backendAuth = CMSBackendAuth::getInstance();
     $comeback = $this->get('r');
     $comeback = null != $comeback ? urldecode($comeback) : '/';
     if ($backendAuth->isCMSBackendAuthenticated()) {
         $this->redirect($comeback);
     }
     $display = $this->post('credential');
     if (!$display) {
         $display = Factory::getCookie()->read('username');
     }
     $languages = \Languages::getAllActiveLanguages('lang_code');
     $error = array();
     if ($this->request()->isPostRequest()) {
         //check captcha first
         $password = $this->post('password');
         $credential = $this->post('credential');
         //don't care display name
         $chosen_lang = $this->post('language');
         Factory::getCookie()->write('language', $chosen_lang);
         /*$captcha = $this->post('captcha');*/
         Factory::getCookie()->write('username', $credential);
         /*if(Math::check($captcha)==false) {
               $error[] = t('Sai rồi, tính nhẩm kém quá');
           }*/
         if (empty($error) && true === ($result = $backendAuth->authenticate($credential, $password))) {
             //authenticated, redirect to pre-page
             $this->redirect($comeback);
         } else {
             if (isset($result)) {
                 switch ($result) {
                     case CMSBackendAuth::ERROR_USER_NOT_ACCESS_ADMIN:
                         $error[] = t('Restricted area, no permission');
                         break;
                     case CMSBackendAuth::ERROR_CREDENTIAL_INVALID:
                         $error[] = t('Plz re-enter your email or your password');
                         break;
                     case CMSBackendAuth::ERROR_UNKNOWN_IDENTITY:
                         $error[] = t('Unknown identity');
                         break;
                     default:
                         $error[] = t('Login fail');
                 }
             }
         }
     }
     $this->view()->assign('display', $display);
     $this->view()->assign('error', $error);
     $this->view()->assign('current_lang', $this->currentLang ? $this->currentLang->getLangCode() : '');
     $this->view()->assign('languages', $languages);
     return $this->renderComponent();
 }
示例#18
0
 public function Show($parameters)
 {
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     // Generate the xml file in the public path /documents
     Reviews::getXMLDataMap($languageID);
     return $view->render('reviewsmap.phtml');
 }
示例#19
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'var', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Var'), 'class' => 'form-control'));
     $this->addElement('text', 'title', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Title'), 'class' => 'form-control'));
     $this->addElement('textarea', 'body', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Body'), 'class' => 'col-lg-12 form-control'));
     $this->addElement('multiselect', 'language_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Language'), 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 2', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4'));
     $this->getElement('language_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Languages::getList());
     $this->addElement('hidden', 'block_id');
 }
示例#20
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'language', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Language'), 'description' => $translate->_('Set the name of the language'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'locale', array('filters' => array('StringTrim'), 'label' => $translate->_('Locale'), 'description' => $translate->_('Write here the name of the locale (eg. en_US).'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'code', array('filters' => array('StringTrim'), 'label' => $translate->_('Code'), 'description' => $translate->_('Write here the name of the locale (eg. en). '), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => Languages::getLanguageFiles()));
     $this->addElement('checkbox', 'active', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Active'), 'class' => 'form-control'));
     $this->addElement('select', 'base', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Base'), 'class' => 'form-control', 'description' => $translate->_('Set the main translation language'), 'multioptions' => array(0 => 'NO', 1 => 'YES, It is the default language')));
     $this->addElement('hidden', 'language_id');
 }
示例#21
0
 /**
  * load languages
  */
 private function _loadLanguage()
 {
     $i18nCfg = ConfigHandler::get('i18n');
     if (!$i18nCfg['enable']) {
         return null;
     }
     $current_lang_code = $this->get('lang');
     if (!$current_lang_code) {
         $current_lang_code = Factory::getCookie()->read('language');
     }
     if (!$current_lang_code) {
         $this->currentLang = \Languages::retrieveByDefault(1);
         $current_lang_code = $this->currentLang->getLangCode();
     } else {
         $this->currentLang = \Languages::retrieveByLangCode($current_lang_code);
     }
     if ($current_lang_code) {
         Factory::getCookie()->write('language', $current_lang_code);
     }
     //load message
     $translator = Translator::getInstance();
     $translator->setLocale($current_lang_code);
     if ($translator) {
         $translator->addLoader('yml', new YamlFileLoader());
         if (isset($i18nCfg['resource']) && is_array($i18nCfg['resource'])) {
             foreach ($i18nCfg['resource'] as $locale => $files) {
                 for ($i = 0, $size = sizeof($files); $i < $size; ++$i) {
                     $fileInfo = new \SplFileInfo($files[$i]);
                     $filename = $fileInfo->getFilename();
                     $ext = $fileInfo->getExtension();
                     if ($ext == 'yml') {
                         $domain = str_replace('.' . $fileInfo->getExtension(), '', $fileInfo->getFilename());
                         $translator->addResource('yml', $files[$i], $locale, $domain);
                     }
                 }
             }
         }
     }
 }
示例#22
0
 public function Show($parameters)
 {
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $limit = 5;
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     if (!empty($parameters['limit']) && is_numeric($parameters['limit'])) {
         $limit = $parameters['limit'];
     }
     $view->data = Reviews::get_random($limit);
     return $view->render('reviewslist.phtml');
 }
示例#23
0
function fn_twg_get_languages()
{
    $include_hidden = AREA == 'A';
    if (function_exists('fn_get_languages')) {
        $languages = fn_get_languages($include_hidden);
    } else {
        $languages = Languages::getAvailable(AREA, $include_hidden);
    }
    foreach ($languages as &$language) {
        $language['value'] = $language['lang_code'];
        $language['label'] = $language['name'];
    }
    return array_values($languages);
}
示例#24
0
 public function languageswitcher($clslang = "")
 {
     $t = new Zend_Controller_Request_Http();
     $url = $t->getRequestUri();
     $url = explode("?", $url);
     if (count($url) > 0) {
         $uri = $url[0];
     } else {
         $uri = $url;
     }
     $this->view->languages = Languages::getActiveLanguageList();
     $this->view->clslang = $clslang;
     $this->view->uri = $uri;
     return $this->view->render('partials/languageswitcher.phtml');
 }
示例#25
0
 public function languageswitcher()
 {
     $ns = new Zend_Session_Namespace('Admin');
     $t = new Zend_Controller_Request_Http();
     $url = $t->getRequestUri();
     $url = explode("?", $url);
     if (count($url) > 0) {
         $uri = $url[0];
     } else {
         $uri = $url;
     }
     $this->view->languages = Languages::getActiveLanguageList();
     $this->view->uri = $uri;
     $this->view->langselected = $ns->lang;
     return $this->view->render('partials/switcher.phtml');
 }
示例#26
0
 public function Show($parameters)
 {
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     if (!empty($parameters['category']) && is_numeric($parameters['category'])) {
         $id = $parameters['category'];
     } else {
         return "";
     }
     // Get the products
     $view->products = ProductsCategories::getProductListbyCatID($id, "p.product_id, p.uri as uri, pd.name as name, pd.shortdescription as description", $languageID);
     return $view->render('productlist.phtml');
 }
/**
 * Render select language box
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_select_language($params, &$smarty)
{
    $default_language_id = ConfigOptions::getValue('language');
    $value = $default_language_id;
    if (array_key_exists('value', $params)) {
        $value = $params['value'];
        unset($params['value']);
    }
    // if
    $optional = false;
    if (array_key_exists('optional', $params)) {
        $optional = (bool) $params['optional'];
        unset($params['optional']);
    }
    $default_language = null;
    $languages = Languages::findAll();
    if (is_foreachable($languages)) {
        foreach ($languages as $language) {
            if ($language->getId() == $default_language_id) {
                $default_language = $language;
            }
            // if
        }
        // foreach
    }
    // if
    $options = array();
    if ($optional) {
        if (instance_of($default_language, 'Language')) {
            $options[] = option_tag(lang('-- System Default (:value) --', array('value' => $default_language->getName())), '');
        } else {
            $options[] = option_tag(lang('-- None --'), '');
        }
        // if
        $options[] = option_tag('', '');
    }
    // if
    if (is_foreachable($languages)) {
        foreach ($languages as $language) {
            $option_attributes = $language->getId() == $value ? array('selected' => true) : null;
            $options[] = option_tag($language->getName(), $language->getId(), $option_attributes);
        }
        // foreach
    }
    // if
    return select_box($options, $params);
}
示例#28
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'subject', array('filters' => array('StringTrim'), 'required' => true, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Subject'), 'class' => 'form-control'));
     $this->addElement('text', 'uri', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('URI'), 'class' => 'form-control'));
     $this->addElement('select', 'language_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Language'), 'class' => 'form-control'));
     $this->getElement('language_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Languages::getList());
     $this->addElement('select', 'active', array('label' => $translate->_('Active'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
     $this->addElement('textarea', 'metadescription', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Meta Description'), 'rows' => 5, 'class' => 'col-lg-12'));
     $this->addElement('textarea', 'metakeywords', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Meta Keywords'), 'rows' => 5, 'class' => 'col-lg-12'));
     $this->addElement('textarea', 'content', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Body'), 'id' => 'body', 'class' => 'col-lg-12 form-control wysiwyg'));
     $this->addElement('select', 'category_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Category'), 'class' => 'form-control'));
     $this->getElement('category_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(WikiCategories::getList());
     $this->addElement('hidden', 'wiki_id');
 }
示例#29
0
 public static function __($strKey, $arrVariables = array(), $numVariety = 1)
 {
     $objLanguages = Languages::getInstance();
     $numVarietyIndex = $numVariety - 1;
     //        $strTranslation = $objLanguages->translatePattern($strKey, $arrVariables);
     if (empty($objLanguages->arrPhrasesBuffor[$strKey])) {
         $strPattern = $strKey;
     } else {
         if (!isset($objLanguages->arrPhrasesBuffor[$strKey][$numVarietyIndex])) {
             $strMessage = sprintf('Message [%s/%s/%s] dont have variety no %d', $objLanguages->strCurrentLoadedElementTranslation, $objLanguages->getCurrentLanguage(), $strKey, $numVariety);
             throw new \Exception($strMessage);
         } else {
             $strPattern = $objLanguages->arrPhrasesBuffor[$strKey][$numVarietyIndex];
         }
     }
     $strTranslation = $objLanguages->translatePattern($strPattern, $arrVariables);
     return $strTranslation;
 }
示例#30
0
 public function Show($parameters)
 {
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $limit = 10;
     $id = null;
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     if (!empty($parameters['category']) && is_numeric($parameters['category'])) {
         $id = $parameters['category'];
     }
     if (!empty($parameters['limit']) && is_numeric($parameters['limit'])) {
         $limit = $parameters['limit'];
     }
     // Get the products
     $view->wiki = Wiki::get_items($limit, $id);
     return $view->render('wikilist.phtml');
 }