public function set_recovery_post() { $ShowpieceList = new ObjList(['db_where_Arr' => ['status' => -1], 'db_where_deletenull_Bln' => TRUE, 'model_name_Str' => 'Showpiece', 'limitstart_Num' => 0, 'limitcount_Num' => 100]); foreach ($ShowpieceList->obj_Arr as $key => $value_showpiece) { $Showpiece = new Showpiece(['showpieceid_Num' => $value_showpiece->showpieceid_Num]); $Showpiece->recovery(); } if (!empty($ShowpieceList->obj_Arr)) { $this->load->model('Message'); $this->Message->show(['message' => '復原成功', 'url' => 'admin/base/showpiece/set/set']); } else { $this->load->model('Message'); $this->Message->show(['message' => '已無可復原的項目', 'url' => 'admin/base/showpiece/set/set']); } }
public function delete() { $hash_Str = $this->input->get('hash'); $showpieceid_Num = $this->input->get('showpieceid'); $showpieceid_Arr = $this->input->post('showpieceid_Arr[]'); if (empty($showpieceid_Arr) && empty($showpieceid_Num)) { $this->load->model('Message'); $this->Message->show(['message' => '未選擇要刪除的產品', 'url' => 'admin/base/showpiece/showpiece/tablelist']); } //CSRF過濾 if ($hash_Str == $this->security->get_csrf_hash()) { if (!empty($showpieceid_Num)) { $Showpiece = new Showpiece(['showpieceid_Num' => $showpieceid_Num]); $Showpiece->delete(); } if (!empty($showpieceid_Arr)) { foreach ($showpieceid_Arr as $key => $value_showpiece) { $Showpiece = new Showpiece(['showpieceid_Num' => $value_showpiece]); $Showpiece->delete(); } } $this->load->model('Message'); $this->Message->show(['message' => '刪除成功', 'url' => 'admin/base/showpiece/showpiece/tablelist']); } else { $this->load->model('Message'); $this->Message->show(['message' => 'hash驗證失敗,請使用標準瀏覽器進行刪除動作', 'url' => 'admin/base/showpiece/showpiece/tablelist']); } }