Example #1
0
 /**
  * Looks up an campaign to display.
  */
 public function _handler_view($handler_id, array $args, array &$data)
 {
     $this->_campaign = $this->_master->load_campaign($args[0]);
     $this->_load_datamanager();
     $this->_datamanager->autoset_storage($this->_campaign);
     $this->set_active_leaf('campaign_' . $this->_campaign->id);
     $this->_request_data['campaign'] =& $this->_campaign;
     $this->_request_data['datamanager'] =& $this->_datamanager;
     org_openpsa_widgets_contact::add_head_elements();
     $this->_populate_toolbar();
     $schemadb_message = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_message'));
     foreach ($schemadb_message as $name => $schema) {
         $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "message/create/{$this->_campaign->guid}/{$name}/", MIDCOM_TOOLBAR_LABEL => sprintf($this->_l10n->get('new %s'), $this->_l10n->get($schema->description)), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/' . org_openpsa_directmarketing_viewer::get_messagetype_icon($schema->customdata['org_openpsa_directmarketing_messagetype']), MIDCOM_TOOLBAR_ENABLED => $this->_campaign->can_do('midgard:create')));
     }
     // Populate calendar events for the campaign
     $this->bind_view_to_object($this->_campaign, $this->_datamanager->schema->name);
     midcom::get('metadata')->set_request_metadata($this->_campaign->metadata->revised, $this->_campaign->guid);
     midcom::get('head')->set_pagetitle($this->_campaign->title);
 }