18 require_once (
"./Services/PersonalDesktop/classes/class.ilBookmarkExplorer.php");
19 require_once (
"./Services/PersonalDesktop/classes/class.ilBookmarkFolder.php");
20 require_once (
"./Services/PersonalDesktop/classes/class.ilBookmark.php");
21 require_once (
"./Services/Table/classes/class.ilTableGUI.php");
59 $this->
id = (empty(
$_GET[
"bmf_id"]))
68 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
72 $this->tree->setTableNames(
'bookmark_tree',
'bookmark_data');
73 $this->root_id = $this->tree->readRootId();
88 $next_class = $this->ctrl->getNextClass();
93 $cmd = $this->ctrl->getCmd(
"view");
102 $this->tpl->show(
true);
107 switch(
$_POST[
"selected_cmd"])
140 $etpl =
new ilTemplate(
"tpl.bookmark_explorer.html",
true,
true,
141 "Services/PersonalDesktop");
144 $exp->setTargetGet(
"bmf_id");
145 $exp->setSessionExpandVariable(
'mexpand');
146 $exp->setExpand($this->
id);
147 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
148 $exp->setExpandTarget($this->ctrl->getLinkTarget($this));
149 if (
$_GET[
"mexpand"] ==
"")
152 $mtree->setTableNames(
'bookmark_tree',
'bookmark_data');
153 $expanded = $mtree->readRootId();
157 $expanded =
$_GET[
"mexpand"];
160 $exp->setExpand($expanded);
161 $exp->highlightNode(
$_GET[
"bmf_id"]);
165 $exp->highlightNode($this->
id);
166 $output = $exp->getOutput();
168 $etpl->setCurrentBlock(
"adm_tree_content");
169 $etpl->setVariable(
"TXT_EXPLORER_HEADER", $this->lng->txt(
"bookmarks"));
170 $this->ctrl->setParameter($this,
"bmf_id", 1);
172 if ($_REQUEST[
'bm_link'])
174 $link = $_SERVER[
'REQUEST_URI'];
175 $link = ereg_replace(
'bmf_id=[0-9]*',
'bmf_id=1', $link);
176 $etpl->setVariable(
"LINK_EXPLORER_HEADER",$link);
179 $etpl->setVariable(
"LINK_EXPLORER_HEADER",$this->ctrl->getLinkTarget($this));
181 $etpl->setVariable(
"EXPLORER",$output);
182 $tpl->setLeftContent($etpl->get());;
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');
227 $s_mode = ($this->mode ==
"tree")
234 include_once
'Services/PersonalDesktop/classes/class.ilBookmarkAdministrationTableGUI.php';
236 $table->setId(
'bookmark_adm_table');
259 $table->setData($objects);
260 $this->tpl->setVariable(
"ADM_CONTENT", $table->getHTML());
270 $this->tpl->setCurrentBlock(
"begin_link");
271 $this->tpl->setVariable(
"LINK_TARGET", $link);
272 $this->tpl->parseCurrentBlock();
273 $this->tpl->touchBlock(
"end_link");
276 $this->tpl->setCurrentBlock(
"text");
277 $this->tpl->setVariable(
"TEXT_CONTENT", $val);
278 $this->tpl->parseCurrentBlock();
279 $this->tpl->setCurrentBlock(
"table_cell");
280 $this->tpl->parseCurrentBlock();
290 if (empty($this->
id))
295 if (!$this->tree->isInTree($this->id))
300 $this->tpl->addBlockFile(
"LOCATOR",
"locator",
"tpl.locator.html",
"Services/Locator");
302 $path = $this->tree->getPathFull($this->
id);
307 $this->tpl->setVariable(
"TXT_LOCATOR",$this->lng->txt(
"locator"));
308 $this->tpl->touchBlock(
"locator_separator");
309 $this->tpl->touchBlock(
"locator_item");
319 if (
$key < count($path)-$modifier)
321 $this->tpl->touchBlock(
"locator_separator");
324 $this->tpl->setCurrentBlock(
"locator_item");
326 $lng->txt(
"bookmarks") :
328 $this->tpl->setVariable(
"ITEM",
$title);
329 $this->ctrl->setParameter($this,
"bmf_id",
$row[
"child"]);
330 $this->tpl->setVariable(
"LINK_ITEM",
331 $this->ctrl->getLinkTarget($this));
332 $this->tpl->parseCurrentBlock();
335 $this->tpl->setCurrentBlock(
"locator");
337 $this->tpl->parseCurrentBlock();
364 if (!$this->tree->isInTree($this->id))
370 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
381 if (!$this->tree->isInTree($this->id))
386 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
388 $form->setTopAnchor(
"bookmark_top");
390 $form->setTitle($lng->txt(
"bookmark_folder_new"));
392 if ($action ==
'updateBookmarkFolder')
394 $ilCtrl->setParameter($this,
'bmf_id', $this->
id);
395 $ilCtrl->setParameter($this,
'obj_id',
$_GET[
"obj_id"]);
398 $hash = ($ilUser->prefs[
"screen_reader_optimization"])
402 $form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
404 $ilCtrl->clearParameters($this);
409 $form->addItem($prop);
412 $form->addCommandButton($action, $lng->txt(
'save'));
413 $form->addCommandButton(
'cancel', $lng->txt(
'cancel'));
424 $form->setValuesByArray
428 "title" => $this->
get_last(
"title", $bmf->getTitle()),
429 "obj_id" =>
$_GET[
"obj_id"],
432 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
444 if (!$this->tree->isInTree($this->id))
449 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
451 $form->setTopAnchor(
"bookmark_top");
453 $form->setTitle($lng->txt(
"bookmark_new"));
455 if ($action ==
'updateBookmark')
457 $ilCtrl->setParameter($this,
'bmf_id', $this->
id);
458 $ilCtrl->setParameter($this,
'obj_id',
$_GET[
"obj_id"]);
461 $hash = ($ilUser->prefs[
"screen_reader_optimization"])
465 $form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
466 $ilCtrl->clearParameters($this);
470 $prop->setRequired(
true);
471 $form->addItem($prop);
475 $form->addItem($prop);
478 $prop =
new ilTextInputGUI($lng->txt(
'bookmark_target'),
'target');
480 $prop->setRequired(
true);
481 $form->addItem($prop);
484 if (
$_GET[
'return_to'])
487 $prop->setValue(
$_GET[
'return_to']);
488 $form->addItem($prop);
491 if (
$_GET[
'return_to_url'])
492 $prop->setValue(
$_GET[
'return_to_url']);
494 $prop->setValue(
$_GET[
'bm_link']);
495 $form->addItem($prop);
499 $form->addCommandButton($action, $lng->txt(
'save'));
500 $form->addCommandButton(
'cancel', $lng->txt(
'cancel'));
523 if (!$this->tree->isInTree($this->id))
528 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
530 $form->setTopAnchor(
"bookmark_top");
531 $form->setTitle($lng->txt(
"bkm_import"));
537 $form->addCommandButton(
"importFile", $lng->txt(
'import'));
538 $form->addCommandButton(
'cancel', $lng->txt(
'cancel'));
549 $html1 = $form->getHTML();
551 if (!$_REQUEST[
"bm_link"])
554 $html2 =
"<br />" . $form2->getHTML();
556 $this->tpl->setVariable(
"ADM_CONTENT", $html1.$html2);
565 return (!empty(
$_POST[$a_var])) ?
576 if (!$this->tree->isInTree(
$_GET[
"obj_id"]))
582 $form->setValuesByArray
586 "title" => $bookmark->getTitle(),
587 "target" => $bookmark->getTarget(),
588 "description" => $bookmark->getDescription(),
589 "obj_id" =>
$_GET[
"obj_id"],
592 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
601 if (!$this->tree->isInTree($this->id))
607 if (empty(
$_POST[
"title"]))
617 $bmf->setParent($this->
id);
630 if (!$this->tree->isInTree(
$_GET[
"obj_id"]))
636 if (empty(
$_POST[
"title"]))
659 if (!$this->tree->isInTree($this->id))
665 if (empty(
$_POST[
"title"]))
670 else if (empty(
$_POST[
"target"]))
682 $bm->setParent($this->
id);
699 if (!$this->tree->isInTree(
$_GET[
"obj_id"]))
705 if (empty(
$_POST[
"title"]))
710 else if (empty(
$_POST[
"target"]))
736 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
739 foreach($bm_ids as
$id)
741 if ($this->tree->isInTree($id))
749 require_once (
"./Services/PersonalDesktop/classes/class.ilBookmarkImportExport.php");
751 $this->lng->txt(
"bookmarks_of").
" ".$this->ilias->account->getFullname());
759 return $html_content;
768 include_once
'classes/class.ilFileDataMail.php';
769 require_once
"Services/Mail/classes/class.ilFormatMail.php";
773 $html_content=$this->
export(
false);
775 $fp=fopen($tempfile,
'w');
776 fwrite($fp, $html_content);
779 $mfile->copyAttachmentFile($tempfile,
$filename);
780 $umail->savePostData($ilUser->getId(),array(
$filename),
794 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
797 $this->tpl->addBlockFile(
"ADM_CONTENT",
"objects",
"tpl.obj_confirm.html");
800 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
801 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
804 $cols = array(
"type",
"title");
805 foreach ($cols as
$key)
807 $this->tpl->setCurrentBlock(
"table_header");
808 $this->tpl->setVariable(
"TEXT",$this->lng->txt($key));
809 $this->tpl->parseCurrentBlock();
814 foreach($bm_ids as $obj_id)
818 if (!$this->tree->isInTree($obj_id))
826 $title = $BookmarkFolder->getTitle();
828 unset($BookmarkFolder);
833 $title = $Bookmark->getTitle();
834 $target = $Bookmark->getTarget();
840 $this->tpl->setCurrentBlock(
"table_cell");
842 $this->tpl->parseCurrentBlock();
845 $this->tpl->setCurrentBlock(
"table_cell");
852 $target,$this->textwidth,
true)));
854 $this->tpl->parseCurrentBlock();
857 $this->tpl->setCurrentBlock(
"table_row");
859 $this->tpl->parseCurrentBlock();
863 $buttons = array(
"cancel" => $this->lng->txt(
"cancel"),
864 "confirm" => $this->lng->txt(
"confirm"));
867 foreach($buttons as
$name => $value)
869 $this->tpl->setCurrentBlock(
"operation_btn");
870 $this->tpl->setVariable(
"BTN_NAME",
$name);
871 $this->tpl->setVariable(
"BTN_VALUE",$value);
872 $this->tpl->parseCurrentBlock();
881 session_unregister(
"saved_post");
893 global
$tree, $rbacsystem, $rbacadmin;
897 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
906 if ($this->tree->isInTree($id))
908 $node_data = $this->tree->getNodeData($id);
909 $subtree_nodes = $this->tree->getSubTree($node_data);
917 $this->tree->deleteTree($node_data);
920 foreach ($subtree_nodes as $node)
922 switch ($node[
"type"])
926 $BookmarkFolder->delete();
950 "delete"=>$this->lng->txt(
"delete"),
951 "export"=>$this->lng->txt(
"export"),
952 "sendmail"=>$this->lng->txt(
"bkm_sendmail"),
955 $subobj = array(
"bm",
"bmf");
957 if (is_array($subobj))
962 $this->tpl->setCurrentBlock(
"add_object");
963 $this->tpl->setVariable(
"COLUMN_COUNTS", 7);
964 $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
965 $this->tpl->setVariable(
"BTN_NAME",
"newForm");
966 $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"add"));
967 $this->tpl->parseCurrentBlock();
970 $this->tpl->setVariable(
"TPLPATH",$this->tpl->tplPath);
972 $this->tpl->setCurrentBlock(
"tbl_action_select");
974 $this->tpl->setVariable(
"BTN_NAME",
"executeAction");
975 $this->tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"execute"));
986 $this->tpl->parseCurrentBlock();
995 include_once(
"./Services/PersonalDesktop/classes/class.ilBookmarkBlockGUI.php");
998 return $bookmark_block_gui->getHTML();
1010 if (!$this->tree->isInTree($this->id))
1015 if ($_FILES[
"bkmfile"][
"error"] > UPLOAD_ERR_OK)
1021 require_once (
"./Services/PersonalDesktop/classes/class.ilBookmarkImportExport.php");
1023 if ($objects===
false)
1030 $num_create=array(
'bm'=>0,
'bmf'=>0);
1034 $num_create[
'bmf']));
1049 if (is_array($objects[$start_key]))
1051 foreach ($objects[$start_key] as $obj_key=>$object)
1053 switch ($object[
'type'])
1056 if (!$object[
"title"])
continue;
1057 if (!$object[
"target"])
continue;
1059 $bm->setTitle($object[
"title"]);
1060 $bm->setDescription($object[
"description"]);
1061 $bm->setTarget($object[
"target"]);
1062 $bm->setParent($folder_id);
1064 $num_create[
'bm']++;
1067 if (!$object[
"title"])
continue;
1069 $bmf->setTitle($object[
"title"]);
1070 $bmf->setParent($folder_id);
1072 $num_create[
'bmf']++;
1073 if (is_array($objects[$obj_key]))
1076 $bmf->getId(),$obj_key);