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


PHP CProject::updateTaskCache方法代码示例

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


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

示例1: hook_postDelete

 protected function hook_postDelete()
 {
     $this->task_id = $this->_old_key;
     $this->task_project = $this->_project_id;
     $this->updateDynamics();
     $last_task_data = $this->getLastTaskData($this->_project_id);
     CProject::updateTaskCache($this->_project_id, $last_task_data['task_id'], $last_task_data['last_date'], $this->getTaskCount($this->_project_id));
     parent::hook_postDelete();
 }
开发者ID:victorrod,项目名称:web2project,代码行数:9,代码来源:tasks.class.php

示例2: delete

 /**
  * @todo Parent store could be partially used
  * @todo Can't delete a task with children
  */
 public function delete(CAppUI $AppUI = null)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     $this->_error = array();
     if ($perms->checkModuleItem('tasks', 'delete', $this->task_id)) {
         //load it before deleting it because we need info on it to update the parents later on
         $this->load($this->task_id);
         // delete children
         $childrenlist = $this->getChildren();
         foreach ($childrenlist as $child) {
             $task = new CTask();
             $task->task_id = $child;
             $task->delete($AppUI);
         }
         $taskList = $childrenlist + array($this->task_id);
         $implodedTaskList = implode(',', $taskList);
         $q = new w2p_Database_Query();
         // delete linked user tasks
         $q->setDelete('user_tasks');
         $q->addWhere('task_id IN (' . $implodedTaskList . ')');
         if (!$q->exec()) {
             return db_error();
         }
         $q->clear();
         // delete affiliated task_dependencies
         $q->setDelete('task_dependencies');
         $q->addWhere('dependencies_task_id IN (' . $implodedTaskList . ') OR
             dependencies_req_task_id IN (' . $implodedTaskList . ')');
         if (!$q->exec()) {
             return db_error();
         }
         $q->clear();
         // delete affiliated task_dependencies
         $q->setDelete('task_contacts');
         $q->addWhere('task_id = ' . $this->task_id);
         if (!$q->exec()) {
             return db_error();
         }
         if ($msg = parent::delete()) {
             return $msg;
         }
         if ($this->task_parent != $this->task_id) {
             $this->updateDynamics();
         }
         $last_task_data = $this->getLastTaskData($this->task_project);
         CProject::updateTaskCache($this->task_project, $last_task_data['task_id'], $last_task_data['last_date'], $this->getTaskCount($this->task_project));
         return true;
     }
     return false;
 }
开发者ID:eureka2,项目名称:web2project,代码行数:55,代码来源:tasks.class.php

示例3: importTasks


//.........这里部分代码省略.........
  *   all three. Imagine you have a task which requires a particular form to
  *   be filled out (Files) but there's also documentation you need about it
  *   (Links) and once the task is underway, you need to let some people
  *   know (Contacts). - dkc 25 Nov 2012
  * */
 public function importTasks($from_project_id, $to_project_id, $project_start_date)
 {
     $errors = array();
     $old_new_task_mapping = array();
     $old_dependencies = array();
     $old_parents = array();
     $project_start_date = new w2p_Utilities_Date($project_start_date);
     $newTask = new w2p_Actions_BulkTasks();
     $task_list = $newTask->loadAll('task_start_date', "task_represents_project = 0 AND task_project = " . $from_project_id);
     $first_task = array_shift($task_list);
     /**
      * This gets the first (earliest) task start date and figures out
      *   how much we have to shift all the tasks by.
      */
     $original_start_date = new w2p_Utilities_Date($first_task['task_start_date']);
     $timeOffset = $original_start_date->dateDiff($project_start_date);
     array_unshift($task_list, $first_task);
     foreach ($task_list as $orig_task) {
         $orig_id = $orig_task['task_id'];
         $new_start_date = new w2p_Utilities_Date($orig_task['task_start_date']);
         $new_start_date->addDays($timeOffset);
         $new_end_date = new w2p_Utilities_Date($orig_task['task_end_date']);
         $new_end_date->addDays($timeOffset);
         $old_parents[$orig_id] = $orig_task['task_parent'];
         $orig_task['task_id'] = 0;
         $orig_task['task_parent'] = 0;
         $orig_task['task_project'] = $to_project_id;
         $orig_task['task_sequence'] = 0;
         $orig_task['task_path_enumeration'] = '';
         $orig_task['task_hours_worked'] = 0;
         // This is necessary because we're using bind() and it shifts by timezone
         $orig_task['task_start_date'] = $this->_AppUI->formatTZAwareTime($new_start_date->format(FMT_DATETIME_MYSQL), '%Y-%m-%d %T');
         $orig_task['task_end_date'] = $this->_AppUI->formatTZAwareTime($new_end_date->format(FMT_DATETIME_MYSQL), '%Y-%m-%d %T');
         $_newTask = new w2p_Actions_BulkTasks();
         $_newTask->bind($orig_task);
         $_newTask->store();
         $task_map[$orig_id] = $_newTask->task_id;
         $old_dependencies[$orig_id] = array_keys($_newTask->getDependentTaskList($orig_id));
         $old_new_task_mapping[$orig_id] = $_newTask->task_id;
     }
     if (count($errors)) {
         $this->_error = $errors;
         foreach ($old_new_task_mapping as $new_id) {
             $newTask->task_id = $new_id;
             $newTask->delete();
         }
     } else {
         $q = $this->_getQuery();
         /* This makes sure we have all the dependencies mapped out. */
         foreach ($old_dependencies as $from => $to_array) {
             foreach ($to_array as $to) {
                 $q->addTable('task_dependencies');
                 $q->addInsert('dependencies_req_task_id', $old_new_task_mapping[$from]);
                 $q->addInsert('dependencies_task_id', $old_new_task_mapping[$to]);
                 $q->exec();
                 $q->clear();
             }
         }
         /* This makes sure all the parents are connected properly. */
         foreach ($old_parents as $old_child => $old_parent) {
             if ($old_child == $old_parent) {
                 /** Remember, this means skip the rest of the loop. */
                 continue;
             }
             $q->addTable('tasks');
             $q->addUpdate('task_parent', $old_new_task_mapping[$old_parent]);
             $q->addWhere('task_id   = ' . $old_new_task_mapping[$old_child]);
             $q->exec();
             $q->clear();
         }
         /* This copies the task assigness to the new tasks. */
         foreach ($old_new_task_mapping as $old_id => $new_id) {
             $newTask->task_id = $old_id;
             $newTask->copyAssignedUsers($new_id);
         }
     }
     $_task = new CTask();
     $task_list = $_task->loadAll('task_parent, task_id', "task_project = " . $to_project_id);
     foreach ($task_list as $key => $data) {
         $_task->load($key);
         $_task->_updatePathEnumeration();
         if (!$_task->task_parent) {
             $q->addTable('tasks');
             $q->addUpdate('task_parent', $_task->task_id);
             $q->addUpdate('task_updated', "'" . $q->dbfnNowWithTZ() . "'", false, true);
             $q->addWhere('task_id = ' . (int) $_task->task_id);
             $q->exec();
             $q->clear();
         }
     }
     $_task->updateDynamics();
     $last_task_data = $this->getLastTaskData($to_project_id);
     CProject::updateTaskCache($to_project_id, $last_task_data['task_id'], $last_task_data['last_date'], $this->getTaskCount($to_project_id));
     return $errors;
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:101,代码来源:BulkTasks.class.php


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