本文整理汇总了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;
}
示例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") {