Ejemplo n.º 1
0
    $rows = db_numrows($result);
    if ($rows > 0) {
        for ($i = 0; $i < $rows; $i++) {
            /* Deduce summary style */
            $style_begin = '';
            $style_end = '';
            if (db_result($result, $i, 'percent_complete') == 100) {
                $style_begin = '<u>';
                $style_end = '</u>';
            }
            if (db_result($result, $i, 'group_project_id') != $last_group) {
                echo '
				<TR><TD COLSPAN="2"><B><A HREF="/pm/task.php?group_id=' . db_result($result, $i, 'group_id') . '&group_project_id=' . db_result($result, $i, 'group_project_id') . '">' . db_result($result, $i, 'group_name') . ' - ' . db_result($result, $i, 'project_name') . '</A></TD></TR>';
            }
            echo '
			<TR BGCOLOR="' . get_priority_color(db_result($result, $i, 'priority')) . '">
			<TD><A HREF="/pm/task.php?func=detailtask&project_task_id=' . db_result($result, $i, 'project_task_id') . '&group_id=' . db_result($result, $i, 'group_id') . '&group_project_id=' . db_result($result, $i, 'group_project_id') . '">' . sprintf("%06d", db_result($result, $i, 'project_task_id')) . '</A></TD>
			<TD WIDTH="99%">' . $style_begin . stripslashes(db_result($result, $i, 'summary')) . $style_end . '</TD></TR>';
            $last_group = db_result($result, $i, 'group_project_id');
        }
    } else {
        echo '
		<TR><TD COLSPAN="2"><B>You have no open tasks assigned to you.</B></TD></TR>';
        echo db_error();
    }
    /*
    	DEVELOPER SURVEYS
    
    	This needs to be updated manually to display any given survey
    */
    $sql = "SELECT * from survey_responses " . "WHERE survey_id='1' AND user_id='" . user_getid() . "' AND group_id='1'";
