public static function display($perm, $formName, $title) { $html = ''; $sql = new SQLStore(wfGetDB(DB_SLAVE)); if ($formName == 'edit') { $titleArray = explode(':', $title); $ontAbbr = $titleArray[0]; $termID = str_replace(' ', '_', $titleArray[1]); $magic = $sql->getAnnotationMagicWords($ontAbbr); $ontology = new OntologyData($ontAbbr); $term = $ontology->parseTermByID($termID); $html .= self::printEditForm($perm, $ontAbbr, $term, $magic); wfDebugLog('OntoKiWi', 'OKW\\Display\\FormDisplayPrinter:: display: edit form'); } else { if ($formName == 'create') { $sql = new SQLStore(wfGetDB(DB_SLAVE)); $ontologies = $sql->getOntologies(); $magic = $sql->getAnnotationMagicWords(); $html .= self::printCreateForm($perm, $ontAbbr, $title, $ontologies, $magic); wfDebugLog('OntoKiWi', 'OKW\\Display\\FormDisplayPrinter:: display: create form'); } else { #TODO: Throw Exception } } return $html; }
public static function parse($parser) { $parser->disableCache(); $title = $parser->getTitle()->getText(); $titleArray = explode(':', $title); $ontAbbr = $titleArray[0]; $termID = str_replace(' ', '_', $titleArray[1]); $ontology = new OntologyData($ontAbbr); $term = $ontology->parseTermByID($termID); $params = array(); for ($i = 2; $i < func_num_args(); $i++) { $params[] = func_get_arg($i); } list($options, $valids, $invalids) = self::extractSupClass($params, $ontology); $pathType = $GLOBALS['okwHierarchyConfig']['pathType']; $supClasses = array(); if (!empty($valids)) { foreach ($valids as $index => $value) { $supClasses[] = $value['iri']; $hierarchy = $ontology->parseTermHierarchy($term, $pathType, $value['iri']); if ($value['iri'] == $GLOBALS['okwRDFConfig']['Thing']) { $GLOBALS['okwCache']['hierarchy'][$index] = $hierarchy; } else { foreach ($hierarchy as $path) { if (!empty($path['path'])) { $GLOBALS['okwCache']['hierarchy'][$index] = $hierarchy; } } } } } wfDebugLog('OntoKiWi', sprintf('OKW\\Parser\\HierarchyParser: parsed hierarchy {%s} for [[%s]]', join(';', $supClasses), $title)); wfDebugLog('OntoKiWi', '[caches] OKW\\Parser\\HierarchyParser: hierarchy'); return array('', 'noparse' => true); }
public static function display($title) { $cache = $GLOBALS['okwCache']; $html = ''; $titleArray = explode(':', $title); $ontAbbr = $titleArray[0]; $termID = str_replace(' ', '_', $titleArray[1]); $ontology = new OntologyData($ontAbbr); $term = $ontology->parseTermByID($termID); if (!empty($cache['hierarchy']) || !empty($cache['axiom']['subclassof']) || !empty($cache['axiom']['equivalent'])) { $html .= self::printPageSidebar($ontology, $term, $cache); } if ($ontology->existClass($term->iri) || !empty($cache['annotation'])) { $html .= self::printPageHeader($ontology, $term, $cache); } return DisplayHelper::tidyHTML($html); }