当前位置: 首页>>代码示例>>PHP>>正文


PHP CContact::delete方法代码示例

本文整理汇总了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();
}
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:30,代码来源:do_contact_aed.php

示例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);
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:31,代码来源:do_contact_aed.php

示例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();
 }
开发者ID:robertbasic,项目名称:web2project-api,代码行数:32,代码来源:Contact.php

示例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');
开发者ID:joly,项目名称:web2project,代码行数:31,代码来源:do_contact_aed.php


注:本文中的CContact::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。