37 require_once (
"./Services/PersonalDesktop/classes/class.ilBookmarkExplorer.php");
38 require_once (
"./Services/PersonalDesktop/classes/class.ilBookmarkFolder.php");
39 require_once (
"./Services/PersonalDesktop/classes/class.ilBookmark.php");
40 require_once (
"./Services/Table/classes/class.ilTableGUI.php");
75 $this->
id = (empty(
$_GET[
"bmf_id"]))
84 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
88 $this->tree->setTableNames(
'bookmark_tree',
'bookmark_data');
89 $this->root_id = $this->tree->readRootId();
91 if (!empty(
$_GET[
"set_mode"]))
93 $this->ilias->account->writePref(
"il_bkm_mode",
$_GET[
"set_mode"]);
95 $this->mode = $this->ilias->account->getPref(
"il_bkm_mode");
103 $next_class = $this->ctrl->getNextClass();
108 $cmd = $this->ctrl->getCmd(
"view");
111 if ($this->
getMode() ==
'tree')
117 $this->tpl->show(
true);
122 switch($_POST[
"action"])
153 $this->tpl->setCurrentBlock(
"left_column");
154 $this->tpl->addBlockFile(
"LEFT_CONTENT",
"adm_tree_content",
"tpl.bookmark_explorer.html");
157 $exp->setTargetGet(
"bmf_id");
158 $exp->setSessionExpandVariable(
'mexpand');
159 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
160 $exp->setExpandTarget($this->ctrl->getLinkTarget($this));
161 if (
$_GET[
"mexpand"] ==
"")
164 $mtree->setTableNames(
'bookmark_tree',
'bookmark_data');
165 $expanded = $mtree->readRootId();
169 $expanded =
$_GET[
"mexpand"];
172 $exp->setExpand($expanded);
176 $output = $exp->getOutput();
178 $this->tpl->setCurrentBlock(
"adm_tree_content");
179 $this->tpl->setVariable(
"TXT_EXPLORER_HEADER", $this->lng->txt(
"bookmarks"));
180 $this->ctrl->setParameter($this,
"bmf_id", 1);
181 $this->tpl->setVariable(
"LINK_EXPLORER_HEADER",$this->ctrl->getLinkTarget($this));
183 $this->tpl->setVariable(
"EXPLORER",$output);
184 $this->tpl->parseCurrentBlock();
204 $this->lng->txt(
"personal_desktop"));
205 $this->tpl->setTitle($this->lng->txt(
"personal_desktop"));
215 include_once(
"classes/class.ilFrameTargetInfo.php");
217 if ($this->
id > 0 && !$this->tree->isInTree($this->id))
223 $mtree->setTableNames(
'bookmark_tree',
'bookmark_data');
225 $this->tpl->addBlockFile(
"ADM_CONTENT",
"objects",
"tpl.table.html");
227 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
228 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
232 $s_mode = ($this->mode ==
"tree")
235 $this->tpl->setCurrentBlock(
"tree_mode");
236 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
237 $this->tpl->setTreeFlatIcon($this->ctrl->getLinkTarget($this).
"&set_mode=".$s_mode,
239 $this->tpl->parseCurrentBlock();
242 $this->tpl->setCurrentBlock(
"objects");
243 $this->tpl->addBlockfile(
"TBL_CONTENT",
"tbl_content",
"tpl.bookmark_row.html");
247 if ($this->
id != $mtree->readRootId() || $this->
id ==
"")
249 $this->tpl->setCurrentBlock(
"tbl_content");
254 $this->tpl->setVariable(
"CHECKBOX",
" ");
255 $this->tpl->setVariable(
"ROWCOL", $css_row);
258 $this->tpl->setVariable(
"IMG", $val);
259 $this->tpl->setVariable(
"ALT_IMG", $this->lng->txt(
"bmf"));
262 $this->ctrl->setParameter($this,
"bmf_id", $mtree->getParentId($this->id));
263 $link = $this->ctrl->getLinkTarget($this);
264 $this->tpl->setVariable(
"TXT_TITLE",
"..");
265 $this->tpl->setVariable(
"LINK_TARGET", $link);
268 $this->tpl->parseCurrentBlock();
272 foreach ($objects as $key => $object)
274 $a_ids[]=$object[
"type"].
":".$object[
"obj_id"];
276 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
277 $this->ctrl->setParameter($this,
"obj_id", $object[
"obj_id"]);
278 $link = ($object[
"type"] ==
"bmf")
279 ? $this->ctrl->getLinkTarget($this,
"editFormBookmarkFolder")
280 : $this->ctrl->getLinkTarget($this,
"editFormBookmark");
285 $this->tpl->setCurrentBlock(
"edit");
286 $this->tpl->setVariable(
"TXT_EDIT", $this->lng->txt(
"edit"));
287 $this->tpl->setVariable(
"LINK_EDIT", $link);
288 $this->tpl->parseCurrentBlock();
290 if (!empty($object[
"target"]))
292 $this->tpl->setCurrentBlock(
"target");
293 $this->tpl->setVariable(
"TXT_TARGET",
295 $object[
"target"],$this->textwidth,
true)));
296 $this->tpl->setVariable(
"LINK_TARGET", htmlentities($object[
"target"]));
297 $this->tpl->parseCurrentBlock();
300 if (!empty($object[
"description"]))
302 $this->tpl->setCurrentBlock(
"description");
303 $this->tpl->setVariable(
"TXT_DESCRIPTION",
305 $this->tpl->parseCurrentBlock();
308 $this->tpl->setCurrentBlock(
"tbl_content");
314 $this->tpl->setVariable(
"CHECKBOX",
315 ilUtil::formCheckBox(
"",
"id[]", $object[
"type"].
":".$object[
"obj_id"]));
316 $this->tpl->setVariable(
"ROWCOL", $css_row);
318 $img_type = ($object[
"type"] ==
"bmf") ?
"cat" : $object[
"type"];
320 $this->tpl->setVariable(
"IMG", $val);
321 $this->tpl->setVariable(
"ALT_IMG", $this->lng->txt($object[
"type"]));
324 $this->ctrl->setParameter($this,
"bmf_id", $object[
"obj_id"]);
325 $link = ($object[
"type"] ==
"bmf") ?
326 $this->ctrl->getLinkTarget($this) :
329 $this->tpl->setVariable(
"LINK_TARGET", htmlentities($link));
331 if ($object[
"type"] ==
"bmf")
341 $this->tpl->parseCurrentBlock();
346 if (!empty($this->
id) && $this->
id != 1)
349 $addstr =
" ".$this->lng->txt(
"in").
" ".$BookmarkFolder->getTitle();
357 $tbl->setTitle($this->lng->txt(
"bookmarks").$addstr,
358 "icon_bm.gif", $this->lng->txt(
"bookmarks"));
360 $tbl->setHeaderNames(array(
"", $this->lng->txt(
"type"), $this->lng->txt(
"title"),
""));
361 $tbl->setHeaderVars(array(
"",
"type",
"title",
"commands"),
362 array(
"bmf_id" => $this->
id));
363 $tbl->setColumnWidth(array(
"1%",
"1%",
"100%",
""));
367 $tbl->setLimit($limit);
368 $tbl->setOffset($offset);
369 $tbl->setMaxCount($maxcount);
371 $tbl->enable(
"select_all");
372 $tbl->setFormName(
"cmd");
373 $tbl->setSelectAllCheckbox(
"id");
376 $tbl->setFooter(
"tblfooter", $this->lng->txt(
"previous"),$this->lng->txt(
"next"));
378 $tbl->disable(
"footer");
379 $tbl->disable(
"header");
386 $this->tpl->setVariable(
"ALT_ARROW", $this->lng->txt(
"actions"));
387 $this->tpl->setVariable(
"NUM_COLS", 5);
390 $this->tpl->setCurrentBlock(
"tbl_action_row");
391 $this->tpl->setVariable(
"COLUMN_COUNTS",4);
392 $this->tpl->parseCurrentBlock();
403 $this->tpl->setCurrentBlock(
"begin_link");
404 $this->tpl->setVariable(
"LINK_TARGET", $link);
405 $this->tpl->parseCurrentBlock();
406 $this->tpl->touchBlock(
"end_link");
409 $this->tpl->setCurrentBlock(
"text");
410 $this->tpl->setVariable(
"TEXT_CONTENT", $val);
411 $this->tpl->parseCurrentBlock();
412 $this->tpl->setCurrentBlock(
"table_cell");
413 $this->tpl->parseCurrentBlock();
423 if (empty($this->
id))
428 if (!$this->tree->isInTree($this->id))
433 $this->tpl->addBlockFile(
"LOCATOR",
"locator",
"tpl.locator.html");
435 $path = $this->tree->getPathFull($this->
id);
440 $this->tpl->setVariable(
"TXT_LOCATOR",$this->lng->txt(
"locator"));
441 $this->tpl->touchBlock(
"locator_separator");
442 $this->tpl->touchBlock(
"locator_item");
450 foreach ($path as $key => $row)
452 if ($key < count($path)-$modifier)
454 $this->tpl->touchBlock(
"locator_separator");
457 $this->tpl->setCurrentBlock(
"locator_item");
458 $title = ($row[
"child"] == 1) ?
459 $lng->txt(
"bookmarks") :
461 $this->tpl->setVariable(
"ITEM",
$title);
462 $this->ctrl->setParameter($this,
"bmf_id", $row[
"child"]);
463 $this->tpl->setVariable(
"LINK_ITEM",
464 $this->ctrl->getLinkTarget($this));
465 $this->tpl->parseCurrentBlock();
468 $this->tpl->setCurrentBlock(
"locator");
470 $this->tpl->parseCurrentBlock();
478 switch($_POST[
"type"])
497 if (!$this->tree->isInTree($this->id))
502 $this->tpl->addBlockFile(
"ADM_CONTENT",
"objects",
"tpl.bookmark_newfolder.html");
503 $this->tpl->setVariable(
"TITLE", $this->
get_last(
"title",
""));
504 $this->tpl->setVariable(
"TXT_TITLE", $lng->txt(
"title"));
505 $this->tpl->setVariable(
"TXT_SAVE", $lng->txt(
"save"));
506 $this->tpl->setVariable(
"TXT_CANCEL", $lng->txt(
"cancel"));
507 $this->tpl->setVariable(
"TXT_FOLDER_NEW", $lng->txt(
"bookmark_folder_new"));
508 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
509 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
510 $this->tpl->setVariable(
"VAL_CMD",
"createBookmarkFolder");
511 $this->tpl->parseCurrentBlock();
522 if (!$this->tree->isInTree(
$_GET[
"obj_id"]))
527 $this->tpl->addBlockFile(
"ADM_CONTENT",
"objects",
"tpl.bookmark_newfolder.html");
531 $this->tpl->setVariable(
"TXT_TITLE", $lng->txt(
"title"));
532 $this->tpl->setVariable(
"TITLE", $this->
get_last(
"title", $bmf->getTitle()));
533 $this->tpl->setVariable(
"TXT_SAVE", $lng->txt(
"save"));
534 $this->tpl->setVariable(
"TXT_CANCEL", $lng->txt(
"cancel"));
535 $this->tpl->setVariable(
"TXT_FOLDER_NEW", $lng->txt(
"bookmark_folder_edit"));
536 $this->tpl->setVariable(
"VAL_CMD",
"updateBookmarkFolder");
537 $this->ctrl->setParameter($this,
"obj_id",
$_GET[
"obj_id"]);
538 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
539 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
551 if (!$this->tree->isInTree($this->id))
557 $this->tpl->addBlockFile(
"ADM_CONTENT",
"objects",
"tpl.bookmark_new.html");
558 $this->tpl->setVariable(
"TXT_BOOKMARK_NEW", $lng->txt(
"bookmark_new"));
559 $this->tpl->setVariable(
"TXT_TARGET", $lng->txt(
"bookmark_target"));
560 $this->tpl->setVariable(
"TXT_TITLE", $lng->txt(
"title"));
561 $this->tpl->setVariable(
"TXT_DESCRIPTION", $lng->txt(
"description"));
563 $this->tpl->setVariable(
"TITLE", $this->
get_last(
"title",
""));
564 $this->tpl->setVariable(
"TARGET", $this->
get_last(
"target",
"http://"));
565 $this->tpl->setVariable(
"DESCRIPTION",$this->
get_last(
"description",
""));
566 $this->tpl->setVariable(
"TXT_SAVE", $lng->txt(
"save"));
567 $this->tpl->setVariable(
"VAL_CMD",
"createBookmark");
568 $this->tpl->setVariable(
"TXT_CANCEL", $lng->txt(
"cancel"));
570 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
571 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
572 $this->tpl->parseCurrentBlock();
575 $this->tpl->setCurrentBlock(
'bkm_import');
576 $this->tpl->setVariable(
"TXT_IMPORT_BKM", $this->lng->txt(
"bkm_import"));
577 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"file_add"));
578 $this->tpl->setVariable(
"TXT_IMPORT", $this->lng->txt(
"import"));
579 $this->tpl->parseCurrentBlock();
589 return (!empty($_POST[$a_var])) ?
601 if (!$this->tree->isInTree(
$_GET[
"obj_id"]))
605 $this->tpl->addBlockFile(
"ADM_CONTENT",
"objects",
"tpl.bookmark_new.html");
607 $this->tpl->setVariable(
"TXT_BOOKMARK_NEW", $lng->txt(
"bookmark_edit"));
608 $this->tpl->setVariable(
"TXT_TARGET", $lng->txt(
"bookmark_target"));
609 $this->tpl->setVariable(
"TXT_TITLE", $lng->txt(
"title"));
610 $this->tpl->setVariable(
"TXT_DESCRIPTION", $lng->txt(
"description"));
613 $this->tpl->setVariable(
"TITLE", $this->
get_last(
"title", $Bookmark->getTitle()));
614 $this->tpl->setVariable(
"TARGET", $this->
get_last(
"target", $Bookmark->getTarget()));
615 $this->tpl->setVariable(
"DESCRIPTION", $this->
get_last(
"description", $Bookmark->getDescription()));
617 $this->tpl->setVariable(
"TXT_SAVE", $lng->txt(
"save"));
618 $this->tpl->setVariable(
"VAL_CMD",
"updateBookmark");
619 $this->tpl->setVariable(
"TXT_CANCEL", $lng->txt(
"cancel"));
620 $this->ctrl->setParameter($this,
"obj_id",
$_GET[
"obj_id"]);
621 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
622 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
624 $this->tpl->parseCurrentBlock();
633 if (!$this->tree->isInTree($this->id))
639 if (empty($_POST[
"title"]))
649 $bmf->setParent($this->
id);
662 if (!$this->tree->isInTree(
$_GET[
"obj_id"]))
668 if (empty($_POST[
"title"]))
690 if (!$this->tree->isInTree($this->id))
696 if (empty($_POST[
"title"]))
701 else if (empty($_POST[
"target"]))
713 $bm->setParent($this->
id);
725 if (!$this->tree->isInTree(
$_GET[
"obj_id"]))
731 if (empty($_POST[
"title"]))
736 else if (empty($_POST[
"target"]))
759 if (!isset($_POST[
"id"]))
761 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
764 foreach($_POST[
"id"] as
$id)
766 if ($this->tree->isInTree($id))
768 list($type, $obj_id) = explode(
":", $id);
769 $export_ids[]=$obj_id;
772 require_once (
"./Services/PersonalDesktop/classes/class.ilBookmarkImportExport.php");
774 $this->lng->txt(
"bookmarks_of").
" ".$this->ilias->account->getFullname());
781 return $html_content;
790 include_once
'classes/class.ilFileDataMail.php';
791 require_once
"Services/Mail/classes/class.ilFormatMail.php";
796 $html_content=$this->
export(
false);
798 $fp=fopen($tempfile,
'w');
799 fwrite($fp, $html_content);
802 $mfile->copyAttachmentFile($tempfile,
$filename);
803 $umail->savePostData($ilUser->getId(),array(
$filename),
814 if (!isset($_POST[
"id"]))
816 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
819 $this->tpl->addBlockFile(
"ADM_CONTENT",
"objects",
"tpl.obj_confirm.html");
822 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
823 $this->tpl->setVariable(
"FORMACTION",
824 $this->ctrl->getFormAction($this));
827 $cols = array(
"type",
"title");
828 foreach ($cols as $key)
830 $this->tpl->setCurrentBlock(
"table_header");
831 $this->tpl->setVariable(
"TEXT",$this->lng->txt($key));
832 $this->tpl->parseCurrentBlock();
837 foreach($_POST[
"id"] as
$id)
840 list($type, $obj_id) = explode(
":", $id);
841 if (!$this->tree->isInTree($obj_id))
849 $title = $BookmarkFolder->getTitle();
851 unset($BookmarkFolder);
856 $title = $Bookmark->getTitle();
857 $target = $Bookmark->getTarget();
863 $this->tpl->setCurrentBlock(
"table_cell");
865 $this->tpl->parseCurrentBlock();
868 $this->tpl->setCurrentBlock(
"table_cell");
875 $target,$this->textwidth,
true)));
877 $this->tpl->parseCurrentBlock();
880 $this->tpl->setCurrentBlock(
"table_row");
882 $this->tpl->parseCurrentBlock();
886 $buttons = array(
"cancel" => $this->lng->txt(
"cancel"),
887 "confirm" => $this->lng->txt(
"confirm"));
890 foreach($buttons as $name => $value)
892 $this->tpl->setCurrentBlock(
"operation_btn");
893 $this->tpl->setVariable(
"BTN_NAME",$name);
894 $this->tpl->setVariable(
"BTN_VALUE",$value);
895 $this->tpl->parseCurrentBlock();
904 session_unregister(
"saved_post");
913 global
$tree, $rbacsystem, $rbacadmin;
918 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
924 list($type, $id) = explode(
":", $id);
927 if ($this->tree->isInTree($id))
929 $node_data = $this->tree->getNodeData($id);
930 $subtree_nodes = $this->tree->getSubTree($node_data);
938 $this->tree->deleteTree($node_data);
941 foreach ($subtree_nodes as $node)
943 switch ($node[
"type"])
947 $BookmarkFolder->delete();
971 "delete"=>$this->lng->txt(
"delete"),
972 "export"=>$this->lng->txt(
"export"),
973 "sendmail"=>$this->lng->txt(
"bkm_sendmail"),
976 $subobj = array(
"bm",
"bmf");
978 if (is_array($subobj))
983 $this->tpl->setCurrentBlock(
"add_object");
984 $this->tpl->setVariable(
"COLUMN_COUNTS", 7);
985 $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
986 $this->tpl->setVariable(
"BTN_NAME",
"newForm");
987 $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"add"));
988 $this->tpl->parseCurrentBlock();
991 $this->tpl->setVariable(
"TPLPATH",$this->tpl->tplPath);
993 $this->tpl->setCurrentBlock(
"tbl_action_select");
995 $this->tpl->setVariable(
"BTN_NAME",
"executeAction");
996 $this->tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"execute"));
1007 $this->tpl->parseCurrentBlock();
1016 include_once(
"./Services/PersonalDesktop/classes/class.ilBookmarkBlockGUI.php");
1019 return $bookmark_block_gui->getHTML();
1031 if (!$this->tree->isInTree($this->id))
1036 if ($_FILES[
"bkmfile"][
"error"] > UPLOAD_ERR_OK)
1042 require_once (
"./Services/PersonalDesktop/classes/class.ilBookmarkImportExport.php");
1044 if ($objects===
false)
1051 $num_create=array(
'bm'=>0,
'bmf'=>0);
1054 ilUtil::sendInfo(sprintf($this->lng->txt(
"bkm_import_ok"),$num_create[
'bm'],
1055 $num_create[
'bmf']));
1070 if (is_array($objects[$start_key]))
1072 foreach ($objects[$start_key] as $obj_key=>$object)
1074 switch ($object[
'type'])
1077 if (!$object[
"title"])
continue;
1078 if (!$object[
"target"])
continue;
1080 $bm->setTitle($object[
"title"]);
1081 $bm->setDescription($object[
"description"]);
1082 $bm->setTarget($object[
"target"]);
1083 $bm->setParent($folder_id);
1085 $num_create[
'bm']++;
1088 if (!$object[
"title"])
continue;
1090 $bmf->setTitle($object[
"title"]);
1091 $bmf->setParent($folder_id);
1093 $num_create[
'bmf']++;
1094 if (is_array($objects[$obj_key]))
1097 $bmf->getId(),$obj_key);