當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CProject::delete方法代碼示例

本文整理匯總了PHP中CProject::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP CProject::delete方法的具體用法?PHP CProject::delete怎麽用?PHP CProject::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CProject的用法示例。


在下文中一共展示了CProject::delete方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: implode

// let's check if there are some assigned departments to project
//部門分配
if (!dPgetParam($_POST, "project_departments", 0)) {
    //返回一個部門的id
    $obj->project_departments = implode(",", dPgetParam($_POST, "dept_ids", array()));
}
$del = dPgetParam($_POST, 'del', 0);
// prepare (and translate) the module name ready for the suffix
if ($del) {
    $project_id = dPgetParam($_POST, 'project_id', 0);
    $canDelete = $obj->canDelete($msg, $project_id);
    if (!$canDelete) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
        $AppUI->redirect();
    }
    if ($msg = $obj->delete()) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
        $AppUI->redirect();
    } else {
        $AppUI->setMsg("Project deleted", UI_MSG_ALERT);
        $AppUI->redirect("m=projects");
    }
} else {
    if ($msg = $obj->store()) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
    } else {
        $isNotNew = @$_POST['project_id'];
        if ($importTask_projectId = dPgetParam($_POST, 'import_tasks_from', '0')) {
            $obj->importTasks($importTask_projectId);
        }
        $AppUI->setMsg($isNotNew ? 'Project updated' : 'Project inserted', UI_MSG_OK, true);
開發者ID:klr2003,項目名稱:sourceread,代碼行數:31,代碼來源:do_project_aed.php

示例2: die

/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$del = (int) w2PgetParam($_POST, 'del', 0);
$obj = new CProject();
if (!$obj->bind($_POST)) {
    $AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
    $AppUI->redirect();
}
if (!w2PgetParam($_POST, 'project_departments', 0)) {
    $obj->project_departments = implode(',', w2PgetParam($_POST, 'dept_ids', array()));
}
$action = $del ? 'deleted' : 'stored';
$result = $del ? $obj->delete($AppUI) : $obj->store($AppUI);
$notify_owner = $_POST['email_project_owner_box'] ? 1 : 0;
$notify_contacts = $_POST['email_project_contacts_box'] ? 1 : 0;
$notfiyTrigger = $del ? 1 : $obj->project_id;
$importTask_projectId = (int) w2PgetParam($_POST, 'import_tasks_from', '0');
if (is_array($result)) {
    $AppUI->setMsg($result, UI_MSG_ERROR);
    $AppUI->holdObject($obj);
    $AppUI->redirect('m=projects&a=addedit');
}
if ($result) {
    if ($importTask_projectId) {
        $obj->importTasks($importTask_projectId);
    }
    if ($notify_owner) {
        if ($msg = $obj->notifyOwner($notfiyTrigger)) {
開發者ID:joly,項目名稱:web2project,代碼行數:30,代碼來源:do_project_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');
     $project_id = $this->getParam('project_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');
     }
     $project = new CProject();
     $project->load($project_id);
     if (!$project->delete($AppUI)) {
         throw new Frapi_Error('PERMISSION_ERROR');
     }
     $this->data['success'] = true;
     return $this->toArray();
 }
開發者ID:robertbasic,項目名稱:web2project-api,代碼行數:32,代碼來源:Project.php


注:本文中的CProject::delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。