Beispiel #1
0
 /**
  * The handler for listing datasets
  *
  * @param mixed $handler_id the array key from the request array
  * @param array $args the arguments given to the handler
  * @param array &$data The local request data.
  * @return boolean Indicating success.
  */
 function _handler_read($handler_id, $args, &$data)
 {
     $this->_request_data['topic']->require_do('midgard:admin');
     $_MIDCOM->enable_jquery();
     $qb = fi_opengov_datacatalog_dataset_suggestion_dba::new_query_builder();
     switch ($handler_id) {
         case 'suggestion_view':
             if (isset($args[0])) {
                 if ($args[0] != 'all') {
                     $qb->add_constraint('guid', '=', $args[0]);
                 }
             }
             break;
     }
     $this->suggestions = $qb->execute();
     if (count($this->suggestions) == 1) {
         $this->_object = $this->suggestions[0];
     }
     $this->_update_breadcrumb($handler_id);
     $this->_populate_toolbar($handler_id);
     return true;
 }
Beispiel #2
0
 /**
  * Object create callback
  *
  * @param mixed $handler_id The ID of the handler.
  */
 function &dm2_create_callback(&$controller)
 {
     $this->_object = new fi_opengov_datacatalog_dataset_dba();
     $this->_object->organization = array_pop($_POST['fi_opengov_datacatalog_organization_chooser_widget_selections']);
     $this->_object->license = array_pop($_POST['fi_opengov_datacatalog_license_chooser_widget_selections']);
     if (!$this->_object->create()) {
         debug_push_class(__CLASS__, __FUNCTION__);
         debug_print_r('We operated on this object:', $this->_object);
         debug_pop();
         $_MIDCOM->generate_error(MIDCOM_ERRNOTFOUND, 'Failed to create a new dataset, cannot continue. Last Midgard error was: ' . midcom_application::get_error_string());
         // This will exit.
     }
     /* if the dataset is created based on a suggestion then delete the suggestion */
     if (isset($this->_defaults['suggestion'])) {
         $suggestion = new fi_opengov_datacatalog_dataset_suggestion_dba($this->_defaults['suggestion']);
         $suggestion->delete();
     }
     return $this->_object;
 }