/** * Method to remove records * @see application/controllers/ICrudController#removeAction() */ public function removeAction() { $key = $this->_getParam($this->_model->getFieldKey()); try { $this->_model->delete("{$this->_model->getFieldKey()} = {$key}"); } catch (Exception $e) { Fgsl_Session_Namespace::set('exception', $e); $this->_redirect('error/message'); } $this->_redirect($this->getRequest()->getModuleName() . '/' . $this->getRequest()->getControllerName() . '/list'); }
/** * 删除post * @param unknown_type $post */ public function deletePost($post) { return $post->delete(); }
/** * 删除Item * @param unknown_type $item */ public function removeItem(&$item) { $item->delete(); }
/** * View the notification, and clear if requested * * @param unknown_type $oKTNotification */ function resolveNotification($oKTNotification) { $notify_action = KTUtil::arrayGet($_REQUEST, 'notify_action', null); if ($notify_action == 'clear') { $_SESSION['KTInfoMessage'][] = _kt('Cleared notification.'); $oKTNotification->delete(); exit(redirect(generateControllerLink('dashboard'))); } // otherwise, we want to redirect the to object represented by the item. // - viewDocument and viewFolder are the appropriate items. // - object_id $info = $this->_getSubscriptionData($oKTNotification); $object_type = $this->_getEventObjectType($info['event_type']); if ($object_type == '') { $_SESSION['KTErrorMessage'][] = 'This notification has no "target". Please report as a bug that this subscription should only have a clear action.' . $object_type; exit(redirect(generateControllerLink('dashboard'))); } if ($object_type == 'document') { if ($info['object_id'] !== null) { // fails and generates an error with no doc-id. $params = 'fDocumentId=' . $info['object_id']; $url = generateControllerLink('viewDocument', $params); //$oKTNotification->delete(); // clear the alert. exit(redirect($url)); } } else { if ($object_type == 'folder') { if ($info['object_id'] !== null) { // fails and generates an error with no doc-id. $params = 'fFolderId=' . $info['object_id']; $url = generateControllerLink('browse', $params); //$oKTNotification->delete(); // clear the alert. exit(redirect($url)); } } } $_SESSION['KTErrorMessage'][] = sprintf('This notification has no "target". Please inform the %s developers that there is a target bug with type: ' . $info['event_type'], APP_NAME); exit(redirect(generateControllerLink('dashboard'))); }
/** * Revoke * * @param string $type * @param string $arg * @return void */ protected function revoke($type, $arg) { list($aclResourceId, $resourceIds) = $this->splitParams($type, $arg); if (isset($this->resourceTypeObjectRelation)) { foreach ($resourceIds as $resourceId) { if ($resourceId != "*") { $this->resourceTypeObjectRelation->delete($aclResourceId, $resourceId); } elseif ($resourceId == "*") { $this->resourceTypeObjectRelation->delete($aclResourceId); } } if ($type == "host" || $type == "hostgroup" || $type == "servicegroup") { $field = "all_" . $type . "s"; $this->object->update($aclResourceId, array($field => '0', 'changed' => '1')); } } }