private function initCountOfItems()
 {
     $countOfItems = $this->settingFacade->getSettingValue('menu_tagsCount');
     if ((int) $countOfItems > 0) {
         $this->countOfItems = (int) $countOfItems;
     }
 }
 /**
  * @return array
  */
 private function getDefaultValues()
 {
     $prepared = array();
     if (count($defaults = $this->settingFacade->getLast())) {
         foreach ($defaults as $setting) {
             $prepared[$setting->getName()] = $setting->getValue();
         }
     }
     return $prepared;
 }
Example #3
0
 protected function beforeRender()
 {
     $postsLimit = (int) $this->settingFacade->getSettingValue('post_itemsPerPage');
     if ($postsLimit > 0) {
         $this->itemsPerPage = $postsLimit;
     }
     $posts = $this->posts;
     $paginator = $this['paginator']->getPaginator();
     $paginator->itemsPerPage = $this->itemsPerPage;
     $paginator->itemCount = count($posts);
     if (is_array($posts) and count($posts)) {
         $posts = $this->getItemsPerPage($posts, $paginator->offset);
     }
     $this->template->posts = $posts;
 }
 /**
  * @param $data
  * @return bool
  */
 public function update($data)
 {
     if (count($data)) {
         foreach ($data as $name => $value) {
             if ($setting = $this->settingFacade->getOneByName($name)) {
                 $setting->setValue($value);
                 $this->settingFacade->save($setting);
             } else {
                 if ($type = $this->settingFacade->getAvailableSettingByName($name)) {
                     $setting = $this->createSetting($name, $value, $type);
                     $this->settingFacade->save($setting);
                 }
             }
         }
         return true;
     } else {
         return false;
     }
 }
 /**
  * @param $setting
  * @return string
  */
 public function setting($setting)
 {
     if ($setting = $this->settingFacade->getOneByName($setting)) {
         return $setting->getValue();
     }
 }