function _content($params) { $html = ''; $html .= '<p>' . $GLOBALS['Language']->getText('plugin_docman', 'admin_view_instructions') . '</p>'; $html .= '<form action="' . $params['default_url'] . '" method="POST">'; $html .= '<select name="selected_view" onchange="this.form.submit()">'; $sBo =& Docman_SettingsBo::instance($params['group_id']); $actual = $sBo->getView(); $views = Docman_View_Browse::getDefaultViews(); foreach ($views as $view) { $html .= '<option value="' . $view . '" ' . ($actual == $view ? 'selected="selected"' : '') . '>' . $GLOBALS['Language']->getText('plugin_docman', 'view_' . $view) . '</option>'; } $html .= '</select>'; $html .= '<input type="hidden" name="action" value="admin_change_view" />'; $html .= '<noscript><input type="submit" value="' . $GLOBALS['Language']->getText('global', 'btn_submit') . '" /></noscript>'; echo $html; }
public function visitItem(Docman_Item $item) { $type = str_replace('docman_', '', strtolower(get_class($item))); $node = $this->doc->createElement('item'); $node->setAttribute('type', $type); $prop = $this->doc->createElement('properties'); $this->appendChild($prop, 'title', $item->getTitle()); $this->appendChild($prop, 'description', $item->getDescription()); $this->appendChild($prop, 'create_date', date('c', $item->getCreateDate())); $this->appendChild($prop, 'update_date', date('c', $item->getUpdateDate())); $this->appendChild($prop, 'owner', $this->getNormalizedLogin($item->getOwnerId())); $prjSettings = Docman_SettingsBo::instance($item->getGroupId()); if ($prjSettings->getMetadataUsage('status')) { $this->appendChild($prop, 'status', $this->getNormalizedStatus($item->getStatus())); } if ($prjSettings->getMetadataUsage('obsolescence_date') && $item->getObsolescenceDate() != 0) { $this->appendChild($prop, 'obsolescence_date', date('c', $item->getObsolescenceDate())); } $this->appendItemMetadataNode($prop, $item); $node->appendChild($prop); $this->statistics['nb_items']++; return $node; }
/** * Export metadata settings of current project into $dstGroupId * * For metadata that are equivalent (@see Docman_Metadata::equivalent) the * settings are just updated. * For metadata that are equal (@see Docman_Metadata::equal) there is * nothing to do (but for ListOfValues we should have a look on them * though). * For metadata that are missing in this project, they are just created * with the very same settings than the one in the source project (like * clone). * * This function just 'add' things, it's not intend to synchronize two * projects (ie. properties defined in destination project but not in source * project are not deleted). * * @access: public */ function exportMetadata($dstGroupId) { // Import hardcoded metadata prefs $sBo =& Docman_SettingsBo::instance($this->groupId); $sBo->exportMetadataUsage($dstGroupId); // Import metadata $this->_exportMetadata($dstGroupId); }
/** * Export metadata usage into destination project * * For each metadata, if it's used in the current project but not in the * destination one, enable it. * Note: this doesn't disable metadata not in use in the current project but * in use in destination one. * * @access: public */ function exportMetadataUsage($dstGroupId) { $dstBo =& Docman_SettingsBo::instance($dstGroupId); $dstBo->_importMetadataUsage($this, 'obsolescence_date'); $dstBo->_importMetadataUsage($this, 'status'); }
function _getSettingsBo($groupId) { return Docman_SettingsBo::instance($groupId); }
function &_getSettingsBo($groupId) { $sBo =& Docman_SettingsBo::instance($groupId); return $sBo; }
function admin_change_view() { $request =& HTTPRequest::instance(); $group_id = (int) $request->get('group_id'); if ($request->exist('selected_view') && Docman_View_Browse::isViewAllowed($request->get('selected_view'))) { require_once 'Docman_SettingsBo.class.php'; $sBo =& Docman_SettingsBo::instance($group_id); if ($sBo->updateView($request->get('selected_view'))) { $this->_controler->feedback->log('info', $GLOBALS['Language']->getText('plugin_docman', 'info_settings_updated')); } else { $this->_controler->feedback->log('error', $GLOBALS['Language']->getText('plugin_docman', 'error_settings_updated')); } } }
/** * The code to display the columns is now totally dynamic and can display * all the metadata of the project. However it raises 2 problems: * - To be able to fetch all the metadata efficently. We cannot rely on a * code that fetch metadata values for each item individualy. * - To be able to sort on dynamic metadata (values in metadata_value * table). This issue is more complex to handle because we will have to * intoduce metadata_value table in searchItemVersion query and it will * be a lot more complex (On JOIN per metadata to display, ...) * * Today, the customization of the report is not a requirement so I don't * develop the feature. We only provide static metadata to display on table * report. */ function initColumns(&$report, $request) { $settingsBo = Docman_SettingsBo::instance($this->groupId); $useStatus = $settingsBo->getMetadataUsage('status'); if ($useStatus) { $columnsOnReport = array('status', 'title', 'description', 'location', 'owner', 'update_date'); // report with a dynamic field: //$columnsOnReport = array('status', 'title', 'description', 'field_2', 'location', 'owner', 'update_date'); } else { $columnsOnReport = array('title', 'description', 'location', 'owner', 'update_date'); } $keepRefOnUpdateDate = null; $thereIsAsort = false; $colFactory = new Docman_ReportColumnFactory($this->groupId); foreach ($columnsOnReport as $colLabel) { $column = $colFactory->getColumnFromLabel($colLabel); if ($column !== null) { $column->initFromRequest($request); // If no sort, sort on update_date in DESC by default if ($colLabel == 'update_date') { $keepRefOnUpdateDate =& $column; } if ($column->getSort() !== null) { $thereIsAsort = true; } $report->addColumn($column); } unset($column); } if (!$thereIsAsort && $keepRefOnUpdateDate !== null) { $keepRefOnUpdateDate->setSort(PLUGIN_DOCMAN_SORT_DESC); } }
function getViewForCurrentUser($group_id, $report = '') { if ($report != '') { $pref = $report; } else { $pref = user_get_preference(PLUGIN_DOCMAN_VIEW_PREF . '_' . $group_id); if (!$pref) { $sBo =& Docman_SettingsBo::instance($group_id); $pref = $sBo->getView(); } } if (!$pref || !Docman_View_Browse::isViewAllowed($pref)) { $pref = 'Tree'; } return $pref; }