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


PHP task::add方法代码示例

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


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

示例1: addTasks

 private function addTasks($project_id, $milestonesHash, $taskListArray)
 {
     $addTaskList = new tasklist();
     $addTask = new task();
     foreach ($taskListArray->{'todo-list'} as $taskList) {
         $name = $taskList->{'name'};
         if (isset($milestonesHash)) {
             $mid = $taskListArray->{'milestone-id'};
             if (strlen($mid) > 0) {
                 $milestoneId = $milestonesHash["{$mid}"];
             } else {
                 $milestoneId = 0;
             }
         }
         $desc = $taskListArray->{'description'};
         $access = 0;
         $tasklistId = $addTaskList->add_liste($project_id, $name, $desc, $access, $milestoneId);
         foreach ($taskList->{'todo-items'}->{'todo-item'} as $todo) {
             //$end = strtotime("+1 month", strtotime($todo->{'created-on'}));
             $end = strtotime($todo->{'created-on'} . " +1month");
             $title = $todo->{'name'};
             $text = $todo->{'content'};
             if (!$title) {
                 $title = $text;
             }
             $uid = $todo->{'responsible-party-id'};
             $assigned = $this->peopleHash["{$uid}"];
             //class.task::add() needed to be modified to pass a timestamp directly.
             if ($addTask->add($end, $title, $text, $tasklistId, $assigned, $project_id)) {
                 ++$this->taskCount;
             }
         }
     }
 }
开发者ID:janvalentik,项目名称:Collabtive,代码行数:34,代码来源:class.importer.php

示例2: addProjectFromExcel

 function addProjectFromExcel($inputFileName)
 {
     include "./include/PHPExcel/IOFactory.php";
     $objReader = new PHPExcel_Reader_Excel2007();
     $objPHPExcel = $objReader->load($inputFileName);
     $sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
     $limiter = "#";
     $projectObj = new project();
     $userObj = new user();
     $milestoneObj = new milestone();
     $tasklistObj = new tasklist();
     $taskObj = new task();
     $companyObj = new company();
     $projectname = $sheetData[2]["A"];
     $projectdescription = $sheetData[3]["A"];
     $projectdue = $sheetData[4]["A"];
     $projectbudget = $sheetData[5]["A"];
     $projectcustomer = $sheetData[6]["A"];
     $projectpriority = $sheetData[7]["A"];
     $projectId = $projectObj->add($projectname, $projectdescription, $projectdue, $projectbudget, $projectpriority);
     $customer = $companyObj->getCompanyByName($projectcustomer);
     if ($customer) {
         $companyObj->assign($customer["ID"], $projectId);
     }
     // USERS
     for ($i = 1; $i < count($sheetData); $i++) {
         $username = $sheetData[$i]["B"];
         if ($username) {
             $user = $userObj->getUserByName($username);
             if ($user) {
                 $projectObj->assign($user["ID"], $projectId);
             }
         } else {
             break;
         }
     }
     // MILESTONES
     for ($i = 1; $i < count($sheetData); $i++) {
         $milestone = explode($limiter, $sheetData[$i]["C"]);
         if ($milestone) {
             $milestoneObj->add($projectId, $milestone[0], $milestone[1], $milestone[2], $milestone[3]);
         } else {
             break;
         }
     }
     // TASK LISTS
     for ($i = 1; $i < count($sheetData); $i++) {
         $tasklist = explode($limiter, $sheetData[$i]["D"]);
         if ($tasklist) {
             if ($tasklist[3]) {
                 $milestone = $milestoneObj->getMilestoneByName($tasklist[3]);
                 if ($milestone) {
                     $tasklistObj->add_liste($projectId, $tasklist[0], $tasklist[1], $tasklist[2], 0, $milestone["ID"]);
                 }
             } else {
                 $tasklistObj->add_liste($projectId, $tasklist[0], $tasklist[1], $tasklist[2]);
             }
         } else {
             break;
         }
     }
     // TASKS
     for ($i = 1; $i < count($sheetData); $i++) {
         $task = explode($limiter, $sheetData[$i]["E"]);
         if ($task) {
             $tasklist = $tasklistObj->getTasklistByName($task[5]);
             $taskid = $taskObj->add($task[2], $task[3], $task[0], $task[4], $tasklist["ID"], $projectId, $task[6], $task[7]);
             $user = $userObj->getUserByName($task[1]);
             if ($taskid) {
                 if ($user) {
                     $taskObj->assign($taskid, $user["ID"]);
                 }
             }
         } else {
             break;
         }
     }
     return $projectId;
 }
开发者ID:veganaize,项目名称:Collabtive,代码行数:79,代码来源:class.project.php


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