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

/**
 * $Id: editphase.php,v 1.8 2003/12/03 21:30:31 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");

$tmpquery = "WHERE pha.id = '$id'";
$phaseDetail = new request();
$phaseDetail->openPhases($tmpquery);
$project = $phaseDetail->pha_project_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";
} 

if ($action == "update") {
    $c = convertData($c);

    if ($st == 0) {
        $ed = "--";
    } 

    if ($st == 1) {
        $ed = "--";
    } 

    if ($st == 2 && $ed == "--") {
        $ed = date('Y-m-d');
    } 

    $tmpquery = "UPDATE " . $tableCollab["phases"] . " SET status='$st', date_start='$sd', date_end='$ed', comments='$c' WHERE id = '$id'";
    connectSql("$tmpquery");

    if ($st != 1) {
        $tmpquery = "WHERE tas.parent_phase = '$id' AND tas.status = '3'";
        $changeTasks = new request();
        $changeTasks->openTasks($tmpquery);
        $comptchangeTasks = count($changeTasks->tas_id);
        for ($i = 0;$i < $comptchangeTasks;$i++) {
            $taskID = $changeTasks->tas_id[$i];
            $tmpquery = "UPDATE " . $tableCollab["tasks"] . " SET status='4' WHERE id = '$taskID'";
            connectSql("$tmpquery");
        } 
    } 
    header("Location: ../phases/viewphase.php?id=$id");
    exit;
} 

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

$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($phaseDetail->pha_name[0]);
$blockPage->closeBreadcrumbs();

if ($msg != "") {
    require_once("../includes/messages.php");
    $blockPage->messagebox($msgLabel);
} 
// set value in form
$sd = $phaseDetail->pha_date_start[0];

$ed = $phaseDetail->pha_date_end[0];
$c = $phaseDetail->pha_comments[0];

$block1 = new block();
$block1->form = "pdD";
$block1->headingToggle($strings["phase"] . " : " . $phaseDetail->pha_name[0]);
$block1->openContent();
$block1->contentTitle($strings["details"]);
$block1->form = "filedetails";
echo "<a name=\"filedetailsAnchor\"></a>";
echo "<form accept-charset=\"UNKNOWN\" method=\"POST\" action=\"../phases/editphase.php?id=$id&amp;action=update#filedetailsAnchor\" name=\"filedetailsForm\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"100000000\"><input type=\"hidden\" name=\"maxCustom\" value=\"" . $projectDetail->pro_upload_max[0] . "\">";

echo"<tr class=\"odd\"><td valign=\"top\" class=\"leftvalue\">" . $strings["name"] . " :</td><td>" . $phaseDetail->pha_name[0] . "</td></tr>";
echo"<tr class=\"odd\"><td valign=\"top\" class=\"leftvalue\">" . $strings["phase_id"] . " :</td><td>" . $phaseDetail->pha_id[0] . "</td></tr>";

echo"<tr class=\"odd\"><td valign=\"top\" class=\"leftvalue\">" . $strings["status"] . " :</td><td><select name=\"st\">";

$comptSta = count($phaseStatus);

for ($i = 0;$i < $comptSta;$i++) {
    if ($phaseDetail->pha_status[0] == $i) {
        echo "<option value=\"$i\" selected>$phaseStatus[$i]</option>";
    } else {
        echo "<option value=\"$i\">$phaseStatus[$i]</option>";
    } 
} 

echo "</select></td></tr>";

if ($sd == "") {
    $sd = $date;
} 
if ($ed == "") {
    $ed = "--";
} 

$block1->contentRow($strings["date_start"], "<input type=\"text\" style=\"width: 150px;\" name=\"sd\" id=\"sel1\" size=\"20\" value=\"$sd\"><button type=\"reset\" id=\"trigger_a\">...</button><script type=\"text/javascript\">Calendar.setup({ inputField:\"sel1\", button:\"trigger_a\" });</script>");

$block1->contentRow($strings["date_end"], "<input type=\"text\" style=\"width: 150px;\" name=\"ed\" id=\"sel3\" size=\"20\" value=\"$ed\"><button type=\"reset\" id=\"trigger_b\">...</button><script type=\"text/javascript\">Calendar.setup({ inputField:\"sel3\", button:\"trigger_b\" });</script>");

echo"<tr class=\"odd\"><td valign=\"top\" class=\"leftvalue\">" . $strings["comments"] . " :</td><td><textarea rows=\"3\" style=\"width: 400px; height: 100px;\" name=\"c\" cols=\"43\">$c</textarea></td></tr>
<tr class=\"odd\"><td valign=\"top\" class=\"leftvalue\">&nbsp;</td><td><input type=\"SUBMIT\" value=\"" . $strings["save"] . "\"></td></tr>";
$block1->closeContent();
$block1->closeToggle();
$block1->closeForm();

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

?>
Return current item: NetOffice