예제 #1
0
$q->clear();
$filter_options = array();
$filter_module_tables = array();
$denied_tables = '';
foreach ($available_modules as $my_mod => $my_mod_data) {
    $my_mod_table = $my_mod_data['permissions_item_table'];
    $filter_options[$my_mod]['Name'] = $my_mod_data['mod_name'];
    $filter_options[$my_mod]['Table'] = $my_mod_table;
    $filter_options[$my_mod]['Table_ID'] = $my_mod_data['permissions_item_field'];
    $filter_options[$my_mod]['Table_ID_Name'] = $my_mod_data['permissions_item_label'];
    $filter_module_tables[$my_mod] = $my_mod_table;
    if ($my_mod_table && !getPermission($my_mod, 'view')) {
        $denied_tables .= ($denied_module_list ? "','" : '') . $my_mod_table;
    }
}
$q->includeCount();
$q->addTable('history', 'h');
$q->leftJoin('users', 'u', 'u.user_id = h.history_user');
$q->addQuery('h.*, u.*');
if ($in_filter) {
    $filter .= ($filter ? ' AND ' : '') . "(h.`history_table` LIKE '" . $in_filter . "%')";
}
if ($denied_tables) {
    $filter .= ($filter ? ' AND ' : '') . "(NOT h.`history_table` IN ('" . $denied_tables . "'))";
}
if (!empty($_REQUEST['project_id'])) {
    $project_id = $_REQUEST['project_id'];
    $r = new DBQuery();
    $r->addTable('tasks');
    $r->addQuery('task_id');
    $r->addWhere('task_project = ' . $project_id);
예제 #2
0
if ($category_filter) {
    $q3->addWhere($category_filter);
}
if ($company_id) {
    $q3->addWhere('p.project_company = ' . $company_id);
}
if ($project_id) {
    $q3->addWhere('f.file_project = ' . $project_id);
}
if ($task_id) {
    $q3->addWhere('f.file_task = ' . $task_id);
}
$files = array();
$file_versions = array();
if ($canRead) {
    $q2->includeCount();
    $files = $q2->loadList();
    $xpg_totalrecs = $q2->foundRows();
    $file_versions = $q3->loadHashList('file_id');
}
$r->dropTemp('files_count_max');
$r->exec();
// How many pages are we dealing with here ??
$xpg_total_pages = $xpg_totalrecs > $xpg_pagesize ? ceil($xpg_totalrecs / $xpg_pagesize) : 1;
shownavbar($xpg_totalrecs, $xpg_pagesize, $xpg_total_pages, $page);
?>
<script type="text/JavaScript">
function expand(id) {
  var element = document.getElementById(id);
  element.style.display = (element.style.display == '' || element.style.display == "none") ? "block" : "none";
}
예제 #3
0
function process_dependencies($i)
{
    global $tasks, $option_advance_if_possible;
    if ($tasks[$i]["fixed"]) {
        return;
    }
    log_info("<div style='padding-left: 1em'>Dependecies for '" . $tasks[$i]["task_name"] . "':<br />");
    // query dependencies for this task
    $q = new DBQuery();
    $q->addTable('tasks', 't');
    $q->addTable('task_dependencies', 'td');
    $q->addQuery('t.*');
    $q->addWhere('task_id=dependencies_req_task_id and dependencies_task_id=' . (int) $tasks[$i]['task_id']);
    $q->includeCount();
    $q->exec();
    if ($q->foundRows() != 0) {
        $all_fixed = true;
        $latest_end_date = null;
        // store dependencies in an array (for adding more entries on the fly)
        $dependencies = array();
        while ($row = $q->fetchRow()) {
            array_push($dependencies, $row);
        }
        $d = 0;
        while ($d < count($dependencies)) {
            $row = $dependencies[$d];
            $index = search_task($row["task_id"]);
            if ($index == -1) {
                // task is not listed => it's a task group
                // => $i depends on all its subtasks
                // => add all subtasks to the dependencies array
                log_info("- task '" . $row["task_name"] . "' is a task group (processing subtask's dependencies)");
                $children = get_last_children($row);
                // replace this taskgroup with all its subtasks
                array_splice($dependencies, $d, 1, $children);
                continue;
            }
            log_info(" - '" . $tasks[$index]["task_name"] . ($tasks[$index]["fixed"] ? " (FIXED)" : "") . "'");
            // TODO: Detect dependencies loops (A->B, B->C, C->A)
            process_dependencies($index);
            if (!$tasks[$index]["fixed"]) {
                $all_fixed = false;
            } else {
                // ignore dependencies of finished tasks if option is enabled
                if (!$option_advance_if_possible || $tasks[$index]["task_percent_complete"] != 100) {
                    // get latest end_date
                    $end_date = db_dateTime2unix($tasks[$index]["task_end_date"]);
                    if (!$latest_end_date || $end_date > $latest_end_date) {
                        $latest_end_date = $end_date;
                        $dep_on_task = $row;
                    }
                } else {
                    log_info("this task is complete => don't check dependency");
                }
                $d++;
            }
        }
        if ($all_fixed) {
            // this task depends only on fixated tasks
            log_info("all dependencies are fixed");
            fixate_task($i, $latest_end_date, $dep_on_task);
        } else {
            log_error("task has not fixed dependencies");
        }
    } else {
        // task has no dependencies
        log_info("no dependencies => ");
        fixate_task($i, time(), "");
    }
    log_info("</div><br />\n");
}