コード例 #1
0
 /**
  * Home
  * @param $params
  * @return mixed
  */
 public function hookHome($params)
 {
     if (Configuration::get('NOW_CATEG_SLIDE_ENABLE')) {
         $aSlides = NowCategorySlide::getCategorySlides();
         $this->context->smarty->assign(array('aSlides' => $aSlides));
         return $this->context->smarty->fetch($this->module_dir . 'views/templates/hook/home.tpl');
     }
 }
コード例 #2
0
 /**
  * Manage position in ajax
  */
 public function ajaxProcessUpdatePositions()
 {
     $way = (int) Tools::getValue('way');
     $id_now_category_slide = (int) Tools::getValue('id');
     $positions = Tools::getValue($this->table);
     foreach ($positions as $position => $value) {
         $pos = explode('_', $value);
         if (isset($pos[2]) && (int) $pos[2] === $id_now_category_slide) {
             if ($oNowCategorySlide = new NowCategorySlide((int) $pos[2])) {
                 if (isset($position) && $oNowCategorySlide->updatePosition($way, $position)) {
                     echo 'ok position ' . (int) $position . ' for bloc category slide ' . (int) $pos[1] . '\\r\\n';
                 } else {
                     echo '{"hasError" : true, "errors" : "Can not update bloc category slide ' . (int) $id_now_category_slide . ' to position ' . (int) $position . ' "}';
                 }
             } else {
                 echo '{"hasError" : true, "errors" : "This bloc category slide (' . (int) $id_now_category_slide . ') can t be loaded"}';
             }
             break;
         }
     }
 }
コード例 #3
0
 /**
  * @see ObjectModel::delete()
  */
 public function delete()
 {
     if (!parent::delete()) {
         return false;
     }
     NowCategorySlide::cleanPositions();
 }