Example #1
0
 /**
  * Add menu items to toolbar
  *
  * @param mixed $handler_id The ID of the handler.
  *
  */
 public function _populate_toolbar($handler_id)
 {
     parent::_populate_toolbar($handler_id);
     if ($this->_topic->can_do('midgard:admin')) {
         $this->_node_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "create", MIDCOM_TOOLBAR_LABEL => sprintf($this->_i18n->get_string('create %s'), 'dataset'), MIDCOM_TOOLBAR_ICON => $this->_config->get('default_new_icon')));
         $this->_node_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "organization/view/all", MIDCOM_TOOLBAR_LABEL => sprintf($this->_i18n->get_string('view %s'), $this->_i18n->get_string('all') . ' ' . $this->_i18n->get_string('organizations')), MIDCOM_TOOLBAR_ICON => $this->_config->get('default_list_icon')));
         $this->_node_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "license/view/all", MIDCOM_TOOLBAR_LABEL => sprintf($this->_i18n->get_string('view %s'), $this->_i18n->get_string('all') . ' ' . $this->_i18n->get_string('licenses')), MIDCOM_TOOLBAR_ICON => $this->_config->get('default_list_icon')));
         $this->_node_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "format/view/all", MIDCOM_TOOLBAR_LABEL => sprintf($this->_i18n->get_string('view %s'), $this->_i18n->get_string('all') . ' ' . $this->_i18n->get_string('formats')), MIDCOM_TOOLBAR_ICON => $this->_config->get('default_list_icon')));
         $this->_node_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "suggestion/view/all", MIDCOM_TOOLBAR_LABEL => sprintf($this->_i18n->get_string('view %s'), $this->_i18n->get_string('all') . ' ' . $this->_i18n->get_string('suggestions')), MIDCOM_TOOLBAR_ICON => $this->_config->get('default_list_icon')));
         if (isset($this->_object->organization)) {
             $organization_guid = fi_opengov_datacatalog_info_dba::get_guid($this->_object->organization);
             if ($organization_guid) {
                 $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "organization/view/" . $organization_guid, MIDCOM_TOOLBAR_LABEL => sprintf($this->_i18n->get_string('view %s'), $this->_i18n->get_string('organization')), MIDCOM_TOOLBAR_ICON => $this->_config->get('default_list_icon')));
             }
         }
         if (isset($this->_object->license)) {
             $license_guid = fi_opengov_datacatalog_info_dba::get_guid($this->_object->license);
             if ($license_guid) {
                 $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "license/view/" . $license_guid, MIDCOM_TOOLBAR_LABEL => sprintf($this->_i18n->get_string('view %s'), $this->_i18n->get_string('license')), MIDCOM_TOOLBAR_ICON => $this->_config->get('default_list_icon')));
             }
         }
         if (isset($this->_object->id)) {
             $formats = fi_opengov_datacatalog_dataset_dba::get_formats($this->_object->id);
             foreach ($formats as $format) {
                 $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "format/view/" . $format->guid, MIDCOM_TOOLBAR_LABEL => sprintf($this->_i18n->get_string('view %s'), $this->_i18n->get_string('format') . ':' . $format->title), MIDCOM_TOOLBAR_ICON => $this->_config->get('default_list_icon')));
             }
         }
     }
 }