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


PHP CTask::deepCopy方法代码示例

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


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

示例1: deepCopy

 public function deepCopy($destProject_id = 0, $destTask_id = 0)
 {
     global $AppUI;
     $children = $this->getChildren();
     $newObj = $this->copy($destProject_id, $destTask_id);
     $new_id = $newObj->task_id;
     if (!empty($children)) {
         $tempTask = new CTask();
         foreach ($children as $child) {
             $tempTask->load($child);
             $tempTask->htmlDecode($child);
             $newChild = $tempTask->deepCopy($destProject_id, $new_id);
             $newChild->store($AppUI);
         }
     }
     return $newObj;
 }
开发者ID:eureka2,项目名称:web2project,代码行数:17,代码来源:tasks.class.php

示例2: foreach

     }
     */
 } else {
     if ($action == 'm') {
         //move task
         if (isset($children)) {
             $t->deepMove($new_project, $new_task);
         } else {
             $t->move($new_project, $new_task);
         }
         $t->store();
     } else {
         if ($action == 'c') {
             //copy task
             if (isset($children)) {
                 $t2 = $t->deepCopy($new_project, $new_task);
             } else {
                 $t2 = $t->copy($new_project, $new_task);
             }
             $t2->store();
         } else {
             if ($action > -2 && $action < 2) {
                 //set priority
                 $t->task_priority = $action;
                 $t->store();
                 if (isset($children)) {
                     foreach ($children as $child_id) {
                         $child_t = new CTask();
                         $child_t->load($child_id);
                         $child_t->task_priority = $action;
                         $child_t->store();
开发者ID:kaz190,项目名称:dotproject,代码行数:31,代码来源:organize.php

示例3: deepCopy

 function deepCopy($destProject_id = 0, $destTask_id = 0)
 {
     $children = $this->getChildren();
     $newObj = $this->copy($destProject_id, $destTask_id);
     if (!empty($children)) {
         $tempTask = new CTask();
         $new_child_ids = array();
         foreach ($children as $child) {
             $tempTask->peek($child);
             $tempTask->htmlDecode($child);
             $newChild = $tempTask->deepCopy($destProject_id, $newObj->task_id);
             $newChild->store();
             //old id to new id translation table
             $old_id = $tempTask->task_id;
             $new_child_ids[$old_id] = $newChild->task_id;
         }
         /*
          * We cannot update beyond the new child id without complicating matters
          * by mapping "old" id's to new in an array that would be accessible in 
          * *every* level of recursive call and get executed just before returning 
          * from a given call. Also we may not want to do this as there could be 
          * good reasons for keeping some of the old non-child dependancy ids anyway
          */
         //update dependancies on old child ids to new child id
         $dep_list = $newObj->getDependencies();
         if ($dep_list) {
             $dep_array = explode(',', $dep_list);
             foreach ($dep_array as $key => $dep_id) {
                 if ($new_child_ids[$dep_id]) {
                     $dep_array[$key] = $new_child_ids[$dep_id];
                 }
             }
             $dep_list = implode(',', $dep_array);
             $newObj->updateDependencies($dep_list);
         }
     }
     $newObj->store();
     return $newObj;
 }
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:39,代码来源:tasks.class.php

示例4: importTasks

 /**	Import tasks from another project
  *
  *	@param	int		Project ID of the tasks come from.
  *	@return	bool	
  **/
 function importTasks($from_project_id)
 {
     // Load the original
     $origProject = new CProject();
     $origProject->load($from_project_id);
     $q = new DBQuery();
     $q->addTable('tasks');
     $q->addQuery('task_id');
     $q->addWhere('task_project =' . $from_project_id);
     $q->addWhere('task_id = task_parent');
     $sql = $q->prepare();
     $q->clear();
     $tasks = array_flip(db_loadColumn($sql));
     $origDate = new CDate($origProject->project_start_date);
     $destDate = new CDate($this->project_start_date);
     $timeOffset = $destDate->getTime() - $origDate->getTime();
     // Dependencies array
     $deps = array();
     // Copy each task into this project and get their deps
     foreach ($tasks as $orig => $void) {
         $objTask = new CTask();
         $objTask->load($orig);
         $destTask = $objTask->deepCopy($this->project_id);
         $tasks[$orig] = $destTask;
         $deps[$orig] = $objTask->getDependencies();
     }
     $q->addTable('tasks');
     $q->addQuery('task_id');
     $q->addWhere('task_project =' . $this->project_id);
     $tasks = $q->loadColumn();
     // Update dates based on new project's start date.
     $newTask = new CTask();
     foreach ($tasks as $task_id) {
         $newTask->load($task_id);
         // Fix task start date from project start date offset
         $origDate->setDate($newTask->task_start_date);
         $destDate->setDate($origDate->getTime() + $timeOffset, DATE_FORMAT_UNIXTIME);
         $destDate = $destDate->next_working_day();
         $newTask->task_start_date = $destDate->format(FMT_DATETIME_MYSQL);
         // Fix task end date from start date + work duration
         //$newTask->calc_task_end_date();
         if (!empty($newTask->task_end_date) && $newTask->task_end_date != '0000-00-00 00:00:00') {
             $origDate->setDate($newTask->task_end_date);
             $destDate->setDate($origDate->getTime() + $timeOffset, DATE_FORMAT_UNIXTIME);
             $destDate = $destDate->next_working_day();
             $newTask->task_end_date = $destDate->format(FMT_DATETIME_MYSQL);
         }
         $newTask->store();
     }
     // end Fix record integrity
 }
开发者ID:magsilva,项目名称:dotproject,代码行数:56,代码来源:projects.class.php


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