public function load()
 {
     $this->setDescriptionTagValue('Build you computer (PC) using this tool and order it. We\'ll configure your PC and proceed your order!');
     $this->setKeywordsTagValue('Build PC, Build Computer, Build Desktop Computer');
     $this->setTitleTagValue('PC Configurator, build your computer!');
     $pccm = PcConfiguratorManager::getInstance($this->config, $this->args);
     $this->addParam('pccm', $pccm);
     if (isset($this->args[0])) {
         $edited_pc_cart_item_id = $this->args[0];
         //if (!isset($this->customerEmail))
         $this->initVars();
         if (!isset($this->customerEmail)) {
             exit;
         }
         $pcToBeEdit = $this->getPcToBeEdited($edited_pc_cart_item_id);
         if ($pcToBeEdit != null) {
             $this->setPcConfiguratorRequestParamsCorrespondingToEditedPcComponents($pcToBeEdit);
             $this->addParam("configurator_mode_edit_cart_row_id", $edited_pc_cart_item_id);
         }
     }
     $right_side_panel_width = $this->getCmsVar('pc_configurator_right_side_panel_width');
     $width = intval($this->getCmsVar('whole_page_width')) - $right_side_panel_width;
     $this->addParam('left_side_panel_width', $width);
     $this->addParam('pcc_components_count', count(PcConfiguratorManager::$PCC_COMPONENTS));
     $lm = LanguageManager::getInstance($this->config, $this->args);
     $componentDisplayNames = array();
     foreach (PcConfiguratorManager::$PCC_COMPONENTS_DISPLAY_NAMES_IDS as $pid) {
         $componentDisplayNames[] = $pid;
     }
     $this->addParam("component_display_names", $componentDisplayNames);
 }
 public function service()
 {
     $languageManager = LanguageManager::getInstance($this->config, $this->args);
     $phrase_id = $this->secure($_REQUEST["phrase_id"]);
     $phrase_text = $_REQUEST["phrase_text"];
     $languageManager->updatePhrase($phrase_id, $phrase_text);
     $jsonArr = array('status' => "ok");
     echo json_encode($jsonArr);
     return true;
 }
Beispiel #3
0
 public function putAllPhrasesInSmarty()
 {
     $lm = LanguageManager::getInstance($this->config, $this->args);
     $this->addParam("all_phrases_dtos_mapped_by_id", json_encode($lm->getAllPhrasesDtosMappedById()));
     $this->addParam("langManager", $lm);
     $ul = $_COOKIE['ul'];
     if (!($ul === 'en' || $ul === 'ru' || $ul === 'am')) {
         $ul = 'en';
     }
     if (!isset($_COOKIE['ul'])) {
         $this->setcookie('ul', $ul);
     }
     $this->addParam("ul", $ul);
 }
Beispiel #4
0
 public function send($from, $recipients, $subject, $template, $params = array(), $separate = false)
 {
     //--proccessing the message
     $smarty = new FAZSmarty();
     $lm = LanguageManager::getInstance(null, null);
     $params["all_phrases"] = $lm->getAllPhrases();
     $ul = $_COOKIE['ul'];
     if (!($ul === 'en' || $ul === 'ru' || $ul === 'am')) {
         $ul = 'en';
     }
     $params["ul"] = $ul;
     $smarty->assign("ns", $params);
     $message = $smarty->fetch($template);
     // To send HTML mail, the Content-type header must be set
     $headers = "";
     //'MIME-Version: 1.0' . "\r\n";
     $headers .= "Reply-To: {$from}\r\n";
     $headers .= "Return-Path: {$from}\r\n";
     $headers .= "X-Priority: normal\r\n";
     $headers .= 'MIME-Version: 1.0' . "\r\n";
     $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
     $headers .= "X-Priority: 3\r\n";
     $headers .= "X-Mailer: PHP" . phpversion() . "\r\n";
     //$headers .= 'Content-type: text/plain; charset=utf-8' . "\n";
     // Additional headers
     //			$headers .= 'To: Mary <*****@*****.**>, Kelly <*****@*****.**>' . "\r\n";
     $headers .= "From: {$from}\r\n";
     //		$headers .= 'From: Birthday Reminder <*****@*****.**>' . "\r\n";
     //		$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
     //		$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
     // multiple recipients
     if ($separate) {
         foreach ($recipients as $recipient) {
             if (!empty($recipient)) {
                 mail($recipient, $subject, $message, $headers);
             }
         }
     } else {
         $to = "";
         foreach ($recipients as $recipient) {
             if (!empty($recipient)) {
                 $to .= $recipient . ',';
             }
         }
         $to = substr($to, 0, -1);
         mail($to, $subject, $message, $headers);
     }
 }
 public function initialize($sessionManager, $loadMapper, $args)
 {
     parent::initialize($sessionManager, $loadMapper, $args);
     $lm = LanguageManager::getInstance();
     $this->addParam("lm", $lm);
     $userLevel = $this->getUserLevel();
     $customer = $this->getCustomer();
     $this->addParam('DOCUMENT_ROOT', DOCUMENT_ROOT);
     $this->addParam('customer', $customer);
     $this->addParam('userLevel', $userLevel);
     $this->addParam('userId', $this->getUserId());
     $this->addParam('userGroupsGuest', UserGroups::$GUEST);
     $this->addParam('userGroupsAdmin', UserGroups::$ADMIN);
     $this->addParam('userGroupsCarwash', UserGroups::$CARWASH);
     $this->addParam("page_name", isset($_REQUEST['page']) ? $_REQUEST['page'] : "");
 }
 public function getPhraseSpan($phrase_id, $ul = null)
 {
     return LanguageManager::getInstance($this->config, $this->args)->getPhraseSpan($phrase_id, $ul);
 }
