/** * Reorder the list of authors * * @return void */ public function reorderTask() { // Incoming $id = Request::getInt('id', 0); $pid = Request::getInt('pid', 0); $move = Request::getVar('move', 'down'); // Ensure we have an ID to work with if (!$id) { $this->setError(Lang::txt('COM_CONTRIBUTE_NO_CHILD_ID')); return $this->displayTask($pid); } // Ensure we have a parent ID to work with if (!$pid) { $this->setError(Lang::txt('COM_CONTRIBUTE_NO_ID')); return $this->displayTask($pid); } switch ($move) { case 'up': $move = -1; break; case 'down': $move = 1; break; } $author = Author::oneByRelationship($pid, $id); // Save changes if (!$author->move($move)) { $this->setError($author->getError()); } // Push through to the attachments view $this->displayTask($pid); }
/** * Edit an entry * * @param array $rows * @return void */ public function editTask($rows = null) { Request::setVar('hidemainmenu', 1); $authorid = 0; if (!is_array($rows)) { // Incoming $authorid = Request::getVar('id', array(0)); if (is_array($authorid)) { $authorid = !empty($authorid) ? $authorid[0] : 0; } $rows = Author::all()->whereEquals('authorid', $authorid)->rows(); } $roles = Role::all()->ordered()->rows(); // Set any errors foreach ($this->getErrors() as $error) { Notify::error($error); } // Output the HTML $this->view->set('rows', $rows)->set('authorid', $authorid)->set('roles', $roles)->setLayout('edit')->display(); }