コード例 #1
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;
         }
     }
 }