/** * Helper that populates the toolbar */ private function _populate_toolbar() { if ($this->_salesproject->can_do('midgard:update')) { $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "salesproject/edit/{$this->_salesproject->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('edit'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ACCESSKEY => 'e')); } /*if ($this->_salesproject->can_do('midgard:delete')) { $this->_view_toolbar->add_item(Array( MIDCOM_TOOLBAR_URL => "salesproject/delete/{$this->_salesproject->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('delete'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', )); }*/ if (!empty($this->_request_data['projects_url'])) { $prefix = midcom::get()->get_page_prefix() . $this->_request_data['projects_url']; $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $prefix . "project/{$this->_salesproject->guid}/", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('org.openpsa.projects', 'org.openpsa.projects'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/jump-to.png')); } $relatedto_button_settings = org_openpsa_relatedto_plugin::common_toolbar_buttons_defaults(); $relatedto_button_settings['wikinote']['wikiword'] = str_replace('/', '-', sprintf($this->_l10n->get($this->_config->get('new_wikinote_wikiword_format')), $this->_request_data['salesproject']->title, date('Y-m-d H:i'))); unset($relatedto_button_settings['task']); org_openpsa_relatedto_plugin::common_node_toolbar_buttons($this->_view_toolbar, $this->_request_data['salesproject'], $this->_component, $relatedto_button_settings); $this->bind_view_to_object($this->_salesproject); }
/** * Handle the single event view * * @param String $handler_id Name of the request handler * @param array $args Variable arguments * @param array &$data Public request data, passed by reference */ public function _handler_event($handler_id, array $args, array &$data) { // We're using a popup here midcom::get()->skip_page_style = true; // Get the requested event object $this->_request_data['event'] = new org_openpsa_calendar_event_dba($args[0]); // Muck schema on private events if (!$this->_request_data['event']->can_do('org.openpsa.calendar:read')) { foreach ($this->_datamanager->_schemadb as $schemaname => $schema) { foreach ($this->_datamanager->_schemadb[$schemaname]->fields as $fieldname => $field) { switch ($fieldname) { case 'title': case 'start': case 'end': break; default: $this->_datamanager->_schemadb[$schemaname]->fields[$fieldname]['hidden'] = true; } } } } // Load the event to datamanager if (!$this->_datamanager->autoset_storage($data['event'])) { throw new midcom_error('Failed to load the event in datamanager'); } // Reload parent if needed if (array_key_exists('reload', $_GET)) { midcom::get('head')->add_jsonload('window.opener.location.reload();'); } // Add toolbar items if ($this->_request_data['view'] == 'default') { $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => 'event/edit/' . $this->_request_data['event']->guid . '/', MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('edit'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ENABLED => $data['event']->can_do('midgard:update'), MIDCOM_TOOLBAR_ACCESSKEY => 'e')); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => 'event/delete/' . $this->_request_data['event']->guid . '/', MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('delete'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ENABLED => $data['event']->can_do('midgard:delete'))); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => 'javascript:window.print()', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('print'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/printer.png', MIDCOM_TOOLBAR_OPTIONS => array('rel' => 'directlink'))); $relatedto_button_settings = null; if (midcom::get('auth')->user) { $user = midcom::get('auth')->user->get_storage(); $relatedto_button_settings = array('wikinote' => array('node' => false, 'wikiword' => str_replace('/', '-', sprintf($this->_l10n->get($this->_config->get('wiki_title_skeleton')), $this->_request_data['event']->title, strftime('%x'), $user->name)))); } org_openpsa_relatedto_plugin::common_node_toolbar_buttons($this->_view_toolbar, $this->_request_data['event'], $this->_component, $relatedto_button_settings); } }
private function _prepare_request_data() { org_openpsa_relatedto_plugin::add_header_files(); $object_url = midcom::get('permalinks')->create_permalink($this->_object->guid); if ($object_url) { $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $object_url, MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('back'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_left.png')); } // Load "Create X" buttons for all the related info $relatedto_button_settings = org_openpsa_relatedto_plugin::common_toolbar_buttons_defaults(); $ref = midcom_helper_reflector::get($this->_object); $class_label = $ref->get_class_label(); $object_label = $ref->get_object_label($this->_object); $relatedto_button_settings['wikinote']['wikiword'] = str_replace('/', '-', sprintf(midcom::get('i18n')->get_string('notes for %s %s on %s', 'org.openpsa.relatedto'), $class_label, $object_label, strftime('%x %H:%M'))); org_openpsa_relatedto_plugin::common_node_toolbar_buttons($this->_view_toolbar, $this->_object, $this->_request_data['topic']->component, $relatedto_button_settings); org_openpsa_relatedto_plugin::add_journal_entry_button($this->_view_toolbar, $this->_object->guid); $this->_request_data['object'] =& $this->_object; $this->_request_data['show_title'] = false; if ($this->_mode == 'both' || $this->_mode == 'both-paged') { $this->_request_data['show_title'] = true; } if ($object_url) { $this->add_breadcrumb($object_url, $object_label); } $this->add_breadcrumb("", $this->_l10n->get('view related information')); }