Exemplo n.º 1
0
 /**
  * Update author ordering
  *
  * @return  void
  */
 public function updateTask()
 {
     // Check for request forgeries
     Request::checkToken(['get', 'post']);
     if ($this->getError()) {
         return $this->displayTask();
     }
     $mbrs = Request::getVar('author', array());
     $mbrs = !is_array($mbrs) ? array($mbrs) : $mbrs;
     $users = array();
     foreach ($mbrs as $i => $mbr) {
         $author = new Author($this->database);
         $author->load(intval($mbr));
         $author->ordering = $i + 1;
         if (!$author->store()) {
             $this->setError(Lang::txt('COM_CITATIONS_ERROR_UNABLE_TO_UPDATE') . ' ' . $mbr);
         }
     }
     // Push through to the view
     $this->displayTask();
 }