コード例 #1
0
ファイル: output.php プロジェクト: nibble-arts/openthesaurus
 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>";
 }
コード例 #2
0
 function get_child($deskriptorID)
 {
     $visible = session::get(visible);
     $descType = session::get(descriptor);
     //    if ($visible) $visibleString = " and entry.status=statustype.ID and statustype.visible='1'";
     $queryString = "SELECT parent.child \r\n    \tFROM entry,parent,linktype,statustype \r\n    \tWHERE entry.ID={$deskriptorID} \r\n    \t\tand parent.parent=entry.ID \r\n    \t\tand parent.type=linktype.ID and linktype.hyrarchic='1'\r\n    \t\t{$visibleString}\r\n        ";
     //echoalert($queryString);
     $tempArray = fetch_to_array(database::query($queryString), "child");
     // order by entry names
     if ($tempArray) {
         foreach ($tempArray as $entry) {
             // is descriptor
             // or is non-descriptor with children
             $cntChild = mysql_num_rows(database::query("SELECT * FROM entry,parent,linktype WHERE entry.ID='{$entry}' and entry.ID=parent.parent and parent.type=linktype.ID and linktype.hyrarchic='1'"));
             if (thesaurus::is_descriptor($entry) or $visible and !thesaurus::is_visible($entry) or $descType and thesaurus::is_equivalent($entry) or $cntChild) {
                 $orderArray[$entry] = strtolower(thesaurus::get_name($entry));
                 // array lowercase for sorting
                 asort($orderArray);
             }
         }
         // rewrite sorted array
         if (is_array($orderArray)) {
             return array_keys($orderArray);
         } else {
             return FALSE;
         }
     } else {
         return FALSE;
     }
 }
