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


PHP Task::insert方法代码示例

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


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

示例1: createtask_POST

function createtask_POST(Web &$w)
{
    $w->Task->navigation($w, "Create Task");
    // unserialise input from step I and store in array: arr_req
    $arr_req = unserialize($w->request('formone'));
    // set relevant dt variables with: Today.
    $arr_req['dt_assigned'] = Date('c');
    $arr_req['dt_first_assigned'] = Date('c');
    // insert Task into database
    $task = new Task($w);
    $task->fill($arr_req);
    $task->insert();
    // if insert is successful, store additional fields as task data
    // we do not want to store data from step I, the task_id (as a key=>value pair) nor the FLOW_SID
    if ($task->id) {
        foreach ($_POST as $name => $value) {
            if ($name != "formone" && $name != "FLOW_SID" && $name != "task_id" && $name !== CSRF::getTokenID()) {
                $tdata = new TaskData($w);
                $arr = array("task_id" => $task->id, "key" => $name, "value" => $value);
                $tdata->fill($arr);
                $tdata->insert();
                unset($arr);
            }
        }
        // return to task dashboard
        $w->msg("Task " . $task->title . " added", "/task/viewtask/" . $task->id);
    } else {
        // if task insert was unsuccessful, say as much
        $w->msg("The Task could not be created. Please inform the IT Group", "/task/index/");
    }
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:31,代码来源:createtask.php

示例2: createTask

 /**
  * Create a new Task
  * 
  * @param unknown $task_type
  * @param unknown $task_group_id
  * @param unknown $title
  * @param unknown $description
  * @param unknown $priority
  * @param unknown $dt_due
  * @param unknown $first_assignee_id
  */
 function createTask($task_type, $task_group_id, $title, $description, $priority, $dt_due, $first_assignee_id)
 {
     $task = new Task($this->w);
     $task->task_type = $task_type;
     $task->task_group_id = $task_group_id;
     $task->title = $title;
     $task->description = $description;
     $task->priority = $priority;
     $task->dt_due = $dt_due;
     $task->first_assignee_id = $first_assignee_id;
     $task->assignee_id = $first_assignee_id;
     $task->dt_assigned = time();
     $task->dt_first_assigned = time();
     $task->insert();
     return $task;
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:27,代码来源:TaskService.php

示例3: Teams

 } else {
     if ($_POST['action'] === "addtask") {
         if ($admin === true) {
             try {
                 (new Teams())->login(htmlspecialchars_decode($team->name), $_POST['pass']);
                 $task = new Task();
                 $task->name = $_POST['name'];
                 $task->desc = implode("<%#:#%>", $_POST['desc']);
                 $task->cat = $_POST['cat'];
                 $task->status = $_POST['status'];
                 $task->author = $_POST['author'];
                 $task->solvers = explode(',', $_POST['solvers']);
                 $task->point = $_POST['point'];
                 //$task->flag = $_POST['flag'];
                 $task->link = $_POST['link'];
                 $task->insert();
                 $success = "HELAL LA EKLEDIN HAYIRLARA VESILE OLUR INS";
             } catch (Exception $e) {
                 $error .= $e->getMessage() . "\n";
             }
         }
     } else {
         if ($_POST['action'] === "attempt") {
             if ($loggedin === true) {
                 try {
                     //throw new Exception("Contest has ended");
                     $task = new Task($_POST['id']);
                     if ($task->attempt($_POST['flag']) === true) {
                         $success = $ltask[6];
                     } else {
                         $error = $ltask[7];
开发者ID:zysicing,项目名称:CTFSys,代码行数:31,代码来源:base.php

示例4: TaskNew

/**
* start taskEdit-form with a new task
* - figure out prio,label and estimated time from name
*
* @ingroup pages
*/
function TaskNew()
{
    global $PH;
    $parent_task = NULL;
    $parent_task_id = 0;
    ### try to figure out parent_task ###
    if ($task_ids = getPassedIds('parent_task', 'tasks_*|folders_*', false)) {
        if (count($task_ids) != 1) {
            $PH->abortWarning(__("Please select only one item as parent"), ERROR_NOTE);
        }
        if ($task_ids[0] != 0) {
            if (!($parent_task = Task::getVisibleById($task_ids[0]))) {
                $PH->abortWarning(__("Insufficient rights for parent item."), ERROR_NOTE);
            }
            $parent_task_id = $parent_task->id;
        } else {
            $parent_task_id = 0;
        }
    } else {
        $parent_task_id = 0;
    }
    ### figure out project ###
    $prj_id = getOnePassedId('prj', 'projects_*', false);
    # NOT aborts with error if not found
    if (!$prj_id) {
        if (!$parent_task) {
            $PH->abortWarning(__("could not find project"), ERROR_NOTE);
        }
        $prj_id = $parent_task->project;
    }
    if (!($project = Project::getVisibleById($prj_id))) {
        $PH->abortWarning(__("could not find project"), ERROR_NOTE);
    }
    ### make sure parent_task is valid ###
    if ($parent_task_id && !($parent_task = Task::getVisibleById($parent_task_id))) {
        $PH->abortWarning(__("Parent task not found."), ERROR_NOTE);
    }
    $name = html_entity_decode(get('new_name'));
    # @@@ hack to get rid of slashed strings
    $estimated = '00:00:00';
    ### for milestone ###
    $for_milestone_id = 0;
    if ($milestone = Task::getVisibleById(get('for_milestone'))) {
        $for_milestone_id = $milestone->id;
    }
    ### if parent-task is milestone for some reason, avoid parenting ###
    if ($parent_task && ($parent_task->category == TCATEGORY_MILESTONE || $parent_task->category == TCATEGORY_VERSION)) {
        $parent_task_id = 0;
        if (!$for_milestone_id) {
            $for_milestone_id = $parent_task->id;
        }
    }
    ### category ###
    $category = TCATEGORY_TASK;
    if (!is_null($cat = get('task_category'))) {
        global $g_tcategory_names;
        if (!isset($g_tcategory_names[$cat])) {
            $category = TCATEGORY_TASK;
        } else {
            $category = $cat;
        }
    }
    $folder_as_docu = get('task_show_folder_as_documentation', $category == TCATEGORY_DOCU ? 1 : 0);
    ### build dummy form ###
    $newtask = new Task(array('id' => 0, 'name' => $name, 'project' => $prj_id, 'state' => 1, 'estimated' => $estimated, 'category' => $category, 'parent_task' => $parent_task_id, 'for_milestone' => $for_milestone_id, 'show_folder_as_documentation' => intval($folder_as_docu)));
    ### set a valid create-level ###
    $newtask->pub_level = $project->getCurrentLevelCreate();
    ### insert without editing ###
    if (get('noedit')) {
        $newtask->insert();
        if (!$PH->showFromPage()) {
            $PH->show('projView', array('prj' => $prj));
        }
    } else {
        $PH->show('taskEdit', array('tsk' => $newtask->id), $newtask);
    }
}
开发者ID:Bremaweb,项目名称:streber-1,代码行数:83,代码来源:task_more.inc.php

示例5: newEffortFromTimeTracking

function newEffortFromTimeTracking()
{
    global $PH;
    global $auth;
    require_once confGet('DIR_STREBER') . 'db/class_effort.inc.php';
    $time_end = intval(get('effort_end_seconds'));
    if ($time_end == 0) {
        $time_end = null;
    }
    $new_effort = new Effort(array('id' => 0, 'time_start' => getGMTString(get('effort_start_seconds')), 'time_end' => getGMTString($time_end), 'name' => get('description'), 'billing' => get('billing'), 'productivity' => get('productivity')));
    ### get project ###
    $new_effort->project = get('effort_project_id');
    if (!($project = Project::getVisibleById($new_effort->project))) {
        $PH->abortWarning(__("Could not get project of effort"));
    }
    if (!$project->isPersonVisibleTeamMember($auth->cur_user)) {
        $PH->abortWarning("ERROR: Insufficient rights");
    }
    ### link to task ###
    $task_id = get('effort_task_id');
    if (!(is_null($task_id) || $task_id == 0)) {
        if ($task_id == 0) {
            $new_effort->task = 0;
        } else {
            if ($task = Task::getVisibleById($task_id)) {
                $new_effort->task = $task->id;
            }
        }
    } else {
        if (get('task_name') != "") {
            ### create new task
            $newtask = new Task(array('id' => 0, 'name' => get('task_name'), 'project' => $project->id));
            $newtask->insert();
            $new_effort->task = $newtask->id;
        }
    }
    ### get person ###
    $new_effort->person = $auth->cur_user->id;
    ### go back to from if validation fails ###
    $failure = false;
    if (strToGMTime($new_effort->time_end) - strToGMTime($new_effort->time_start) < 0) {
        $failure = true;
        new FeedbackWarning(__("Cannot start before end."));
    }
    ### write to db ###
    $new_effort->insert();
    ### display taskView ####
    if (!$PH->showFromPage()) {
        $PH->show('projView', array('prj' => $effort->project));
    }
}
开发者ID:Bremaweb,项目名称:streber-1,代码行数:51,代码来源:home_timetracking.inc.php

示例6: strip_tags

<?php

$taskName = strip_tags($_POST['task']);
$dueDate = empty($_POST['dueOn']) ? NULL : strip_tags($_POST['dueOn']);
$priority = empty($_POST['prio']) ? NULL : strip_tags($_POST['prio']);
require '../Models/Task.php';
if (isset($taskName)) {
    $newRow = Task::insert($taskName, $dueDate, $priority);
    echo Task::stringify($newRow);
}
开发者ID:grikka,项目名称:request-list,代码行数:10,代码来源:addTask.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $model = new Task();
     $a = $model->insert($_POST);
     return Redirect::to('project/' . $a);
 }
开发者ID:kotow,项目名称:Calendar,代码行数:11,代码来源:TaskController.php


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