Beispiel #7
0
 public function getTitle()
 {
     return $this->titlePhraseId;
     return LanguageManager::getInstance(null, null)->getPhraseSpan($this->titlePhraseId);
 }
 public function getPhraseSpan($phrase_id, $ul = null)
 {
     return LanguageManager::getInstance(null, null)->getPhraseSpan($phrase_id, $ul);
 }
 public function manageTabs()
 {
     $userLevel = $this->sessionManager->getUser()->getLevel();
     $tabTitles = array();
     $customer = $this->getCustomer();
     $lm = LanguageManager::getInstance($this->config, $this->args);
     if ($this->isLoggedInCustomer()) {
         $customerLocalEmailsManager = CustomerLocalEmailsManager::getInstance($this->config, $this->args);
         $unreadEmailsCount = $customerLocalEmailsManager->getCustomerInboxUnreadEmailsCountCustomerEmail($this->getCustomerLogin());
     }
     $tabsPath = array("item_search" => "main", "companies_list" => "main", "company_profile" => "company", "service_company_profile" => "servicecompany", "service_company_profile" => "servicecompany", "manage_items" => "company/stock", "pc_configurator" => "main", "upload_price" => "company/uploadprice", "service_upload_price" => "servicecompany/uploadprice", "user_management" => "main", "your_orders" => "main", "your_profile" => "main", "item_warranty" => "company", "dealers_list" => "company", "your_mails" => "main");
     $this->addParam("tabs_path", $tabsPath);
     if ($userLevel === UserGroups::$ADMIN) {
         $type = $customer->getType();
         if ($type === 'price_manager') {
             $tabTitles['companies_list'] = $lm->getPhraseSpan(89);
             $tabTitles['upload_price'] = $lm->getPhraseSpan(90);
             $tabTitles['service_upload_price'] = "Service upload";
             $tabTitles['item_search'] = $lm->getPhraseSpan(184);
             $this->activeLoadName = "upload_price";
         } elseif ($type === 'item_manager') {
             $tabTitles['companies_list'] = $lm->getPhraseSpan(89);
             $tabTitles['manage_items'] = $lm->getPhraseSpan(92);
             $tabTitles['item_search'] = $lm->getPhraseSpan(184);
             $this->activeLoadName = "manage_items";
         } elseif ($type === 'order_manager') {
             $tabTitles['your_orders'] = 'Customer Orders';
             $tabTitles['item_search'] = $lm->getPhraseSpan(184);
             $this->activeLoadName = "your_orders";
         } elseif ($type === 'admin') {
             $tabTitles['companies_list'] = $lm->getPhraseSpan(89);
             $tabTitles['upload_price'] = $lm->getPhraseSpan(90);
             $tabTitles['service_upload_price'] = "Service upload";
             $tabTitles['items_categories'] = 'Manage Categories';
             $tabTitles['manage_items'] = $lm->getPhraseSpan(92);
             $tabTitles['your_orders'] = 'Customer Orders';
             $tabTitles['item_search'] = $lm->getPhraseSpan(184);
             $tabTitles['admin_statistics'] = '***';
             $this->activeLoadName = "companies_list";
         } elseif ($type === 'all') {
             $tabTitles['companies_list'] = $lm->getPhraseSpan(89);
             $tabTitles['upload_price'] = $lm->getPhraseSpan(90);
             $tabTitles['service_upload_price'] = "Service upload";
             $tabTitles['manage_items'] = $lm->getPhraseSpan(92);
             $tabTitles['your_orders'] = 'Customer Orders';
             $tabTitles['item_search'] = $lm->getPhraseSpan(184);
             $this->activeLoadName = "companies_list";
         }
         $tabTitles['your_mails'] = $lm->getPhraseSpan(468) . ($unreadEmailsCount > 0 ? '*' : '');
     } elseif ($userLevel === UserGroups::$COMPANY) {
         $tabTitles['companies_list'] = $lm->getPhraseSpan(89);
         $tabTitles['company_profile'] = $lm->getPhraseSpan(94);
         $tabTitles['upload_price'] = $lm->getPhraseSpan(90);
         $tabTitles['dealers_list'] = $lm->getPhraseSpan(93);
         $tabTitles['your_orders'] = $lm->getPhraseSpan(142);
         $tabTitles['item_warranty'] = $lm->getPhraseSpan(82);
         $tabTitles['manage_items'] = $lm->getPhraseSpan(92);
         $tabTitles['item_search'] = $lm->getPhraseSpan(184);
         $tabTitles['your_mails'] = $lm->getPhraseSpan(468) . ($unreadEmailsCount > 0 ? '*' : '');
         $this->activeLoadName = "companies_list";
     } elseif ($userLevel === UserGroups::$SERVICE_COMPANY) {
         $tabTitles['companies_list'] = $lm->getPhraseSpan(89);
         $tabTitles['service_company_profile'] = $lm->getPhraseSpan(94);
         $serviceCompany = $this->getCustomer();
         if ($serviceCompany->getHasPrice() == 1) {
             $tabTitles['service_upload_price'] = $lm->getPhraseSpan(90);
             $tabTitles['service_dealers_list'] = $lm->getPhraseSpan(93);
         }
         $tabTitles['your_orders'] = $lm->getPhraseSpan(142);
         $tabTitles['item_search'] = $lm->getPhraseSpan(184);
         $tabTitles['your_mails'] = $lm->getPhraseSpan(468) . ($unreadEmailsCount > 0 ? '*' : '');
         $this->activeLoadName = "companies_list";
     } elseif ($userLevel === UserGroups::$USER) {
         $tabTitles['companies_list'] = $lm->getPhraseSpan(89);
         if ($this->getCustomer()->getHidden() != 1) {
             $tabTitles['your_profile'] = $lm->getPhraseSpan(20);
             $tabTitles['user_management'] = $lm->getPhraseSpan(141);
         }
         $tabTitles['your_orders'] = $lm->getPhraseSpan(142);
         $tabTitles['item_search'] = $lm->getPhraseSpan(184);
         $tabTitles['your_mails'] = $lm->getPhraseSpan(468) . ($unreadEmailsCount > 0 ? '*' : '');
         $this->activeLoadName = "pc_configurator";
     } elseif ($userLevel === UserGroups::$GUEST) {
         $tabTitles['item_search'] = $lm->getPhraseSpan(184);
         $activeTabsArray = array('item_search', 'pc_configurator');
         shuffle($activeTabsArray);
         $this->activeLoadName = $activeTabsArray[0];
     }
     $tabTitles['pc_configurator'] = $lm->getPhraseSpan(226);
     $this->activeLoadPath = 'main/';
     $activeTab = $this->getActiveTab(isset($_REQUEST["p"]) ? $_REQUEST["p"] : null);
     if ($activeTab != null) {
         $this->activeLoadName = $activeTab[0];
         $this->activeLoadPath = $activeTab[1];
     }
     //var_dump($tabTitles);exit;
     $this->addParam("tabTitles", $tabTitles);
     $this->addParam('active_load_name', $this->activeLoadName);
     $pagesClone = $this->pages;
     unset($pagesClone['item']);
     $_allLoadNames = array_values($pagesClone);
     $allLoadNames = array();
     foreach ($_allLoadNames as $value) {
         if (is_array($value)) {
             $allLoadNames[] = $value[0];
         } else {
             $allLoadNames[] = $value;
         }
     }
     $allLoadPageUrls = array_keys($pagesClone);
     $this->addParam('load_url', array_combine($allLoadNames, $allLoadPageUrls));
 }
 private function compileIfTemplate($templateId, $params)
 {
     $ul = $_COOKIE['ul'];
     if (!($ul === 'en' || $ul === 'ru' || $ul === 'am')) {
         $ul = 'en';
     }
     $params["ul"] = $ul;
     $template = null;
     if (strlen($templateId) <= 50) {
         $template = EmailTemplatesManager::getInstance()->getTemplate($templateId, $ul);
     }
     if (!isset($template)) {
         return $templateId;
     }
     $smarty = new FAZSmarty();
     $lm = LanguageManager::getInstance(null, null);
     $params["all_phrases"] = $lm->getAllPhrases();
     $smarty->assign("ns", $params);
     require_once $smarty->_get_plugin_filepath('function', 'eval');
     return smarty_function_eval(array('var' => $template), $smarty);
 }