Пример #1
0
 /**
  * Loads some data
  */
 public function _load_object($handler_id, $args, &$data)
 {
     $qb = fi_opengov_datacatalog_info_dba::new_query_builder();
     if ($args[0] != 'all') {
         $qb->add_constraint('guid', '=', $args[0]);
     }
     $qb->add_constraint('type', '=', $this->_request_data['type']);
     $_res = $qb->execute();
     if (count($_res)) {
         if ($args[0] != 'all') {
             $this->_object = $_res[0];
         } else {
             $this->_objects = $_res;
             /* make sure _load_datamanager will not bail out */
             $this->_object = $_res[0];
             echo "<pre>";
             //print_r($this->_objects);
             echo "</pre>";
         }
     } else {
         echo "yes";
         debug_push_class(__CLASS__, __FUNCTION__);
         debug_pop();
         $_MIDCOM->generate_error(MIDCOM_ERRNOTFOUND, 'Failed to read info object (handler: ' . $handler_id . '/' . $args[0] . ')');
         //this will result in HTTP error 404
     }
 }
Пример #2
0
 /**
  * Finds and returns the info's guid
  * @param integer id of the info
  * @return string guid of the info object
  */
 public function get_guid($id = null)
 {
     $guid = null;
     if (isset($id)) {
         $qb = fi_opengov_datacatalog_info_dba::new_query_builder();
         $qb->add_constraint('id', '=', $id);
         $_res = $qb->execute();
         $guid = $_res[0]->guid;
         unset($_res);
         unset($qb);
     }
     return $guid;
 }
Пример #3
0
 /**
  * Displays the datasets delete form
  *
  * @param mixed $handler_id The ID of the handler.
  * @param mixed &$data The local request data.
  */
 public function _show_delete($handler_id, &$data)
 {
     switch ($this->_action) {
         case 'cancel':
             $_MIDCOM->relocate('view/' . $this->_object->guid);
             break;
         case 'delete':
             $_MIDCOM->relocate('');
             break;
         default:
             $this->_request_data['type'] = 'dataset';
             $this->_request_data['dataset'] = $this->_object;
             $this->_request_data['permalink'] = $_MIDCOM->permalinks->create_permalink($this->_object->guid);
             $this->_request_data['organization'] = fi_opengov_datacatalog_info_dba::get_details($this->_object->organization, 'organization');
             $this->_request_data['license'] = fi_opengov_datacatalog_info_dba::get_details($this->_object->license, 'license');
             $this->_request_data['formats'] = fi_opengov_datacatalog_dataset_dba::get_formats($this->_object->id);
             $this->_request_data['class'] = 'odd';
             midcom_show_style('delete');
     }
 }
Пример #4
0
 /**
  * Checks the license type of the dataset
  * @param GUID guid of the dataset
  * @param string type; can be free or non-free
  * @return boolean true, if the dataset license type macthes the given criteria
  */
 public function matching_license_type($dataset_guid, $type)
 {
     $retval = false;
     $qb = fi_opengov_datacatalog_dataset_dba::new_query_builder();
     $qb->add_constraint('guid', '=', $dataset_guid);
     $res = $qb->execute();
     if (count($res) == 1) {
         $qb = fi_opengov_datacatalog_info_dba::new_query_builder();
         $qb->add_constraint('id', '=', $res[0]->license);
         $qb->add_constraint('type', '=', 'license');
         $res = $qb->execute();
         if (count($res) == 1) {
             if ($res[0]->get_parameter('fi.opengov.datacatalog', 'license_type') == $type) {
                 $retval = true;
             }
         }
     }
     unset($qb);
     unset($res);
     return $retval;
 }