function display($searchResult) { if ($searchResult) { echo "<div id='result' class='search'>"; echo "<b>Suchergebnis - </b>"; echo " <i class='normal'>" . count($searchResult) . " Treffer</i>"; echo form::link("delete", "x", "index.php?action=hidesearch", "close-search"); action::listit("search", $searchResult); foreach ($searchResult as $entry) { $nameArray = thesaurus::get_descriptor($entry[ID]); export::descriptor($nameArray[ID], session::get("search"), "SHOW"); echo "<hr>"; } // set parent if (session::get(show) != 0) { $parent = session::get(show); } else { $parent = system::getval("val_orderdefault"); } // sugest new entry if orderdefault is set or OB is displayed if ($parent) { form::insert_entry(array('parent' => $parent, 'action' => 'add', ""), array(), session::get(search)); } else { echo "<p>Kein Oberbegriff für neuen Begriff gesetzt.</p>"; } echo "</div>"; } else { echo "<div id='result' class='search'>"; echo "<span class='red'>Kein Eintrag gefunden</span>"; echo form::link("delete", "x", "index.php?action=hidesearch", "close-search"); // set parent if (session::get(show) != 0) { $parent = session::get(show); } else { $parent = system::getval("val_orderdefault"); } // sugest new entry if orderdefault is set or OB is displayed if ($parent) { form::insert_entry(array('parent' => $parent, 'action' => 'add', ""), array(), session::get(search)); } else { echo "<p>Kein Oberbegriff für neuen Begriff gesetzt.</p>"; } echo "</div>"; } }
function debug() { if (!system::getval(debug)) { echo form::link("nodebug", "Wartung ein", "index.php?action=debugon", "debugon"); } else { echo form::link("debug", "Wartung aus", "index.php?action=debugoff", "debugoff"); } }
function descriptor($id, $name, $error) { echo "<fieldset><legend>"; //----------------- if (!thesaurus::is_descriptor($id)) { $checkString = ""; echo "kein "; } else { $checkString = " checked"; } echo "Begriff"; if (!thesaurus::is_visible($id)) { echo " <span class='red'>(versteckt)</span>"; } echo "</legend>"; // descriptor value echo form::field("text", "name", $name, 30, "class='{$error}'", "", "", $help = "name-field"); // display ID echo "<span class='small'>ID = {$id}</span>"; // open tree echo form::link("opentree", "[+]", "index.php?action=showhyrarchy&id={$id}", "opentree"); // exit edit mode if (right::write()) { action::edit(); } // delete entry if (thesaurus::child_num($id, 1) == 0) { $javaText = "Wollen Sie " . $name . " wirklich löschen? Es werden auch alle Links zu diesem Eintrag gelöscht"; echo form::link("delete", "x", "javascript:get_confirm("{$javaText}","index.php?action=deleteid&id={$id}");", "delete"); } echo "<br>"; // type of descriptor /* $typeArray = thesaurus::get_type_list(); $entryType = thesaurus::get_entrytype($id); $entryTypeName = thesaurus::get_entrytype_name($entryType); $javaText = "Wollen Sie wirklich allen Unterbegriffen von " . $name . " den Begriffstyp " . $entryTypeName . " zuweisen?"; echo form::selector("entrytype",$typeArray,1,"",$entryType,"<span class='small'>Begriffstype</span><br>","","entrytype"); // herite to all childs echo form::link("inheritance"," Begriffstyp vererben","javascript:get_confirm("$javaText","index.php?id=$id&entrytype=$entryType&action=inherit");","inheritance"); */ echo "<span class='normal'><i>" . thesaurus::get_name(thesaurus::get_thesaurus($id)) . "</i></span>"; echo "<br>"; // status of descriptor $statusArray = thesaurus::get_status_list(); echo form::selector("status", $statusArray, 1, "", thesaurus::get_status($id), "<span class='small'>Status</span><br>", "", "statustype"); echo "<br>"; // descriptor is default value for ordered entries // default place for kandidates defined $orderDefault = system::getval("val_orderdefault"); if ($orderDefault) { if (intval($orderDefault) == $id) { $checkedString = "checked='checked'"; } else { $defaultString = "<br>(derzeit: <i>'"; $defaultString .= "<a href='index.php?id={$orderDefault}&action=show'>"; $defaultString .= thesaurus::get_name($orderDefault); $defaultString .= "</a>"; $defaultString .= "'</i>)"; } } else { $defaultString = "<br>(Kein Ort für Kandidaten festgelegt)"; } echo form::field("checkbox", "orderdefault", $id, "", $checkedString, "", "als Standard für Kandidaten festlegen {$defaultString}", "orderdefault"); echo "</fieldset>"; }
function show() { if (system::getval(debug)) { echo "<div id='login_debug'>"; } else { echo "<div id='login'>"; } if ($userID = session::get("user")) { // change password if ($_GET[action] == "change") { echo "<form method='get' action='index.php'>"; echo form::field("password", "password", "", "", "", "<i>Neues Passort</i>", "", "newpassword"); echo form::field("submit", "b1", "ändern"); echo form::field("hidden", "action", "changedo"); echo "</form>"; } else { echo "<span class='normal'>Angemeldet: </span><span class='red'>" . user::name($userID) . " </span>"; echo form::link("", " - abmelden ", "index.php?action=logout", "logout"); echo form::link("", " - Passwort ändern ", "index.php?action=change", "change-password"); // if su display admin echo form::link("", " - Administration", "admin.php", "admin"); if ($_SESSION['show']) { echo form::link("", " - Import into <b>" . thesaurus::name($_SESSION['show']) . "</b>", "import.php?id=" . $_SESSION['show'], "import"); } // menu switches action::hyrarchy(); // toggle hyrarchy off / on action::descriptor(); action::visible(); action::tooltips(); // toggle tooltips off / on if (right::write()) { action::edit(); } // show edit function action::listit(); action::debug(); } } else { echo "<span class='normal'>"; echo "<form method='get' action='index.php'>"; echo "<i>Benutzername </i><input type='text' name='user' value='{$user}'>"; echo " <i>Passwort </i><input type='password' name='password'>"; echo " <input type='submit' name='action' value='anmelden'>"; echo "<input type='hidden' name='action' value='login'>"; echo "</form>"; echo "</span>"; } // display javascript status /* echo "<span class='small'>"; if (session::get("JS")) echo "JavaScript aktiv"; else echo "kein Javascript"; echo "</span>";*/ echo "</div>"; }
// connect database $daba = new database(); $daba->connect("localhost", "", ""); $daba->select("thesaurus"); // open thesaurus $display = new hyrarchy(); // call actions action($_GET); if (right::link()) { thesaurus::validate(); } // show login or logged user user::show(); //---------------------------------- // headline if (system::getval(debug) and !user::superuser()) { echo "<div id='alert' class='big'>Die Seite steht derzeit wegen Wartungsarbeiten nicht zur Verfügung.</div>"; } else { ?> <div id='header'> <a href='index.php'>OpenThesaurus</a><br> <?php // show count of entries echo " <i class='normal'>("; echo database::count() . " Einträge mit "; echo database::linkcount() . " Verknüpfungen"; echo ")</i>"; ?> </div>