예제 #1
0
<?php

require "lib.php";
require $entry_file;
if (function_exists("processTask")) {
    processTask(json_decode($data, true));
}
예제 #2
0
파일: index.php 프로젝트: pmtool/pmtool
    function processTask($taskDepth, $taskList)
    {
        global $taskInst, $max, $toolInst, $sumPercentage, $rows;
        while ($element = current($taskList)) {
            $taskInst->activate($element);
            ?>
<tr class="light" onmouseover="this.style.backgroundColor='#fafafa'" onmouseout="this.style.backgroundColor=''"><?php 
            for ($i = 1; $i < $taskDepth; $i++) {
                echo "<td>&nbsp;&nbsp;&nbsp;</td>";
            }
            $colspan = $max - $taskDepth + 1;
            echo "<td colspan=\"" . $colspan . "\"><nobr><a href=\"javascript:openwindow('" . $toolInst->encodeUrl("index.php?content=taskdetails.php&view=details&taskid=" . $element) . "',width='500',height='500')\" title=\"show details for this task\">" . $taskInst->subject . "</a></nobr></td>\n";
            echo "<td><nobr class=" . $taskInst->getPriorityStyle() . ">" . $taskInst->getPriorityName() . "</nobr></td>\n";
            echo "<td><nobr class=" . $taskInst->getStatusStyle() . ">" . $taskInst->getStatusName() . "</nobr></td>\n";
            echo "<td align=right><nobr>" . $toolInst->formatTime($taskInst->getSummary()) . "</nobr></td>\n";
            echo "<td align=right><nobr>" . $toolInst->getTime("Y-m-d", $taskInst->time) . " - " . $toolInst->getTime("Y-m-d", $taskInst->finish) . "</nobr></td>\n";
            if (!$taskInst->isDone() && $taskInst->statusId != TASK_STATUS_WAITING && $taskInst->finish != 0) {
                $days = $toolInst->numberRound(($taskInst->finish - $toolInst->getTime("U")) / 60 / 60 / 24, 2);
                $percent = $toolInst->numberRound(100 * ($toolInst->getTime("U") - $taskInst->finish) / ($taskInst->finish - $taskInst->time), 2);
                if ($taskInst->finish < $toolInst->getTime("U")) {
                    $percent += 100;
                }
                $sumPercentage += $percent;
                $rows++;
                if ($percent > 100) {
                    // alert: we've exceeded the scheduled finishing time
                    echo "<td align=\"right\" class=\"rmred\">" . $days . "</td>\n";
                    echo "<td align=\"right\" class=\"rmred\">" . $percent . " %</td>\n";
                } elseif ($percent > 80) {
                    // warn: less than 3 days left
                    echo "<td align=\"right\" class=\"rmyellow\">" . $days . "</td>\n";
                    echo "<td align=\"right\" class=\"rmyellow\">" . $percent . " %</td>\n";
                } else {
                    echo "<td align=\"right\" class=\"rmgreen\">" . $days . "</td>\n";
                    echo "<td align=\"right\" class=\"rmgreen\">" . $percent . " %</td>\n";
                }
            } else {
                echo "<td colspan=\"2\" class=\"" . $taskInst->getStatusStyle() . "\">" . $taskInst->getStatusName() . "</td>\n";
            }
            echo "<td width=\"100%\">&nbsp;</td>\n";
            echo "</tr>\n";
            next($taskList);
            $count = $taskDepth;
            processTask(++$count, $taskInst->childs());
        }
    }