Esempio n. 1
0
 static function renderManiphestList($parser, $projectPHID = '')
 {
     $parser->disableCache();
     $tasks = ManiphestListCommand::getTasks($projectPHID);
     $auxdeps = array();
     ManiphestListCommand::findDeps($tasks, $auxdeps);
     $usermap = ManiphestListCommand::getUserMap($tasks);
     $output = ManiphestListRenderer::render($tasks, $usermap, $auxdeps);
     return array($output, 'noparse' => true, 'isHTML' => true);
 }
 static function renderTasks($tasks, $usermap, $auxdeps)
 {
     $output = "";
     foreach ($tasks as $phid => $task) {
         $uri = htmlspecialchars($task["uri"]);
         $deps_ids = array();
         $deps_closed = array();
         foreach ($task['deps'] as $phid) {
             if (isset($tasks[$phid])) {
                 $dt = $tasks[$phid];
                 $deps_ids[$dt['id']] = $dt['uri'];
                 $deps_closed[$dt['id']] = false;
             } else {
                 if (isset($auxdeps[$phid])) {
                     $dt = $auxdeps[$phid];
                     $deps_ids[$dt['id']] = $dt['uri'];
                     $deps_closed[$dt['id']] = $dt['closed'];
                 }
             }
         }
         ksort($deps_ids);
         $deps = "";
         foreach ($deps_ids as $tid => $uri) {
             $depm = sprintf("<a href=\"%s\">%u</a>, ", $uri, $tid);
             if ($deps_closed[$tid]) {
                 $depm = '<strike>' . $depm . '</strike>';
             }
             $deps .= $depm;
         }
         if (substr($deps, -2) == ", ") {
             $deps = substr($deps, 0, -2);
         }
         $owner = isset($usermap[$task["owner"]]) ? $usermap[$task["owner"]] : '';
         if (!empty($owner)) {
             $assigned_to = sprintf("<a href=\"%s\">%s</a>", htmlspecialchars($owner["uri"]), htmlspecialchars($owner["name"]));
         } else {
             $assigned_to = "";
         }
         $output .= sprintf("<tr><td style=\"text-align: center;\">" . "<span style=\"background: %s; color: white; font-weight: bold;\">&nbsp;%s&nbsp;" . "</span></td><th><a href=\"%s\">%u</a></th>" . "<td>%s</td><td><a href=\"%s\">%s</a></td><td>%s</td><td>%s</td></tr>\n", ManiphestListRenderer::fixColor($task["color"]), $task['priority'] === 'Needs Triage' ? '?' : '&nbsp;&nbsp;&nbsp;', $uri, (int) $task["id"], $deps, $uri, htmlspecialchars($task["title"]), $assigned_to, htmlspecialchars(empty($task["points"]) ? '?' : $task['points']));
     }
     return $output;
 }