本文整理汇总了PHP中CTask::getDeepChildren方法的典型用法代码示例。如果您正苦于以下问题:PHP CTask::getDeepChildren方法的具体用法?PHP CTask::getDeepChildren怎么用?PHP CTask::getDeepChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTask
的用法示例。
在下文中一共展示了CTask::getDeepChildren方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
//$q->addTable('user_tasks');
$q->addTable('user_tasks');
$q->addWhere('user_tasks.user_id = ' . (int) $user_id);
$q->addWhere('user_tasks.task_id = tasks.task_id');
$q->addWhere('task_percent_complete = 100');
//TODO: use date class to construct date.
$q->addWhere('task_end_date >= \'' . date('Y-m-d 00:00:00', mktime(0, 0, 0, date('m'), date('d') - 7, date('Y'))) . '\'');
break;
case 'children':
$q->addWhere('task_parent = ' . (int) $task_id);
$q->addWhere('tasks.task_id <> ' . $task_id);
break;
case 'deepchildren':
$taskobj = new CTask();
$taskobj->load((int) $task_id);
$deepchildren = $taskobj->getDeepChildren();
$q->addWhere('tasks.task_id IN (' . implode(',', $deepchildren) . ')');
$q->addWhere('tasks.task_id <> ' . $task_id);
break;
case 'myproj':
$q->addWhere('project_owner = ' . (int) $user_id);
break;
case 'mycomp':
if (!$AppUI->user_company) {
$AppUI->user_company = 0;
}
$q->addWhere('project_company = ' . (int) $AppUI->user_company);
break;
case 'myunfinished':
$q->addTable('user_tasks');
$q->addWhere('user_tasks.user_id = ' . (int) $user_id);
示例2: getDeepChildren
public function getDeepChildren()
{
$children = $this->getChildren();
if ($children) {
$deep_children = array();
$tempTask = new CTask();
foreach ($children as $child) {
$tempTask->load($child);
$deep_children = array_merge($deep_children, $tempTask->getDeepChildren());
}
return array_merge($children, $deep_children);
}
return array();
}
示例3: getDeepChildren
function getDeepChildren()
{
$q = new DBQuery();
$q->addTable('tasks');
$q->addQuery('task_id');
$q->addWhere("task_id <> '" . $this->task_id . "' AND task_parent = '" . $this->task_id . "'");
$sql = $q->prepare();
$q->clear();
$children = db_loadColumn($sql);
if ($children) {
$deep_children = array();
$tempTask = new CTask();
foreach ($children as $child) {
$tempTask->peek($child);
$deep_children = array_merge($deep_children, $tempTask->getDeepChildren());
}
return array_merge($children, $deep_children);
}
return array();
}
示例4: dPgetParam
//$user_id = $AppUI->getState('user_id');
}
}
// check permissions
$canEdit = $perms->checkModule($m, 'edit');
// if task priority set and items selected, do some work
$action = dPgetParam($_POST, 'action', 99);
$selected = dPgetParam($_POST, 'selected', 0);
if ($selected && count($selected)) {
$new_task = dPgetParam($_POST, 'new_task', -1);
$new_project = dPgetParam($_POST, 'new_project', $project_id);
foreach ($selected as $key => $val) {
$t = new CTask();
$t->load($val);
if (isset($_POST['include_children']) && $_POST['include_children']) {
$children = $t->getDeepChildren();
}
if ($action == 'f') {
//mark task as completed
if ($perms->checkModuleItem('tasks', 'edit', $t->task_id)) {
$t->task_percent_complete = 100;
$t->store();
}
if (isset($children)) {
foreach ($children as $child_id) {
if ($perms->checkModuleItem('tasks', 'edit', $child_t->task_id)) {
$child_t = new CTask();
$child_t->load($child_id);
$child_t->task_percent_complete = 100;
$child_t->store();
}
示例5: defVal
$q->addGroup('project_id');
$q->addOrder('project_name');
$project->setAllowedSQL($AppUI->user_id, $q);
$projects = $q->loadHashList('project_id');
$q->clear();
$caller = defVal(@$_REQUEST['caller'], null);
/**
* if task filtering has been requested create the list of task_ids
* which will be used to filter the query
*/
if ($ganttTaskFilter > 0) {
$task_child_search = new CTask();
$task_child_search->peek($ganttTaskFilter);
//$childrenlist[] = $ganttTaskFilter;
//print_r($childrenlist);
$childrenlist = $task_child_search->getDeepChildren();
//print_r($childrenlist);
$where .= ' t.task_id IN (' . $ganttTaskFilter . ', ' . implode(', ', $childrenlist) . ')';
}
//else {
// $where = '';
//}
//echo '<pre> $where = ' . $where . '</pre>';
//die;
// gantt is called now by the todo page, too. There is a different filter approach in todo
// so we have to tweak a little bit, also we do not have a special project available
if ($caller == 'todo') {
$user_id = defVal(@$_REQUEST['user_id'], 0);
$projects[$project_id]['project_name'] = $AppUI->_('Todo for') . ' ' . dPgetUsernameFromID($user_id);
$projects[$project_id]['project_color_identifier'] = 'ff6000';
$q->addTable('tasks', 't');
示例6: __extract_from_tasks3
/**
* @param $f
* @param $q
* @param $user_id
* @param $task_id
* @param $AppUI
* @return string
*/
function __extract_from_tasks3($f, $q, $user_id, $task_id, $AppUI)
{
$f = $f ? $f : '';
if ($task_id) {
//if we are on a task context make sure we show ALL the children tasks
$f = 'deepchildren';
}
switch ($f) {
case 'myfinished7days':
$q->addWhere('ut.user_id = ' . (int) $user_id);
case 'allfinished7days':
$q->addTable('user_tasks');
$q->addWhere('user_tasks.user_id = ' . (int) $user_id);
$q->addWhere('user_tasks.task_id = tasks.task_id');
$q->addWhere('task_percent_complete = 100');
//TODO: use date class to construct date.
$q->addWhere('task_end_date >= \'' . date('Y-m-d 00:00:00', mktime(0, 0, 0, date('m'), date('d') - 7, date('Y'))) . '\'');
break;
case 'children':
$q->addWhere('task_parent = ' . (int) $task_id);
$q->addWhere('tasks.task_id <> ' . $task_id);
break;
case 'deepchildren':
$taskobj = new CTask();
$taskobj->load((int) $task_id);
$deepchildren = $taskobj->getDeepChildren();
$q->addWhere('tasks.task_id IN (' . implode(',', $deepchildren) . ')');
$q->addWhere('tasks.task_id <> ' . $task_id);
break;
case 'myproj':
$q->addWhere('project_owner = ' . (int) $user_id);
break;
case 'mycomp':
if (!$AppUI->user_company) {
$AppUI->user_company = 0;
}
$q->addWhere('project_company = ' . (int) $AppUI->user_company);
break;
case 'myunfinished':
$q->addTable('user_tasks');
$q->addWhere('user_tasks.user_id = ' . (int) $user_id);
$q->addWhere('user_tasks.task_id = tasks.task_id');
$q->addWhere('(task_percent_complete < 100 OR task_end_date = \'\')');
break;
case 'allunfinished':
$q->addWhere('(task_percent_complete < 100 OR task_end_date = \'\')');
break;
case 'unassigned':
$q->leftJoin('user_tasks', 'ut_empty', 'tasks.task_id = ut_empty.task_id');
$q->addWhere('ut_empty.task_id IS NULL');
break;
case 'taskcreated':
$q->addWhere('task_creator = ' . (int) $user_id);
break;
case 'taskowned':
$q->addWhere('task_owner = ' . (int) $user_id);
break;
case 'all':
//break;
//break;
default:
if ($user_id) {
$q->addTable('user_tasks');
$q->addWhere('user_tasks.user_id = ' . (int) $user_id);
$q->addWhere('user_tasks.task_id = tasks.task_id');
}
break;
}
return $q;
}