<?php if (!isset($_SESSION)) { session_start(); } require 'init_smarty.php'; require 'tmUtils.php'; class gFormVar { public $name = "Recent Task Updates"; public $stylesheet = 'normal.css'; public $pageTitle = 'Project Tracking Database'; } $g = new gFormVar(); DBConnect(); $g->compCols = "Project Name, Task Name, Who, Status, Comment, Modified Date"; $g->compDetails = MakeTable("p.projectname, taskname, u.name, s.status, tc.comment, date_format(tc.createddate,\"%d-%m-%Y\")", "project p, task t, taskcompletion tc, users u, status s", "p.projectid = t.projectid and t.taskid = tc.taskid and t.developerid = u.userid and tc.statusid = s.statusid\r\nand tc.createddate > (current_date() - interval 1 month)\r\nand t.taskid not in (select taskid from taskcompletion where taskid = t.taskid and statusid = 5) and comment != ''", "tc.createddate desc"); if (is_array($g->compDetails)) { $g->updates = 'yes'; } else { $g->updates = 'no'; } $tmpl->assign('g', $g); $tmpl->display('taskupdates.tpl');
#if(!isset($_SESSION)) # session_start(); require 'init_smarty.php'; require 'tmUtils.php'; if ($_SERVER['QUERY_STRING']) { parse_str($_SERVER['QUERY_STRING']); if (isset($user)) { class gFormVar { public $holCols; public $holDetails; } $g = new gFormVar(); DBConnect(); $today = date('Y-m-d'); $g->holCols = "Developer, Start Date, EndDate"; $g->holDetails = MakeTable("name, date_format(startdate,\"%d-%m-%Y\"), date_format(enddate,\"%d-%m-%Y\")", "holiday, users", "holiday.developerid = users.userid and enddate > '{$today}' and developerid = {$user}", "startdate desc"); if (count($g->holDetails) == 0) { echo "No Out of Office weeks found<br>"; } else { $tmpl->assign('g', $g); echo $tmpl->fetch('holtable.tpl'); } } } else { echo "User not set<br>"; } ?>
if ($g->projid >= 1) { $g->statusMessage = "Project Inserted"; $g->formAction = "Update"; } else { $g->statusMessage = "Insert Failed"; } } elseif ($_POST['ProjAction'] == "Update") { $g->post = $_POST; if (UpdateProj($_POST)) { $g->statusMessage = "Project Updated"; $g->formAction = "Update"; } else { $g->statusMessage = "Update Failed"; } } if ($_POST['ProjectID']) { $g->proj = $_POST['ProjectID']; $g->formAction = "Update"; $g->projDetails = $_POST['ProjectID'] . " - " . $_POST['ProjectName']; } if ($_POST['Status']) { $g->status = $_POST['Status']; } } $g->statList = array("L" => "Current", "O" => "Completed"); $g->compCols = "Task, Date Entered, Comment, Estimated Start, Estimated Completion, Status, Who"; $g->compDetails = MakeTable("taskname, date_format(tc.createddate,\"%d-%m-%Y\"), comment, date_format(commencedate,\"%d-%m-%Y\"),\r\n date_format(completiondate,\"%d-%m-%Y\"), status, u.name", "task t, taskcompletion tc, status s, users u", "t.taskid = tc.taskid and projectid = " . $g->proj . " and tc.statusid = s.statusid\r\n and t.developerid = u.userid \r\n and completionid in (select max(completionid) from taskcompletion group by taskid)", "t.taskid"); $g->trAttr = array("class='odd'", "class='even'"); $g->taskRows = count($g->compDetails); $tmpl->assign('g', $g); $tmpl->display('proj.tpl');
if ($userRes) { $g->formAction = "Update"; $g->post = $userRow; $g->taskDetails = $g->taskDetails . " - " . $taskRow['TaskName']; } } } } } if ($_POST['UserAction']) { if ($_POST['UserAction'] == "Insert") { $sts = mysql_query("insert into users (UserName,Name, Team) values('" . $_POST['UserName'] . "','" . $_POST['Name'] . "','" . $_POST['Team'] . "')", $sqlSess); if ($sts) { $g->statusMessage = "New User inserted"; } else { $g->statusMessage = "An error occured inserting the user. " . $sts; } } if ($_POST['UserAction'] == "Update") { $sts = mysql_query("update users set UserName = '******'UserName'] . "', Name = '" . $_POST['Name'] . "', Team = '" . $_POST['Team'] . "' where userid = '" . $_POST['UserID'] . "'", $sqlSess); if ($sts) { $g->statusMessage = "User Updated"; } else { $g->statusMessage = "An error occured updating the user. " . $_POST['UserID'] . $sts; } } } $g->userCols = "ID, User Name, Name"; $g->userList = MakeTable("UserID, UserName, Name, Team", "users", "", "Name"); $tmpl->assign('g', $g); $tmpl->display('newuser.tpl');
$_SESSION['Status'] = $g->status; $_SESSION['CompDate'] = $g->compDate; $_SESSION['StartDate'] = $g->startDate; $_SESSION['Comment'] = $g->comment; $where = ""; if ($g->status > 1) { $where = "statusid > 1"; } //$g->projList=GetProjects(); $g->projList = MakeDropDown("projectid", "projectname", "project", "live='L'", "projectname"); $g->devList = MakeDropDown("userid", "name", "users", null, "name"); $g->statList = MakeDropDown("statusid", "status", "status", $where, "statusid"); if (!isset($g->compDate)) { $g->compDate = date("Y-m-d"); } if (!isset($g->startDate)) { $g->startDate = date("Y-m-d"); } $g->trAttr = array("class='odd'", "class='even'"); //select date_format(createddate,"%d-%m-%Y"), comment, date_format(createddate,"%d-%m-%Y"), status //from taskcompletion, status where taskcompletion.statusid = status.statusid and taskid = 11 if ($g->taskid >= 1) { $g->compCols = "Date Entered, Comment, Estimated Start, Estimated Completion, Status"; $g->compDetails = MakeTable("date_format(createddate,\"%d-%m-%Y\"), comment, date_format(commencedate,\"%d-%m-%Y\"),\r\n date_format(completiondate,\"%d-%m-%Y\"), status", "taskcompletion, status", "taskcompletion.statusid = status.statusid and taskid =" . $g->taskid, "createddate desc"); $g->timeCols = "Year,Month,Time"; $g->timeDetails = MakeTable("year(date), monthname(date), concat (sum(minutes) div 60, ':', lpad(sum(minutes) mod 60,2,0)) hhmm", "time", "taskid=" . $g->taskid, "year(date),month(date)", "year(date), month(date)"); } $g->calendar = MakeCalendar(); $tmpl->registerPlugin("function", "minsToHours", "minsToHours"); $tmpl->assign('g', $g); $tmpl->display('task.tpl');