/**
  *
  */
 function _getReportSettings($reportId)
 {
     $html = '';
     $um =& UserManager::instance();
     $user = $um->getCurrentUser();
     $dpm =& Docman_PermissionsManager::instance($this->groupId);
     $isAdmin = $dpm->userCanAdmin($user);
     $reportFactory = new Docman_ReportFactory($this->groupId);
     $r = $reportFactory->getReportById($reportId);
     if ($r != null && $r->getGroupId() == $this->groupId) {
         $txts = array($GLOBALS['Language']->getText('plugin_docman', 'report_scope_I'), $GLOBALS['Language']->getText('plugin_docman', 'report_scope_P'));
         $vals = array('I', 'P');
         $html .= '<p>' . $GLOBALS['Language']->getText('plugin_docman', 'report_settings_report_info') . '</p>';
         $html .= '<form name="docman_report_update" method="post" action="?" class="docman_form">';
         $html .= '<input type="hidden" name="group_id" value="' . $this->groupId . '">';
         $html .= '<input type="hidden" name="action" value="report_upd">';
         $html .= '<input type="hidden" name="report_id" value="' . $r->getId() . '">';
         $html .= '<table>';
         // Scope
         if ($dpm->userCanAdmin($user)) {
             $html .= '<tr>';
             $html .= '<td>' . $GLOBALS['Language']->getText('plugin_docman', 'report_settings_report_scope') . '</td>';
             $html .= '<td>';
             $html .= html_build_select_box_from_arrays($vals, $txts, 'scope', $r->getScope(), false);
             $html .= '</td>';
             $html .= '</tr>';
         }
         // Description
         $html .= '<tr>';
         $html .= '<td>' . $GLOBALS['Language']->getText('plugin_docman', 'report_settings_report_description') . '</td>';
         $html .= '<td>';
         $html .= '<textarea name="description">' . $r->getDescription() . '</textarea>';
         $html .= '</td>';
         $html .= '</tr>';
         // Title
         $title = "";
         if ($r->getTitle() !== null) {
             $title = $r->getTitle();
         }
         $html .= '<tr>';
         $html .= '<td>' . $GLOBALS['Language']->getText('plugin_docman', 'report_settings_report_title') . '</td>';
         $html .= '<td>';
         $html .= '<input type="text" name="title" value="' . $title . '" class="text_field" />';
         $html .= '</td>';
         $html .= '</tr>';
         // Image
         $image = "";
         if ($r->getImage() !== null) {
             $image = $r->getImage();
         }
         $html .= '<tr>';
         $html .= '<td>' . $GLOBALS['Language']->getText('plugin_docman', 'report_settings_report_image') . '</td>';
         $html .= '<td>';
         $html .= '<input type="text" name="image" value="' . $image . '" />';
         $html .= ' ' . $GLOBALS['Language']->getText('plugin_docman', 'report_settings_report_image_help');
         $html .= '</td>';
         $html .= '</tr>';
         // Current image
         $html .= '<tr>';
         $html .= '<td>';
         $html .= $GLOBALS['Language']->getText('plugin_docman', 'report_settings_report_image_current');
         $html .= '</td>';
         $reportHtml = new Docman_ReportHtml($r, $this, $this->defaultUrl);
         $html .= '<td>';
         $html .= $reportHtml->getReportImage();
         $html .= '</td>';
         $html .= '</tr>';
         // Submit
         $html .= '<tr>';
         $html .= '<td colspan="2">';
         $html .= '<input type="submit" name="sub" value="' . $GLOBALS['Language']->getText('global', 'btn_update') . '">';
         $html .= '</td>';
         $html .= '</tr>';
         $html .= '</table>';
         $html .= '</form>';
     }
     return $html;
 }
 /**
  * @access: protected
  */
 function _content($params)
 {
     $itemFactory = new Docman_ItemFactory($params['group_id']);
     // Limit browsing
     $offset = 25;
     $_low_limit = 0;
     if (isset($params['start'])) {
         $_low_limit = (int) $params['start'];
     }
     $_high_limit = $_low_limit + $offset;
     $nbItemsFound = 0;
     $itemIterator =& $itemFactory->getItemList($params['item']->getId(), $nbItemsFound, array('user' => $params['user'], 'ignore_collapse' => true, 'ignore_obsolete' => true, 'filter' => $params['filter'], 'start' => $_low_limit, 'offset' => $offset));
     // Default URL
     $this->_getDefaultUrlParams($params);
     $baseUrl = $this->buildActionUrl($params, array_merge($this->dfltParams, $this->dfltSearchParams));
     // Generate table header
     $ci = $params['filter']->getColumnIterator();
     $ci->rewind();
     while ($ci->valid()) {
         $column = $ci->current();
         $columnsTitles[] = $column->getTitle($this, $params);
         $ci->next();
     }
     $table = html_build_list_table_top($columnsTitles);
     // Generate table
     $altRowClass = 0;
     $itemIterator->rewind();
     while ($itemIterator->valid()) {
         $item =& $itemIterator->current();
         $trclass = html_get_alt_row_color($altRowClass++);
         $table .= "<tr class=\"" . $trclass . "\">\n";
         $ci->rewind();
         while ($ci->valid()) {
             $column = $ci->current();
             $table .= "<td>";
             $table .= $column->getTableBox($item, $this, $params);
             $this->javascript .= $column->getJavascript($item, $this);
             $table .= "</td>\n";
             $ci->next();
         }
         $table .= "</tr>\n";
         $itemIterator->next();
     }
     $table .= "</table>\n";
     // Prepare Navigation Bar
     if ($_low_limit > 0) {
         $firstUrl = $this->_buildSearchUrl($params, array('start' => '0'));
         $first = '<a href="' . $firstUrl . '">&lt;&lt; ' . $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_begin') . '</a>';
     } else {
         $first = '&lt;&lt; ' . $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_begin');
     }
     $previousOffset = $_low_limit - $offset;
     if ($_low_limit > 0) {
         if ($previousOffset < 0) {
             $previousOffset = 0;
         }
         $previousUrl = $this->_buildSearchUrl($params, array('start' => $previousOffset));
         $previous = '<a href="' . $previousUrl . '">&lt; ' . $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_previous', $offset) . '&gt;</a>';
     } else {
         $previous = '&lt; ' . $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_previous', $offset);
     }
     if ($_high_limit < $nbItemsFound) {
         $nextUrl = $this->_buildSearchUrl($params, array('start' => $_high_limit));
         $next = '<a href="' . $nextUrl . '">' . $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_next', $offset) . ' &gt;</a>';
     } else {
         $next = $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_next', $offset) . ' &gt;';
     }
     if ($_high_limit < $nbItemsFound) {
         $lastOffset = $nbItemsFound - $offset;
         $lastUrl = $this->_buildSearchUrl($params, array('start' => $lastOffset));
         $last = '<a href="' . $lastUrl . '">' . $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_end') . ' &gt;&gt;</a>';
     } else {
         $last = $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_end') . ' &gt;&gt;';
     }
     $navbar = '<table border="0" width="100%"><tr><td align="left">' . $first . ' ' . $previous . '</td><td align="center">' . $nbItemsFound . ' ' . $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_docfound') . '</td><td align="right">' . $next . ' ' . $last . '</td></tr></table>';
     if (isset($params['filter']) && $params['filter'] !== null) {
         $htmlReport = new Docman_ReportHtml($params['filter'], $this, $params['default_url']);
         print $htmlReport->getReportCustomization($params);
     }
     print $navbar;
     print $table;
 }
 /**
  * @access: protected
  */
 function _filter($params)
 {
     $html = '';
     // No filter in printer version
     if (isset($params['pv']) && $params['pv'] > 0) {
         return;
     }
     $html .= "<!-- Filters -->\n";
     $html .= '<div class="docman_filters">';
     if (isset($params['filter']) && $params['filter'] !== null) {
         $htmlReport = new Docman_ReportHtml($params['filter'], $this, $params['default_url']);
         $html .= $htmlReport->toHtml($params);
     }
     $html .= "</div>\n";
     echo $html;
 }