本文整理汇总了PHP中Model_User::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_User::delete方法的具体用法?PHP Model_User::delete怎么用?PHP Model_User::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_User
的用法示例。
在下文中一共展示了Model_User::delete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteAction
public function deleteAction()
{
$id = $this->getParam('id');
$user = new Model_User($id);
$user->delete();
$this->_helper->redirector('index');
}
示例2: action_delete
public function action_delete()
{
$user = new Model_User($this->request->param('id'));
if ($user->loaded()) {
$user->delete();
}
$this->redirect('admin/user/all');
}
示例3: userdeleteAction
public function userdeleteAction()
{
$user = new Model_User();
if ($user->findById($this->getParamNumeric(AdminController::USER_PARAM))) {
$user->delete();
$this->getLog()->info("Deleted {$user}");
}
return $this->_helper->redirector('index');
}
示例4: deleteAction
public function deleteAction()
{
//定义删除方法
$table = new Model_User();
//类的实例化
$where = 'id = 2';
//定义删除的条件
if ($table->delete($where)) {
//执行删除操作
$this->view->delete = "删除成功!";
} else {
$this->view->delete = "该数据已经不存在";
}
}
示例5: action_delete
public function action_delete($nip)
{
$this->template->title = "Delete Dosen";
$dosen = new Model_Dosen($nip);
$user = new Model_User($dosen->user_id);
$user->delete();
Request::instance()->redirect('dosen/list');
}
示例6: action_delete
public function action_delete($nim)
{
$this->template->title = "Delete Mahasiswa";
$mahasiswa = new Model_Mahasiswa($nim);
$user = new Model_User($mahasiswa->user_id);
$user->delete();
// redirect
Request::instance()->redirect('mahasiswa/list');
}
示例7: userAction
public function userAction($iId = null)
{
$this->mTemplate->sSectionTitle = $this->getLang('section_title_useredit');
// sprawdzamy czy user jest adminem
if ($this->sRole !== 'admin') {
$aData['info'] = $this->getLang('access_denied');
$this->mTemplate->content = View::factory('account/item_edit', $aData)->render();
return;
}
if (isset($iId) and $iId !== 0 and !isset($_POST['submit'])) {
// edycja usera
$bDelete = func_get_arg(0) == 'delete';
if ($bDelete) {
$iId = func_get_arg(1);
}
$iId = (int) $iId;
$oUser = new Model_User($iId);
$aUser = $oUser->getRow();
if ($iId and !empty($aUser) and $aUser['account_id'] == $this->oCurrentUser->account_id) {
if ($bDelete) {
// usuwanie uzytkownika
if (func_num_args() == 4 and $this->oAuth->isValidToken(func_get_arg(2))) {
if ($oUser->delete()) {
$aMeta = $this->mTemplate->aMeta;
$aMeta[] = '<meta http-equiv="refresh" content="1;url=' . $this->mTemplate->anchor('/account/users/') . '" />';
$this->mTemplate->aMeta = $aMeta;
$aData['info'] = $this->getLang('delele_user_successfull');
} else {
$aData['info'] = $this->getLang('delele_user_failed');
}
} else {
// potwierdzenie usuniecia
$aData = array('sQuestion' => $this->getLang('delele_user_question', $aUser['name']), 'sTextYes' => $this->getLang('Catering.ok'), 'sLinkYes' => '/account/user/delete/' . $iId . '/' . $this->oAuth->getSecurityToken() . '/', 'sTextNo' => $this->getLang('Catering.cancel'), 'sLinkNo' => '/account/user/' . $iId . '/');
}
$this->mTemplate->sSectionTitle = $this->getLang('section_title_userdelete');
} else {
// edycja danych
$aOptions = array();
$aLayoutList = array();
$oRole = new Model_Role();
$aRoles = $oRole->getAll();
foreach ($aRoles as $aRole) {
$aOptions[] = array('value' => $aRole['role_id'], 'name' => $aRole['name']);
}
// pobieramy dostepne layouty
$oLayout = new Model_Layout();
$aLayouts = $oLayout->getAll();
foreach ($aLayouts as $aLayout) {
$aLayoutList[] = array('value' => $aLayout['layout_id'], 'name' => $aLayout['name']);
}
$aInputs[] = array('type' => 'text', 'label' => $this->getLang('first_name'), 'name' => 'fname', 'value' => $aUser['fname']);
$aInputs[] = array('type' => 'text', 'label' => $this->getLang('sure_name'), 'name' => 'name', 'value' => $aUser['name']);
$aInputs[] = array('type' => 'text', 'label' => $this->getLang('email'), 'name' => 'email', 'value' => $aUser['email']);
$aInputs[] = array('type' => 'password', 'label' => $this->getLang('password'), 'name' => 'pass', 'value' => '');
$aInputs[] = array('type' => 'text', 'label' => $this->getLang('registered'), 'name' => 'since', 'value' => $aUser['since'], 'disabled' => true);
$aInputs[] = array('type' => 'text', 'label' => $this->getLang('last_login'), 'name' => 'last_login', 'value' => $aUser['last_login'], 'disabled' => true);
$aInputs[] = array('type' => 'select', 'label' => $this->getLang('layout'), 'name' => 'layout', 'value' => $aUser['layout_id'], 'items' => $aLayoutList);
$aInputs[] = array('type' => 'select', 'label' => $this->getLang('role'), 'name' => 'role', 'value' => $aUser['role_id'], 'items' => $aOptions);
$aInputs[] = array('type' => 'hidden', 'name' => 'user_id', 'value' => $aUser['user_id']);
$aData = array('bPrintForm' => true, 'aInputs' => $aInputs, 'sTextDelete' => $this->getLang('delete'), 'sLinkDelete' => '/account/user/delete/' . $aUser['user_id'] . '/');
$this->mTemplate->sSectionTitle = $this->getLang('section_title_useredit');
}
} else {
$aData['info'] = $this->getLang('user_not_found');
}
} elseif (isset($_POST['submit'])) {
// zapis usera
$sFName = $this->post('fname');
$sName = $this->post('name');
$sPass = $this->post('pass');
$sEmail = $this->post('email');
$iRole = $this->post('role');
$iLayout = $this->post('layout');
$user_id = $this->post('user_id');
$oValidator = new Module_Validator();
$oValidator->field('first_name', $sFName)->rules('required');
$oValidator->field('sure_name', $sName)->rules('required');
$oValidator->field('email', $sEmail)->rules('required|email');
$oValidator->field('layout', $iLayout)->rules('required|toint');
$oValidator->field('role', $iRole)->rules('required|toint');
$oValidator->field('user_id', $user_id)->rules('toint');
if ($user_id == 0) {
$oValidator->field($this->getLang('password'), $sPass)->rules('required|md5');
} elseif (strlen($sPass)) {
$oValidator->field($this->getLang('password'), $sPass)->rules('md5');
}
if ($oValidator->validate()) {
if ($user_id == 0) {
//zapis nowego usera
$oUser = new Model_User();
$oUser->fname = $sFName;
$oUser->name = $sName;
$oUser->email = $sEmail;
$oUser->password = $sPass;
$oUser->layout_id = $iLayout;
$oUser->role_id = $iRole;
$oUser->account_id = $this->oCurrentUser->account_id;
if ($oUser->save()) {
$aMeta = $this->mTemplate->aMeta;
$aMeta[] = '<meta http-equiv="refresh" content="1;url=' . $this->mTemplate->anchor('/account/users/') . '" />';
//.........这里部分代码省略.........
示例8: deleteAction
/**
* Delete action
*
* Delete a user
*
* @return void
*/
public function deleteAction()
{
$userName = $this->_request->getParam('username');
$u = new Model_User();
$u->delete("name = '{$userName}'");
$url = 'admin/site';
$this->_redirect($url);
}