Esempio n. 1
0
 case 'show_one_user':
     // Prepare params
     $urlParam = '';
     echo '<h2>' . $GLOBALS['Language']->getText('plugin_statistics_show_one_user', 'user_growth') . '</h2>';
     echo '<form name="progress_by_user" method="get" action="?">';
     echo '<input type="hidden" name="func" value="show_one_user" />';
     echo '<label>User: </label>';
     echo '<input type="text" name="user_id" id="plugin_statistics_project" value="' . $userId . '" />';
     echo '<label>Group by:</label>';
     echo html_build_select_box_from_array($groupByDate, 'group_by', $selectedGroupByDate, 1) . '<br />';
     echo '<label>Start: </label>';
     list($timestamp, ) = util_date_to_unixtime($startDate);
     echo html_field_date('start_date', $startDate, false, 10, 10, 'progress_by_user', false) . '&nbsp;<em>' . html_time_ago($timestamp) . '</em><br />';
     echo '<label>End: </label>';
     list($timestamp, ) = util_date_to_unixtime($endDate);
     echo html_field_date('end_date', $endDate, false, 10, 10, 'progress_by_user', false) . '&nbsp;<em>' . html_time_ago($timestamp) . '</em><br />';
     $sel = '';
     if ($relative) {
         $sel = ' checked="checked"';
         $urlParam .= '&relative=true';
     }
     echo '<input type="checkbox" name="relative" value="true" ' . $sel . '/>';
     echo '<label>Relative Y-axis (depend of data set values):</label><br/>';
     echo '<input type="submit" value="' . $GLOBALS['Language']->getText('global', 'btn_submit') . '"/>';
     echo '</form>';
     if ($userId && $startDate && $endDate) {
         echo '<h3>' . $GLOBALS['Language']->getText('plugin_statistics_show_one_user', 'user_detail') . '</h3>';
         $duHtml->getUserDetails($userId);
         $urlParam .= 'start_date=' . $startDate . '&end_date=' . $endDate;
         $urlParam .= '&group_by=' . $selectedGroupByDate;
         $urlParam .= '&user_id=' . $userId;
Esempio n. 2
0
    echo '<h1>' . $title . '</h1>';
    echo '<form name="form_service_usage_stats" method="get">';
    echo '<table>';
    echo '<tr>';
    echo '<td>';
    echo '<b>' . $GLOBALS['Language']->getText('plugin_statistics', 'start_date') . '</b>';
    echo '</td><td>';
    echo '<b>' . $GLOBALS['Language']->getText('plugin_statistics', 'end_date') . '</b>';
    echo '</td>';
    echo '</tr><tr>';
    echo '<td>';
    list($timestamp, ) = util_date_to_unixtime($startDate);
    echo html_field_date('start', $startDate, false, 10, 10, 'form_service_usage_stats', false);
    echo '</td><td>';
    list($timestamp, ) = util_date_to_unixtime($endDate);
    echo html_field_date('end', $endDate, false, 10, 10, 'form_service_usage_stats', false);
    echo '</td>';
    echo '</tr><tr><td>';
    echo '<input type="submit" name="export" value="' . $GLOBALS['Language']->getText('plugin_statistics', 'csv_export_button') . '" >';
    echo '</td>';
    echo '</tr>';
    echo '</table>';
    echo '</form>';
    $GLOBALS['HTML']->footer(array());
}
function exportDiskUsageForDate(Statistics_Services_UsageFormatter $csv_exporter, $date, $column_name)
{
    $disk_usage_manager = new Statistics_DiskUsageManager();
    $disk_usage = $disk_usage_manager->returnTotalSizeOfProjects($date);
    $disk_usage = $csv_exporter->formatSizeInMegaBytes($disk_usage);
    $csv_exporter->buildDatas($disk_usage, $column_name);
 function _getField()
 {
     $labels = array(PLUGIN_DOCMAN_ITEM_VALIDITY_PERMANENT => $GLOBALS['Language']->getText('plugin_docman', 'md_html_validity_permanent'), 3 => $GLOBALS['Language']->getText('plugin_docman', 'md_html_validity_3_months'), 6 => $GLOBALS['Language']->getText('plugin_docman', 'md_html_validity_6_months'), 12 => $GLOBALS['Language']->getText('plugin_docman', 'md_html_validity_12_months'), 100 => $GLOBALS['Language']->getText('plugin_docman', 'md_html_validity_fixed_date'), 200 => $GLOBALS['Language']->getText('plugin_docman', 'md_html_validity_today'));
     $selected = $this->md->getValue();
     $selectedInput = '';
     if ($selected === null) {
         $selected = $this->md->getDefaultValue();
     } else {
         if ($selected != 0) {
             $selectedInput = date("Y-n-j", $selected);
             $selected = 100;
         }
     }
     $name = 'validity';
     $inputname = $this->_getFieldName();
     $field = '';
     $field .= '<select name="' . $name . '" onchange="javascript:change_obsolescence_date(document.forms.' . $this->formParams['form_name'] . ')" id="' . $this->md->getLabel() . '">' . "\n";
     foreach ($labels as $value => $label) {
         $select = '';
         if ($value == $selected) {
             $select = ' selected="selected"';
         }
         $field .= '<option value="' . $value . '"' . $select . '>' . $label . '</option>' . "\n";
     }
     $field .= '</select>' . "\n";
     $field .= '&nbsp;<em>' . $GLOBALS['Language']->getText('plugin_docman', 'md_html_validity_corresp_date') . '</em>';
     $field .= html_field_date($inputname, $selectedInput, false, '10', '10', $this->formParams['form_name'], false);
     return $field;
 }
Esempio n. 4
0
print '<select name="data[]">';
foreach ($allData as $key => $val) {
    $selected = '';
    if (is_array($request->get('data')) && in_array($key, $request->get('data'))) {
        $selected = 'selected';
    }
    print '<option value="' . $key . '"  ' . $selected . '>' . $val . '</option>';
}
print '</select>';
// advanced search form
if (isset($advsrch) && $advsrch == 1) {
    print '<div id="id_advanced_block">';
    print '<label>Start:</label>';
    print html_field_date('start', $startdate, false, 10, 10, 'date_form', false);
    print '<label>End:</label>';
    print html_field_date('end', $enddate, false, 10, 10, 'date_form', false);
    print '<label>Filter:</label>';
    print '<select name="filter" id="id_filter">';
    foreach ($allFilter as $key => $val) {
        $selected = '';
        if ($key == $filter) {
            $selected = 'selected';
        }
        print '<option value="' . $key . '" ' . $selected . '>' . $val . '</option>';
    }
    print '</select>';
    print '(or use <a id="id_link_advanced" href="frequence_stat.php?advsrch=0">Simple Search</a>)';
    print '<input type="hidden" name="advsrch" value="1" id="id_advanced">';
    print '</div>';
} else {
    // simple search form
Esempio n. 5
0
    $GLOBALS['HTML']->header(array('title' => $title));
    echo '<h1>' . $title . '</h1>';
    echo '<form name="form_scm_stats" method="get">';
    echo '<table>';
    echo '<tr>';
    echo '<td>';
    echo '<b>' . $GLOBALS['Language']->getText('plugin_statistics', 'start_date') . '</b>';
    echo '</td><td>';
    echo '<b>' . $GLOBALS['Language']->getText('plugin_statistics', 'end_date') . '</b>';
    echo '</td><td>';
    echo '<b>' . $GLOBALS['Language']->getText('plugin_statistics', 'scm_project_id') . ' <font color="red">*</font></b>';
    echo '</td>';
    echo '</tr><tr>';
    echo '<td>';
    list($timestamp, ) = util_date_to_unixtime($startDate);
    echo html_field_date('start', $startDate, false, 10, 10, 'form_scm_stats', false);
    echo '</td><td>';
    list($timestamp, ) = util_date_to_unixtime($endDate);
    echo html_field_date('end', $endDate, false, 10, 10, 'form_scm_stats', false);
    echo '</td><td>';
    echo '<input id="scm_stats_group_id" name="group_id" >';
    echo '</td><td></tr><tr><td>';
    echo '<input type="submit" name="export" value="' . $GLOBALS['Language']->getText('plugin_statistics', 'csv_export_button') . '" >';
    echo '</td>';
    echo '</tr><tr><td colspan="3">';
    echo '<font color="red"><b>*</b></font> <font size="-2">' . $GLOBALS['Language']->getText('plugin_statistics', 'scm_project_id_info') . '</font>';
    echo '</td></tr>';
    echo '</table>';
    echo '</form>';
    $GLOBALS['HTML']->footer(array());
}
 function displayLogs($offset, $selectedDay = null)
 {
     $dao =& $this->getDao();
     $year = null;
     $month = null;
     $day = null;
     if ($selectedDay !== null) {
         if (preg_match('/^([0-9]+)-([0-9]{1,2})-([0-9]{1,2})$/', $selectedDay, $match)) {
             $year = $match[1];
             $month = $match[2];
             $day = $match[3];
         }
     }
     if ($year === null) {
         //
         // Default dates
         $year = date('Y');
         $month = date('n');
         $day = date('j');
     }
     $start = mktime(0, 0, 0, $month, $day, $year);
     $end = mktime(23, 59, 59, $month, $day, $year);
     $count = 100;
     $dar = $dao->search($start, $end, $offset, $count);
     $foundRows = $dao->getFoundRows();
     //
     // Prepare Navigation bar
     $hrefDay = 'day=' . $year . '-' . $month . '-' . $day;
     $prevHref = '&lt;Previous';
     if ($offset > 0) {
         $prevOffset = $offset - $count;
         if ($prevOffset < 0) {
             $prevOffset = 0;
         }
         $prevHref = '<a href="?' . $hrefDay . '&amp;offset=' . $prevOffset . '">' . $prevHref . '</a>';
     }
     $nextHref = 'Next&gt;';
     $nextOffset = $offset + $count;
     if ($nextOffset > $foundRows) {
         $nextOffset = null;
     } else {
         $nextHref = '<a href="?' . $hrefDay . '&amp;offset=' . $nextOffset . '">' . $nextHref . '</a>';
     }
     //
     // Init previous value
     $pval = array();
     $this->initPval($pval);
     //
     // Start display
     $GLOBALS['Response']->includeCalendarScripts();
     $GLOBALS['Response']->header(array('title' => 'userlog'));
     echo '<form name="userlog_form" method="get" action="?">';
     echo html_field_date('day', $year . '-' . $month . '-' . $day, false, '10', '10', 'userlog_form');
     echo ' ';
     echo '<input type="submit" value="Submit">';
     echo '</form>';
     echo $prevHref . " - (" . $foundRows . " results found)  - " . $nextHref . "<br>";
     echo '<table border="1">';
     echo '<thead>';
     echo '<tr>';
     echo '<th>Time</th>';
     echo '<th>Project</th>';
     echo '<th>User</th>';
     //echo '<th>SessionHash</th>';
     //echo '<th>User Agent</th>';
     echo '<th>Method</th>';
     echo '<th>URI</th>';
     echo '<th>Remote addr</th>';
     echo '<th>Referer</th>';
     echo '</tr>';
     echo '</thead>';
     echo '<tbody>';
     $dar->rewind();
     while ($dar->valid()) {
         $row = $dar->current();
         $classStyle = '';
         if ($pval['hour'] != date('H', $row['time'])) {
             //
             //Change day
             $classStyle = ' class="hourbreak"';
             $year = date('Y', $row['time']);
             $month = date('M', $row['time']);
             $day = date('d', $row['time']);
             $hour = date('H', $row['time']);
             echo '<tr' . $classStyle . '>';
             $nexthour = date('H', mktime($hour + 1, 0, 0, (int) $month, (int) $day, (int) $year));
             echo '<td colspan="9">' . $day . ' ' . $month . ' ' . $year . ' between ' . $hour . ' and ' . $nexthour . ' hour</td>';
             $this->initPval($pval);
             echo '</tr>';
         }
         $classStyle = '';
         echo '<tr' . $classStyle . '>';
         echo '<td>' . $this->displayNewOrIdem('time', $row, $pval, date('H:i:s', $row['time'])) . '</td>';
         echo '<td>' . $this->displayNewOrIdem('group_id', $row, $pval) . '</td>';
         $name = 'Anonymous';
         if ($row['user_id'] != 0) {
             $name = user_getname($row['user_id']);
         }
         echo '<td>' . $this->displayNewOrIdem('user_id', $row, $pval, $name) . '</td>';
         //echo '<td>'.$this->displayNewOrIdem('session_hash', $row, $pval).'</td>';
         //echo '<td>'.$this->displayNewOrIdem('http_user_agent', $row, $pval).'</td>';
         echo '<td>' . $this->displayNewOrIdem('http_request_method', $row, $pval) . '</td>';
         echo '<td>' . $this->displayNewOrIdem('http_request_uri', $row, $pval) . '</td>';
         echo '<td>' . $this->displayNewOrIdem('http_remote_addr', $row, $pval) . '</td>';
         echo '<td>' . $this->displayNewOrIdem('http_referer', $row, $pval) . '</td>';
         echo '</tr>';
         $pval['hour'] = date('H', $row['time']);
         $dar->next();
     }
     echo '</tbody>';
     echo '</table>';
     echo $prevHref . " - (" . $foundRows . " results found)  - " . $nextHref . "<br>";
     $GLOBALS['Response']->footer(array());
 }
 function _valueSelectorHtml($formName)
 {
     $html = '';
     $html .= $GLOBALS['Language']->getText('plugin_docman', 'filters_html_date_start');
     $html .= '&nbsp;';
     $html .= html_field_date($this->filter->getFieldStartValueName(), $this->filter->getValueStart(), false, '10', '10', $formName, false);
     $html .= '&nbsp;';
     $html .= $GLOBALS['Language']->getText('plugin_docman', 'filters_html_date_end');
     $html .= '&nbsp;';
     $html .= html_field_date($this->filter->getFieldEndValueName(), $this->filter->getValueEnd(), false, '10', '10', $formName, false);
     return $html;
 }
Esempio n. 8
0
/**
 * Nicely html-formatted output of this group's audit trail
 *
 * @param Integer $group_id     Id of the project
 * @param Integer $offset       Offset used for pagination
 * @param Integer $limit        Number of events by page
 * @param String  $event        Events category used to filter results
 * @param String  $subEventsBox Event used to filter results
 * @param String  $value        Value used to filter results
 * @param Integer $startDate    Start date used to filter results
 * @param Integer $endDate      End date used to filter results
 * @param String  $by           User name used to filter results
 *
 * @return void
 */
function show_grouphistory($group_id, $offset, $limit, $event = null, $subEventsBox = null, $value = null, $startDate = null, $endDate = null, $by = null)
{
    /*
    show the group_history rows that are relevant to
    this group_id
    */
    global $Language;
    $dao = new ProjectHistoryDao(CodendiDataAccess::instance());
    $history_filter = build_grouphistory_filter($event, $subEventsBox, $value, $startDate, $endDate, $by);
    $res = $dao->groupGetHistory($offset, $limit, $group_id, $history_filter);
    if (isset($subEventsBox)) {
        $subEventsString = implode(",", array_keys($subEventsBox));
        $forwardSubEvents = '&event=' . $event . '&subEventsBox=' . $subEventsString;
    } else {
        $forwardSubEvents = '&event=' . $event;
    }
    echo '
        <H2>' . $Language->getText('project_admin_utils', 'g_change_history') . '</H2>';
    echo '<FORM METHOD="POST" ACTION="?group_id=' . $group_id . '" id="project_history_form" name="project_history_form">';
    echo '<div>';
    echo '<SPAN title="' . $Language->getText('project_admin_utils', 'toggle_search') . '" id="history_search_title" class="' . Toggler::getClassname('history_search_title') . '"><B>' . $Language->getText('project_admin_utils', 'history_search_title') . '</B></SPAN>';
    echo '<TABLE ID="project_history_search">';
    echo '<TH colspan="2" style="text-align:left">' . $Language->getText('project_admin_utils', 'event') . '</TH>
              <TH style="text-align:left">' . $Language->getText('project_admin_utils', 'val') . '</TH>
              <TH style="text-align:left">' . $Language->getText('project_admin_utils', 'from') . '</TH>
              <TH style="text-align:left">' . $Language->getText('project_admin_utils', 'to') . '</TH>
              <TH style="text-align:left">' . $Language->getText('global', 'by') . '</TH>
              <TR VALIGN="TOP"><TD>';
    //Event select Box
    $events = array('any' => $GLOBALS["Language"]->getText('global', 'any'), 'event_permission' => $GLOBALS["Language"]->getText("project_admin_utils", "event_permission"), 'event_project' => $GLOBALS["Language"]->getText("project_admin_utils", "event_project"), 'event_user' => $GLOBALS["Language"]->getText("project_admin_utils", "event_user"), 'event_ug' => $GLOBALS["Language"]->getText("project_admin_utils", "event_ug"), 'event_others' => $GLOBALS["Language"]->getText("project_admin_utils", "event_others"));
    $select = new HTML_Element_Selectbox('', 'events_box', '');
    $select->setId('events_box');
    $select->addMultipleOptions($events, $event);
    echo $select->renderValue();
    //SubEvent select Box
    echo '</TD><TD><select id="sub_events_box" name="sub_events_box[]" multiple>
         <Option value="choose_event" disabled="disabled">' . $GLOBALS['Language']->getText('project_admin_utils', 'choose_event') . '</Option>
         </select>';
    echo '</TD><TD><input type="text" name="value" value="' . $value . '"></TD>
              <TD>';
    echo html_field_date('start', $startDate, false, 10, 10, 'project_history_form', false);
    echo '</TD>
              <TD>';
    echo html_field_date('end', $endDate, false, 10, 10, 'project_history_form', false);
    echo '</TD>
              <TD><input type="text" name="by" id="by" value="' . $by . '"></TD>
              </TR>';
    echo '<TR><TD id="events_array"></TD></TR>';
    echo '<TR><TD><input type="submit" name="filter"></TD></TR>
              </TABLE>';
    echo '</div>';
    echo '<P>';
    if ($res['numrows'] > 0) {
        $title_arr = array();
        $title_arr[] = $Language->getText('project_admin_utils', 'event');
        $title_arr[] = $Language->getText('project_admin_utils', 'val');
        $title_arr[] = $Language->getText('project_admin_utils', 'date');
        $title_arr[] = $Language->getText('global', 'by');
        echo html_build_list_table_top($title_arr);
        $i = 1;
        displayProjectHistoryResults($group_id, $res, false, $i);
        echo '</TABLE>';
        echo '<div style="text-align:center" class="' . util_get_alt_row_color($i++) . '">';
        if ($offset > 0) {
            echo '<a href="?group_id=' . $group_id . '&offset=' . ($offset - $limit) . $forwardSubEvents . '&value=' . $value . '&start=' . $startDate . '&end=' . $endDate . '&by=' . $by . '">[ ' . $Language->getText('project_admin_utils', 'previous') . ' ]</a>';
            echo '&nbsp;';
        }
        if ($offset + $limit < $res['numrows']) {
            echo '&nbsp;';
            echo '<a href="?group_id=' . $group_id . '&offset=' . ($offset + $limit) . $forwardSubEvents . '&value=' . $value . '&start=' . $startDate . '&end=' . $endDate . '&by=' . $by . '">[ ' . $Language->getText('project_admin_utils', 'next') . ' ]</a>';
        }
        echo '</div>';
        echo '<div style="text-align:center" class="' . util_get_alt_row_color($i++) . '">';
        echo $offset + $i - 3 . '/' . $res['numrows'];
        echo '</div>';
        echo '<BR><TABLE align="left"><TR><TD>
                 <input type="submit" name="export" value="' . $GLOBALS['Language']->getText('project_admin_utils', 'export_history') . '">
                 </TD></TR></TABLE></FORM><BR><P>';
    } else {
        echo '<H3>' . $Language->getText('project_admin_utils', 'no_g_change') . '</H3>';
    }
    $translatedEvents = convert_project_history_events(get_history_entries(), false);
    if (isset($subEventsString)) {
        $selectedSubEvents = explode(",", $subEventsString);
        foreach ($selectedSubEvents as $element) {
            $subEventsBox[] = $element;
        }
    }
    $translatedSelectedEvents = convert_project_history_events($subEventsBox, true);
    $js = "options = new Array();\n           options['defaultValueActsAsHint'] = false;\n           new UserAutoCompleter('by', '" . util_get_dir_image_theme() . "', true, options);\n           new ProjectHistory(" . $translatedEvents . ", " . $translatedSelectedEvents . ");";
    $GLOBALS['HTML']->includeFooterJavascriptFile('/scripts/codendi/ProjectHistory.js');
    $GLOBALS['Response']->includeFooterJavascriptSnippet($js);
}