Esempio n. 1
0
function prj_breadcrumbs($tid = 0, $pid = 0, $last_label1 = '', $last_label2 = '')
{
    global $_TABLES, $_CONF, $strings;
    $result = DB_query("SELECT tid,name,parent_task,lhs,rhs FROM {$_TABLES['prj_tasks']} WHERE tid={$tid}");
    list($tid, $taskName, $taskParent, $task_lhs, $task_rhs) = DB_fetchArray($result);
    $result = DB_query("SELECT pid, name FROM {$_TABLES['prj_projects']} WHERE pid={$pid}");
    list($pid, $projectName) = DB_fetchArray($result);
    $navbar = new navbar();
    $navbar->openBreadcrumbs();
    $navbar->add_breadcrumbs("{$_CONF['site_url']}/nexproject/index.php", $strings["home"]);
    $navbar->add_breadcrumbs("{$_CONF['site_url']}/nexproject/projects.php", $strings["projects"]);
    if ($pid > 0) {
        $navbar->add_breadcrumbs("{$_CONF['site_url']}/nexproject/viewproject.php?pid={$pid}", $projectName);
    }
    if ($tid > 0) {
        if ($taskParent == 0) {
            $navbar->add_breadcrumbs("{$_CONF['site_url']}/nexproject/viewproject.php?mode=view&id={$tid}", $taskName);
            $navbar->add_lastBreadcrumb($last_label1);
        } else {
            $hierarchy = '';
            // Need to pass 2nd variable as an empty array
            $relatedTasks = implode(',', prj_getTopLevelTask($tid, $hierarchy));
            $result = DB_query("SELECT tid, name,rhs FROM {$_TABLES['prj_tasks']} WHERE tid in ({$relatedTasks})");
            while (list($tid, $taskName, $subtask_rhs) = DB_fetchArray($result)) {
                $navbar->add_breadcrumbs("{$_CONF['site_url']}/nexproject/viewproject.php?mode=view&id={$tid}", $taskName);
            }
            if ($last_label2 != '') {
                $navbar->add_lastBreadcrumb($last_label2);
            } else {
                $navbar->add_lastBreadcrumb($last_label1);
            }
        }
    } else {
        $navbar->add_lastBreadcrumb($last_label1);
    }
    return $navbar->closeBreadcrumbs();
}