35 include_once
'Services/Search/classes/class.ilSearchBaseGUI.php';
58 $this->ctrl->saveParameter($this,
'folder_id');
59 $this->ctrl->setParameter($this,
'folder_id',$this->folder_obj->getFolderId());
65 $this->user_id = $a_user_id;
81 $next_class = $this->ctrl->getNextClass($this);
82 $cmd = $this->ctrl->getCmd();
89 if($_POST[
'action'] and is_numeric($_POST[
'action']))
96 $cmd = $_POST[
'action'];
100 $cmd =
"showResults";
112 unset($_POST[
'del_id']);
123 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.search_results.html",
'Services/Search');
124 $this->ctrl->setParameter($this,
'folder_id',$this->folder_obj->getFolderId());
125 $this->tpl->setVariable(
"SEARCH_ADMINISTRATION_ACTION",$this->ctrl->getFormAction($this));
127 $this->tpl->setCurrentBlock(
"FOLDER_CREATE_FORM");
128 $this->tpl->setVariable(
"FOLDER_CREATE_FORM_TXT",$this->lng->txt(
"search_new_folder"));
129 $this->tpl->setVariable(
"FOLDER_CREATE_FORM_TITLE_TXT",$this->lng->txt(
"title"));
130 $this->tpl->setVariable(
"FOLDER_CREATE_FORM_VALUE",
"");
131 $this->tpl->setVariable(
"FOLDER_CREATE_FORM_CMD",
"save");
132 $this->tpl->setVariable(
"FOLDER_CREATE_FORM_SUBMIT_1",$this->lng->txt(
"cancel"));
133 $this->tpl->setVariable(
"FOLDER_CREATE_FORM_SUBMIT_2",$this->lng->txt(
"save"));
134 $this->tpl->parseCurrentBlock();
140 if(!strlen($_POST[
'title']))
148 $this->folder_obj->create(ilUtil::stripslashes($_POST[
"title"]));
157 if(!strlen($_POST[
'title']))
165 include_once
"Services/Search/classes/class.ilSearchItemFactory.php";
168 $tmp_obj->updateTitle(ilUtil::stripslashes($_POST[
"title"]));
180 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.search_results.html',
'Services/Search');
181 $this->ctrl->setParameter($this,
'folder_id',$this->folder_obj->getFolderId());
182 $this->tpl->setVariable(
"SEARCH_ADMINISTRATION_ACTION",$this->ctrl->getFormAction($this));
184 if($a_confirm_delete)
188 $this->tpl->setCurrentBlock(
"CONFIRM_DELETE");
189 $this->tpl->setVariable(
"TXT_DELETE_CANCEL",$this->lng->txt(
"cancel"));
190 $this->tpl->setVariable(
"TXT_DELETE_CONFIRM",$this->lng->txt(
"delete"));
191 $this->tpl->parseCurrentBlock();
194 $items = $this->folder_obj->getChilds();
195 if(count($items) or $this->folder_obj->getFolderId() != $this->folder_obj->getRootId())
198 foreach($items as $item)
200 if($item[
'type'] ==
'seaf')
203 $this->tpl->setCurrentBlock(
"folder");
204 $this->tpl->setVariable(
"FOLDER_LINK",$link);
205 $this->tpl->setVariable(
"FOLDER_TARGET",$target);
206 $this->tpl->setVariable(
"FOLDER_TITLE",$this->
__formatTitle($item));
207 $this->tpl->parseCurrentBlock();
212 include_once
'Services/Search/classes/class.ilSearchObjectListFactory.php';
214 $item_data = unserialize(stripslashes($item[
'target']));
218 $this->tpl->setCurrentBlock(
"link");
219 $this->tpl->setVariable(
"HTML",$item_list_gui->getListItemHTML($item_data[
'id'],
224 $this->tpl->parseCurrentBlock();
226 $checked = (is_array($_POST[
"del_id"]) and in_array($item[
"obj_id"],$_POST[
"del_id"])) ? 1 : 0;
227 $this->tpl->setCurrentBlock(
"TBL_FOLDER_ROW");
229 $this->tpl->setVariable(
"ROWCOL",$counter % 2 ?
"tblrow1" :
"tblrow2");
230 $this->tpl->parseCurrentBlock();
234 $this->tpl->setCurrentBlock(
"TBL_FOOTER");
236 $this->tpl->setVariable(
"TBL_FOOTER_SELECT",$this->
__getActions());
237 $this->tpl->setVariable(
"TBL_FOOTER_SUBMIT",$this->lng->txt(
"ok"));
238 $this->tpl->parseCurrentBlock();
243 $this->tpl->setCurrentBlock(
"TBL_ROW_FOLDER");
244 $this->tpl->setVariable(
"TXT_NO_FOLDER",$this->lng->txt(
"search_no_results_saved"));
245 $this->tpl->parseCurrentBlock();
247 $this->tpl->setCurrentBlock(
"TBL_FOLDER");
248 $this->tpl->setVariable(
"COLSPAN",count($items) ? 2 : 1);
249 $this->tpl->setVariable(
"TXT_FOLDER_HEADER",$this->lng->txt(
"search_my_search_results"));
250 $this->tpl->setVariable(
"TXT_FOLDER_TITLE",$this->lng->txt(
"title"));
251 $this->tpl->parseCurrentBlock();
257 if(!count($_POST[
"del_id"]))
272 foreach($_POST[
"del_id"] as $folder_id)
274 $this->folder_obj->delete($folder_id);
276 $this->message = $this->lng->txt(
"search_objects_deleted");
287 $ilLocator->addItem($this->lng->txt(
'search_search_results'),
288 $this->ctrl->getLinkTarget($this));
289 $this->tpl->setLocator();
295 if(!count($_POST[
"del_id"]))
303 if(count($_POST[
"del_id"]) > 1)
311 include_once
"Services/Search/classes/class.ilSearchItemFactory.php";
315 if($tmp_obj->getType() ==
'sea')
325 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.search_results.html",
'Services/Search');
326 $this->ctrl->setParameter($this,
'folder_id',$this->folder_obj->getFolderId());
327 $this->tpl->setVariable(
"SEARCH_ADMINISTRATION_ACTION",$this->ctrl->getFormAction($this));
330 include_once
"Services/Search/classes/class.ilSearchItemFactory.php";
337 $_SESSION[
"search_rename"] = $_POST[
"del_id"][0];
344 if(!count($_POST[
"del_id"]))
350 include_once
"Services/Search/classes/class.ilSearchItemFactory.php";
353 foreach($_POST[
"del_id"] as $id)
357 if($tmp_obj->getType() ==
"seaf")
363 $objects[] =& $tmp_obj;
366 include_once
"Services/Search/classes/class.ilUserResult.php";
371 foreach($objects as $obj)
375 $search_res_obj->setTitle($obj->getTitle());
376 $search_res_obj->setTarget(addslashes(serialize($obj->getTarget())));
378 $tmp_folder->assignResult($search_res_obj);
381 $this->folder_obj->delete($obj->getObjId());
382 unset($search_res_obj);
398 $this->tpl->setCurrentBlock(
"add_commands");
401 $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
402 $this->tpl->setVariable(
"BTN_NAME",
"create");
403 $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"add"));
404 $this->tpl->setVariable(
"H_FORMACTION",$this->ctrl->getFormAction($this));
405 $this->tpl->parseCurrentBlock();
407 $this->tpl->setCurrentBlock(
"header_image");
409 $this->tpl->parseCurrentBlock();
411 $this->ctrl->setParameter($this,
'folder_id',$this->folder_obj->getFolderId());
412 $this->tpl->setVariable(
"TXT_HEADER",$this->lng->txt(
'search_search_results'));
414 $this->tpl->addBlockFile(
"TABS",
"tabs",
"tpl.tabs.html");
416 $this->tpl->setCurrentBlock(
"tab");
417 $this->tpl->setVariable(
"TAB_TYPE",
"tabinactive");
418 $this->tpl->setVariable(
"TAB_LINK",$this->ctrl->getLinkTargetByClass(
'ilsearchgui'));
419 $this->tpl->setVariable(
"TAB_TEXT",$this->lng->txt(
"search"));
420 $this->tpl->parseCurrentBlock();
422 $this->tpl->setCurrentBlock(
"tab");
423 $this->tpl->setVariable(
"TAB_TYPE",
"tabinactive");
424 $this->tpl->setVariable(
"TAB_LINK",$this->ctrl->getLinkTargetByClass(
'iladvancedsearchgui'));
425 $this->tpl->setVariable(
"TAB_TEXT",$this->lng->txt(
"search_advanced"));
426 $this->tpl->parseCurrentBlock();
428 $this->tpl->setCurrentBlock(
"tab");
429 $this->tpl->setVariable(
"TAB_TYPE",
"tabactive");
430 $this->ctrl->setParameter($this,
'folder_id',$this->folder_obj->getFolderId());
431 $this->tpl->setVariable(
"TAB_LINK",$this->ctrl->getLinkTarget($this));
432 $this->tpl->setVariable(
"TAB_TEXT",$this->lng->txt(
"search_search_results"));
433 $this->tpl->parseCurrentBlock();
436 if($this->folder_obj->getFolderId() != $this->folder_obj->getRootId())
438 $this->tpl->setVariable(
"TXT_HEADER",$this->folder_obj->getTitle());
439 $this->tpl->setCurrentBlock(
"top");
440 $this->ctrl->setParameter($this,
'folder_id',$this->folder_obj->getParentId());
441 $this->tpl->setVariable(
"LINK_TOP",$this->ctrl->getLinkTarget($this));
443 $this->tpl->parseCurrentBlock();
450 include_once
'Services/Search/classes/class.ilSearchFolder.php';
459 if($this->folder_obj->getFolderId() == $this->folder_obj->getRootId())
467 $this->tpl->setVariable(
"CHECK",
" ");
469 $this->tpl->setCurrentBlock(
"TBL_FOLDER_ROW");
470 $this->tpl->setVariable(
"ROWCOL",
"tblrow1");
472 list($link,$target) = $this->
__formatLink(array(
"type" =>
"top"));
473 $this->tpl->setVariable(
"FOLDER_LINK",$link);
474 $this->tpl->setVariable(
"FOLDER_TARGET",$target);
475 $this->tpl->setVariable(
"FOLDER_TITLE",$this->
__formatTitle(array(
"type" =>
"top")));
476 $this->tpl->parseCurrentBlock();
482 switch($a_item[
"type"])
485 $img =
"<img border=\"0\" vspace=\"0\" align=\"left\" src=\"".
488 return $img.$a_item[
"title"];
491 $img =
"<img border=\"0\" vspace=\"0\" align=\"left\" src=\"".
494 return $img.$a_item[
"title"];
497 $img =
"<img border=\"0\" vspace=\"0\" align=\"left\" src=\"".
506 switch($a_item[
"type"])
509 $this->ctrl->setParameter($this,
'folder_id',$a_item[
'obj_id']);
511 return array($this->ctrl->getLinkTarget($this),
515 include_once
"Services/Search/classes/class.ilUserResult.php";
519 $link = $tmp_obj->createLink();
525 $this->ctrl->setParameter($this,
'folder_id',$this->folder_obj->getParentId());
527 return array($this->ctrl->getLinkTarget($this),
533 $options[0] = $this->lng->txt(
"search_select_one_action");
535 if($this->folder_obj->hasResults() and $this->folder_obj->countFolders())
538 $tree_data = $this->folder_obj->getTree();
540 foreach($tree_data as $node)
542 $prefix = $this->lng->txt(
"search_move_to") ;
543 for($i = 0; $i < $node[
"depth"];++$i)
545 $prefix .=
" ";
547 if($node[
"obj_id"] == $this->folder_obj->getRootId())
549 $options[$node[
"obj_id"]] = $prefix.$this->lng->txt(
"search_search_results");
553 $options[$node[
"obj_id"]] = $prefix.$node[
"title"];
560 $options[
"rename"] = $this->lng->txt(
"rename");
563 $options[
"confirmDelete"] = $this->lng->txt(
"delete");
570 $this->tpl->setCurrentBlock(
"FOLDER_CREATE_FORM");
571 $this->tpl->setVariable(
"FOLDER_CREATE_FORM_TXT",$this->lng->txt(
"search_rename_title"));
572 $this->tpl->setVariable(
"FOLDER_CREATE_FORM_TITLE_TXT",$this->lng->txt(
"title"));
573 $this->tpl->setVariable(
"FOLDER_CREATE_FORM_VALUE",$a_old_title);
574 $this->tpl->setVariable(
"FOLDER_CREATE_FORM_CMD",
"update");
575 $this->tpl->setVariable(
"FOLDER_CREATE_FORM_SUBMIT_1",$this->lng->txt(
"cancel"));
576 $this->tpl->setVariable(
"FOLDER_CREATE_FORM_SUBMIT_2",$this->lng->txt(
"rename"));
577 $this->tpl->parseCurrentBlock();