Пример #1
0
 /**
  * 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);
 }