Exemplo n.º 1
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     //--Get the ids and split them
     $ids = explode(',', trim(\SpoonFilter::getPostValue('ids', null, '', 'string')));
     //--Check if the id is not empty
     if (!empty($ids)) {
         //--Set the sequence to 1
         $sequence = 1;
         //--Loop the id's
         foreach ($ids as $id) {
             //--Set the item array
             $item = array();
             $item["id"] = (int) $id;
             $item["sequence"] = $sequence;
             BackendGalleryModel::exists($item["id"]) ? BackendGalleryModel::update($item) : null;
             //--Add the sequence for each id
             $sequence++;
         }
     }
     // success output
     $this->output(self::OK, null, 'sequence updated');
 }