本文整理汇总了PHP中CProject::updateTaskCount方法的典型用法代码示例。如果您正苦于以下问题:PHP CProject::updateTaskCount方法的具体用法?PHP CProject::updateTaskCount怎么用?PHP CProject::updateTaskCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CProject
的用法示例。
在下文中一共展示了CProject::updateTaskCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CTask
}
// prepare (and translate) the module name ready for the suffix
if ($del) {
$result = $obj->delete();
if (is_array($result)) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
} else {
$AppUI->setMsg('Task deleted');
$AppUI->redirect('', -1);
}
}
$result = $obj->store($AppUI);
if ($taskRecount) {
$myTask = new CTask();
CProject::updateTaskCount($taskRecount, $myTask->getTaskCount($taskRecount));
}
//$obj->task_project
if (is_array($result)) {
$AppUI->setMsg($result, UI_MSG_ERROR, true);
$AppUI->holdObject($obj);
$AppUI->redirect('m=tasks&a=addedit');
}
if ($result) {
$task_parent = (int) w2PgetParam($_POST, 'task_parent', 0);
$old_task_parent = (int) w2PgetParam($_POST, 'old_task_parent', 0);
if ($task_parent != $old_task_parent) {
$oldTask = new CTask();
$oldTask->load($old_task_parent);
$oldTask->updateDynamics(false);
}
示例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;
$q = new DBQuery();
$this->_action = 'deleted';
//load it before deleting it because we need info on it to update the parents later on
$this->load($this->task_id);
addHistory('tasks', $this->task_id, 'delete', $this->task_name, $this->task_project);
// 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);
// delete linked user tasks
$q->setDelete('user_tasks');
$q->addWhere('task_id IN (' . $implodedTaskList . ')');
if (!$q->exec()) {
return db_error();
}
$q->clear();
$q->setDelete('tasks');
$q->addWhere('task_id=' . (int) $this->task_id);
if (!$q->exec()) {
return db_error();
} elseif ($this->task_parent != $this->task_id) {
// Has parent, run the update sequence, this child will no longer be in the
// database
$this->updateDynamics();
}
$q->clear();
// delete affiliated task_logs
$q->setDelete('task_log');
$q->addWhere('task_log_task 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();
} else {
$this->_action = 'deleted';
}
$q->clear();
CProject::updateTaskCount($this->task_project, $this->getTaskCount($this->task_project));
return null;
}
示例3: moveTaskBetweenProjects
/**
* This method handles moving the $task_id specified from $project_old to
* $project_new and then updates the corresponding task counts and task
* start/end dates for the projects.
*
* @todo Get the start/end dates for the cache.. - updateTaskCache
*
* @param type $task_id
* @param type $project_old
* @param type $project_new
*/
public function moveTaskBetweenProjects($task_id, $project_old, $project_new)
{
$this->updateSubTasksProject($project_new, $task_id);
$this->removeDependencies();
$this->task_project = $project_new;
$this->task_parent = $this->task_id;
$this->store();
$taskCount_oldProject = $this->getTaskCount($project_old);
CProject::updateTaskCount($project_old, $taskCount_oldProject);
$taskCount_newProject = $this->getTaskCount($project_new);
CProject::updateTaskCount($project_new, $taskCount_newProject);
}