ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSearchresultGUI Class Reference
+ Inheritance diagram for ilSearchresultGUI:
+ Collaboration diagram for ilSearchresultGUI:

Public Member Functions

 ilSearchResultGUI ()
 Constructor public.
 setUserId ($a_user_id)
 getUserId ()
executeCommand ()
 Control public.
 cancel ()
 create ()
 save ()
 update ()
 showResults ($a_confirm_delete=false)
 confirmDelete ()
 delete ()
 setLocator ()
 rename ()
 moveItem ()
 prepareOutput ()
 __initFolderObject ()
 __appendParentLink ($nr_items)
 __formatTitle ($a_item)
 __formatLink ($a_item)
 __getActions ()
 __showRenameForm ($a_old_title)
- Public Member Functions inherited from ilSearchBaseGUI
 ilSearchBaseGUI ()
 Constructor public.

Data Fields

 $user_id
- Data Fields inherited from ilSearchBaseGUI
 $settings = null
 $ilias = null
 $lng = null
 $tpl = null

Additional Inherited Members

- Protected Member Functions inherited from ilSearchBaseGUI
 addPager ($result, $a_session_key)
 Add Pager.
- Protected Attributes inherited from ilSearchBaseGUI
 $ctrl = null

Detailed Description

Definition at line 37 of file class.ilSearchResultGUI.php.

Member Function Documentation

ilSearchresultGUI::__appendParentLink (   $nr_items)

Definition at line 457 of file class.ilSearchResultGUI.php.

References __formatLink(), and __formatTitle().

Referenced by showResults().

