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();
169 $etpl->setVariable(
"TXT_EXPLORER_HEADER", $this->lng->txt(
"bookmarks"));
170 $this->ctrl->setParameter($this,
"bmf_id", 1);
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();
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),
785 require_once
'Services/Mail/classes/class.ilMailFormCall.php';
796 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
799 $this->tpl->addBlockFile(
"ADM_CONTENT",
"objects",
"tpl.obj_confirm.html");
802 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
803 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
806 $cols = array(
"type",
"title");
807 foreach ($cols as $key)
809 $this->tpl->setCurrentBlock(
"table_header");
810 $this->tpl->setVariable(
"TEXT",$this->lng->txt($key));
811 $this->tpl->parseCurrentBlock();
816 foreach($bm_ids as $obj_id)
820 if (!$this->tree->isInTree($obj_id))
828 $title = $BookmarkFolder->getTitle();
830 unset($BookmarkFolder);
835 $title = $Bookmark->getTitle();
836 $target = $Bookmark->getTarget();
842 $this->tpl->setCurrentBlock(
"table_cell");
844 $this->tpl->parseCurrentBlock();
847 $this->tpl->setCurrentBlock(
"table_cell");
854 $target,$this->textwidth,
true)));
856 $this->tpl->parseCurrentBlock();
859 $this->tpl->setCurrentBlock(
"table_row");
861 $this->tpl->parseCurrentBlock();
865 $buttons = array(
"cancel" => $this->lng->txt(
"cancel"),
866 "confirm" => $this->lng->txt(
"confirm"));
869 foreach($buttons as
$name => $value)
871 $this->tpl->setCurrentBlock(
"operation_btn");
872 $this->tpl->setVariable(
"BTN_NAME",
$name);
873 $this->tpl->setVariable(
"BTN_VALUE",$value);
874 $this->tpl->parseCurrentBlock();
883 session_unregister(
"saved_post");
895 global
$tree, $rbacsystem, $rbacadmin;
899 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
908 if ($this->tree->isInTree($id))
910 $node_data = $this->tree->getNodeData($id);
911 $subtree_nodes = $this->tree->getSubTree($node_data);
919 $this->tree->deleteTree($node_data);
922 foreach ($subtree_nodes as $node)
924 switch ($node[
"type"])
928 $BookmarkFolder->delete();
952 "delete"=>$this->lng->txt(
"delete"),
953 "export"=>$this->lng->txt(
"export"),
954 "sendmail"=>$this->lng->txt(
"bkm_sendmail"),
957 $subobj = array(
"bm",
"bmf");
959 if (is_array($subobj))
964 $this->tpl->setCurrentBlock(
"add_object");
965 $this->tpl->setVariable(
"COLUMN_COUNTS", 7);
966 $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
967 $this->tpl->setVariable(
"BTN_NAME",
"newForm");
968 $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"add"));
969 $this->tpl->parseCurrentBlock();
972 $this->tpl->setVariable(
"TPLPATH",$this->tpl->tplPath);
974 $this->tpl->setCurrentBlock(
"tbl_action_select");
976 $this->tpl->setVariable(
"BTN_NAME",
"executeAction");
977 $this->tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"execute"));
988 $this->tpl->parseCurrentBlock();
997 include_once(
"./Services/PersonalDesktop/classes/class.ilBookmarkBlockGUI.php");
1000 return $bookmark_block_gui->getHTML();
1012 if (!$this->tree->isInTree($this->id))
1017 if ($_FILES[
"bkmfile"][
"error"] > UPLOAD_ERR_OK)
1023 require_once (
"./Services/PersonalDesktop/classes/class.ilBookmarkImportExport.php");
1025 if ($objects===
false)
1032 $num_create=array(
'bm'=>0,
'bmf'=>0);
1036 $num_create[
'bmf']));
1051 if (is_array($objects[$start_key]))
1053 foreach ($objects[$start_key] as $obj_key=>$object)
1055 switch ($object[
'type'])
1058 if (!$object[
"title"])
continue;
1059 if (!$object[
"target"])
continue;
1061 $bm->setTitle($object[
"title"]);
1062 $bm->setDescription($object[
"description"]);
1063 $bm->setTarget($object[
"target"]);
1064 $bm->setParent($folder_id);
1066 $num_create[
'bm']++;
1069 if (!$object[
"title"])
continue;
1071 $bmf->setTitle($object[
"title"]);
1072 $bmf->setParent($folder_id);
1074 $num_create[
'bmf']++;
1075 if (is_array($objects[$obj_key]))
1078 $bmf->getId(),$obj_key);