public function indexAction()
 {
     $layout_id = null;
     $base = true;
     if (!$this->getRequest()->isApplication()) {
         if ($this->getRequest()->isInstalling()) {
             $layout_id = 'installer_installation_index';
         } else {
             if (!$this->getSession()->isLoggedIn()) {
                 $layout_id = 'admin_account_login';
             } else {
                 $layout_id = 'application_customization_design_style_edit';
             }
         }
         $module = substr($layout_id, 0, stripos($layout_id, '_'));
         Core_Model_Translator::addModule($module);
     } else {
         if ($this->getApplication()->getLayoutVisibility() != Application_Model_Layout_Homepage::VISIBILITY_HOMEPAGE and !$this->hasParam("value_id")) {
             $page = $this->getApplication()->getFirstActivePage();
             if (!$page->getId()) {
                 $page = Application_Model_Option_Value::getDummy();
             }
             $this->_redirect($page->getMobileUri(), array('value_id' => $page->getId()));
             return $this;
         } else {
             Core_Model_Translator::addModule("padlock");
         }
     }
     //        } else if($this->getRequest()->isXmlHttpRequest()) {
     //            $base = false;
     //        }
     $this->loadPartials($layout_id);
 }
 public function findallAction()
 {
     $data = array();
     if (Core_Model_Language::getCurrentLanguage() != Core_Model_Language::DEFAULT_LANGUAGE) {
         Core_Model_Translator::addModule("mcommerce");
         Core_Model_Translator::addModule("comment");
         $translations = array("OK", "Website", "Phone", "Locate", "Contact successfully added to your address book", "Unable to add the contact to your address book", "You must give the permission to the app to add a contact to your address book", "You already have this user in your contact", "The address you're looking for does not exists.", "An error occurred while loading. Please, try again later.", "An unexpected error occurred while calculating the route.", "Cart", "Proceed", "Next", "Payment", "Delivery", "My information", "Review", "Some mandatory fields are empty.", "Validate", "The payment has been cancelled, something wrong happened? Feel free to contact us.", "Map", "Invalid place", "Unable to calculate the route.", "No address to display on map.", "You must share your location to access this page.", "No place to display on map.", "An error occurred while loading places.", "Load More", "This section is unlocked for mobile users only", "You have gone offline", "Cancel", "Confirm", "View", "Offline content", "Don't close the app while downloading. This may take a while.", "Do you want to download all the contents now to access it when offline? If you do, we recommend you to use a WiFi connection.");
         foreach ($translations as $translation) {
             $data[$translation] = $this->_($translation);
         }
     }
     $this->_sendHtml($data);
 }
