本文整理汇总了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'));
}
示例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);
}
示例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);
}
示例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);
}