コード例 #3
0
 function display($parent, $depth, $pos, $errorArray)
 {
     // V2.0
     // starting on thesaurus level
     if ($parent == 0) {
         $elementArray = thesaurus::get_thesaurus_list();
         // get thesauri
     } else {
         $elementArray = thesaurus::get_child($parent);
     }
     // get children
     // entries found
     if (is_array($elementArray)) {
         $cntElements = count($elementArray);
         // start new line
         if (!isset($pos)) {
             $pos = 0;
         }
         // set position to 0
         $line = new line();
         // ****************************************************************
         // start array
         $lineCnt = 0;
         foreach ($elementArray as $id) {
             // don't display if
             // non descriptor
             // or not visible
             //        if ((thesaurus::is_descriptor($id) or session::get("descriptor"))
             //          and (thesaurus::is_visible($id) or session::get("visible"))
             //          )
             if (thesaurus::is_visible($id) or session::get("visible")) {
                 $cntParents = thesaurus::parent_num($id);
                 $equivArray = thesaurus::get_equiv($id, "BS");
                 if (is_array($equivArray)) {
                     $cntEquiv = count($equivArray);
                 } else {
                     $cntEquiv = 0;
                 }
                 // get count and list of subentries
                 $childrenArray = thesaurus::get_child($id);
                 $cntChildren = thesaurus::child_num($id, session::get(descriptor));
                 // get entry details
                 $entry = thesaurus::get_descriptor($id);
                 // ECHO ENTRY
                 // space in front
                 $x = 0;
                 while ($x < $pos - 1) {
                     $line->insert(grafik::disp("line", "|", 20), 20);
                     // insert line-grafik
                     $x++;
                 }
                 // search elements in next level enabled
                 if ($depth > $pos or $depth == -1) {
                     // display tree grafik
                     if ($pos > 0) {
                         if ($lineCnt++ < $cntElements - 1) {
                             $line->insert(grafik::disp("subtree", "|", 20), 20);
                         } else {
                             $line->insert(grafik::disp("subend", "|", 20), 20);
                         }
                         // insert sub end icon
                     }
                     // display open / close icon if subobjects
                     if ($cntChildren != 0) {
                         // subobjects found -> display icon to open / close
                         if (thesaurus::is_open($id)) {
                             if ($pos > 0) {
                                 $tempString = form::link("minus", "[+]", "index.php?id={$id}&amp;action=close", "close");
                             } else {
                                 $tempString = form::link("thesaurus-open", "[+]", "index.php?id={$id}&amp;action=close", "close");
                             }
                         } else {
                             if ($pos > 0) {
                                 $tempString = form::link("plus", "[+]", "index.php?id={$id}&amp;action=open", "open");
                             } else {
                                 $tempString = form::link("thesaurus", "[T]", "index.php?id={$id}&amp;action=open", "open");
                             }
                         }
                     } else {
                         $tempString = grafik::disp("space", " ", 20);
                     }
                     $line->insert($tempString, 20);
                     // insert navigation symbols
                     $tempString = "";
                     // Display parent and child link icon
                     if (session::get("show")) {
                         // display parent arrow
                         if (thesaurus::is_child_of(session::get("show"), $id) and session::get("show")) {
                             $line->insert(grafik::arrow("right", "blue", 15), 20);
                             // display parent arrow
                         }
                         // display link-arrow
                         if (thesaurus::is_parent_of(session::get("show"), $id)) {
                             $line->insert(grafik::arrow("right", "orange", 15), 20);
                         }
                         // display associate links
                         if (thesaurus::is_assoc_of(session::get("show"), $id)) {
                             $line->insert(grafik::disp("assoc", "=", 20), 20);
                         }
                     }
                     // entry name
                     $textLength = strlen($entry[name]) * 15;
                     $textString = $entry[name];
                     // set style for selection
                     $styleString = "";
                     if (thesaurus::is_equivalent($id)) {
                         $styleString = "class='bright'";
                     }
                     if (thesaurus::is_descriptor($id)) {
                         $textString = strtoupper($textString);
                     }
                     if ($id == session::get("show")) {
                         $styleString = "class='select'";
                     } elseif ($cntParents > 1) {
                         $styleString = "class='multiple'";
                     }
                     if (!thesaurus::is_visible($id)) {
                         $styleString = "class='red'";
                     }
                     if (thesaurus::is_deleted($id)) {
                         $styleString = "class='through'";
                     }
                     // draw name with link
                     if ($pos == 0) {
                         $tempString .= form::link("", "<b><span {$styleString}>" . $textString . "</span></b>", "index.php?id={$id}&amp;action=show", "name", "", $id);
                     } else {
                         $tempString .= form::link("", "<span {$styleString}>" . $textString . "</span>", "index.php?id={$id}&amp;action=show", "name", "", $id);
                     }
                     // number of sub-objects
                     if ($cntChildren) {
                         $subText = "";
                         $listCnt = 0;
                         foreach ($childrenArray as $entry) {
                             $subText .= thesaurus::get_name($entry) . "<br>";
                         }
                         $tempString .= "<span ";
                         $tempString .= help::show("elementcount", $subText) . ">";
                         $tempString .= "<i class='small'>";
                         if ($cntChildren) {
                             $tempString .= " ({$cntChildren} UB)</i>";
                         }
                         $tempString .= "</span>";
                     }
                     // number of equiv-objects
                     if ($cntEquiv) {
                         $equivText = "";
                         $listCnt = 0;
                         foreach ($equivArray as $entry) {
                             $equivText .= thesaurus::get_name($entry) . "<br>";
                         }
                         $tempString .= "<span ";
                         $tempString .= help::show("equivcount", $equivText) . ">";
                         $tempString .= "<i class='small'>";
                         if ($cntEquiv) {
                             $tempString .= " ({$cntEquiv} BS)</i>";
                         }
                         $tempString .= "</span>";
                     }
                     // Count of containing elements
                     // show owner
                     $ownerID = thesaurus::get_owner($entry[ID]);
                     $infoText = "ID: " . $id;
                     $infoText .= "<br>Status: " . thesaurus::get_status_name(thesaurus::get_status($id));
                     //              $infoText .= "<br>Begriffstyp: " . thesaurus::get_entrytype_name(thesaurus::get_entrytype($id));
                     $infoText .= "<br>Ersteller: " . user::name($ownerID);
                     $tempString .= " " . form::link("", "?", "", "owner", $infoText);
                     // Edit Link
                     $tempString .= form::link("add", "add", "index.php?parent={$id}&amp;action=add", "add");
                     // Delete Link
                     if ($cntChildren == 0) {
                         $javaText = "Wollen Sie " . $entry[name] . " wirklich l&ouml;schen? Es werden auch alle Links zu diesem Eintrag gelöscht";
                         $tempString .= form::link("delete", "x", "javascript:get_confirm(&#34;{$javaText}&#34;,&#34;index.php?action=deleteid&id={$id}&#34;);", "delete");
                     }
                     // Link Link
                     if (session::get("link") and $id != session::get("link")) {
                         if (!thesaurus::is_parent_of(session::get("link"), $id) or session::get(linkaction) == "change") {
                             $linkType = "do" . thesaurus::get_type_name(session::get("linktype"));
                             $tempString .= form::link($linkType, "L", "index.php?id={$id}&amp;linkaction=linkdo", "{$linkType}");
                         }
                     }
                     $line->insert($tempString);
                     // Insert text in line
                     $tempString = "";
                     // recursive display subtree
                     if (thesaurus::is_open($id)) {
                         // recursive call of level
                         if (thesaurus::child_num($id, 1)) {
                             hyrarchy::display_line($line);
                             hyrarchy::display($id, $depth, $pos + 1, $errorArray);
                         }
                     }
                 }
                 // display line
                 hyrarchy::display_line($line);
             }
         }
     }
 }
コード例 #4
0
ファイル: form.php プロジェクト: nibble-arts/openthesaurus
 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>";
 }