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


PHP CTask::updateHoursWorked方法代码示例

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


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

示例1: testUpdateHoursWorked

 /**
  * Test updating hours worked for a task
  */
 public function testUpdateHoursWorked()
 {
     CTask::updateHoursWorked(1, 25);
     $xml_file_dataset = $this->createXMLDataSet($this->getDataSetPath() . 'tasksTestUpdateHoursWorked.xml');
     $xml_db_dataset = $this->getConnection()->createDataSet();
     $this->assertTablesEqual($xml_file_dataset->getTable('tasks'), $xml_db_dataset->getTable('tasks'));
 }
开发者ID:eureka2,项目名称:web2project,代码行数:10,代码来源:tasks.test.php

示例2: updateTaskSummary

 /**
  * Updates the variable information on the task.
  *
  * @param int $task_log_task that task id of task this task log is for
  *
  * @return void
  *
  * @access private
  */
 protected function updateTaskSummary($AppUI = null, $task_id)
 {
     $q = $this->_getQuery();
     if ($this->_perms->checkModuleItem('tasks', 'edit', $task_id)) {
         if ($this->task_log_percent_complete < 100) {
             $q->addQuery('task_log_percent_complete, task_log_date');
             $q->addTable('task_log');
             $q->addWhere('task_log_task = ' . (int) $task_id);
             $q->addOrder('task_log_date DESC, task_log_id DESC');
             $q->setLimit(1);
             $results = $q->loadHash();
             $percentComplete = $results['task_log_percent_complete'];
         } else {
             $percentComplete = 100;
         }
         $task = new CTask();
         $task->overrideDatabase($this->_query);
         $task->load($task_id);
         $task->task_percent_complete = $percentComplete;
         $diff = strtotime($this->task_log_task_end_date) - strtotime($task->task_end_date);
         $task->task_end_date = 0 == $diff ? $task->task_end_date : $this->task_log_task_end_date;
         $success = $task->store();
         if (!$success) {
             $this->_AppUI->setMsg($task->getError(), UI_MSG_ERROR, true);
         }
         $task->pushDependencies($task_id, $task->task_end_date);
     }
     $q->addQuery('SUM(task_log_hours)');
     $q->addTable('task_log');
     $q->addWhere('task_log_task = ' . (int) $task_id);
     $totalHours = $q->loadResult();
     CTask::updateHoursWorked($task_id, $totalHours);
 }
开发者ID:,项目名称:,代码行数:42,代码来源:

示例3: updateHoursWorked

 private function updateHoursWorked($task_log_task)
 {
     $q = new DBQuery();
     $q->addQuery('SUM(task_log_hours)');
     $q->addTable('task_log');
     $q->addWhere('task_log_task = ' . (int) $task_log_task);
     $totalHours = $q->loadResult();
     CTask::updateHoursWorked($task_log_task, $totalHours);
 }
开发者ID:joly,项目名称:web2project,代码行数:9,代码来源:tasks.class.php

示例4: updateTaskSummary

 /**
  * Updates the variable information on the task.
  *
  * @param int $task_log_task that task id of task this task log is for
  *
  * @return void
  *
  * @access private
  */
 private function updateTaskSummary(CAppUI $AppUI, $task_id)
 {
     $perms = $AppUI->acl();
     $q = $this->_query;
     if ($perms->checkModuleItem('tasks', 'edit', $task_id)) {
         if ($this->task_log_percent_complete < 100) {
             $q->addQuery('task_log_percent_complete, task_log_date, task_log_task_end_date');
             $q->addTable('task_log');
             $q->addWhere('task_log_task = ' . (int) $task_id);
             $q->addOrder('task_log_date DESC, task_log_id DESC');
             $q->setLimit(1);
             $results = $q->loadHash();
             $q->clear();
             $percentComplete = $results['task_log_percent_complete'];
             /*
              * TODO: In theory, we shouldn't just use the task_log_task_end_date, 
              *   because if we're after that date and someone is still adding 
              *   logs to a task, obviously the task isn't complete. We may want 
              *   to check to see if task_log_date > task_log_task_end_date and 
              *   use the later one as the end date.. not sure yet.
              */
             $taskEndDate = $results['task_log_task_end_date'];
         } else {
             $percentComplete = 100;
             $taskEndDate = $this->task_log_date;
         }
         $task = new CTask();
         $task->load($task_id);
         $task->task_percent_complete = $percentComplete;
         $task->task_end_date = $taskEndDate;
         $msg = $task->store($AppUI);
         if (is_array($msg)) {
             $AppUI->setMsg($msg, UI_MSG_ERROR, true);
         }
         $task->pushDependencies($task_id, $task->task_end_date);
     }
     $q->addQuery('SUM(task_log_hours)');
     $q->addTable('task_log');
     $q->addWhere('task_log_task = ' . (int) $task_log_task);
     $totalHours = $q->loadResult();
     CTask::updateHoursWorked($task_id, $totalHours);
 }
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:51,代码来源:tasklogs.class.php


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