예제 #1
0
 /**
  * Set the state on an item to "deleted" (4)
  *
  * @param      integer $id Resource ID
  * @return     boolean False if errors, True on success
  */
 private function _markRemovedContribution($id)
 {
     // Make sure we have a record to pull
     if (!$id) {
         $this->setError(Lang::txt('COM_CONTRIBUTE_NO_ID'));
         return false;
     }
     // Load resource info
     $row = new Resource($this->database);
     $row->load($id);
     // Mark resource as deleted
     $row->published = 4;
     if (!$row->store()) {
         $this->setError($row->getError());
         return false;
     }
     // Return success
     return true;
 }
예제 #2
0
 /**
  * Resets the ranking of a resource
  * Redirects to edit task for the resource
  *
  * @return  void
  */
 public function resetrankingTask()
 {
     // Check for request forgeries
     Request::checkToken();
     // Incoming
     $id = Request::getInt('id', 0);
     if ($id) {
         // Load the object, reset the ratings, save, checkin
         $row = new Resource($this->database);
         $row->load($id);
         $row->ranking = '0';
         $row->store();
         $row->checkin();
         $this->setMessage(Lang::txt('COM_RESOURCES_RANKING_RESET'));
     }
     // Redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=edit&id=' . $id, false));
 }
예제 #3
0
 /**
  * Change access on an entry
  *
  * @return  void
  */
 public function accessTask()
 {
     // Incoming parent ID
     $pid = Request::getInt('pid', 0);
     if (!$pid) {
         $this->setError(Lang::txt('CONTRIBUTE_NO_ID'));
         $this->displayTask($pid);
         return;
     }
     // Incoming child ID
     $id = Request::getInt('id', 0);
     if (!$id) {
         $this->setError(Lang::txt('CONTRIBUTE_NO_CHILD_ID'));
         $this->displayTask($pid);
         return;
     }
     // Load resource info
     $row = new Resource($this->database);
     $row->load($id);
     if (!$row) {
         $this->setError(Lang::txt('CONTRIBUTE_NO_CHILD_ID'));
         $this->displayTask($pid);
         return;
     }
     $access = Request::getInt('access', 0);
     if (!in_array($access, array(0, 1))) {
         $access = 0;
     }
     $row->access = $access;
     // Store new content
     if (!$row->store()) {
         $this->setError($row->getError());
         $this->displayTask($pid);
         return;
     }
     // Push through to the attachments view
     $this->displayTask($pid);
 }