Ejemplo n.º 2
0
function show_supportlist($result, $offset, $set = 'open')
{
    global $sys_datefmt, $group_id;
    /*
    	Accepts a result set from the support table. Should include all columns from
    	the table, and it should be joined to USER to get the user_name.
    */
    $url = "/support/?group_id={$group_id}&set={$set}&order=";
    $title_arr = array();
    $title_arr[] = 'Request ID';
    $title_arr[] = 'Summary';
    $title_arr[] = 'Date';
    $title_arr[] = 'Assigned To';
    $title_arr[] = 'Submitted By';
    $links_arr = array();
    $links_arr[] = $url . 'support_id';
    $links_arr[] = $url . 'summary';
    $links_arr[] = $url . 'date';
    $links_arr[] = $url . 'assigned_to_user';
    $links_arr[] = $url . 'submitted_by';
    $IS_SUPPORT_ADMIN = user_ismember($group_id, 'S2');
    echo '
		<FORM ACTION="' . $PHP_SELF . '" METHOD="POST">
		<INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . $group_id . '">
		<INPUT TYPE="HIDDEN" NAME="func" VALUE="postmodsupport">';
    echo html_build_list_table_top($title_arr, $links_arr);
    $then = time() - 1296000;
    $rows = db_numrows($result);
    for ($i = 0; $i < $rows; $i++) {
        echo '
			<TR BGCOLOR="' . get_priority_color(db_result($result, $i, 'priority')) . '">' . '<TD NOWRAP>' . ($IS_SUPPORT_ADMIN ? '<INPUT TYPE="CHECKBOX" NAME="support_id[]" VALUE="' . db_result($result, $i, 'support_id') . '"> ' : '') . sprintf("%06d", db_result($result, $i, 'support_id')) . '</TD>' . '<TD><A HREF="' . $PHP_SELF . '?func=detailsupport&support_id=' . db_result($result, $i, 'support_id') . '&group_id=' . db_result($result, $i, 'group_id') . '">' . db_result($result, $i, 'summary') . '</A></TD>' . '<TD>' . ($set != 'closed' && db_result($result, $i, 'date') < $then ? '<B>* ' : '&nbsp; ') . date($sys_datefmt, db_result($result, $i, 'date')) . '</TD>' . '<TD>' . db_result($result, $i, 'assigned_to_user') . '</TD>' . '<TD>' . db_result($result, $i, 'submitted_by') . '</TD></TR>';
    }
    /*
    	Show extra rows for <-- Prev / Next -->
    */
    echo '
		<TR><TD COLSPAN="2">';
    if ($offset > 0) {
        echo '<A HREF="' . $PHP_SELF . '?func=browse&group_id=' . $group_id . '&set=' . $set . '&offset=' . ($offset - 50) . '"><B><-- Previous 50</B></A>';
    } else {
        echo '&nbsp;';
    }
    echo '</TD><TD>&nbsp;</TD><TD COLSPAN="2">';
    if ($rows >= 50) {
        echo '<A HREF="' . $PHP_SELF . '?func=browse&group_id=' . $group_id . '&set=' . $set . '&offset=' . ($offset + 50) . '"><B>Next 50 --></B></A>';
    } else {
        echo '&nbsp;';
    }
    echo '</TD></TR>';
    /*
            Mass Update Code
    */
    if ($IS_SUPPORT_ADMIN) {
        echo '<TR><TD COLSPAN="5">
                <FONT COLOR="#FF0000"><B>Support Admin:</B></FONT>  If you wish to apply changes to all support tickets selected above, use these controls to change their properties and click once on "Mass Update".
                <TABLE WIDTH="100%" BORDER="0">

                <TR><TD><B>Category:</B><BR>' . support_category_box($group_id, 'support_category_id', 'xyz', 'No Change') . '</TD>
                <TD><B>Priority:</B><BR>';
        echo build_priority_select_box('priority', '5', true);
        echo '</TD></TR>


                <TR><TD><B>Assigned To:</B><BR>' . support_technician_box($group_id, 'assigned_to', 'xyz', 'No Change') . '</TD>
                <TD><B>Status:</B><BR>' . support_status_box('support_status_id', 'xyz', 'No Change') . '</TD></TR>

                <TR><TD COLSPAN="2"><B>Canned Response:</B><BR>' . support_canned_response_box($group_id, 'canned_response') . '</TD></TR>

                <TR><TD COLSPAN="3" ALIGN="MIDDLE"><INPUT TYPE="SUBMIT" name="submit" VALUE="Mass Update"></TD></TR>

                </TABLE>        
		</FORM>
                </TD></TR>';
    }
    echo '</TABLE>';
}
 function _display_artifacts($list_trackers, $print_box_begin)
 {
     $request = HTTPRequest::instance();
     $vItemId = new Valid_UInt('hide_item_id');
     $vItemId->required();
     if ($request->valid($vItemId)) {
         $hide_item_id = $request->get('hide_item_id');
     } else {
         $hide_item_id = null;
     }
     $vArtifact = new Valid_WhiteList('hide_artifact', array(0, 1));
     $vArtifact->required();
     if ($request->valid($vArtifact)) {
         $hide_artifact = $request->get('hide_artifact');
     } else {
         $hide_artifact = null;
     }
     $j = $print_box_begin;
     $html_my_artifacts = "";
     $html = "";
     $html_hdr = "";
     $aid_old = 0;
     $atid_old = 0;
     $group_id_old = 0;
     $count_aids = 0;
     $group_name = "";
     $tracker_name = "";
     $artifact_types = array();
     $pm = ProjectManager::instance();
     while ($trackers_array = db_fetch_array($list_trackers)) {
         $atid = $trackers_array['group_artifact_id'];
         $group_id = $trackers_array['group_id'];
         // {{{ check permissions
         //create group
         $group = $pm->getProject($group_id);
         if (!$group || !is_object($group) || $group->isError()) {
             exit_no_group();
         }
         //Create the ArtifactType object
         if (!isset($artifact_types[$group_id])) {
             $artifact_types[$group_id] = array();
         }
         if (!isset($artifact_types[$group_id][$atid])) {
             $artifact_types[$group_id][$atid] = array();
             $artifact_types[$group_id][$atid]['at'] = new ArtifactType($group, $atid);
             $artifact_types[$group_id][$atid]['user_can_view_at'] = $artifact_types[$group_id][$atid]['at']->userCanView();
             $artifact_types[$group_id][$atid]['user_can_view_summary_or_aid'] = null;
         }
         //Check if user can view artifact
         if ($artifact_types[$group_id][$atid]['user_can_view_at'] && $artifact_types[$group_id][$atid]['user_can_view_summary_or_aid'] !== false) {
             if (is_null($artifact_types[$group_id][$atid]['user_can_view_summary_or_aid'])) {
                 $at = $artifact_types[$group_id][$atid]['at'];
                 //Create ArtifactFieldFactory object
                 if (!isset($artifact_types[$group_id][$atid]['aff'])) {
                     $artifact_types[$group_id][$atid]['aff'] = new ArtifactFieldFactory($at);
                 }
                 $aff = $artifact_types[$group_id][$atid]['aff'];
                 //Retrieve artifact_id field
                 $field = $aff->getFieldFromName('artifact_id');
                 //Check if user can read it
                 $user_can_view_aid = $field->userCanRead($group_id, $atid);
                 //Retrieve percent_complete field
                 $field = $aff->getFieldFromName('percent_complete');
                 //Check if user can read it
                 $user_can_view_percent_complete = $field && $field->userCanRead($group_id, $atid);
                 //Retriebe summary field
                 $field = $aff->getFieldFromName('summary');
                 //Check if user can read it
                 $user_can_view_summary = $field->userCanRead($group_id, $atid);
                 $artifact_types[$group_id][$atid]['user_can_view_summary_or_aid'] = $user_can_view_aid || $user_can_view_summary;
             }
             if ($artifact_types[$group_id][$atid]['user_can_view_summary_or_aid']) {
                 //work on the tracker of the last round if there was one
                 if ($atid != $atid_old && $count_aids != 0) {
                     list($hide_now, $count_diff, $hide_url) = my_hide_url('artifact', $atid_old, $hide_item_id, $count_aids, $hide_artifact);
                     $html_hdr = ($j ? '<tr class="boxitem"><td colspan="3">' : '') . $hide_url . '<A HREF="/tracker/?group_id=' . $group_id_old . '&atid=' . $atid_old . '">' . $group_name . " - " . $tracker_name . '</A>&nbsp;&nbsp;&nbsp;&nbsp;';
                     $count_new = max(0, $count_diff);
                     $html_hdr .= my_item_count($count_aids, $count_new) . '</td></tr>';
                     $html_my_artifacts .= $html_hdr . $html;
                     $count_aids = 0;
                     $html = '';
                     $j++;
                 }
                 if ($count_aids == 0) {
                     //have to call it to get at least the hide_now even if count_aids is false at this point
                     $hide_now = my_hide('artifact', $atid, $hide_item_id, $hide_artifact);
                 }
                 $group_name = $trackers_array['group_name'];
                 $tracker_name = $trackers_array['name'];
                 $aid = $trackers_array['artifact_id'];
                 $summary = $trackers_array['summary'];
                 $atid_old = $atid;
                 $group_id_old = $group_id;
                 // If user is assignee and submitter of an artifact, it will
                 // appears 2 times in the result set.
                 if ($aid != $aid_old) {
                     $count_aids++;
                 }
                 if (!$hide_now && $aid != $aid_old) {
                     // Form the 'Submitted by/Assigned to flag' for marking
                     $AS_flag = my_format_as_flag2($trackers_array['assignee'], $trackers_array['submitter']);
                     //get percent_complete if this field is used in the tracker
                     $percent_complete = '';
                     if ($user_can_view_percent_complete) {
                         $sql = "SELECT afvl.value " . "FROM artifact_field_value afv,artifact_field af, artifact_field_value_list afvl, artifact_field_usage afu " . "WHERE af.field_id = afv.field_id AND af.field_name = 'percent_complete' " . "AND afv.artifact_id = {$aid} " . "AND afvl.group_artifact_id = {$atid} AND af.group_artifact_id = {$atid} " . "AND afu.group_artifact_id = {$atid} AND afu.field_id = af.field_id AND afu.use_it = 1 " . "AND afvl.field_id = af.field_id AND afvl.value_id = afv.valueInt";
                         $res = db_query($sql);
                         if (db_numrows($res) > 0) {
                             $percent_complete = '<TD class="small">' . db_result($res, 0, 'value') . '</TD>';
                         }
                     }
                     $html .= '
                         <TR class="' . get_priority_color($trackers_array['severity']) . '"><TD class="small"><A HREF="/tracker/?func=detail&group_id=' . $group_id . '&aid=' . $aid . '&atid=' . $atid . '">' . $aid . '</A></TD>' . '<TD class="small"' . ($percent_complete ? '>' : ' colspan="2">');
                     if ($user_can_view_summary) {
                         $html .= stripslashes($summary);
                     }
                     $html .= '&nbsp;' . $AS_flag . '</TD>' . $percent_complete . '</TR>';
                 }
                 $aid_old = $aid;
             }
         }
     }
     //work on the tracker of the last round if there was one
     if ($atid_old != 0 && $count_aids != 0) {
         list($hide_now, $count_diff, $hide_url) = my_hide_url('artifact', $atid_old, $hide_item_id, $count_aids, $hide_artifact);
         $html_hdr = ($j ? '<tr class="boxitem"><td colspan="3">' : '') . $hide_url . '<A HREF="/tracker/?group_id=' . $group_id_old . '&atid=' . $atid_old . '">' . $group_name . " - " . $tracker_name . '</A>&nbsp;&nbsp;&nbsp;&nbsp;';
         $count_new = max(0, $count_diff);
         $html_hdr .= my_item_count($count_aids, $count_new) . '</td></tr>';
         $html_my_artifacts .= $html_hdr . $html;
     }
     return $html_my_artifacts;
 }
