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


PHP task::insert方法代码示例

本文整理汇总了PHP中task::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP task::insert方法的具体用法?PHP task::insert怎么用?PHP task::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在task的用法示例。


在下文中一共展示了task::insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: assignTo

 function assignTo($userId)
 {
     global $dbInst, $loginInst;
     if (!$loginInst->hasAccess("request.assignTo")) {
         return false;
     }
     $taskInst = new task();
     $taskInst->subject = $this->subject;
     $taskInst->body = $this->body;
     $taskInst->projectId = $this->projectId;
     $taskInst->typeId = $this->typeId;
     $taskInst->priorityId = $this->priorityId;
     $taskInst->userId = $userId;
     $taskInst->statusId = TASK_STATUS_REQUEST;
     $taskInst->posterId = $loginInst->id;
     $taskInst->attachments = $this->attachments;
     $taskId = $taskInst->insert();
     if (!$taskId) {
         return false;
     }
     // task saved successfully. Now whe can assign the attachments to the task id
     $taskInst->id = $taskId;
     while ($element = current($taskInst->attachments)) {
         $attachment = new attachment($element);
         $attachment->taskId = $taskId;
         $attachment->update();
         next($taskInst->attachments);
     }
     // the attachments are now assigned to the task -> so we should
     // clean the attachment array in the request instance, to prevent
     // deleting of the attachments
     $this->attachments = array();
     if ($this->delete()) {
         return $taskId;
     }
     return false;
 }
开发者ID:pmtool,项目名称:pmtool,代码行数:37,代码来源:request.inc.php

示例2:

## perform action
$recordType = "new";
$action = tool::securePost('action');
if ($action == "update") {
    $taskInst->id = tool::securePost('id');
    $taskInst->fill(tool::securePostAll());
    if ($taskInst->update()) {
        $taskInst->clear();
        $recordType = "new";
    } else {
        $recordType = "edit";
    }
}
if ($action == "new") {
    $taskInst->fill(tool::securePostAll());
    if ($taskInst->insert()) {
        $taskInst->clear();
    }
}
if ($action == "search") {
    if (tool::securePost('lastrecordtype')) {
        $recordType = tool::securePost('lastrecordtype');
    }
    $taskInst->fill(tool::securePostAll());
    $taskInst->id = tool::securePost('id');
}
if ($action == "delete") {
    $taskInst->id = tool::securePost('id');
    $taskInst->delete();
}
if ($action == "edit") {
开发者ID:pmtool,项目名称:pmtool,代码行数:31,代码来源:tasks.php


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