Esempio n. 1
0
 function validate($action = "")
 {
     // check entries with undefined links
     $sqlRef = database::query("SELECT * FROM parent");
     $tempString = "";
     // loop over all link entries
     while ($entry = mysql_fetch_array($sqlRef)) {
         if (!$action) {
             $parentName = thesaurus::get_name($entry[parent]);
             $childName = thesaurus::get_name($entry[child]);
             if (!thesaurus::get_descriptor($entry[parent]) and $entry[parent] != 0) {
                 $tempString .= "Oberbegriff {$entry['parent']} von <b>'{$childName}'</b> <i>({$entry['child']})</i> existiert nicht<br>";
             }
             if (!thesaurus::get_descriptor($entry[child])) {
                 $tempString .= "Unterbegriff {$entry['child']} von <b>'{$parentName}'</b> <i>({$entry['parent']})</i> existiert nicht<br>";
             }
         } else {
             if ((!thesaurus::get_descriptor($entry[parent]) or !thesaurus::get_descriptor($entry[child])) and $entry[parent] != 0) {
                 database::query("DELETE FROM parent WHERE ID={$entry['ID']}");
             }
         }
         // check crosslinks between thesauri
         if (thesaurus::get_thesaurus($entry[parent]) and thesaurus::get_thesaurus($entry[parent]) != thesaurus::get_thesaurus($entry[child])) {
             $crossString .= form::link("", $entry[parent], "index.php?action=show&amp;id={$entry['parent']}") . " <=> " . form::link("", $entry[child], "index.php?action=show&amp;id={$entry['child']}") . " link in different thesauri<br>";
         }
     }
     // display error messages
     if (right::link() and ($tempString or $crossString)) {
         echo "<div id='alert' class='red'>";
         if ($tempString) {
             echo "<b>OB / UB Fehler</b><br>{$tempString}<br>";
             echo "Datenbank bereinigen ";
             echo form::link("delete", "Datenbank bereinigen", "index.php?action=correct", "correct", "");
         }
         // display error message
         if ($crossString) {
             echo "<b>Crosslink Fehler</b><br>{$crossString}<br>";
             //        echo "Datenbank bereinigen ";
             //        echo form::link("delete","Datenbank bereinigen","index.php?action=correct","correct","");
         }
         echo "</div>";
     }
     // rewrite thesaurus links
     $sqlRef = database::query("SELECT * FROM entry");
     while ($entry = mysql_fetch_array($sqlRef)) {
         $tempArray = thesaurus::get_hyrarchy($entry[ID]);
         if (is_array($tempArray)) {
             $thesaurus = $tempArray[0];
         } else {
             $thesaurus = $tempArray;
         }
         database::query("UPDATE entry SET thesaurus='{$thesaurus}' WHERE ID='{$entry['ID']}'");
     }
 }