Beispiel #3
0
 public static function prepare($module_name)
 {
     $current_language = Core_Model_Language::getCurrentLanguage();
     if (!file_exists(Core_Model_Directory::getBasePathTo("/languages/{$current_language}/default.csv"))) {
         return;
     }
     self::$_translator = new Zend_Translate(array('adapter' => 'csv', 'content' => Core_Model_Directory::getBasePathTo("/languages/{$current_language}/default.csv"), 'locale' => $current_language));
     if (file_exists(Core_Model_Directory::getBasePathTo("/languages/{$current_language}/emails/default.csv"))) {
         self::$_translator->addTranslation(array('content' => Core_Model_Directory::getBasePathTo("/languages/{$current_language}/emails/default.csv"), 'locale' => $current_language));
     }
     if ($module_name != 'application') {
         self::addModule('application');
     }
     self::addModule($module_name);
     return;
 }
 public function indexAction()
 {
     $layout_id = null;
     if (!$this->getRequest()->isApplication()) {
         if ($this->getRequest()->isInstalling()) {
             $layout_id = 'installer_installation_index';
         } else {
             if (!$this->getSession()->isLoggedIn()) {
                 $layout_id = 'admin_account_login';
             } else {
                 $layout_id = 'application_customization_design_style_edit';
             }
         }
         $module = substr($layout_id, 0, stripos($layout_id, '_'));
         Core_Model_Translator::addModule($module);
     }
     $this->loadPartials($layout_id);
 }
 public function findallAction()
 {
     $pages = $this->getApplication()->getOptions();
     $path = $this->getApplication()->getPath() . "/";
     $partials = array();
     $paths = array();
     $option_layouts = array();
     $option_layout = new Application_Model_Option_Layout();
     $layouts = $option_layout->findAll();
     foreach ($layouts as $layout) {
         $option_layouts[] = $layout->getOptionId();
     }
     foreach ($pages as $page) {
         if (!$page->isActive()) {
             continue;
         }
         if (!$page->getIsAjax() and $page->getObject()->getLink()) {
             continue;
         }
         $module_name = current(explode("_", $page->getModel()));
         if (!empty($module_name)) {
             $module_name = strtolower($module_name);
             Core_Model_Translator::addModule($module_name);
         }
         $suffix = "_l{$page->getLayoutId()}";
         $paths = array_merge($paths, $page->getObject()->getTemplatePaths($page, $option_layouts, $suffix, $path));
     }
     if ($this->getApplication()->usesUserAccount()) {
         Core_Model_Translator::addModule("customer");
         $account_partials = array("customer/mobile_account_login/template", "customer/mobile_account_register/template", "customer/mobile_account_edit/template", "customer/mobile_account_forgottenpassword/template");
         foreach ($account_partials as $account_partial) {
             $layout = str_replace("/", "_", $account_partial . "_l1");
             $layout_id = $path . $account_partial;
             $paths[] = array("layout" => $layout, "layout_id" => $layout_id);
         }
     }
     foreach ($paths as $path) {
         $this->loadPartials($path["layout"], false);
         $partials[$path["layout_id"]] = $this->getLayout()->render();
         $this->getLayout()->unload();
     }
     $this->_sendHtml($partials);
 }
Beispiel #6
0
 public function getTemplatePaths($page, $option_layouts, $suffix, $path)
 {
     $paths = array();
     $baseUrl = $this->getApplication()->getUrl(null, array(), null, $this->getApplication()->getKey());
     $module_name = current(explode("_", $this->getModel()));
     if (!empty($module_name)) {
         $module_name = strtolower($module_name);
         Core_Model_Translator::addModule($module_name);
     }
     $layout = str_replace(array($baseUrl, "/"), array("", "_"), $page->getUrl("template") . $suffix);
     $params = array();
     if (in_array($page->getOptionId(), $option_layouts)) {
         $params["value_id"] = $page->getId();
     }
     $layout_id = str_replace($baseUrl, "", $path . $page->getUrl("template", $params));
     $paths[] = array("layout" => $layout, "layout_id" => $layout_id);
     if ($page->getMobileViewUri("template")) {
         $layout = str_replace(array($baseUrl, "/", "view"), array("", "_", "list"), $page->getMobileViewUri("template") . $suffix);
         $params = array();
         if (in_array($page->getOptionId(), $option_layouts)) {
             $params["value_id"] = $page->getId();
         }
         $layout_id = str_replace(array($baseUrl, "view"), array("", "list"), $path . $page->getMobileViewUri("template", $params));
         $paths[] = array("layout" => $layout, "layout_id" => $layout_id);
         $layout = str_replace(array($baseUrl, "/"), array("", "_"), $page->getMobileViewUri("template") . $suffix);
         $params = array();
         if (in_array($page->getOptionId(), $option_layouts)) {
             $params["value_id"] = $page->getId();
         }
         $layout_id = str_replace($baseUrl, "", $path . $page->getMobileViewUri("template", $params));
         $paths[] = array("layout" => $layout, "layout_id" => $layout_id);
     }
     return $paths;
 }
Beispiel #7
0
 protected function _initTranslator()
 {
     Core_Model_Translator::prepare(strtolower($this->getRequest()->getModuleName()));
     return $this;
 }
Beispiel #8
0
 public function _($text)
 {
     $args = func_get_args();
     return Core_Model_Translator::translate($text, $args);
 }