• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

classes/class.ilSearchAdministrationGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 require_once "./classes/class.ilSearch.php";
00025 require_once "./classes/class.ilTableGUI.php";
00026 require_once "./classes/class.ilSearchGUIExplorer.php";
00027 require_once "./classes/class.ilSearchFolder.php";
00028 
00037 class ilSearchAdministrationGUI
00038 {
00044         var $ilias;
00045 
00051         var $folder_obj;
00052         var $search;
00053         var $tpl;
00054         var $lng;
00055         var $tree;
00056 
00057         // TABLE VARS
00058         var $res_type;
00059         var $offset;
00060         var $sort_by;
00061         var $sort_order;
00062 
00063         var $folder_id;
00064         var $viewmode;
00065 
00066         var $message;
00067 
00072         function ilSearchAdministrationGUI($a_user_id)
00073         {
00074                 global $ilias,$tpl,$lng;
00075 
00076                 // DEFINE SOME CONSTANTS
00077                 define("RESULT_LIMIT",10);
00078                 
00079                 // Initiate variables
00080                 $this->ilias    =& $ilias;
00081                 $this->tpl              =& $tpl;
00082                 $this->lng              =& $lng;
00083                 $this->lng->loadLanguageModule("search");
00084 
00085 
00086                 $this->folder_id  = $_GET["folder_id"];
00087                 $this->res_type   = $_GET["res_type"];
00088                 $this->offset     = $_GET["offset"];
00089                 $this->sort_by    = $_GET["sort_by"];
00090                 $this->sort_order = $_GET["sort_order"];
00091                 
00092                 $this->setUserId($a_user_id);
00093                 $this->setViewmode($_GET["viewmode"]);
00094 
00095                 // INITIATE SEARCH OBJECT
00096                 $this->search =& new ilSearch($a_user_id);
00097                 $this->folder_obj =& new ilSearchFolder($this->getUserId(),$_GET["folder_id"]);
00098                 $this->tree = new ilTree(1);
00099 
00100                 $this->setFolderId($_GET["folder_id"] ? $_GET["folder_id"] : $this->folder_obj->getRootId());
00101 
00102                 $this->performAction();
00103         }
00104 
00105         function performAction()
00106         {
00107                 if(!isset($_POST["cmd"]))
00108                 {
00109                         if($this->getViewmode() == "flat")
00110                         {
00111                                 $this->__show();
00112                         }
00113                         else
00114                         {
00115                                 $this->__showTree();
00116                                 return true;
00117                         }
00118                 }
00119                 if(isset($_POST["cmd"]["cancel"]))
00120                 {
00121                         session_unregister("search_rename");
00122                         unset($_POST["del_id"]);
00123                         $this->__show();
00124                 }
00125                 if(isset($_POST["cmd"]["create"]))
00126                 {
00127                         $this->__showCreateFolder();
00128                 }
00129                 if(isset($_POST["cmd"]["create_folder"]))
00130                 {
00131                         $this->createNewFolder();
00132                         $this->__show();
00133                 }
00134                 if(isset($_POST["cmd"]["delete"]))
00135                 {
00136                         $this->__show();
00137                         $this->__showConfirmDeleteFolder();
00138                 }
00139                 if(isset($_POST["cmd"]["confirmed_delete"]))
00140                 {
00141                         $this->deleteFolders();
00142                         $this->__show();
00143                 }
00144                 if(isset($_POST["cmd"]["rename"]))
00145                 {
00146                         $this->__renameItem($_SESSION["search_rename"]);
00147                         $this->__show();
00148                 }
00149 
00150                 if(isset($_POST["cmd"]["do_it"]))
00151                 {
00152                         switch($_POST["action"])
00153                         {
00154                                 case "0":
00155                                         $this->message = $this->lng->txt("search_select_one_action");
00156                                         $this->__show();
00157                                         break;
00158 
00159                                 case "rename":
00160                                         if(!$this->__showRename())
00161                                         {
00162                                                 $this->__show();
00163                                         }
00164                                         break;
00165                                         
00166                                 case "delete":
00167                                         $this->__show();
00168                                         $this->__showConfirmDeleteFolder();
00169                                         break;
00170 
00171                                 default:
00172                                         $this->__moveItem();
00173                                         $this->__show();
00174                                         break;
00175                         }
00176                 }
00177         }
00178         // SET/GET
00179         function setUserId($a_user_id)
00180         {
00181                 $this->user_id = $a_user_id;
00182                 
00183         }
00184         function getUserId()
00185         {
00186                 return $this->user_id;
00187         }
00188         function setFolderId($a_folder_id)
00189         {
00190                 $this->folder_id = $a_folder_id;
00191         }
00192         function getFolderId()
00193         {
00194                 return $this->folder_id;
00195         }
00196         function setViewmode($a_viewmode)
00197         {
00198                 switch($a_viewmode)
00199                 {
00200                         case "flat":
00201                                 $this->viewmode = "flat";
00202                                 $_SESSION["s_viewmode"] = "flat";
00203                                 break;
00204 
00205                         case "tree":
00206                                 $this->viewmode = "tree";
00207                                 $_SESSION["s_viewmode"] = "tree";
00208                                 break;
00209                                 
00210                         default:
00211                                 $this->viewmode = $_SESSION["s_viewmode"] ? $_SESSION["s_viewmode"] : "flat";
00212                                 break;
00213                 }
00214         }
00215         function getViewmode()
00216         {
00217                 return $this->viewmode;
00218         }
00219 
00220         function createNewFolder()
00221         {
00222                 $new_folder_obj = $this->folder_obj->create(ilUtil::stripslashes($_POST["title"]));
00223         }
00224 
00225         function deleteFolders()
00226         {
00227                 foreach($_POST["del_id"] as $folder_id)
00228                 {
00229                         $this->folder_obj->delete($folder_id);
00230                 }
00231                 $this->message = $this->lng->txt("search_objects_deleted");
00232         }
00233 
00234         // PRIVATE METHODS
00235         function __showTree()
00236         {
00237                 // SHOW SEARCH ADMINISTRATION PAGE
00238                 $this->tpl->addBlockFile("CONTENT","content","tpl.search_administration_explorer.html");
00239                 $this->tpl->addBlockFile("STATUSLINE","statusline","tpl.statusline.html");
00240                 infoPanel();
00241 
00242                 $this->__showTabs();
00243                 $this->__showLocator();
00244 
00245                 // output message
00246                 if($this->message)
00247                 {
00248                         sendInfo($this->message);
00249                 }
00250 
00251                 // set header
00252                 $this->__showHeader();
00253 
00254                 require_once ("classes/class.ilSearchResultExplorer.php");
00255                 $exp = new ilSearchResultExplorer("search_administration.php",$this->getUserId());
00256                 $exp->setTargetGet("folder_id");
00257 
00258                 if ($_GET["sea_expand"] == "")
00259                 {
00260                         $expanded = 1;
00261                 }
00262                 else
00263                 {
00264                         $expanded = $_GET["sea_expand"];
00265                 }
00266 
00267                 $exp->setExpand($expanded);
00268                 // build html-output
00269                 $exp->setOutput(0);
00270                 $output = $exp->getOutput();
00271 
00272                 $this->tpl->setVariable("EXPLORER", $output);
00273         }               
00274 
00275 
00276         function __show()
00277         {
00278                 // SHOW SEARCH ADMINISTRATION PAGE
00279                 $this->tpl->addBlockFile("CONTENT","content","tpl.search_administration.html");
00280                 $this->tpl->addBlockFile("STATUSLINE","statusline","tpl.statusline.html");
00281                 infoPanel();
00282                 $this->tpl->setVariable("SEARCH_ADMINISTRATION_ACTION","./search_administration.php?folder_id=".$this->getFolderId());
00283                 
00284                 $this->__showHeader();
00285                 $this->__showLocator();
00286                 $this->__showTabs();
00287 
00288 
00289                 $this->__showFolders();
00290 
00291                 if($this->message)
00292                 {
00293                         sendInfo($this->message);
00294                 }
00295 
00296         }
00297 
00298         function __showRename()
00299         {
00300                 // NO ITEM SELECTED
00301                 if(!count($_POST["del_id"]))
00302                 {
00303                         $this->message = $this->lng->txt("search_select_exactly_one_object");
00304                         return false;
00305                 }
00306                 // TOO MANY ITEMS SELECTED
00307                 if(count($_POST["del_id"]) > 1)
00308                 {
00309                         $this->message = $this->lng->txt("search_select_exactly_one_object");
00310                         return false;
00311                 }
00312 
00313                 // SHOW SEARCH ADMINISTRATION PAGE
00314                 $this->tpl->addBlockFile("CONTENT","content","tpl.search_administration.html");
00315                 $this->tpl->addBlockFile("STATUSLINE","statusline","tpl.statusline.html");
00316                 infoPanel();
00317                 $this->tpl->setVariable("SEARCH_ADMINISTRATION_ACTION","./search_administration.php?folder_id=".$this->getFolderId());
00318                 
00319                 $this->__showHeader();
00320                 $this->__showLocator();
00321                 $this->__showTabs();
00322 
00323                 // GET OLD TITLE
00324                 include_once "./classes/class.ilSearchItemFactory.php";
00325 
00326                 $tmp_obj = ilSearchItemFactory::getInstance($_POST["del_id"][0]);
00327                 $this->__showRenameForm($tmp_obj->getTitle());
00328                 unset($tmp_obj);
00329 
00330                 // SET SESSION VARIABLE TO REMEMBER obj_id
00331                 $_SESSION["search_rename"] = $_POST["del_id"][0];
00332 
00333                 if($this->message)
00334                 {
00335                         sendInfo($this->message);
00336                 }
00337                 return true;
00338         }
00339         function __renameItem($a_id)
00340         {
00341                 include_once "./classes/class.ilSearchItemFactory.php";
00342 
00343                 $tmp_obj = ilSearchItemFactory::getInstance($a_id);
00344 
00345                 $tmp_obj->updateTitle(ilUtil::stripslashes($_POST["title"]));
00346 
00347                 $this->message = $this->lng->txt("search_object_renamed");
00348                 
00349                 return true;
00350         }
00351                 
00352 
00353 
00354         function __moveItem()
00355         {
00356                 if(!count($_POST["del_id"]))
00357                 {
00358                         $this->message = $this->lng->txt("");
00359                         return false;
00360                 }
00361                 
00362                 include_once "./classes/class.ilSearchItemFactory.php";
00363 
00364                 // CHECK IF MOVE ACTION IS POSSIBLE
00365                 foreach($_POST["del_id"] as $id)
00366                 {
00367                         $tmp_obj = ilSearchItemFactory::getInstance($id);
00368 
00369                         if($tmp_obj->getType() == "seaf")
00370                         {
00371                                 $this->message = $this->lng->txt("search_move_folders_not_allowed");
00372                                 return false;
00373                         }
00374                         $objects[] =& $tmp_obj;
00375                         unset($tmp_obj);
00376                 }
00377                 include_once "./classes/class.ilSearchFolder.php";
00378                 include_once "./classes/class.ilSearchResult.php";
00379 
00380                 $tmp_folder =& new ilSearchFolder($this->getUserId(),$_POST["action"]);
00381                 
00382                 // MOVE ITEMS
00383                 foreach($objects as $obj)
00384                 {
00385                         // COPY DATA
00386                         $search_res_obj =& new ilSearchResult($this->getUserId());
00387                         $search_res_obj->setTitle($obj->getTitle());
00388                         $search_res_obj->setTarget(addslashes(serialize($obj->getTarget())));
00389                         
00390                         $tmp_folder->assignResult($search_res_obj);
00391 
00392                         // AND FINALLY:
00393                         $this->folder_obj->delete($obj->getObjId());
00394                         unset($search_res_obj);
00395                 }
00396                 unset($objects);
00397                 $this->message = $this->lng->txt("search_objects_moved");
00398 
00399                 return true;
00400         }
00401                 
00402 
00403         function __showCreateFolder()
00404         {
00405                 // SHOW SEARCH ADMINISTRATION PAGE
00406                 $this->tpl->addBlockFile("CONTENT","content","tpl.search_administration.html");
00407                 $this->tpl->addBlockFile("STATUSLINE","statusline","tpl.statusline.html");
00408                 infoPanel();
00409                 $this->tpl->setVariable("SEARCH_ADMINISTRATION_ACTION","./search_administration.php?folder_id=".$this->getFolderId());
00410                 
00411                 $this->__showHeader();
00412                 $this->__showLocator();
00413                 $this->__showTabs();
00414 
00415                 $this->__showCreateFolderForm();
00416                 if($this->message)
00417                 {
00418                         sendInfo($this->message);
00419                 }
00420 
00421         }
00422 
00423         function __showConfirmDeleteFolder()
00424         {
00425                 if(!count($_POST["del_id"]))
00426                 {
00427                         sendInfo($this->lng->txt("search_no_selection"));
00428                         return false;
00429                 }
00430                 sendInfo($this->lng->txt("search_delete_sure"));
00431 
00432                 $this->tpl->setCurrentBlock("CONFIRM_DELETE");
00433                 $this->tpl->setVariable("TXT_DELETE_CANCEL",$this->lng->txt("cancel"));
00434                 $this->tpl->setVariable("TXT_DELETE_CONFIRM",$this->lng->txt("delete"));
00435                 $this->tpl->parseCurrentBlock();
00436         }
00437 
00438         function __showCreateFolderForm()
00439         {
00440                 $this->tpl->setVariable("SEARCH_ADMINISTRATION_ACTION","./search_administration.php?folder_id=".$this->getFolderId());
00441 
00442                 $this->tpl->setCurrentBlock("FOLDER_CREATE_FORM");
00443                 $this->tpl->setVariable("FOLDER_CREATE_FORM_TXT",$this->lng->txt("search_new_folder"));
00444                 $this->tpl->setVariable("FOLDER_CREATE_FORM_TITLE_TXT",$this->lng->txt("title"));
00445                 $this->tpl->setVariable("FOLDER_CREATE_FORM_VALUE","");
00446                 $this->tpl->setVariable("FOLDER_CREATE_FORM_CMD","create_folder");
00447                 $this->tpl->setVariable("FOLDER_CREATE_FORM_SUBMIT_1",$this->lng->txt("cancel"));
00448                 $this->tpl->setVariable("FOLDER_CREATE_FORM_SUBMIT_2",$this->lng->txt("save"));
00449                 $this->tpl->parseCurrentBlock();
00450         }
00451         
00452         function __showRenameForm($a_old_title)
00453         {
00454                 $this->tpl->setVariable("SEARCH_ADMINISTRATION_ACTION","./search_administration.php?folder_id=".$this->getFolderId());
00455 
00456                 $this->tpl->setCurrentBlock("FOLDER_CREATE_FORM");
00457                 $this->tpl->setVariable("FOLDER_CREATE_FORM_TXT",$this->lng->txt("search_rename_title"));
00458                 $this->tpl->setVariable("FOLDER_CREATE_FORM_TITLE_TXT",$this->lng->txt("title"));
00459                 $this->tpl->setVariable("FOLDER_CREATE_FORM_VALUE",$a_old_title);
00460                 $this->tpl->setVariable("FOLDER_CREATE_FORM_CMD","rename");
00461                 $this->tpl->setVariable("FOLDER_CREATE_FORM_SUBMIT_1",$this->lng->txt("cancel"));
00462                 $this->tpl->setVariable("FOLDER_CREATE_FORM_SUBMIT_2",$this->lng->txt("rename"));
00463                 $this->tpl->parseCurrentBlock();
00464         }
00465 
00466         function __showHeader()
00467         {
00468                 if($this->getFolderId() == $this->folder_obj->getRootId())
00469                 {
00470                         $this->tpl->setVariable("TXT_HEADER",$this->lng->txt("search_search_results"));
00471                 }
00472                 else
00473                 {
00474                         // SHOW BACK TO TOP IMAGE
00475                         $this->tpl->setVariable("TXT_HEADER",$this->folder_obj->getTitle());
00476                         $this->tpl->setCurrentBlock("top");
00477                         $this->tpl->setVariable("LINK_TOP", "search_administration.php?folder_id=".$this->folder_obj->getParentId());
00478                         $this->tpl->setVariable("IMG_TOP",ilUtil::getImagePath("ic_top.gif"));
00479                         $this->tpl->parseCurrentBlock();
00480                 }
00481                 // SHOW TREE/FLAT IMAGES
00482                 $this->tpl->setVariable("H_FORMACTION","./search_administration.php?folder_id=".$this->getFolderId());
00483 
00484                 $this->tpl->setCurrentBlock("content");
00485                 $this->tpl->setVariable("LINK_FLAT", "search_administration.php?viewmode=flat&folder_id=".$this->getFolderId());
00486                 $this->tpl->setVariable("IMG_FLAT",ilUtil::getImagePath("ic_flatview.gif"));
00487 
00488                 $this->tpl->setVariable("LINK_TREE", "search_administration.php?viewmode=tree&folder_id".$this->getFolderId());
00489                 $this->tpl->setVariable("IMG_TREE",ilUtil::getImagePath("ic_treeview.gif"));
00490 
00491                 if($this->getViewmode() == 'flat')
00492                 {
00493                         $this->tpl->setCurrentBlock("commands");
00494                         // possible subobjects
00495                         $opts = ilUtil::formSelect("", "new_type", array("folder"));
00496                         $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
00497                         $this->tpl->setVariable("BTN_NAME", "create");
00498                         $this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
00499                         $this->tpl->parseCurrentBlock();
00500                 }
00501         }
00502 
00503         function __showLocator()
00504         {
00505                 $path_info = $this->folder_obj->getPath();
00506 
00507                 $this->tpl->addBlockFile("LOCATOR","locator","tpl.locator.html");
00508 
00509                 $this->tpl->setCurrentBlock("locator_item");
00510                 $this->tpl->setVariable("LINK_ITEM","./search.php");
00511                 $this->tpl->setVariable("LINK_TARGET","bottom");
00512                 $this->tpl->setVariable("ITEM",$this->lng->txt("mail_search_word"));
00513                 $this->tpl->parseCurrentBlock();
00514 
00515                 $this->tpl->touchBlock("locator_separator_prefix");
00516                 $this->tpl->setCurrentBlock("locator_item");
00517                 $this->tpl->setVariable("LINK_ITEM","./search_administration.php");
00518                 $this->tpl->setVariable("LINK_TARGET","bottom");
00519                 $this->tpl->setVariable("ITEM",$this->lng->txt("search_search_results"));
00520                 $this->tpl->parseCurrentBlock();
00521 
00522                 for($i = 1; $i < count($path_info); ++$i)
00523                 {
00524                         $this->tpl->touchBlock("locator_separator_prefix");
00525                         $this->tpl->setCurrentBlock("locator_item");
00526                         $this->tpl->setVariable("LINK_ITEM","./search_administration.php?folder_id=".$path_info[$i]["child"]);
00527                         $this->tpl->setVariable("LINK_TARGET","bottom");
00528                         $this->tpl->setVariable("ITEM",$path_info[$i]["title"]);
00529                         $this->tpl->parseCurrentBlock();
00530                 }
00531 
00532                 $this->tpl->setCurrentBlock("locator");
00533                 $this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));
00534                 $this->tpl->parseCurrentBlock();
00535 
00536         }
00537                 
00538         function __showTabs()
00539         {
00540                 $this->tpl->addBlockFile("TABS","tabs","tpl.tabs.html");
00541 
00542                 if($this->res_type)
00543                 {
00544                         $this->tpl->setCurrentBlock("tab");
00545                         $this->tpl->setVariable("TAB_TYPE","tabinactive");
00546                         $this->tpl->setVariable("TAB_LINK","search.php");
00547                         $this->tpl->setVariable("TAB_TEXT",$this->lng->txt("search_all_results"));
00548                         $this->tpl->parseCurrentBlock();
00549                 }
00550                 // SEARCH ADMINISTRATION
00551                 $this->tpl->setCurrentBlock("tab");
00552                 $this->tpl->setVariable("TAB_TYPE","tabinactive");
00553                 $this->tpl->setVariable("TAB_LINK","search.php?folder_id=".$this->getFolderId());
00554                 $this->tpl->setVariable("TAB_TEXT",$this->lng->txt("search"));
00555                 $this->tpl->parseCurrentBlock();
00556 
00557                 return true;
00558         }
00559 
00560         function __getActions()
00561         {
00562                 $options[0] = $this->lng->txt("search_select_one_action");
00563 
00564                 if($this->folder_obj->hasResults() and $this->folder_obj->countFolders())
00565                 {
00566                         // SHOW MOVE TO
00567                         $tree_data = $this->folder_obj->getTree();
00568 
00569                         foreach($tree_data as $node)
00570                         {
00571                                 $prefix = $this->lng->txt("search_move_to") ;
00572                                 for($i = 0; $i < $node["depth"];++$i)
00573                                 {
00574                                         $prefix .= "&nbsp;&nbsp;";
00575                                 }
00576                                 if($node["obj_id"] == $this->folder_obj->getRootId())
00577                                 {
00578                                         $options[$node["obj_id"]] = $prefix.$this->lng->txt("search_search_results");
00579                                 }
00580                                 else
00581                                 {
00582                                         $options[$node["obj_id"]] = $prefix.$node["title"];
00583                                 }
00584 
00585                         }                       
00586 
00587                 }
00588                 // SHOW RENAME
00589                 $options["rename"] = $this->lng->txt("rename");
00590 
00591                 // SHOW DELETE
00592                 $options["delete"] = $this->lng->txt("delete");
00593 
00594                 return ilUtil::formSelect($_POST["action"],"action",$options,false,true);
00595         }
00596 
00597                 
00598 
00599         function __showFolders()
00600         {
00601                 $items = $this->getChildFolders();
00602 
00603                 if(count($items) or $this->getFolderId() != $this->folder_obj->getRootId())
00604                 {
00605                         $counter = $this->__appendParentLink(count($items)) ? 0 : 1;
00606                         foreach($items as $item)
00607                         {
00608                                 $checked = (is_array($_POST["del_id"]) and in_array($item["obj_id"],$_POST["del_id"])) ? 1 : 0;
00609 
00610                                 $this->tpl->setVariable("CHECK",ilUtil::formCheckbox($checked,"del_id[]",$item["obj_id"]));
00611 
00612                                 $this->tpl->setCurrentBlock("TBL_FOLDER_ROW");
00613                                 $this->tpl->setVariable("ROWCOL",$counter % 2 ? "tblrow1" : "tblrow2");
00614 
00615                                 list($link,$target) = $this->__formatLink($item);
00616                                 $this->tpl->setVariable("FOLDER_LINK",$link);
00617                                 $this->tpl->setVariable("FOLDER_TARGET",$target);
00618                                 $this->tpl->setVariable("FOLDER_TITLE",$this->__formatTitle($item));
00619                                 $this->tpl->parseCurrentBlock();
00620                                 ++$counter;
00621                         }
00622                         if(count($items))
00623                         {
00624                                 $this->tpl->setCurrentBlock("TBL_FOOTER");
00625                                 $this->tpl->setVariable("TBL_FOOTER_IMG_SRC",ilUtil::getImagePath("arrow_downright.gif"));
00626                                 $this->tpl->setVariable("TBL_FOOTER_SELECT",$this->__getActions());
00627                                 $this->tpl->setVariable("TBL_FOOTER_SUBMIT",$this->lng->txt("ok"));
00628                                 $this->tpl->parseCurrentBlock();
00629                         }
00630                 }
00631                 else
00632                 {
00633                         $this->tpl->setCurrentBlock("TBL_ROW_FOLDER");
00634                         $this->tpl->setVariable("TXT_NO_FOLDER",$this->lng->txt("search_no_results_saved"));
00635                         $this->tpl->parseCurrentBlock();
00636                 }
00637                 $this->tpl->setCurrentBlock("TBL_FOLDER");
00638                 $this->tpl->setVariable("COLSPAN",count($items) ? 2 : 1);
00639                 $this->tpl->setVariable("TXT_FOLDER_HEADER",$this->lng->txt("search_my_search_results"));
00640                 $this->tpl->setVariable("TXT_FOLDER_TITLE",$this->lng->txt("title"));
00641                 $this->tpl->parseCurrentBlock();
00642                 
00643         }
00644 
00645         function __appendParentLink($nr_items)
00646         {
00647                 if($this->getFolderId() == $this->folder_obj->getRootId())
00648                 {
00649                         return false;
00650                 }
00651                 else
00652                 {
00653                         if($nr_items)
00654                         {
00655                                 $this->tpl->setVariable("CHECK","&nbsp;");
00656                         }
00657                         $this->tpl->setCurrentBlock("TBL_FOLDER_ROW");
00658                         $this->tpl->setVariable("ROWCOL","tblrow1");
00659 
00660                         list($link,$target) = $this->__formatLink(array("type" => "top"));
00661                         $this->tpl->setVariable("FOLDER_LINK",$link);
00662                         $this->tpl->setVariable("FOLDER_TARGET",$target);
00663                         $this->tpl->setVariable("FOLDER_TITLE",$this->__formatTitle(array("type" => "top")));
00664                         $this->tpl->parseCurrentBlock();
00665                         return true;
00666                 }
00667         }
00668 
00669         function __formatTitle($a_item)
00670         {
00671                 switch($a_item["type"])
00672                 {
00673                         case "seaf":
00674                                 $img = "<img border=\"0\" vspace=\"0\" align=\"left\" src=\"".
00675                                         ilUtil::getImagePath("icon_cat.gif")."\">&nbsp;";
00676                                 
00677                                 return $img.$a_item["title"];
00678 
00679                         case "sea":
00680                                 $img = "<img border=\"0\" vspace=\"0\" align=\"left\" src=\"".
00681                                         ilUtil::getImagePath("icon_bm.gif")."\">&nbsp;";
00682                                 
00683                                 return $img.$a_item["title"];
00684 
00685                         case "top":
00686                                 $img = "<img border=\"0\" vspace=\"0\" align=\"left\" src=\"".
00687                                         ilUtil::getImagePath("icon_cat.gif")."\">&nbsp;";
00688 
00689                                 return $img."..";
00690                 }
00691         }
00692 
00693         function __formatLink($a_item)
00694         {
00695                 switch($a_item["type"])
00696                 {
00697                         case "seaf":
00698                                 $target = "bottom";
00699                                 $link = "./search_administration.php?folder_id=".$a_item["obj_id"];
00700 
00701                                 return array($link,$target);
00702 
00703                         case "sea":
00704                                 include_once "./classes/class.ilSearchResult.php";
00705 
00706                                 $tmp_obj =& new ilSearchResult($this->getUserId(),$a_item["obj_id"]);
00707 
00708                                 $link = $tmp_obj->createLink();
00709                                 unset($tmp_obj);
00710 
00711                                 return $link;
00712                                 
00713                         case "top":
00714                                 $parent_id = $this->folder_obj->getParentId();
00715                                 $target = "bottom";
00716                                 $link = "./search_administration.php?folder_id=".$parent_id;
00717 
00718                                 return array($link,$target);
00719                 }
00720         }
00721                 
00722         function getChildFolders()
00723         {
00724                 return $folder = $this->folder_obj->getChilds();
00725         }
00726                 
00727         
00728 } // END class.Search
00729 ?>

Generated on Fri Dec 13 2013 09:06:35 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1