Ejemplo n.º 4
0
function show_priority_colors_key()
{
    echo '<P><B>Priority Colors:</B><BR>

		<TABLE BORDER=0><TR>';
    for ($i = 1; $i < 10; $i++) {
        echo '
			<TD BGCOLOR="' . get_priority_color($i) . '">' . $i . '</TD>';
    }
    echo '</tr></table>';
}
Ejemplo n.º 5
0
function show_priority_colors_key($msg = '')
{
    global $Language;
    echo '<P class="small"><B>' . ($msg ? $msg : $Language->getText('include_utils', 'prio_colors') . ':') . '</B><BR>

		<TABLE BORDER=0><TR>';
    for ($i = 1; $i < 10; $i++) {
        echo '
			<TD class="' . get_priority_color($i) . '">' . $i . '</TD>';
    }
    echo '</tr></table>';
}
Ejemplo n.º 6
0
 /**
  *  Return the HTML code to display the results of the query fields
  *
  *  @param group_id: the group id
  *  @param prefs: array of parameters used for the current query
  *  @param total_rows: number of rows of the result
  *  @param url: HTTP Get variables to add
  *  @param nolink: link to detailartifact
  *  @param offset,chunksz,morder,advsrch,offset,chunksz: HTTP get variables
  *
  *      @return string
  *
  */
 function showResult($group_id, $prefs, $offset, $total_rows, $url, $nolink, $chunksz, $morder, $advsrch, $chunksz, $aids, $masschange = false, $pv)
 {
     global $PHP_SELF, $Language, $ath;
     $hp = Codendi_HTMLPurifier::instance();
     $html_result = "";
     // Build the list of links to use for column headings
     // Used to trigger sort on that column
     $result_fields = $this->getResultFields();
     $links_arr = array();
     $title_arr = array();
     $width_arr = array();
     $id_arr = array();
     if (count($result_fields) == 0) {
         return;
     }
     reset($result_fields);
     while (list(, $field) = each($result_fields)) {
         if ($pv != 0) {
             $links_arr[] = $url . '&pv=' . (int) $pv . '&order=' . urlencode($field->getName()) . '#results';
         } else {
             $links_arr[] = $url . '&order=' . urlencode($field->getName()) . '#results';
         }
         $title_arr[] = $hp->purify(SimpleSanitizer::unsanitize($field->getLabel()), CODENDI_PURIFIER_CONVERT_HTML);
         $width_arr[$field->getName()] = $field->getColWidth();
         $id_arr[] = $hp->purify($field->getName(), CODENDI_PURIFIER_CONVERT_HTML);
     }
     $query = $this->createQueryReport($prefs, $morder, $advsrch, $offset, $chunksz, $aids);
     $result = $this->getResultQueryReport($query);
     $rows = count($result);
     /*
       Show extra rows for <-- Prev / Next -->
     */
     $nav_bar = '<table width= "100%"><tr>';
     $nav_bar .= '<td width="40%" align ="left">';
     // If all artifacts on screen so no prev/begin pointer at all
     if ($total_rows > $chunksz) {
         if ($offset > 0) {
             $nav_bar .= '<A HREF="' . $url . '&offset=0#results" class="small"><B>&lt;&lt; ' . $Language->getText('global', 'begin') . '</B></A>' . '&nbsp;&nbsp;&nbsp;' . '<A HREF="' . $url . '&offset=' . ($offset - $chunksz) . '#results" class="small"><B>&lt; ' . $Language->getText('global', 'prev') . ' ' . (int) $chunksz . '</B></A></td>';
         } else {
             $nav_bar .= '<span class="disable">&lt;&lt; ' . $Language->getText('global', 'begin') . '&nbsp;&nbsp;&lt; ' . $Language->getText('global', 'prev') . ' ' . (int) $chunksz . '</span>';
         }
     }
     $nav_bar .= '</td>';
     $offset_last = min($offset + $chunksz - 1, $total_rows - 1);
     #display 'Items x - y'  only in normal and printer-version modes
     if ($pv != 2) {
         $nav_bar .= '<td width= "20% " align = "center" class="small">' . $Language->getText('tracker_include_report', 'items') . ' ' . ($offset + 1) . ' - ' . ($offset_last + 1) . "</td>\n";
     }
     $nav_bar .= '<td width="40%" align ="right">';
     // If all artifacts on screen, no next/end pointer at all
     if ($total_rows > $chunksz) {
         if ($offset + $chunksz < $total_rows) {
             $offset_end = $total_rows - $total_rows % $chunksz;
             if ($offset_end == $total_rows) {
                 $offset_end -= $chunksz;
             }
             $nav_bar .= '<A HREF="' . $url . '&offset=' . ($offset + $chunksz) . '#results" class="small"><B>' . $Language->getText('global', 'next') . ' ' . (int) $chunksz . ' &gt;</B></A>' . '&nbsp;&nbsp;&nbsp;' . '<A HREF="' . $url . '&offset=' . $offset_end . '#results" class="small"><B>' . $Language->getText('global', 'end') . ' &gt;&gt;</B></A></td>';
         } else {
             $nav_bar .= '<span class="disable">' . $Language->getText('global', 'next') . ' ' . (int) $chunksz . ' &gt;&nbsp;&nbsp;' . $Language->getText('global', 'end') . ' &gt;&gt;</span>';
         }
     }
     $nav_bar .= '</td>';
     $nav_bar .= "</tr></table>\n";
     $html_result .= $nav_bar;
     if ($masschange) {
         $html_result .= '</form><FORM NAME="artifact_list" action="" METHOD="POST">';
         //TODO: put width here
         $html_result .= html_build_list_table_top($title_arr, $links_arr, true);
     } else {
         $html_result .= '<table width="100%" cellpadding="2" cellspacing="1" border="0">';
         $html_result .= '<thead>';
         $html_result .= '<tr class="boxtable">';
         while ((list(, $title) = each($title_arr)) && (list(, $link) = each($links_arr)) && (list(, $id) = each($id_arr)) && (list(, $width) = each($width_arr))) {
             if ($width) {
                 $width = 'style="width:' . $width . '%"';
             } else {
                 $width = '';
             }
             $html_result .= '<th class="boxtitle" ' . $width . '><a href="' . $link . '" id="' . $id . '">' . $title . '</a></th>';
         }
         $html_result .= '</tr>';
         $html_result .= '</thead>';
     }
     $html_result .= '<tbody>';
     for ($i = 0; $i < $rows; $i++) {
         $html_result .= '<TR class="' . get_priority_color($result[$i]['severity_id']) . '">' . "\n";
         if ($masschange) {
             $html_result .= '<TD align="center"><INPUT TYPE="checkbox" name="mass_change_ids[]" value="' . $result[$i]['artifact_id'] . '"></td>';
         }
         reset($result_fields);
         while (list($key, $field) = each($result_fields)) {
             //echo "$key=".$result[$i][$key]."<br>";
             $value = $result[$i][$key];
             $width = ' class="small"';
             if ($field->isDateField()) {
                 if ($value) {
                     if ($field->getName() == 'last_update_date') {
                         $html_result .= "<TD {$width}>" . format_date("Y-m-d H:i", $value) . '</TD>' . "\n";
                     } else {
                         $html_result .= "<TD {$width}>" . format_date("Y-m-d", $value) . '</TD>' . "\n";
                     }
                 } else {
                     $html_result .= '<TD align="center">-</TD>';
                 }
             } else {
                 if ($field->getName() == 'artifact_id') {
                     if ($nolink) {
                         $html_result .= "<TD {$width}>" . $hp->purify($value, CODENDI_PURIFIER_CONVERT_HTML) . "</TD>\n";
                     } else {
                         $target = $pv == 0 ? "" : " target=blank";
                         $html_result .= "<TD {$width}>" . '<A HREF="/tracker/?func=detail&aid=' . urlencode($value) . '&atid=' . (int) $this->group_artifact_id . '&group_id=' . (int) $group_id . '"' . $target . '>' . $value . '</A></TD>' . "\n";
                     }
                 } else {
                     if ($field->isUsername()) {
                         if ($nolink) {
                             $html_result .= "<TD {$width}>" . util_multi_user_nolink($value) . "</TD>\n";
                         } else {
                             $html_result .= "<TD {$width}>" . util_multi_user_link($value) . "</TD>\n";
                         }
                     } else {
                         if ($field->isFloat()) {
                             $html_result .= "<TD {$width}>" . number_format($value, 2) . '&nbsp;</TD>' . "\n";
                         } else {
                             if ($field->isTextArea()) {
                                 $unsane = util_unconvert_htmlspecialchars($value);
                                 $text = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;", $hp->purify($unsane, CODENDI_PURIFIER_BASIC, $group_id));
                                 $text = str_replace('  ', '&nbsp; ', $text);
                                 $text = str_replace('  ', '&nbsp; ', $text);
                                 $html_result .= '<TD ' . $width . ' style="font-family:monospace; font-size:10pt;">' . $text . '&nbsp;</TD>';
                             } else {
                                 if ($field->getName() == 'status_id') {
                                     $html_result .= "<TD {$width}>";
                                     $html_result .= '<div id="status_id_' . $i . '">';
                                     $html_result .= $hp->purify($value, CODENDI_PURIFIER_BASIC, $group_id);
                                     $html_result .= '</div>';
                                     if ($field->userCanUpdate($group_id, $ath->getId())) {
                                         $field_values = $field->getFieldPredefinedValues($ath->getId(), false, false, true, false);
                                         $array_values = array();
                                         while ($row = db_fetch_array($field_values)) {
                                             $array_values[] = "[" . $row['value_id'] . ", '" . addslashes($row['value']) . "']";
                                         }
                                     }
                                     $html_result .= "</TD>\n";
                                 } else {
                                     $html_result .= "<TD {$width}>" . $hp->purify(util_unconvert_htmlspecialchars($value), CODENDI_PURIFIER_BASIC, $group_id) . '&nbsp;</TD>' . "\n";
                                 }
                             }
                         }
                     }
                 }
             }
         }
         // while
         $html_result .= "</tr>\n";
     }
     $html_result .= '</tbody></table>';
     if ($masschange) {
         $html_result .= '<script language="JavaScript">';
         $html_result .= "\n       <!--\n              function checkAll(val) {\n                  \$\$('input[name=\"mass_change_ids[]\"]').each(function (element) {\n                      element.checked = val;\n                  });\n              }\n       //-->\n       </script>";
         $html_result .= '<INPUT TYPE="HIDDEN" NAME="atid" VALUE="' . (int) $this->group_artifact_id . '">
                       <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . (int) $group_id . '">
                       <INPUT TYPE="HIDDEN" NAME="report_id" VALUE="' . (int) $this->report_id . '">
                       <INPUT TYPE="HIDDEN" NAME="advsrch" VALUE="' . (int) $advsrch . '">
                       <INPUT TYPE="HIDDEN" NAME="func" VALUE="masschange_detail">';
         // get the query
         while (list($field, $value) = each($prefs)) {
             if (is_array($value)) {
                 while (list(, $val) = each($value)) {
                     $html_result .= '<INPUT TYPE="HIDDEN" NAME="' . $hp->purify($field, CODENDI_PURIFIER_CONVERT_HTML) . '[]" VALUE="' . $hp->purify($val, CODENDI_PURIFIER_CONVERT_HTML) . '">';
                 }
             } else {
                 $html_result .= '<INPUT TYPE="HIDDEN" NAME="' . $hp->purify($field, CODENDI_PURIFIER_CONVERT_HTML) . '" VALUE="' . $hp->purify($value, CODENDI_PURIFIER_CONVERT_HTML) . '">';
             }
         }
         #stuff related to mass-change (buttons, check_all_items link, clear_all_items link) should be hidden in printer version
         #as well as table-only view. keep only 'select' column checkboxes
         if ($pv == 0) {
             if ($total_rows > $chunksz) {
                 $html_result .= '<a href="javascript:checkAll(1)">' . $Language->getText('tracker_include_report', 'check_items') . ' ' . ($offset + 1) . '-' . ($offset_last + 1) . '</a>' . ' - <a href="javascript:checkAll(0)">' . $Language->getText('tracker_include_report', 'clear_items') . ' ' . ($offset + 1) . '-' . ($offset_last + 1) . '</a><p>';
                 $html_result .= '<table width= "100%"><tr><td width="50%" align ="center" class="small">';
                 $html_result .= '<INPUT TYPE="SUBMIT" name="submit_btn" VALUE="' . $Language->getText('tracker_masschange_detail', 'selected_items') . '(' . ($offset + 1) . '-' . ($offset_last + 1) . ')">';
                 $html_result .= '</td><td width="50%" align ="center" class="small">';
                 $html_result .= '<INPUT TYPE="SUBMIT" name="submit_btn" VALUE="' . $Language->getText('tracker_include_report', 'mass_change_all', (int) $total_rows) . '">';
             } else {
                 $html_result .= '<a href="javascript:checkAll(1)">' . $Language->getText('tracker_include_report', 'check_all_items') . '</a>' . ' - <a href="javascript:checkAll(0)">' . $Language->getText('tracker_include_report', 'clear_all_items') . ' </a><p>';
                 $html_result .= '<table width= "100%"><tr><td width="60%" align ="center" class="small">';
                 $html_result .= '<INPUT TYPE="SUBMIT" name="submit_btn" VALUE="' . $Language->getText('tracker_masschange_detail', 'selected_items', array(1, (int) $total_rows)) . '">';
             }
         }
         $html_result .= '</td></tr></table>';
     } else {
         $html_result .= $nav_bar;
     }
     return $html_result;
 }
