Esempio n. 1
0
 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;
 }
Esempio n. 2
0
    protected static function inputHTML()
    {
        $sql = new SQLStore(wfGetDB(DB_SLAVE));
        $ontologies = $sql->getOntologies();
        $html = <<<END
<form id="export-form" class="export-form" action="" method="post">

<fieldset>
<legend>Export Ontology</legend>

<p>Please select an ontology to export.</p>

<select name="ontology">
<option disabled selected value=""> -- select an ontology -- </option>

END;
        foreach ($ontologies as $ont) {
            $html .= '<option value="';
            $html .= $ont['ontAbbr'];
            $html .= '">';
            $html .= $ont['fullName'] . ' (' . $ont['ontAbbr'] . ')';
            $html .= '</option>';
        }
        $html .= <<<END

</select></br>

<input type="checkbox" value="1" name="downloadOntology" checked>
<label for="download">Save as file</label><br/>

<input type="submit" value="Export" name="exportOntology">
</fieldset>

<fieldset>
<legend>Export Pages as Ontology</legend>

<p>Please enter the titles in the text box below to export corresponding WikiPages as ontology, one title per line.</p>

<textarea name="pages" cols="40" rows="10"></textarea><br/>

<input type="checkbox" value="1" name="downloadTerm" checked>
<label for="download">Save as file</label><br/>

<input type="submit" value="Export" name="exportTerm">
</fieldset>

</form>
END;
        return $html;
    }