Esempio n. 2
0
 function descriptor($id, $highlight = "", $view = "")
 {
     echo "<div id='export'>";
     $dataArray = thesaurus::get_descriptor($id);
     $linkArray = thesaurus::get_link($id, session::get(descriptor));
     $separator = FALSE;
     $isDescriptor = thesaurus::is_descriptor($id);
     //------------------------------------------------------------------------------
     // icons for actions
     echo "<p>";
     if ($view) {
         echo "<div id='box'>";
         echo "<table width='100%'><tr>";
         echo "<td>";
         echo form::link("opentree", "[+]", "index.php?action=showhyrarchy&amp;id={$id}", "opentree");
         // open hyrarchy tree
         echo " " . form::link("edit", "edit", "index.php?action=edit&amp;id={$id}", "edit");
         // link icons
         echo " " . form::link("link", "OB", "index.php?linkaction=link&amp;link={$id}&amp;id={$id}&amp;linktype=1", "newlink_1");
         echo " " . form::link("equiv", "BS", "index.php?linkaction=link&amp;link={$id}&amp;id={$id}&amp;linktype=2", "newlink_2");
         echo " " . form::link("assoc", "VB", "index.php?linkaction=link&amp;link={$id}&amp;id={$id}&amp;linktype=3", "newlink_3");
         echo " " . form::link("add", "add", "index.php?action=add&amp;parent={$id}", "add");
         echo "</td>";
         // print tree
         echo "<td>";
         echo " " . form::link("", "txt", "csv.php?id={$id}&amp;type=txt", "csv");
         echo "</td>";
         // print csv
         echo "<td>";
         echo " " . form::link("", "csv", "csv.php?id={$id}&amp;type=csv", "csv");
         echo "</td>";
         echo "<td align='right'>";
         // export Adlib
         echo "<td>";
         echo " " . form::link("", "adlib", "csv.php?id={$id}&amp;type=adlib", "adlib");
         echo "</td>";
         // set link
         $linkType = session::get(linktype);
         $linkIcon = array("", "dolink", "doequiv", "doassoc");
         if (session::get(link) != $id and session::get(link)) {
             echo "mit <b>'" . thesaurus::name(session::get(link)) . "'</b>' verknüpfen";
             echo " " . form::link($linkIcon[$linkType], $linkType, "index.php?linkaction=linkdo&amp;id={$id}", $linkIcon[$linkType]);
             echo " " . form::link("delete", "end", "index.php?linkaction=linkend", "end-linking");
         }
         echo "</td>";
         echo "</tr></table>";
         echo "</div>";
     }
     echo "</p>";
     //------------------------------------------------------------------------------
     // display name
     echo "<p>";
     echo "<span class='exporthead'><b>";
     $tempString = highlight($highlight, $dataArray[name], $isDescriptor);
     echo "<a href='index.php?action=show&amp;id={$id}'>";
     echo $tempString;
     // if javascript -> direkt edit
     if (session::get(JS)) {
     }
     echo grafik::disp("edit", "edit", 15);
     echo "</a>";
     echo "</b>";
     // display status of descriptor
     echo " <i>(" . thesaurus::get_status_name(thesaurus::get_status($id)) . ")</i>";
     // mark if kandidate
     if (!thesaurus::is_visible($id)) {
         echo "<br><span class='red'>versteckt</span>";
     }
     echo "</span>";
     // display type of descriptor
     echo "<br><i>" . thesaurus::get_name(thesaurus::get_thesaurus($id)) . "</i>";
     echo "</p>";
     //------------------------------------------------------------------------------
     // display comment
     echo "<p>";
     if ($dataArray[comment]) {
         echo "<tr><td></td>";
         echo "<td class='export'>";
         echo nl2br(highlight($highlight, $dataArray[comment]));
         echo "</td></tr>";
     }
     echo "</p>";
     //------------------------------------------------------------------------------
     // get link data for descriptor
     $parentArray = $linkArray[parent];
     $childArray = $linkArray[child];
     $assocArray = $linkArray[assoc];
     $equivArray = $linkArray[equiv];
     //------------------------------------------------------------------------------
     // list synonyms
     echo "<table>";
     if ($equivArray) {
         // sort for use and used for
         $x = $y = 0;
         foreach ($equivArray as $entry) {
             if ($entry > 0) {
                 $forArray[$x++] = $entry;
             } else {
                 $retArray[$x++] = abs($entry);
             }
         }
         if ($forArray) {
             echo "<tr><td valign='top'>BS</td>";
             echo "<td class='export'>";
             export::list_names($forArray, $highlight);
             echo "</td></tr>";
         }
         if ($retArray) {
             echo "<tr><td valign='top'>BF</td>";
             echo "<td class='export'>";
             export::list_names($retArray, $highlight);
             echo "</td></tr>";
         }
     }
     echo "</p>";
     //------------------------------------------------------------------------------
     // list parents
     if ($parentArray) {
         echo "<tr><td valign='top'>";
         echo "<a href='javascript:void();'";
         echo help::show("OB", "");
         echo ">OB</a>";
         echo "</td>";
         echo "<td class='export'>";
         export::list_names($parentArray, $highlight);
         echo "</td></tr>";
     }
     //------------------------------------------------------------------------------
     // list childs
     if ($childArray) {
         echo "<tr><td valign='top'>";
         echo "<a href='javascript:void();'";
         echo help::show("UB", "");
         echo ">UB</a>";
         echo "</td>";
         echo "<td class='export'>";
         export::list_names($childArray, $highlight);
         echo "</td></tr>";
     }
     //------------------------------------------------------------------------------
     // list associative links
     if ($assocArray) {
         echo "<tr><td valign='top'>";
         echo "<a href='javascript:void();'";
         echo help::show("VB", "");
         echo ">VB</a>";
         echo "</td>";
         echo "<td class='export'>";
         export::list_names($assocArray, $highlight);
         echo "</td></tr>";
     }
     echo "</table>";
     echo "</div>";
 }
Esempio n. 3
0
 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&amp;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&ouml;schen? Es werden auch alle Links zu diesem Eintrag gel&ouml;scht";
         echo form::link("delete", "x", "javascript:get_confirm(&#34;{$javaText}&#34;,&#34;index.php?action=deleteid&id={$id}&#34;);", "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(&#34;$javaText&#34;,&#34;index.php?id=$id&amp;entrytype=$entryType&amp;action=inherit&#34;);","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}&amp;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>";
 }