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());;
203 $this->tpl->setTitle($this->lng->txt(
"bookmarks"));
213 include_once(
"classes/class.ilFrameTargetInfo.php");
215 if ($this->
id > 0 && !$this->tree->isInTree($this->id))
217 $this->ctrl->setParameter($this,
'bmf_id',
'');
218 $this->ctrl->redirect($this);
222 $mtree->setTableNames(
'bookmark_tree',
'bookmark_data');
226 $s_mode = ($this->mode ==
"tree")
233 include_once
'Services/PersonalDesktop/classes/class.ilBookmarkAdministrationTableGUI.php';
235 $table->setId(
'bookmark_adm_table');
258 $table->setData($objects);
259 $this->tpl->setVariable(
"ADM_CONTENT", $table->getHTML());
269 $this->tpl->setCurrentBlock(
"begin_link");
270 $this->tpl->setVariable(
"LINK_TARGET", $link);
271 $this->tpl->parseCurrentBlock();
272 $this->tpl->touchBlock(
"end_link");
275 $this->tpl->setCurrentBlock(
"text");
276 $this->tpl->setVariable(
"TEXT_CONTENT", $val);
277 $this->tpl->parseCurrentBlock();
278 $this->tpl->setCurrentBlock(
"table_cell");
279 $this->tpl->parseCurrentBlock();
289 if (empty($this->
id))
294 if (!$this->tree->isInTree($this->id))
299 $this->tpl->addBlockFile(
"LOCATOR",
"locator",
"tpl.locator.html",
"Services/Locator");
301 $path = $this->tree->getPathFull($this->
id);
306 $this->tpl->setVariable(
"TXT_LOCATOR",$this->lng->txt(
"locator"));
307 $this->tpl->touchBlock(
"locator_separator");
308 $this->tpl->touchBlock(
"locator_item");
318 if ($key < count(
$path)-$modifier)
320 $this->tpl->touchBlock(
"locator_separator");
323 $this->tpl->setCurrentBlock(
"locator_item");
325 $lng->txt(
"bookmarks") :
327 $this->tpl->setVariable(
"ITEM",
$title);
328 $this->ctrl->setParameter($this,
"bmf_id",
$row[
"child"]);
329 $this->tpl->setVariable(
"LINK_ITEM",
330 $this->ctrl->getLinkTarget($this));
331 $this->tpl->parseCurrentBlock();
334 $this->tpl->setCurrentBlock(
"locator");
336 $this->tpl->parseCurrentBlock();
363 if (!$this->tree->isInTree($this->id))
365 $this->ctrl->setParameter($this,
'bmf_id',
'');
366 $this->ctrl->redirect($this);
370 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
381 if (!$this->tree->isInTree($this->id))
383 $this->ctrl->setParameter($this,
'bmf_id',
'');
384 $this->ctrl->redirect($this);
387 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
389 $form->setTopAnchor(
"bookmark_top");
391 $form->setTitle($lng->txt(
"bookmark_folder_new"));
393 if ($action ==
'updateBookmarkFolder')
395 $ilCtrl->setParameter($this,
'bmf_id', $this->
id);
396 $ilCtrl->setParameter($this,
'obj_id',
$_GET[
"obj_id"]);
399 $hash = ($ilUser->prefs[
"screen_reader_optimization"])
403 $form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
405 $ilCtrl->clearParameters($this);
410 $form->addItem($prop);
413 $form->addCommandButton($action, $lng->txt(
'save'));
414 $form->addCommandButton(
'cancel', $lng->txt(
'cancel'));
423 if(!$this->tree->isInTree(
$_GET[
"obj_id"]))
425 $this->ctrl->setParameter($this,
'bmf_id',
'');
426 $this->ctrl->setParameter($this,
'obj_id',
'');
427 $this->ctrl->redirect($this);
432 $form->setValuesByArray
436 "title" => $this->
get_last(
"title", $bmf->getTitle()),
437 "obj_id" =>
$_GET[
"obj_id"],
440 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
452 if (!$this->tree->isInTree($this->id))
454 $this->ctrl->setParameter($this,
'bmf_id',
'');
455 $this->ctrl->redirect($this);
458 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
460 $form->setTopAnchor(
"bookmark_top");
462 $form->setTitle($lng->txt(
"bookmark_new"));
464 if ($action ==
'updateBookmark')
466 $ilCtrl->setParameter($this,
'bmf_id', $this->
id);
467 $ilCtrl->setParameter($this,
'obj_id',
$_GET[
"obj_id"]);
470 $hash = ($ilUser->prefs[
"screen_reader_optimization"])
474 $form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
475 $ilCtrl->clearParameters($this);
479 $prop->setRequired(
true);
480 $form->addItem($prop);
484 $form->addItem($prop);
487 $prop =
new ilTextInputGUI($lng->txt(
'bookmark_target'),
'target');
489 $prop->setRequired(
true);
490 $form->addItem($prop);
493 if (
$_GET[
'return_to'])
496 $prop->setValue(
$_GET[
'return_to']);
497 $form->addItem($prop);
500 if (
$_GET[
'return_to_url'])
501 $prop->setValue(
$_GET[
'return_to_url']);
503 $prop->setValue(
$_GET[
'bm_link']);
504 $form->addItem($prop);
508 $form->addCommandButton($action, $lng->txt(
'save'));
509 $form->addCommandButton(
'cancel', $lng->txt(
'cancel'));
532 if (!$this->tree->isInTree($this->id))
534 $this->ctrl->setParameter($this,
'bmf_id',
'');
535 $this->ctrl->redirect($this);
538 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
540 $form->setTopAnchor(
"bookmark_top");
541 $form->setTitle($lng->txt(
"bkm_import"));
547 $form->addCommandButton(
"importFile", $lng->txt(
'import'));
548 $form->addCommandButton(
'cancel', $lng->txt(
'cancel'));
559 $html1 = $form->getHTML();
564 $html2 =
"<br />" . $form2->getHTML();
566 $this->tpl->setVariable(
"ADM_CONTENT", $html1.$html2);
575 return (!empty(
$_POST[$a_var])) ?
586 if (!$this->tree->isInTree(
$_GET[
"obj_id"]))
588 $this->ctrl->setParameter($this,
'bmf_id',
'');
589 $this->ctrl->setParameter($this,
'obj_id',
'');
590 $this->ctrl->redirect($this);
594 $form->setValuesByArray
598 "title" => $bookmark->getTitle(),
599 "target" => $bookmark->getTarget(),
600 "description" => $bookmark->getDescription(),
601 "obj_id" =>
$_GET[
"obj_id"],
604 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
613 if (!$this->tree->isInTree($this->id))
615 $this->ctrl->setParameter($this,
'bmf_id',
'');
616 $this->ctrl->redirect($this);
620 if (empty(
$_POST[
"title"]))
630 $bmf->setParent($this->
id);
634 $ilCtrl->saveParameter($this,
'bmf_id');
635 $ilCtrl->redirect($this,
'view');
645 if (!$this->tree->isInTree(
$_GET[
"obj_id"]))
647 $this->ctrl->setParameter($this,
'bmf_id',
'');
648 $this->ctrl->setParameter($this,
'obj_id',
'');
649 $this->ctrl->redirect($this);
653 if (empty(
$_POST[
"title"]))
666 $ilCtrl->saveParameter($this,
'bmf_id');
667 $ilCtrl->redirect($this,
'view');
678 if (!$this->tree->isInTree($this->id))
680 $this->ctrl->setParameter($this,
'bmf_id',
'');
681 $this->ctrl->redirect($this);
685 if (empty(
$_POST[
"title"]))
690 else if (empty(
$_POST[
"target"]))
702 $bm->setParent($this->
id);
710 $ilCtrl->saveParameter($this,
'bmf_id');
711 $ilCtrl->redirect($this,
'view');
721 if (!$this->tree->isInTree(
$_GET[
"obj_id"]))
723 $this->ctrl->setParameter($this,
'bmf_id',
'');
724 $this->ctrl->setParameter($this,
'obj_id',
'');
725 $this->ctrl->redirect($this);
729 if (empty(
$_POST[
"title"]))
734 else if (empty(
$_POST[
"target"]))
760 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
763 foreach($bm_ids as
$id)
765 if ($this->tree->isInTree($id))
773 require_once (
"./Services/PersonalDesktop/classes/class.ilBookmarkImportExport.php");
775 $this->lng->txt(
"bookmarks_of").
" ".$this->ilias->account->getFullname());
783 return $html_content;
792 include_once
'classes/class.ilFileDataMail.php';
793 require_once
"Services/Mail/classes/class.ilFormatMail.php";
797 $html_content=$this->
export(
false);
799 $fp=fopen($tempfile,
'w');
800 fwrite($fp, $html_content);
803 $mfile->copyAttachmentFile($tempfile,
$filename);
804 $umail->savePostData($ilUser->getId(),array(
$filename),
809 require_once
'Services/Mail/classes/class.ilMailFormCall.php';
820 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
823 $this->tpl->addBlockFile(
"ADM_CONTENT",
"objects",
"tpl.obj_confirm.html");
826 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
827 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
830 $cols = array(
"type",
"title");
831 foreach ($cols as $key)
833 $this->tpl->setCurrentBlock(
"table_header");
834 $this->tpl->setVariable(
"TEXT",$this->lng->txt($key));
835 $this->tpl->parseCurrentBlock();
840 foreach($bm_ids as $obj_id)
844 if (!$this->tree->isInTree($obj_id))
852 $title = $BookmarkFolder->getTitle();
854 unset($BookmarkFolder);
859 $title = $Bookmark->getTitle();
860 $target = $Bookmark->getTarget();
866 $this->tpl->setCurrentBlock(
"table_cell");
868 $this->tpl->parseCurrentBlock();
871 $this->tpl->setCurrentBlock(
"table_cell");
878 $target,$this->textwidth,
true)));
880 $this->tpl->parseCurrentBlock();
883 $this->tpl->setCurrentBlock(
"table_row");
885 $this->tpl->parseCurrentBlock();
889 $buttons = array(
"cancel" => $this->lng->txt(
"cancel"),
890 "confirm" => $this->lng->txt(
"confirm"));
893 foreach($buttons as $name => $value)
895 $this->tpl->setCurrentBlock(
"operation_btn");
896 $this->tpl->setVariable(
"BTN_NAME",$name);
897 $this->tpl->setVariable(
"BTN_VALUE",$value);
898 $this->tpl->parseCurrentBlock();
907 session_unregister(
"saved_post");
919 global
$tree, $rbacsystem, $rbacadmin;
923 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
932 if ($this->tree->isInTree($id))
934 $node_data = $this->tree->getNodeData($id);
935 $subtree_nodes = $this->tree->getSubTree($node_data);
943 $this->tree->deleteTree($node_data);
946 foreach ($subtree_nodes as $node)
948 switch ($node[
"type"])
952 $BookmarkFolder->delete();
976 "delete"=>$this->lng->txt(
"delete"),
977 "export"=>$this->lng->txt(
"export"),
978 "sendmail"=>$this->lng->txt(
"bkm_sendmail"),
981 $subobj = array(
"bm",
"bmf");
983 if (is_array($subobj))
988 $this->tpl->setCurrentBlock(
"add_object");
989 $this->tpl->setVariable(
"COLUMN_COUNTS", 7);
990 $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
991 $this->tpl->setVariable(
"BTN_NAME",
"newForm");
992 $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"add"));
993 $this->tpl->parseCurrentBlock();
996 $this->tpl->setVariable(
"TPLPATH",$this->tpl->tplPath);
998 $this->tpl->setCurrentBlock(
"tbl_action_select");
1000 $this->tpl->setVariable(
"BTN_NAME",
"executeAction");
1001 $this->tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"execute"));
1012 $this->tpl->parseCurrentBlock();
1021 include_once(
"./Services/PersonalDesktop/classes/class.ilBookmarkBlockGUI.php");
1024 return $bookmark_block_gui->getHTML();
1036 if (!$this->tree->isInTree($this->id))
1038 $this->ctrl->setParameter($this,
'bmf_id',
'');
1039 $this->ctrl->redirect($this);
1042 if ($_FILES[
"bkmfile"][
"error"] > UPLOAD_ERR_OK)
1048 require_once (
"./Services/PersonalDesktop/classes/class.ilBookmarkImportExport.php");
1050 if ($objects===
false)
1057 $num_create=array(
'bm'=>0,
'bmf'=>0);
1061 $num_create[
'bmf']));
1076 if (is_array($objects[$start_key]))
1078 foreach ($objects[$start_key] as $obj_key=>$object)
1080 switch ($object[
'type'])
1083 if (!$object[
"title"])
continue;
1084 if (!$object[
"target"])
continue;
1086 $bm->setTitle($object[
"title"]);
1087 $bm->setDescription($object[
"description"]);
1088 $bm->setTarget($object[
"target"]);
1089 $bm->setParent($folder_id);
1091 $num_create[
'bm']++;
1094 if (!$object[
"title"])
continue;
1096 $bmf->setTitle($object[
"title"]);
1097 $bmf->setParent($folder_id);
1099 $num_create[
'bmf']++;
1100 if (is_array($objects[$obj_key]))
1103 $bmf->getId(),$obj_key);