Location: PHPKode > projects > NetOffice > netoffice/phases/viewphase.php
<?php // $Revision: 1.16 $
/* vim: set expandtab ts=4 sw=4 sts=4: */

/**
 * $Id: viewphase.php,v 1.16 2004/01/18 20:55:08 madbear Exp $
 * 
 * Copyright (c) 2003 by the NetOffice developers
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

$checkSession = true;
require_once("../includes/library.php");

if ($action == "publish") {
    if ($addToSite == "true") {
        $multi = strstr($id, "**");
        if ($multi != "") {
            $id = str_replace("**", ",", $id);
            $tmpquery1 = "UPDATE " . $tableCollab["tasks"] . " SET published='0' WHERE id IN($id)";
        } else {
            $tmpquery1 = "UPDATE " . $tableCollab["tasks"] . " SET published='0' WHERE id = '$id'";
        } 
        connectSql("$tmpquery1");
        $msg = "addToSite";
        $id = $phase;
    } 

    if ($removeToSite == "true") {
        $multi = strstr($id, "**");
        if ($multi != "") {
            $id = str_replace("**", ",", $id);
            $tmpquery1 = "UPDATE " . $tableCollab["tasks"] . " SET published='1' WHERE id IN($id)";
        } else {
            $tmpquery1 = "UPDATE " . $tableCollab["tasks"] . " SET published='1' WHERE id = '$id'";
        } 
        connectSql("$tmpquery1");
        $msg = "removeToSite";
        $id = $phase;
    } 
    if ($addToSiteFile == "true") {
        $multi = strstr($id, "**");
        if ($multi != "") {
            $id = str_replace("**", ",", $id);
            $tmpquery1 = "UPDATE " . $tableCollab["files"] . " SET published='0' WHERE id IN($id)";
        } else {
            $tmpquery1 = "UPDATE " . $tableCollab["files"] . " SET published='0' WHERE id = '$id'";
        } 
        connectSql("$tmpquery1");
        $msg = "addToSite";
        $id = $phase;
    } 

    if ($removeToSiteFile == "true") {
        $multi = strstr($id, "**");
        if ($multi != "") {
            $id = str_replace("**", ",", $id);
            $tmpquery1 = "UPDATE " . $tableCollab["files"] . " SET published='1' WHERE id IN($id)";
        } else {
            $tmpquery1 = "UPDATE " . $tableCollab["files"] . " SET published='1' WHERE id = '$id'";
        } 
        connectSql("$tmpquery1");
        $msg = "removeToSite";
        $id = $phase;
    } 
} 

require_once("../themes/" . THEME . "/header.php");

$tmpquery = "WHERE pha.id = '$id'";
$phaseDetail = new request();
$phaseDetail->openPhases($tmpquery);
$project = $phaseDetail->pha_project_id[0];
$phase = $phaseDetail->pha_id[0];

$tmpquery = "WHERE pro.id = '$project'";
$projectDetail = new request();
$projectDetail->openProjects($tmpquery);

$teamMember = "false";
$tmpquery = "WHERE tea.project = '$project' AND tea.member = '$idSession'";
$memberTest = new request();
$memberTest->openTeams($tmpquery);
$comptMemberTest = count($memberTest->tea_id);
if ($comptMemberTest == "0") {
    $teamMember = "false";
} else {
    $teamMember = "true";
} 

$blockPage = new block();
$blockPage->openBreadcrumbs();
$blockPage->itemBreadcrumbs($blockPage->buildLink("../projects/listprojects.php?", $strings["projects"], in));
$blockPage->itemBreadcrumbs($blockPage->buildLink("../projects/viewproject.php?id=" . $projectDetail->pro_id[0], $projectDetail->pro_name[0], in));
$blockPage->itemBreadcrumbs($blockPage->buildLink("../phases/listphases.php?id=" . $projectDetail->pro_id[0], $strings["phases"], in));
$blockPage->itemBreadcrumbs($phaseDetail->pha_name[0]);
$blockPage->closeBreadcrumbs();

if ($msg != "") {
    require_once("../includes/messages.php");
    $blockPage->messagebox($msgLabel);
} 

$block1 = new block();
$block1->form = "pppD";
$block1->openForm("../projects/listprojects.php#" . $block1->form . "Anchor");
$block1->headingToggle($strings["phase"] . " : " . $phaseDetail->pha_name[0]);

if ($idSession == $projectDetail->pro_owner[0] || $profilSession == "0" || $profilSession == "5") {
    $block1->openPaletteIcon();
    $block1->paletteIcon(0, "edit", $strings["edit"]);
    $block1->closePaletteIcon();
} 

$block1->openContent();
$block1->contentTitle($strings["details"]);

$block1->contentRow($strings["name"], $phaseDetail->pha_name[0]);
$block1->contentRow($strings["phase_id"], $phaseDetail->pha_id[0]);
$block1->contentRow($strings["status"], $phaseStatus[$phaseDetail->pha_status[0]]);

$parentPhase = $phaseDetail->pha_order_num[0];
$tmpquery = "WHERE tas.project = '$project' AND tas.parent_phase = '$parentPhase'";
$countPhaseTasks = new request();
$countPhaseTasks->openTasks($tmpquery);
$comptlistTasks = count($countPhaseTasks->tas_id);

$comptlistTasksRow = "0";
$comptUncompleteTasks = "0";
for ($k = 0;$k < $comptlistTasks;$k++) {
    if ($countPhaseTasks->tas_status[$k] == "2" || $countPhaseTasks->tas_status[$k] == "3" || $countPhaseTasks->tas_status[$k] == "4") {
        $comptUncompleteTasks = $comptUncompleteTasks + 1;
    } 
} 

$block1->contentRow($strings["total_tasks"], $comptlistTasks);
$block1->contentRow($strings["uncomplete_tasks"], $comptUncompleteTasks);
$block1->contentRow($strings["date_start"], $phaseDetail->pha_date_start[0]);
$block1->contentRow($strings["date_end"], $phaseDetail->pha_date_end[0]);
$block1->contentRow($strings["comments"], nl2br($phaseDetail->pha_comments[0]));

$block1->closeContent();
$block1->closeToggle();
$block1->closeForm();

if ($idSession == $projectDetail->pro_owner[0] || $profilSession == "0" || $profilSession == "5") {
    $block1->openPaletteScript();
    $block1->paletteScript(0, "edit", "../phases/editphase.php?id=$id", "true,true,true", $strings["edit"]);
    $block1->closePaletteScript($comptListPhaese, $listPhases->pha_id);
} 

$block2 = new block();

$block2->form = "saP";
$block2->openForm("../phases/viewphase.php?id=$id#" . $block2->form . "Anchor");

$block2->headingToggle($strings["tasks"]);

$block2->openPaletteIcon();
if ($teamMember == "true" || $profilSession == "5") {
    $block2->paletteIcon(0, "add", $strings["add"]);
    $block2->paletteIcon(1, "remove", $strings["delete"]);
    $block2->paletteIcon(2, "copy", $strings["copy"]); 
    // $block1->paletteIcon(3,"export",$strings["export"]);
    if ($sitePublish == "true") {
        $block2->paletteIcon(4, "add_projectsite", $strings["add_project_site"]);
        $block2->paletteIcon(5, "remove_projectsite", $strings["remove_project_site"]);
    } 
} 

$block2->paletteIcon(6, "info", $strings["view"]);
if ($teamMember == "true" || $profilSession == "5") {
    $block2->paletteIcon(7, "edit", $strings["edit"]);
    $block2->paletteIcon(8, "timelog", $strings["loghours"]);
} 
$block2->closePaletteIcon();

$block2->sorting("tasks", $sortingUser->sor_tasks[0], "tas.name ASC", $sortingFields = array(0 => "tas.id", 1 => "tas.name", 2 => "tas.priority", 3 => "tas.status", 4 => "tas.completion", 5 => "tas.due_date", 6 => "mem.login", 7 => "tas.published"));

$tmpquery = "WHERE tas.project = '$project' AND tas.parent_phase = '$parentPhase' ORDER BY $block2->sortingValue";
$listTasks = new request();
$listTasks->openTasks($tmpquery);
$comptListTasks = count($listTasks->tas_id);

if ($comptListTasks != "0") {
    $block2->openResults();
    $block2->labels($labels = array(0 => $strings["id"],1 => $strings["task"], 2 => $strings["priority"], 3 => $strings["status"], 4 => $strings["completion"], 5 => $strings["due_date"], 6 => $strings["assigned_to"], 7 => $strings["published"]), "true");

    for ($i = 0;$i < $comptListTasks;$i++) {
        if ($listTasks->tas_due_date[$i] == "") {
            $listTasks->tas_due_date[$i] = $strings["none"];
        } 
        $idStatus = $listTasks->tas_status[$i];
        $idPriority = $listTasks->tas_priority[$i];
        $idPublish = $listTasks->tas_published[$i];
        $complValue = ($listTasks->tas_completion[$i] > 0) ? $listTasks->tas_completion[$i] . "0 %": $listTasks->tas_completion[$i] . " %";
        $block2->openRow();
        $block2->checkboxRow($listTasks->tas_id[$i]);

        $block2->cellRow($blockPage->buildLink("../tasks/viewtask.php?id=" . $listTasks->tas_id[$i], $listTasks->tas_id[$i], in));

        if ($idStatus == 1) {
            $block2->cellRow($blockPage->buildLink("../tasks/viewtask.php?id=" . $listTasks->tas_id[$i], $listTasks->tas_name[$i], instrike));
        } else {
            $block2->cellRow($blockPage->buildLink("../tasks/viewtask.php?id=" . $listTasks->tas_id[$i], $listTasks->tas_name[$i], in));
        } 

        $block2->cellRow('<img src="../themes/' . THEME . '/gfx_priority/' . $idPriority . '.gif" alt="' . $priority[$idPriority] . '">&nbsp;' . $priority[$idPriority], '', true);
        $block2->cellRow('<img src="../themes/' . THEME . '/gfx_status/' . $idStatus . '.gif" alt="' . $status[$idStatus] . '">&nbsp;' . $status[$idStatus], '', true);
        $block2->cellRow($complValue);
        if ($listTasks->tas_due_date[$i] <= $date) {
            $block2->cellRow("<b>" . $listTasks->tas_due_date[$i] . "</b>");
        } else {
            $block2->cellRow($listTasks->tas_due_date[$i]);
        } 
        if ($listTasks->tas_start_date[$i] != "--" && $listTasks->tas_due_date[$i] != "--") {
            $gantt = "true";
        } 
        if ($listTasks->tas_assigned_to[$i] == "0") {
            $block2->cellRow($strings["unassigned"]);
        } else {
            $block2->cellRow($blockPage->buildLink($listTasks->tas_mem_email_work[$i], $listTasks->tas_mem_login[$i], mail));
        } 
        echo "</td>";
        if ($sitePublish == "true") {
            $block2->cellRow($statusPublish[$idPublish]);
        } 
        $block2->closeRow();
    } 
    $block2->closeResults();

    if ($activeJpgraph == "true" && $gantt == "true") {
        // show the expanded or compact Gantt Chart
        if ($HTTP_GET_VARS['base'] == 1) {
            echo "<a href='viewphase.php?id=$id&amp;base=0'>expand</a><br>";
        } else {
            echo "<a href='viewphase.php?id=$id&amp;base=1'>compact</a><br>";
        }

        echo "<img src=\"graphtasks.php?project=" . $projectDetail->pro_id[0] . "&amp;phase=" . $phaseDetail->pha_order_num[0] . "&amp;base=" . $HTTP_GET_VARS['base'] . "\" alt=\"\"><br>
<span class=\"listEvenBold\">" . $blockPage->buildLink("http://www.aditus.nu/jpgraph/", "JpGraph", powered) . "</span>";
    } 
} else {
    $block2->noresults();
} 
$block2->closeToggle();
$block2->closeFormResults();

$block2->openPaletteScript();
if ($teamMember == "true" || $profilSession == "5") {
    $block2->paletteScript(0, "add", "../tasks/edittask.php?project=$project&phase=" . $phaseDetail->pha_order_num[0] . "", "true,true,true", $strings["add"]);
    $block2->paletteScript(1, "remove", "../tasks/deletetasks.php?project=$project", "false,true,true", $strings["delete"]);
    $block2->paletteScript(2, "copy", "../tasks/edittask.php?project=$project&cpy=true", "false,true,false", $strings["copy"]);
    // $block1->paletteScript(3,"export","export.php?","false,true,true",$strings["export"]);
    if ($sitePublish == "true") {
        $block2->paletteScript(4, "add_projectsite", "../phases/viewphase.php?addToSite=true&phase=$phase&action=publish", "false,true,true", $strings["add_project_site"]);
        $block2->paletteScript(5, "remove_projectsite", "../phases/viewphase.php?removeToSite=true&phase=$phase&action=publish", "false,true,true", $strings["remove_project_site"]);
    } 
} 
$block2->paletteScript(6, "info", "../tasks/viewtask.php?", "false,true,false", $strings["view"]);
if ($teamMember == "true" || $profilSession == "5") {
    $block2->paletteScript(7, "edit", "../tasks/edittask.php?project=$project&phase=" . $phaseDetail->pha_order_num[0] . "", "false,true,false", $strings["edit"]);
    $block2->paletteScript(8, "timelog", "../tasks/addtasktime.php?project=$project&phase=" . $phaseDetail->pha_order_num[0] . "", "false,true,false", $strings["loghours"]);
} 
$block2->closePaletteScript($comptListTasks, $listTasks->tas_id);

if ($fileManagement == "true") {
    $block3 = new block();

    $block3->form = "tdC";
    $block3->openForm("../phases/viewphase.php?id=$id#" . $block3->form . "Anchor");

    $block3->headingToggle($strings["linked_content"]);

    $block3->openPaletteIcon();
    if ($teamMember == "true" || $profilSession == "5") {
        $block3->paletteIcon(0, "add", $strings["add"]);
        $block3->paletteIcon(1, "remove", $strings["delete"]);
        if ($sitePublish == "true") {
            $block3->paletteIcon(2, "add_projectsite", $strings["add_project_site"]);
            $block3->paletteIcon(3, "remove_projectsite", $strings["remove_project_site"]);
        } 
    } 
    $block3->paletteIcon(4, "info", $strings["view"]);
    if ($teamMember == "true" || $profilSession == "5") {
        $block3->paletteIcon(5, "edit", $strings["edit"]);
    } 
    $block3->closePaletteIcon();

    $block3->sorting("files", $sortingUser->sor_files[0], "fil.name ASC", $sortingFields = array(0 => "fil.extension", 1 => "fil.name", 2 => "fil.date", 3 => "fil.status", 4 => "fil.published"));

    $tmpquery = "WHERE fil.project = '" . $projectDetail->pro_id[0] . "' AND fil.phase = '" . $phaseDetail->pha_id[0] . "' AND fil.task = '0' AND fil.vc_parent = '0' ORDER BY $block3->sortingValue";
    $listFiles = new request();
    $listFiles->openFiles($tmpquery);
    $comptListFiles = count($listFiles->fil_id);

    if ($comptListFiles != "0") {
        $block3->openResults();

        $block3->labels($labels = array(0 => $strings["type"], 1 => $strings["name"], 2 => $strings["date"], 3 => $strings["approval_tracking"], 4 => $strings["published"]), "true");

        require_once("../includes/files_types.php");

        for ($i = 0;$i < $comptListFiles;$i++) {
            $existFile = "false";
            $idStatus = $listFiles->fil_status[$i];
            $idPublish = $listFiles->fil_published[$i];
            $type = file_info_type($listFiles->fil_extension[$i]);
            if (file_exists("../files/" . $listFiles->fil_project[$i] . "/" . $listFiles->fil_name[$i])) {
                $existFile = "true";
            } 
            $block3->openRow();
            $block3->checkboxRow($listFiles->fil_id[$i]);
            if ($existFile == "true") {
                $block3->cellRow($blockPage->buildLink("../linkedcontent/viewfile.php?id=" . $listFiles->fil_id[$i], $type, icone));
            } else {
                $block3->cellRow("&nbsp;");
            } 
            if ($existFile == "true") {
                $block3->cellRow($blockPage->buildLink("../linkedcontent/viewfile.php?id=" . $listFiles->fil_id[$i], $listFiles->fil_name[$i], in));
            } else {
                $block3->cellRow($strings["missing_file"] . " (" . $listFiles->fil_name[$i] . ")");
            } 
            $block3->cellRow($listFiles->fil_date[$i]);
            $block3->cellRow($blockPage->buildLink("../linkedcontent/viewfile.php?id=" . $listFiles->fil_id[$i], $statusFile[$idStatus], in));
            if ($sitePublish == "true") {
                $block3->cellRow($statusPublish[$idPublish]);
            } 
            $block3->closeRow();
        } 
        $block3->closeResults();
    } else {
        $block3->noresults();
    } 
    $block3->closeToggle();
    $block3->closeFormResults();

    $block3->openPaletteScript();
    if ($teamMember == "true" || $profilSession == "5") {
        $block3->paletteScript(0, "add", "../linkedcontent/addfile.php?project=" . $projectDetail->pro_id[0] . "&phase=" . $phaseDetail->pha_id[0] . "", "true,true,true", $strings["add"]);
        $block3->paletteScript(1, "remove", "../linkedcontent/deletefiles.php?project=" . $projectDetail->pro_id[0] . "&phase=" . $phaseDetail->pha_id[0] . "&sendto=phasedetail", "false,true,true", $strings["delete"]);
        if ($sitePublish == "true") {
            $block3->paletteScript(2, "add_projectsite", "../phases/viewphase.php?addToSiteFile=true&phase=" . $phaseDetail->pha_id[0] . "&action=publish", "false,true,true", $strings["add_project_site"]);
            $block3->paletteScript(3, "remove_projectsite", "../phases/viewphase.php?removeToSiteFile=true&phase=" . $phaseDetail->pha_id[0] . "&action=publish", "false,true,true", $strings["remove_project_site"]);
        } 
    } 
    $block3->paletteScript(4, "info", "../linkedcontent/viewfile.php?", "false,true,false", $strings["view"]);
    if ($teamMember == "true" || $profilSession == "5") {
        $block3->paletteScript(5, "edit", "../linkedcontent/viewfile.php?edit=true", "false,true,false", $strings["edit"]);
    } 
    $block3->closePaletteScript($comptListFiles, $listFiles->fil_id);
} 

require_once("../themes/" . THEME . "/footer.php");

?>
Return current item: NetOffice