ActivityController::delete PHP Метод

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

Delete an activity item.
С версии: 2.0.0
public delete ( integer $ActivityID = '', string $TransientKey = '' )
$ActivityID integer Unique ID of item to delete.
$TransientKey string 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->deleteID($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();
    }