本文整理汇总了PHP中CContact::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP CContact::delete方法的具体用法?PHP CContact::delete怎么用?PHP CContact::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContact
的用法示例。
在下文中一共展示了CContact::delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
/* CONTACTS $Id: do_contact_aed.php 5872 2009-04-25 00:09:56Z merlinyoda $ */
if (!defined('DP_BASE_DIR')) {
die('You should not access this file directly.');
}
$obj = new CContact();
$msg = '';
if (!$obj->bind($_POST)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
$del = dPgetParam($_POST, 'del', 0);
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg('Contact');
if ($del) {
if ($msg = $obj->delete()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
} else {
$AppUI->setMsg("deleted", UI_MSG_ALERT, true);
$AppUI->redirect("m=contacts");
}
} else {
$isNotNew = @$_POST['contact_id'];
if ($msg = $obj->store()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
} else {
$AppUI->setMsg($isNotNew ? 'updated' : 'added', UI_MSG_OK, true);
}
$AppUI->redirect();
}
示例2: die
<?php
/* $Id: do_contact_aed.php 1940 2011-05-31 05:20:41Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/contacts/do_contact_aed.php $ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
$del = (int) w2PgetParam($_POST, 'del', 0);
$obj = new CContact();
if (!$obj->bind($_POST)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
$action = $del ? 'deleted' : 'stored';
$result = $del ? $obj->delete($AppUI) : $obj->store($AppUI);
$redirect = $del ? 'm=contacts' : 'm=contacts&a=view&contact_id=' . $obj->contact_id;
if (is_array($result)) {
$AppUI->setMsg($result, UI_MSG_ERROR, true);
$AppUI->holdObject($obj);
$AppUI->redirect('m=contacts&a=addedit');
}
if ($result) {
$AppUI->setMsg('Contact ' . $action, UI_MSG_OK, true);
if (!$del) {
$updatekey = $obj->getUpdateKey();
$notifyasked = w2PgetParam($_POST, 'contact_updateask', 0);
if ($notifyasked && !$updatekey) {
$rnow = new w2p_Utilities_Date();
$obj->contact_updatekey = MD5($rnow->format(FMT_DATEISO));
$obj->contact_updateasked = $rnow->format(FMT_DATETIME_MYSQL);
$obj->contact_lastupdate = '';
$obj->store($AppUI);
示例3: executeDelete
/**
* Delete Request Handler
*
* This method is called when a request is a DELETE
*
* @return array
*/
public function executeDelete()
{
$valid = $this->hasRequiredParameters($this->requiredParams);
if ($valid instanceof Frapi_Error) {
return $valid;
}
$username = $this->getParam('username');
$password = $this->getParam('password');
$contact_id = $this->getParam('contact_id', self::TYPE_INT);
// Attempt to login as user, a little bit of a hack as we currently
// require the $_POST['login'] var to be set as well as a global AppUI
$AppUI = new CAppUI();
$GLOBALS['AppUI'] = $AppUI;
$_POST['login'] = 'login';
if (!$AppUI->login($username, $password)) {
throw new Frapi_Error('INVALID_LOGIN');
}
$contact = new CContact();
$contact->load($contact_id);
if (!$contact->delete($AppUI)) {
throw new Frapi_Error('PERMISSION_ERROR');
}
$this->data['success'] = true;
return $this->toArray();
}
示例4: CustomFields
if (!$perms->checkModule('contacts', 'add')) {
$AppUI->redirect('m=public&a=access_denied');
}
}
$notifyasked = w2PgetParam($_POST, 'contact_updateask', 0);
if ($notifyasked != 0) {
$notifyasked = 1;
}
if (!$obj->bind($_POST)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg('Contact');
if ($del) {
if ($msg = $obj->delete($AppUI)) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
} else {
$AppUI->setMsg('deleted', UI_MSG_ALERT, true);
$AppUI->redirect('m=contacts');
}
} else {
if ($result = $obj->store($AppUI)) {
if (is_array($result)) {
$AppUI->setMsg($result, UI_MSG_ERROR, true);
$AppUI->holdObject($obj);
$AppUI->redirect('m=contacts&a=addedit');
}
} else {
$custom_fields = new CustomFields($m, 'addedit', $obj->contact_id, 'edit');