{
if($this->folder_obj->getFolderId() == $this->folder_obj->getRootId())
{
return false;
}
else
{
if($nr_items)
{
$this->tpl->setVariable("CHECK"," ");
}
$this->tpl->setCurrentBlock("TBL_FOLDER_ROW");
$this->tpl->setVariable("ROWCOL","tblrow1");
list($link,$target) = $this->__formatLink(array("type" => "top"));
$this->tpl->setVariable("FOLDER_LINK",$link);
$this->tpl->setVariable("FOLDER_TARGET",$target);
$this->tpl->setVariable("FOLDER_TITLE",$this->__formatTitle(array("type" => "top")));
$this->tpl->parseCurrentBlock();
return true;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchresultGUI::__formatLink (   $a_item)

Definition at line 504 of file class.ilSearchResultGUI.php.

References ilFrameTargetInfo\_getFrame(), and getUserId().

Referenced by __appendParentLink(), and showResults().

{
switch($a_item["type"])
{
case "seaf":
$this->ctrl->setParameter($this,'folder_id',$a_item['obj_id']);
return array($this->ctrl->getLinkTarget($this),
case "sea":
include_once "Services/Search/classes/class.ilUserResult.php";
$tmp_obj =& new ilUserResult($this->getUserId(),$a_item["obj_id"]);
$link = $tmp_obj->createLink();
unset($tmp_obj);
return $link;
case "top":
$this->ctrl->setParameter($this,'folder_id',$this->folder_obj->getParentId());
return array($this->ctrl->getLinkTarget($this),
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchresultGUI::__formatTitle (   $a_item)

Definition at line 480 of file class.ilSearchResultGUI.php.

References $img, and ilUtil\getImagePath().

Referenced by __appendParentLink(), and showResults().

{
switch($a_item["type"])
{
case "seaf":
$img = "<img border=\"0\" vspace=\"0\" align=\"left\" src=\"".
ilUtil::getImagePath("icon_cat.gif")."\">&nbsp;";
return $img.$a_item["title"];
case "sea":
$img = "<img border=\"0\" vspace=\"0\" align=\"left\" src=\"".
ilUtil::getImagePath("icon_bm.gif")."\">&nbsp;";
return $img.$a_item["title"];
case "top":
$img = "<img border=\"0\" vspace=\"0\" align=\"left\" src=\"".
ilUtil::getImagePath("icon_cat.gif")."\">&nbsp;";
return $img."..";
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchresultGUI::__getActions ( )

Definition at line 531 of file class.ilSearchResultGUI.php.

References formSelect().

Referenced by showResults().

{
$options[0] = $this->lng->txt("search_select_one_action");
if($this->folder_obj->hasResults() and $this->folder_obj->countFolders())
{
// SHOW MOVE TO
$tree_data = $this->folder_obj->getTree();
foreach($tree_data as $node)
{
$prefix = $this->lng->txt("search_move_to") ;
for($i = 0; $i < $node["depth"];++$i)
{
$prefix .= "&nbsp;&nbsp;";
}
if($node["obj_id"] == $this->folder_obj->getRootId())
{
$options[$node["obj_id"]] = $prefix.$this->lng->txt("search_search_results");
}
else
{
$options[$node["obj_id"]] = $prefix.$node["title"];
}
}
}
// SHOW RENAME
$options["rename"] = $this->lng->txt("rename");
// SHOW DELETE
$options["confirmDelete"] = $this->lng->txt("delete");
return ilUtil::formSelect($_POST["action"],"action",$options,false,true);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchresultGUI::__initFolderObject ( )

Definition at line 448 of file class.ilSearchResultGUI.php.

References $_GET, and getUserId().

Referenced by ilSearchResultGUI().

{
include_once 'Services/Search/classes/class.ilSearchFolder.php';
$this->folder_obj = new ilSearchFolder($this->getUserId(),(int) $_GET['folder_id']);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchresultGUI::__showRenameForm (   $a_old_title)

Definition at line 568 of file class.ilSearchResultGUI.php.

Referenced by rename().

{
$this->tpl->setCurrentBlock("FOLDER_CREATE_FORM");
$this->tpl->setVariable("FOLDER_CREATE_FORM_TXT",$this->lng->txt("search_rename_title"));
$this->tpl->setVariable("FOLDER_CREATE_FORM_TITLE_TXT",$this->lng->txt("title"));
$this->tpl->setVariable("FOLDER_CREATE_FORM_VALUE",$a_old_title);
$this->tpl->setVariable("FOLDER_CREATE_FORM_CMD","update");
$this->tpl->setVariable("FOLDER_CREATE_FORM_SUBMIT_1",$this->lng->txt("cancel"));
$this->tpl->setVariable("FOLDER_CREATE_FORM_SUBMIT_2",$this->lng->txt("rename"));
$this->tpl->parseCurrentBlock();
}

+ Here is the caller graph for this function:

ilSearchresultGUI::cancel ( )

Definition at line 110 of file class.ilSearchResultGUI.php.

References $_SESSION, and showResults().

{
unset($_POST['del_id']);
unset($_SESSION['search_rename']);
$this->showResults();
return true;
}

+ Here is the call graph for this function:

ilSearchresultGUI::confirmDelete ( )

Definition at line 255 of file class.ilSearchResultGUI.php.

References ilUtil\sendInfo(), and showResults().

{
if(!count($_POST["del_id"]))
{
ilUtil::sendInfo($this->lng->txt("search_no_selection"));
$this->showResults();
return false;
}
$this->showResults(true);
return true;
}

+ Here is the call graph for this function:

ilSearchresultGUI::create ( )

Definition at line 119 of file class.ilSearchResultGUI.php.

References setLocator().

Referenced by save().

{
// SHOW SEARCH ADMINISTRATION PAGE
$this->setLocator();
$this->tpl->addBlockFile("ADM_CONTENT","adm_content","tpl.search_results.html",'Services/Search');
$this->ctrl->setParameter($this,'folder_id',$this->folder_obj->getFolderId());
$this->tpl->setVariable("SEARCH_ADMINISTRATION_ACTION",$this->ctrl->getFormAction($this));
$this->tpl->setCurrentBlock("FOLDER_CREATE_FORM");
$this->tpl->setVariable("FOLDER_CREATE_FORM_TXT",$this->lng->txt("search_new_folder"));
$this->tpl->setVariable("FOLDER_CREATE_FORM_TITLE_TXT",$this->lng->txt("title"));
$this->tpl->setVariable("FOLDER_CREATE_FORM_VALUE","");
$this->tpl->setVariable("FOLDER_CREATE_FORM_CMD","save");
$this->tpl->setVariable("FOLDER_CREATE_FORM_SUBMIT_1",$this->lng->txt("cancel"));
$this->tpl->setVariable("FOLDER_CREATE_FORM_SUBMIT_2",$this->lng->txt("save"));
$this->tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchresultGUI::delete ( )

Definition at line 270 of file class.ilSearchResultGUI.php.

References showResults().

{
foreach($_POST["del_id"] as $folder_id)
{
$this->folder_obj->delete($folder_id);
}
$this->message = $this->lng->txt("search_objects_deleted");
$this->showResults();
return true;
}

+ Here is the call graph for this function:

& ilSearchresultGUI::executeCommand ( )

Control public.

Definition at line 77 of file class.ilSearchResultGUI.php.

References $cmd, moveItem(), and prepareOutput().

{
global $rbacsystem;
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
switch($next_class)
{
default:
if($cmd == 'gateway')
{
if($_POST['action'] and is_numeric($_POST['action']))
{
$this->prepareOutput();
$this->moveItem();
return true;
}
$cmd = $_POST['action'];
}
if(!$cmd)
{
$cmd = "showResults";
}
$this->prepareOutput();
$this->$cmd();
break;
}
return true;
}

+ Here is the call graph for this function:

ilSearchresultGUI::getUserId ( )

Definition at line 67 of file class.ilSearchResultGUI.php.

References $user_id.

Referenced by __formatLink(), __initFolderObject(), and moveItem().

{
}

+ Here is the caller graph for this function:

ilSearchresultGUI::ilSearchResultGUI ( )

Constructor public.

Definition at line 48 of file class.ilSearchResultGUI.php.

References __initFolderObject(), ilSearchBaseGUI\ilSearchBaseGUI(), and setUserId().

{
global $ilUser;
$this->setUserId($ilUser->getId());
$this->ctrl->saveParameter($this,'folder_id');
$this->ctrl->setParameter($this,'folder_id',$this->folder_obj->getFolderId());
}

+ Here is the call graph for this function:

ilSearchresultGUI::moveItem ( )

Definition at line 342 of file class.ilSearchResultGUI.php.

References ilSearchItemFactory\getInstance(), getUserId(), ilUtil\sendInfo(), and showResults().

Referenced by executeCommand().

{
if(!count($_POST["del_id"]))
{
$this->showResults();
return false;
}
include_once "Services/Search/classes/class.ilSearchItemFactory.php";
// CHECK IF MOVE ACTION IS POSSIBLE
foreach($_POST["del_id"] as $id)
{
if($tmp_obj->getType() == "seaf")
{
ilUtil::sendInfo($this->lng->txt("search_move_folders_not_allowed"));
$this->showResults();
return false;
}
$objects[] =& $tmp_obj;
unset($tmp_obj);
}
include_once "Services/Search/classes/class.ilUserResult.php";
$tmp_folder =& new ilSearchFolder($this->getUserId(),$_POST["action"]);
// MOVE ITEMS
foreach($objects as $obj)
{
// COPY DATA
$search_res_obj =& new ilUserResult($this->getUserId());
$search_res_obj->setTitle($obj->getTitle());
$search_res_obj->setTarget(addslashes(serialize($obj->getTarget())));
$tmp_folder->assignResult($search_res_obj);
// AND FINALLY:
$this->folder_obj->delete($obj->getObjId());
unset($search_res_obj);
}
unset($objects);
ilUtil::sendInfo($this->lng->txt("search_objects_moved"));
$this->showResults();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchresultGUI::prepareOutput ( )

Reimplemented from ilSearchBaseGUI.

Definition at line 393 of file class.ilSearchResultGUI.php.

References formSelect(), and ilUtil\getImagePath().

Referenced by executeCommand().

{
// SHOW ADD FOLDER
$this->tpl->setCurrentBlock("add_commands");
// possible subobjects
$opts = ilUtil::formSelect("", "new_type", array("folder"));
$this->tpl->setVariable("SELECT_OBJTYPE", $opts);
$this->tpl->setVariable("BTN_NAME", "create");
$this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
$this->tpl->setVariable("H_FORMACTION",$this->ctrl->getFormAction($this));
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("header_image");
$this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_src_b.gif"));
$this->tpl->parseCurrentBlock();
$this->ctrl->setParameter($this,'folder_id',$this->folder_obj->getFolderId());
$this->tpl->setVariable("TXT_HEADER",$this->lng->txt('search_search_results'));
$this->tpl->addBlockFile("TABS","tabs","tpl.tabs.html");
$this->tpl->setCurrentBlock("tab");
$this->tpl->setVariable("TAB_TYPE","tabinactive");
$this->tpl->setVariable("TAB_LINK",$this->ctrl->getLinkTargetByClass('ilsearchgui'));
$this->tpl->setVariable("TAB_TEXT",$this->lng->txt("search"));
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("tab");
$this->tpl->setVariable("TAB_TYPE","tabinactive");
$this->tpl->setVariable("TAB_LINK",$this->ctrl->getLinkTargetByClass('iladvancedsearchgui'));
$this->tpl->setVariable("TAB_TEXT",$this->lng->txt("search_advanced"));
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("tab");
$this->tpl->setVariable("TAB_TYPE","tabactive");
$this->ctrl->setParameter($this,'folder_id',$this->folder_obj->getFolderId());
$this->tpl->setVariable("TAB_LINK",$this->ctrl->getLinkTarget($this));
$this->tpl->setVariable("TAB_TEXT",$this->lng->txt("search_search_results"));
$this->tpl->parseCurrentBlock();
// show top button if folder isn't root folder
if($this->folder_obj->getFolderId() != $this->folder_obj->getRootId())
{
$this->tpl->setVariable("TXT_HEADER",$this->folder_obj->getTitle());
$this->tpl->setCurrentBlock("top");
$this->ctrl->setParameter($this,'folder_id',$this->folder_obj->getParentId());
$this->tpl->setVariable("LINK_TOP",$this->ctrl->getLinkTarget($this));
$this->tpl->setVariable("IMG_TOP",ilUtil::getImagePath("ic_top.gif"));
$this->tpl->parseCurrentBlock();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchresultGUI::rename ( )

Definition at line 292 of file class.ilSearchResultGUI.php.

References $_SESSION, __showRenameForm(), ilSearchItemFactory\getInstance(), ilUtil\sendInfo(), setLocator(), and showResults().

{
// NO ITEM SELECTED
if(!count($_POST["del_id"]))
{
ilUtil::sendInfo($this->lng->txt("search_select_exactly_one_object"));
$this->showResults();
return false;
}
// TOO MANY ITEMS SELECTED
if(count($_POST["del_id"]) > 1)
{
ilUtil::sendInfo($this->lng->txt("search_select_exactly_one_object"));
$this->showResults();
return false;
}
// GET OLD TITLE
include_once "Services/Search/classes/class.ilSearchItemFactory.php";
$tmp_obj = ilSearchItemFactory::getInstance($_POST["del_id"][0]);
if($tmp_obj->getType() == 'sea')
{
ilUtil::sendInfo($this->lng->txt("search_select_folder"));
$this->showResults();
return false;
}
// SHOW SEARCH ADMINISTRATION PAGE
$this->setLocator();
$this->tpl->addBlockFile("ADM_CONTENT","adm_content","tpl.search_results.html",'Services/Search');
$this->ctrl->setParameter($this,'folder_id',$this->folder_obj->getFolderId());
$this->tpl->setVariable("SEARCH_ADMINISTRATION_ACTION",$this->ctrl->getFormAction($this));
// GET OLD TITLE
include_once "Services/Search/classes/class.ilSearchItemFactory.php";
$tmp_obj = ilSearchItemFactory::getInstance($_POST["del_id"][0]);
$this->__showRenameForm($tmp_obj->getTitle());
unset($tmp_obj);
// SET SESSION VARIABLE TO REMEMBER obj_id
$_SESSION["search_rename"] = $_POST["del_id"][0];
return true;
}

+ Here is the call graph for this function:

ilSearchresultGUI::save ( )

Definition at line 138 of file class.ilSearchResultGUI.php.

References create(), ilUtil\sendInfo(), and showResults().

{
if(!strlen($_POST['title']))
{
ilUtil::sendInfo($this->lng->txt('search_enter_title'));
$this->create();
return false;
}
$this->folder_obj->create(ilUtil::stripslashes($_POST["title"]));
ilUtil::sendInfo($this->lng->txt('search_added_new_folder'));
$this->showResults();
return true;
}

+ Here is the call graph for this function:

ilSearchresultGUI::setLocator ( )

Definition at line 282 of file class.ilSearchResultGUI.php.

Referenced by create(), rename(), and showResults().

{
global $ilLocator;
return;
$ilLocator->addItem($this->lng->txt('search_search_results'),
$this->ctrl->getLinkTarget($this));
$this->tpl->setLocator();
}

+ Here is the caller graph for this function:

ilSearchresultGUI::setUserId (   $a_user_id)

Definition at line 63 of file class.ilSearchResultGUI.php.

Referenced by ilSearchResultGUI().

{
$this->user_id = $a_user_id;
}

+ Here is the caller graph for this function:

ilSearchresultGUI::showResults (   $a_confirm_delete = false)

Definition at line 177 of file class.ilSearchResultGUI.php.

References __appendParentLink(), __formatLink(), __formatTitle(), __getActions(), ilSearchObjectListFactory\_getInstance(), ilObject\_lookupDescription(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilUtil\formCheckbox(), ilUtil\getImagePath(), ilUtil\sendInfo(), and setLocator().

Referenced by cancel(), confirmDelete(), delete(), moveItem(), rename(), save(), and update().

{
$this->setLocator();
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.search_results.html','Services/Search');
$this->ctrl->setParameter($this,'folder_id',$this->folder_obj->getFolderId());
$this->tpl->setVariable("SEARCH_ADMINISTRATION_ACTION",$this->ctrl->getFormAction($this));
if($a_confirm_delete)
{
ilUtil::sendInfo($this->lng->txt("search_delete_sure"));
$this->tpl->setCurrentBlock("CONFIRM_DELETE");
$this->tpl->setVariable("TXT_DELETE_CANCEL",$this->lng->txt("cancel"));
$this->tpl->setVariable("TXT_DELETE_CONFIRM",$this->lng->txt("delete"));
$this->tpl->parseCurrentBlock();
}
$items = $this->folder_obj->getChilds();
if(count($items) or $this->folder_obj->getFolderId() != $this->folder_obj->getRootId())
{
$counter = $this->__appendParentLink(count($items)) ? 0 : 1;
foreach($items as $item)
{
if($item['type'] == 'seaf')
{
list($link,$target) = $this->__formatLink($item);
$this->tpl->setCurrentBlock("folder");
$this->tpl->setVariable("FOLDER_LINK",$link);
$this->tpl->setVariable("FOLDER_TARGET",$target);
$this->tpl->setVariable("FOLDER_TITLE",$this->__formatTitle($item));
$this->tpl->parseCurrentBlock();
++$counter;
}
else
{
include_once 'Services/Search/classes/class.ilSearchObjectListFactory.php';
$item_data = unserialize(stripslashes($item['target']));
$item_list_gui =& ilSearchObjectListFactory::_getInstance($item_data['type']);
$item_list_gui->initItem($target['id'],ilObject::_lookupObjId($item_data['id']));
$this->tpl->setCurrentBlock("link");
$this->tpl->setVariable("HTML",$item_list_gui->getListItemHTML($item_data['id'],
$id = ilObject::_lookupObjId($item_data['id']),
$this->tpl->parseCurrentBlock();
}
$checked = (is_array($_POST["del_id"]) and in_array($item["obj_id"],$_POST["del_id"])) ? 1 : 0;
$this->tpl->setCurrentBlock("TBL_FOLDER_ROW");
$this->tpl->setVariable("CHECK",ilUtil::formCheckbox($checked,"del_id[]",$item["obj_id"]));
$this->tpl->setVariable("ROWCOL",$counter % 2 ? "tblrow1" : "tblrow2");
$this->tpl->parseCurrentBlock();
}
if(count($items))
{
$this->tpl->setCurrentBlock("TBL_FOOTER");
$this->tpl->setVariable("TBL_FOOTER_IMG_SRC",ilUtil::getImagePath("arrow_downright.gif"));
$this->tpl->setVariable("TBL_FOOTER_SELECT",$this->__getActions());
$this->tpl->setVariable("TBL_FOOTER_SUBMIT",$this->lng->txt("ok"));
$this->tpl->parseCurrentBlock();
}
}
else
{
$this->tpl->setCurrentBlock("TBL_ROW_FOLDER");
$this->tpl->setVariable("TXT_NO_FOLDER",$this->lng->txt("search_no_results_saved"));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("TBL_FOLDER");
$this->tpl->setVariable("COLSPAN",count($items) ? 2 : 1);
$this->tpl->setVariable("TXT_FOLDER_HEADER",$this->lng->txt("search_my_search_results"));
$this->tpl->setVariable("TXT_FOLDER_TITLE",$this->lng->txt("title"));
$this->tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchresultGUI::update ( )

Definition at line 155 of file class.ilSearchResultGUI.php.

References $_SESSION, ilSearchItemFactory\getInstance(), ilUtil\sendInfo(), and showResults().

{
if(!strlen($_POST['title']))
{
ilUtil::sendInfo($this->lng->txt('search_enter_title'));
$this->showResults();
return false;
}
include_once "Services/Search/classes/class.ilSearchItemFactory.php";
$tmp_obj = ilSearchItemFactory::getInstance($_SESSION['search_rename']);
$tmp_obj->updateTitle(ilUtil::stripslashes($_POST["title"]));
ilUtil::sendInfo($this->lng->txt("search_object_renamed"));
$this->showResults();
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilSearchresultGUI::$user_id

Definition at line 42 of file class.ilSearchResultGUI.php.

Referenced by getUserId().


The documentation for this class was generated from the following file: