private function _find_component() { // Figure out the component $dummy = new $this->type(); $midcom_dba_classname = midcom::get('dbclassloader')->get_midcom_class_name_for_mgdschema_object($dummy); if (!$midcom_dba_classname) { throw new midcom_error("Failed to load DBA class for type {$this->type}."); } $component = midcom::get('dbclassloader')->get_component_for_class($midcom_dba_classname); $help_component = $component; if ($component == 'midcom') { $component = 'midgard'; $help_component = 'midgard.admin.asgard'; } $help = new midcom_admin_help_help(); $this->_request_data['help'] = $help->get_help_contents('asgard_' . $this->type, $help_component); $this->_request_data['component'] = $component; }
function read_url_methods($component) { $data = array(); if ($component == 'midcom') { $exec_path = MIDCOM_ROOT . '/midcom/exec'; } else { $component_path = str_replace('.', '/', $component); $exec_path = MIDCOM_ROOT . '/' . $component_path . '/exec'; } if (!is_dir($exec_path) || !is_readable($exec_path)) { // Directory not accessible, skip loading it return $data; } $dir_handle = opendir($exec_path); while (false !== ($file = readdir($dir_handle))) { if (preg_match('/^\\./', $file)) { //Skip hidden files continue; } $data[$file] = array(); $info_id = "urlmethod_" . str_replace('.php', '', $file); $data[$file]['url'] = '/midcom-exec-' . $component . '/' . $file; $data[$file]['description'] = midcom_admin_help_help::get_help_contents($info_id, $component); if (midcom_admin_help_help::help_exists($info_id, $component)) { $data[$file]['handler_help_url'] = $info_id; } } return $data; }