delete() публичный Метод

public delete ( $where = [], $options = [] )
Пример #1
0
 /**
  * Delete an activity item.
  *
  * @since 2.0.0
  * @access public
  *
  * @param int $ActivityID Unique ID of item to delete.
  * @param string $TransientKey Verify intent.
  */
 public function delete($ActivityID = '', $TransientKey = '')
 {
     $session = Gdn::session();
     if (!$session->validateTransientKey($TransientKey)) {
         throw permissionException();
     }
     if (!is_numeric($ActivityID)) {
         throw Gdn_UserException('Invalid ID');
     }
     if (!$this->ActivityModel->canDelete($this->ActivityModel->getID($ActivityID))) {
         throw permissionException();
     }
     $this->ActivityModel->delete($ActivityID);
     if ($this->_DeliveryType === DELIVERY_TYPE_ALL) {
         $target = Gdn::request()->get('Target');
         if ($target) {
             // Bail with a redirect if we got one.
             redirect($target);
         } else {
             // We got this as a full page somehow, so send them back to /activity.
             $this->RedirectUrl = url('activity');
         }
     }
     $this->render();
 }
 /**
  * Delete an activity item.
  *
  * @since 2.0.0
  * @access public
  *
  * @param int $ActivityID Unique ID of item to delete.
  * @param string $TransientKey Verify intent.
  */
 public function delete($ActivityID = '', $TransientKey = '')
 {
     $session = Gdn::session();
     if (!$session->validateTransientKey($TransientKey)) {
         throw permissionException();
     }
     if (!is_numeric($ActivityID)) {
         throw Gdn_UserException('Invalid ID');
     }
     if (!$this->ActivityModel->canDelete($this->ActivityModel->getID($ActivityID))) {
         throw permissionException();
     }
     $this->ActivityModel->delete($ActivityID);
     if ($this->_DeliveryType === DELIVERY_TYPE_ALL) {
         redirect(GetIncomingValue('Target', $this->SelfUrl));
     }
     // Still here? Getting a 404.
     $this->ControllerName = 'Home';
     $this->View = 'FileNotFound';
     $this->render();
 }
 public static function delete($id)
 {
     ActivityModel::delete($id);
 }
Пример #4
0
 public function deleteactivityAction()
 {
     $activityid = $this->getRequest()->getParam('activityid', '0');
     //删除一条活动
     $table = new ActivityModel();
     $db = $table->getAdapter();
     $where = $db->quoteInto('id = ?', $activityid);
     if ($table->delete($where) > 0) {
         $this->view->info = 'success';
     } else {
         $this->view->info = 'fail';
     }
     $this->_forward('result2', 'globals');
 }