/** * Reorder checklists widget * * @param void * @return null */ function reorder() { if ($this->request->isAsyncCall() && $this->request->isSubmitted()) { if (!Checklist::canReorder($this->logged_user, $this->active_project)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if $checklists_ids = $this->request->post('checklists'); if (is_foreachable($checklists_ids)) { for ($x = 0; $x < count($checklists_ids); $x++) { db_execute('UPDATE ' . TABLE_PREFIX . 'project_objects SET position=? WHERE id = ?', $x + 1, $checklists_ids[$x]); } // for } // if $this->httpOk(); } else { $this->httpError(HTTP_ERR_BAD_REQUEST); } // if }