本文整理汇总了PHP中Application_Model_User::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_User::delete方法的具体用法?PHP Application_Model_User::delete怎么用?PHP Application_Model_User::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application_Model_User
的用法示例。
在下文中一共展示了Application_Model_User::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteAction
function deleteAction()
{
$this->view->title = "Delete user";
$user = new Application_Model_User();
if ($this->_request->isPost()) {
Zend_Loader::loadClass('Zend_Filter_Alpha');
$filter = new Zend_Filter_Alpha();
$id = (int) $this->_request->getPost('id');
$del = $filter->filter($this->_request->getPost('del'));
if ($del == 'Yes' && $id > 0) {
$where = 'id = ' . $id;
$rows_affected = $user->delete($where);
}
} else {
$id = (int) $this->_request->getParam('id');
if ($id > 0) {
// only render if we have an id and can find the vehicle.
$this->view->user = $user->fetchRow('id=' . $id);
if ($this->view->user->id > 0) {
// render template automatically
return;
}
}
}
// redirect back to the vehicle list unless we have rendered the view
$this->_redirect('/users');
}
示例2: deleteAction
/**
* Método utilizado para excluir Users. Aguarda um parametro do tipo Int id.
* @param int $id
* @method deleteAction
* @access public
* @return void
*/
public function deleteAction()
{
$user = new Application_Model_User();
$id = $this->_getParam('id');
$user->delete("id={$id}");
$this->_redirect('/user/retrieve');
}
示例3: removeUserAction
public function removeUserAction()
{
// action body
$delId = $this->_getParam('id');
$valid_actions = array("delete_cascade", "reassign_to");
$files_action = $this->_getParam('deleted_files');
# TODO : remove this. we only use default for now not to break the UI.
if (!$files_action) {
# set default action
$files_action = "reassign_to";
$new_owner = Application_Model_User::getFirstAdmin();
}
# only delete when valid action is selected for the owned files
if (!in_array($files_action, $valid_actions)) {
return;
}
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$userId = $userInfo->id;
# Don't let users delete themselves
if ($delId == $userId) {
return;
}
$user = new Application_Model_User($delId);
# Take care of the user's files by either assigning them to somebody
# or deleting them all
if ($files_action == "delete_cascade") {
$user->deleteAllFiles();
} elseif ($files_action == "reassign_to") {
// TODO : fix code to actually use the line below and pick a
// real owner instead of defaulting to the first found admin
//$new_owner_id = $this->_getParam("new_owner");
//$new_owner = new Application_Model_User($new_owner_id);
$user->donateFilesTo($new_owner);
Logging::info("Reassign to user {$new_owner->getDbId()}");
}
# Finally delete the user
$this->view->entries = $user->delete();
}