function buildList($section) { global $files; $output = ""; if ($section) { $tempFiles = $files[$section]; } else { $tempFiles = $files; } foreach ($tempFiles as $key => $value) { if (is_array($value)) { $output .= "<div class=\"section\">"; $output .= "<h2>{$key}</h2>"; $output .= buildList($key); $output .= "</div>"; } else { $value2 = substr($value, 0, -3); $file = urlencode($value); $output .= "<div class=\"item\"><a href=\"debug.php?f={$section}/{$file}\">{$value2}</a></div>"; } } return $output; }
function getUsersNextJobs($shifts, $withinSeconds) { global $user; $ids = array(); foreach (getUpcomingShifts($shifts, $withinSeconds) as $shift) { $ids[] = $shift['SID']; } if (count($ids) === 0) { return 0; } $sql = sprintf("SELECT s.* FROM ShiftEntry se JOIN Shifts s ON s.SID = se.SID WHERE se.UID = '%s' AND se.SID IN ('%s')", $user['UID'], implode("', '", $ids)); $usersShifts = sql_select($sql); return buildList($usersShifts); }
</a></h4> </div> <?php $c++; if ($c === 4) { $c = 0; } if ($c === 0) { ?> </div> <?php } } return $output; } buildList(false); ?> <hr> <footer style="margin-top: 100px"> <div class="row"> <div class="col-lg-12"> <img src="assets/sprites/phaser.png" /> <p>Copyright © <a href="http://www.photonstorm.com">Photon Storm Limited</a> 2015</p> </div> </div> </footer> </div>
public $stylesheet = 'normal.css'; public $pageTitle = 'Project Tracking Database'; } $g = new gFormVar(); DBConnect(); GetPrefs(); parse_str($_SERVER['QUERY_STRING'], $query); if (isset($_COOKIE['userno'])) { $g->devID = $_COOKIE['userno']; if (array_key_exists('date', $query)) { $g->date = $query['date']; } else { $g->date = date("Y-m-d"); } $tl1 = buildList("select t.taskid, taskname, p.projectid, p.projectname, 0 type, t.developerid from task t\r\n left join taskcompletion tc on (t.taskid = tc.taskid\r\n and tc.completionid = (select max(completionid) from taskcompletion where taskid = t.taskid))\r\n left join project p on t.projectid = p.projectid\r\n where t.developerid = " . $g->devID . " and tc.statusid < 5\r\n order by p.projectname, t.taskname"); $tl2 = buildList("select t.taskid, t.taskname, p.projectid, p.projectname, 1 type, t.developerid\r\n from task t, project p where t.projectid = p.projectid and (developerid=0 or developerid = " . $g->devID . ")\r\n and t.tracked='N' order by t.developerid desc, p.projectname, t.taskname"); if ($tl1[0] && $tl2[0]) { $g->taskList = array_merge($tl1, $tl2); } else { if ($tl1[0]) { $g->taskList = $tl1; } else { if ($tl2[0]) { $g->taskList = $tl2; } } } include "timesheetsub.php"; $g->name = $_COOKIE['userfullname']; $g->startHour = $startHour; $g->startMin = $startMin;
<?php $g->timeList = buildList("select tm.timeid, tk.taskname, tm.minutes, tm.date,\r\ndate_format(tm.starttime,'%d-%m-%Y %H:%i') starttime, tk.taskid, tm.description\r\nfrom time tm, task tk\r\nwhere tm.taskid = tk.taskid\r\nand date = '" . $g->date . "'\r\nand tm.developerid = " . $g->devID . " order by tm.starttime"); $g->name = $_COOKIE['userfullname']; if ($g->timeList[0]) { $g->showList = true; } else { $g->showList = false; } $tmpl->registerPlugin("function", "minsToHours", "minsToHours");
} $g->items = 0; $g->projName = ""; if (isset($g->projID)) { if ($sqlSess) { $sql = "select ProjectName from project where projectid = " . $g->projID; $projRes = mysql_query($sql, $sqlSess); if ($projRes) { $projRow = mysql_fetch_array($projRes); if ($projRow) { $g->projName = $projRow['ProjectName']; } $g->filename = $g->projName . "-timesheet.csv"; } } $tl = buildList("select tk.taskname, tm.description,\n date_format(tm.date, '%Y%m') taskMonth, sum(tm.minutes) mins\n from time tm, task tk\n where tm.taskid = tk.taskid\n and tk.projectid = " . $g->projID . " group by taskname, description, taskMonth\n order by taskname, description, taskMonth"); if (!$tl[0]) { $g->statusMessage = $tl[1]; } else { $g->items = count($tl); if ($g->items > 0) { $g->startMon = 300012; $g->endMon = 199501; foreach ($tl as $row) { if ($row['taskMonth'] < $g->startMon) { $g->startMon = $row['taskMonth']; } if ($row['taskMonth'] > $g->endMon) { $g->endMon = $row['taskMonth']; } }