Ejemplo n.º 7
0
function pm_show_tasklist($result, $offset, $set = 'open')
{
    global $sys_datefmt, $group_id, $group_project_id, $PHP_SELF;
    /*
    	Accepts a result set from the bugs table. Should include all columns from
    	the table, and it should be joined to USER to get the user_name.
    */
    $rows = db_numrows($result);
    $url = "/pm/task.php?group_id={$group_id}&group_project_id={$group_project_id}&func=browse&set={$set}&order=";
    $title_arr = array();
    $title_arr[] = 'Task ID';
    $title_arr[] = 'Summary';
    $title_arr[] = 'Start Date';
    $title_arr[] = 'End Date';
    $title_arr[] = 'Percent Complete';
    $links_arr = array();
    $links_arr[] = $url . 'project_task_id';
    $links_arr[] = $url . 'summary';
    $links_arr[] = $url . 'start_date';
    $links_arr[] = $url . 'end_date';
    $links_arr[] = $url . 'percent_complete';
    echo html_build_list_table_top($title_arr, $links_arr);
    $now = time();
    for ($i = 0; $i < $rows; $i++) {
        echo '
			<TR BGCOLOR="' . get_priority_color(db_result($result, $i, 'priority')) . '">' . '<TD><A HREF="' . $PHP_SELF . '?func=detailtask' . '&project_task_id=' . db_result($result, $i, 'project_task_id') . '&group_id=' . $group_id . '&group_project_id=' . db_result($result, $i, 'group_project_id') . '">' . sprintf("%06d", db_result($result, $i, 'project_task_id')) . '</A></TD>' . '<TD>' . db_result($result, $i, 'summary') . '</TD>' . '<TD>' . date('Y-m-d', db_result($result, $i, 'start_date')) . '</TD>' . '<TD>' . ($now > db_result($result, $i, 'end_date') ? '<B>* ' : '&nbsp; ') . date('Y-m-d', db_result($result, $i, 'end_date')) . '</TD>' . '<TD>' . db_result($result, $i, 'percent_complete') . '%</TD></TR>';
    }
    /*
    	Show extra rows for <-- Prev / Next -->
    */
    echo '<TR><TD COLSPAN="2">';
    if ($offset > 0) {
        echo '<A HREF="' . $PHP_SELF . '?func=browse&group_project_id=' . $group_project_id . '&set=' . $set . '&group_id=' . $group_id . '&offset=' . ($offset - 50) . '">
			<B><-- Previous 50</B></A>';
    } else {
        echo '&nbsp;';
    }
    echo '</TD><TD>&nbsp;</TD><TD COLSPAN="2">';
    if ($rows == 50) {
        echo '<A HREF="' . $PHP_SELF . '?func=browse&group_project_id=' . $group_project_id . '&set=' . $set . '&group_id=' . $group_id . '&offset=' . ($offset + 50) . '"><B>Next 50 --></B></A>';
    } else {
        echo '&nbsp;';
    }
    echo '</TD></TR></TABLE>';
}