Exemplo n.º 1
0
 private function initCountOfItems()
 {
     $countOfItems = $this->settingFacade->getSettingValue('menu_tagsCount');
     if ((int) $countOfItems > 0) {
         $this->countOfItems = (int) $countOfItems;
     }
 }
Exemplo n.º 2
0
 /**
  * @return array
  */
 private function getDefaultValues()
 {
     $prepared = array();
     if (count($defaults = $this->settingFacade->getLast())) {
         foreach ($defaults as $setting) {
             $prepared[$setting->getName()] = $setting->getValue();
         }
     }
     return $prepared;
 }
Exemplo n.º 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;
 }
Exemplo n.º 4
0
 /**
  * @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;
     }
 }
Exemplo n.º 5
0
 /**
  * @param $setting
  * @return string
  */
 public function setting($setting)
 {
     if ($setting = $this->settingFacade->getOneByName($setting)) {
         return $setting->getValue();
     }
 }