/** * @param mixed $handler_id The ID of the handler. * @param Array $args The argument list. * @param Array &$data The local request data. */ public function _handler_view($handler_id, array $args, array &$data) { midcom::get('auth')->require_valid_user(); $qb = org_openpsa_documents_document_dba::new_query_builder(); //check if there is another output-mode wanted if (isset($args[0])) { $this->_output_mode = $args[0]; } if (isset($args[1])) { $current_topic = midcom_db_topic::get_cached($args[1]); } else { $current_topic = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_CONTENTTOPIC); } switch ($this->_output_mode) { case 'xml': $current_component = $current_topic->component; $parent_link = ""; $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX); //check if id of a topic is passed if (isset($_POST['nodeid'])) { $root_topic = new midcom_db_topic((int) $_POST['nodeid']); while ($root_topic->get_parent()->component == $current_component && $root_topic->id != $current_topic->id) { $parent_link = $root_topic->name . "/" . $parent_link; $root_topic = $root_topic->get_parent(); } $root_topic = new midcom_db_topic((int) $_POST['nodeid']); $this->_request_data['parent_link'] = $parent_link; } else { $root_topic = $current_topic; $current_topic = $current_topic->get_parent(); if ($current_topic->get_parent()) { $this->_request_data['parent_directory'] = $current_topic; $parent_link = substr($prefix, 0, strlen($prefix) - (strlen($root_topic->name) + 1)); } $this->_request_data['parent_up_link'] = $parent_link; } //show only documents of the right topic $qb->add_constraint('topic', '=', $root_topic->id); //get needed directories $this->_prepare_directories($root_topic, $current_component); //set header & style for xml midcom::get()->header("Content-type: text/xml; charset=UTF-8"); midcom::get()->skip_page_style = true; break; //html //html default: $qb->add_constraint('orgOpenpsaObtype', '=', ORG_OPENPSA_OBTYPE_DOCUMENT); $qb->add_constraint('topic', '=', $this->_request_data['directory']->id); $this->_prepare_output(); break; } $this->_request_data['current_guid'] = $current_topic->guid; $qb->add_constraint('nextVersion', '=', 0); $qb->add_order('title'); $this->_documents = $qb->execute(); }