/**
  * Returns an singleton instance of this class
  *
  * @return
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new CmsSettingsManager();
     }
     return self::$instance;
 }
 public function service()
 {
     $variable_names = json_decode($_REQUEST['variable_names']);
     $variable_values = json_decode($_REQUEST['variable_values']);
     $cmsSettingsManager = CmsSettingsManager::getInstance($this->config, $this->args);
     foreach ($variable_names as $key => $varName) {
         $cmsSettingsManager->saveVariableValue($varName, $variable_values[$key]);
     }
     $jsonArr = array('status' => "ok");
     echo json_encode($jsonArr);
     return true;
 }
Esempio n. 3
0
 public function initialize($smarty, $sessionManager, $config, $loadMapper, $args)
 {
     parent::initialize($smarty, $sessionManager, $config, $loadMapper, $args);
     $this->config = $config;
     $this->putAllPhrasesInSmarty();
     $allVarsArray = CmsSettingsManager::getInstance()->getAllVarsArray();
     $this->addParam("cms_vars", json_encode($allVarsArray));
     $this->setCustomerCartItemsCount();
     $userLevel = $this->getUserLevel();
     $customer = $this->getCustomer();
     $this->addParam("user", $customer);
     $this->addParam("userId", $this->getUserId());
     $this->addParam('userLevel', $userLevel);
     if ($userLevel == UserGroups::$USER) {
         $this->addParam('userLoginType', $customer->getLoginType());
     }
     $this->addParam('userGroupsCompany', UserGroups::$COMPANY);
     $this->addParam('userGroupsServiceCompany', UserGroups::$SERVICE_COMPANY);
     $this->addParam('userGroupsUser', UserGroups::$USER);
     $this->addParam('userGroupsGuest', UserGroups::$GUEST);
     $this->addParam('userGroupsAdmin', UserGroups::$ADMIN);
     if ($this->getUserLevel() === UserGroups::$ADMIN) {
         $this->addParam('admin_price_group', $this->getCustomer()->getPriceGroup());
     }
     $this->addParam('DOCUMENT_ROOT', DOCUMENT_ROOT);
     $this->addParam("salesPhone", $this->getCmsVar("pcstore_sales_phone_number"));
     $this->addParam("salesPhone1", $this->getCmsVar("pcstore_sales_phone_number1"));
     $this->addParam("wholePageWidth", $this->getCmsVar("whole_page_width"));
     $this->addParam("passRegexp", $this->getCmsVar("password_regexp"));
     $this->addParam("us_dollar_exchange", floatval($this->getCmsVar("us_dollar_exchange")));
     if ($userLevel == UserGroups::$COMPANY) {
         $this->addParam("customer_ping_pong_timeout_seconds", $this->getCmsVar("company_ping_pong_timeout_seconds"));
         $this->addParam("company_item_check_message_timeout_seconds", $this->getCmsVar("company_item_check_message_timeout_seconds"));
     } elseif ($userLevel == UserGroups::$USER) {
         $this->addParam("customer_ping_pong_timeout_seconds", $this->getCmsVar("user_ping_pong_timeout_seconds"));
     } elseif ($userLevel == UserGroups::$ADMIN) {
         $this->addParam("customer_ping_pong_timeout_seconds", $this->getCmsVar("admin_ping_pong_timeout_seconds"));
     } else {
         $this->addParam("customer_ping_pong_timeout_seconds", $this->getCmsVar("guest_ping_pong_timeout_seconds"));
     }
 }
Esempio n. 4
0
 public function getCmsVar($var)
 {
     return CmsSettingsManager::getInstance()->getValue($var);
 }