5 require_once (
"./Services/Bookmarks/classes/class.ilBookmarkFolder.php");
6 require_once (
"./Services/Bookmarks/classes/class.ilBookmark.php");
7 require_once (
"./Services/Table/classes/class.ilTableGUI.php");
53 $tpl->getStandardTemplate();
57 $this->
id = (empty(
$_GET[
"bmf_id"]))
66 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
67 $this->user_id = $ilUser->getId();
69 $this->tree =
new ilTree($this->user_id);
70 $this->tree->setTableNames(
'bookmark_tree',
'bookmark_data');
71 $this->root_id = $this->tree->readRootId();
81 $next_class = $this->ctrl->getNextClass();
86 $cmd = $this->ctrl->getCmd(
"view");
95 $this->tpl->show(
true);
101 switch(
$_POST[
"selected_cmd"])
135 include_once(
"./Services/Bookmarks/classes/class.ilBookmarkExplorerGUI.php");
137 if (!$exp->handleCommand())
139 $tpl->setLeftNavContent($exp->getHTML());
159 $this->tpl->setTitle($this->lng->txt(
"bookmarks"));
169 if($this->
id > 0 && !$this->tree->isInTree($this->id))
171 $this->ctrl->setParameter($this,
'bmf_id',
'');
172 $this->ctrl->redirect($this);
175 $ilToolbar->addButton($this->lng->txt(
"bookmark_new"),
176 $this->ctrl->getLinkTarget($this,
"newFormBookmark"));
177 $ilToolbar->addButton($this->lng->txt(
"bookmark_folder_new"),
178 $this->ctrl->getLinkTarget($this,
"newFormBookmarkFolder"));
182 include_once
'Services/Bookmarks/classes/class.ilBookmarkAdministrationTableGUI.php';
184 $table->setId(
'bookmark_adm_table');
185 $table->setData($objects);
186 $this->tpl->setVariable(
"ADM_CONTENT", $table->getHTML());
196 $this->tpl->setCurrentBlock(
"begin_link");
197 $this->tpl->setVariable(
"LINK_TARGET", $link);
198 $this->tpl->parseCurrentBlock();
199 $this->tpl->touchBlock(
"end_link");
202 $this->tpl->setCurrentBlock(
"text");
203 $this->tpl->setVariable(
"TEXT_CONTENT", $val);
204 $this->tpl->parseCurrentBlock();
205 $this->tpl->setCurrentBlock(
"table_cell");
206 $this->tpl->parseCurrentBlock();
221 if(!$this->tree->isInTree($this->id))
226 $this->tpl->addBlockFile(
"LOCATOR",
"locator",
"tpl.locator.html",
"Services/Locator");
228 $path = $this->tree->getPathFull($this->
id);
233 $this->tpl->setVariable(
"TXT_LOCATOR", $this->lng->txt(
"locator"));
234 $this->tpl->touchBlock(
"locator_separator");
235 $this->tpl->touchBlock(
"locator_item");
245 if($key < count(
$path) - $modifier)
247 $this->tpl->touchBlock(
"locator_separator");
250 $this->tpl->setCurrentBlock(
"locator_item");
251 $title = (
$row[
"child"] == 1) ?
252 $lng->txt(
"bookmarks") :
254 $this->tpl->setVariable(
"ITEM", $title);
255 $this->ctrl->setParameter($this,
"bmf_id",
$row[
"child"]);
256 $this->tpl->setVariable(
"LINK_ITEM",
257 $this->ctrl->getLinkTarget($this));
258 $this->tpl->parseCurrentBlock();
261 $this->tpl->setCurrentBlock(
"locator");
263 $this->tpl->parseCurrentBlock();
290 if(!$this->tree->isInTree($this->id))
292 $this->ctrl->setParameter($this,
'bmf_id',
'');
293 $this->ctrl->redirect($this);
297 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
308 if(!$this->tree->isInTree($this->id))
310 $this->ctrl->setParameter($this,
'bmf_id',
'');
311 $this->ctrl->redirect($this);
314 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
316 $form->setTopAnchor(
"bookmark_top");
318 $form->setTitle($lng->txt(
"bookmark_folder_new"));
320 if($action ==
'updateBookmarkFolder')
322 $ilCtrl->setParameter($this,
'bmf_id', $this->
id);
323 $ilCtrl->setParameter($this,
'obj_id',
$_GET[
"obj_id"]);
326 $hash = ($ilUser->prefs[
"screen_reader_optimization"])
330 $form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
332 $ilCtrl->clearParameters($this);
337 $form->addItem($prop);
340 $form->addCommandButton($action, $lng->txt(
'save'));
341 $form->addCommandButton(
'cancel', $lng->txt(
'cancel'));
350 if(!$this->tree->isInTree(
$_GET[
"obj_id"]))
352 $this->ctrl->setParameter($this,
'bmf_id',
'');
353 $this->ctrl->setParameter($this,
'obj_id',
'');
354 $this->ctrl->redirect($this);
359 $form->setValuesByArray
363 "title" => $this->
get_last(
"title", $bmf->getTitle()),
364 "obj_id" =>
$_GET[
"obj_id"],
367 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
379 if(!$this->tree->isInTree($this->id))
381 $this->ctrl->setParameter($this,
'bmf_id',
'');
382 $this->ctrl->redirect($this);
385 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
387 $form->setTopAnchor(
"bookmark_top");
389 $form->setTitle($lng->txt(
"bookmark_new"));
391 if($action ==
'updateBookmark')
393 $ilCtrl->setParameter($this,
'bmf_id', $this->
id);
394 $ilCtrl->setParameter($this,
'obj_id',
$_GET[
"obj_id"]);
397 $hash = ($ilUser->prefs[
"screen_reader_optimization"])
401 $form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
402 $ilCtrl->clearParameters($this);
406 $prop->setRequired(
true);
407 $form->addItem($prop);
411 $form->addItem($prop);
414 $prop =
new ilTextInputGUI($lng->txt(
'bookmark_target'),
'target');
416 $prop->setRequired(
true);
417 $form->addItem($prop);
420 if(
$_GET[
'return_to'])
423 $prop->setValue(
$_GET[
'return_to']);
424 $form->addItem($prop);
427 if(
$_GET[
'return_to_url'])
428 $prop->setValue(
$_GET[
'return_to_url']);
430 $prop->setValue(
$_GET[
'bm_link']);
431 $form->addItem($prop);
435 $form->addCommandButton($action, $lng->txt(
'save'));
436 $form->addCommandButton(
'cancel', $lng->txt(
'cancel'));
459 if(!$this->tree->isInTree($this->id))
461 $this->ctrl->setParameter($this,
'bmf_id',
'');
462 $this->ctrl->redirect($this);
465 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
467 $form->setFormAction($ilCtrl->getFormAction($this,
"importFile"));
468 $form->setTopAnchor(
"bookmark_top");
469 $form->setTitle($lng->txt(
"bkm_import"));
475 $form->addCommandButton(
"importFile", $lng->txt(
'import'));
476 $form->addCommandButton(
'cancel', $lng->txt(
'cancel'));
487 $html1 = $form->getHTML();
492 $html2 =
"<br />" . $form2->getHTML();
494 $this->tpl->setVariable(
"ADM_CONTENT", $html1 . $html2);
503 return (!empty(
$_POST[$a_var])) ?
515 if(!$this->tree->isInTree(
$_GET[
"obj_id"]))
517 $this->ctrl->setParameter($this,
'obj_id',
'');
518 $this->ctrl->setParameter($this,
'bmf_id',
'');
519 $this->ctrl->redirect($this);
524 $form->setValuesByArray
528 "title" => $bookmark->getTitle(),
529 "target" => $bookmark->getTarget(),
530 "description" => $bookmark->getDescription(),
531 "obj_id" =>
$_GET[
"obj_id"],
534 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
543 if(!$this->tree->isInTree($this->id))
545 $this->ctrl->setParameter($this,
'bmf_id',
'');
546 $this->ctrl->redirect($this);
550 if(empty(
$_POST[
"title"]))
560 $bmf->setParent($this->
id);
564 $ilCtrl->saveParameter($this,
'bmf_id');
565 $ilCtrl->redirect($this,
'view');
575 if(!$this->tree->isInTree(
$_GET[
"obj_id"]))
577 $this->ctrl->setParameter($this,
'obj_id',
'');
578 $this->ctrl->setParameter($this,
'bmf_id',
'');
579 $this->ctrl->redirect($this);
583 if(empty(
$_POST[
"title"]))
596 $ilCtrl->saveParameter($this,
'bmf_id');
597 $ilCtrl->redirect($this,
'view');
609 if(!$this->tree->isInTree($this->id))
611 $this->ctrl->setParameter($this,
'bmf_id',
'');
612 $this->ctrl->redirect($this);
616 if(empty(
$_POST[
"title"]))
621 else if(empty(
$_POST[
"target"]))
633 $bm->setParent($this->
id);
642 $ilCtrl->saveParameter($this,
'bmf_id');
643 $ilCtrl->redirect($this,
'view');
653 if(!$this->tree->isInTree(
$_GET[
"obj_id"]))
655 $this->ctrl->setParameter($this,
'obj_id',
'');
656 $this->ctrl->setParameter($this,
'bmf_id',
'');
657 $this->ctrl->redirect($this);
661 if(empty(
$_POST[
"title"]))
666 else if(empty(
$_POST[
"target"]))
692 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"), $this->ilias->error_obj->MESSAGE);
694 $export_ids = array();
695 foreach($bm_ids as
$id)
697 if($this->tree->isInTree($id))
705 require_once (
"./Services/Bookmarks/classes/class.ilBookmarkImportExport.php");
707 $this->lng->txt(
"bookmarks_of") .
" " . $this->ilias->account->getFullname());
715 return $html_content;
725 include_once
'./Services/Mail/classes/class.ilFileDataMail.php';
726 require_once
"Services/Mail/classes/class.ilFormatMail.php";
730 $html_content = $this->
export(
false);
732 $fp = fopen($tempfile,
'w');
733 fwrite($fp, $html_content);
736 $mfile->copyAttachmentFile($tempfile,
$filename);
737 $umail->savePostData($ilUser->getId(), array(
$filename),
742 require_once
'Services/Mail/classes/class.ilMailFormCall.php';
754 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"), $this->ilias->error_obj->MESSAGE);
757 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
760 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
762 $cgui->setFormAction($this->ctrl->getFormAction($this));
763 $cgui->setHeaderText($this->lng->txt(
"info_delete_sure"));
764 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancel");
765 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirm");
767 foreach($bm_ids as $obj_id)
771 if(!$this->tree->isInTree($obj_id))
780 $title = $BookmarkFolder->getTitle();
782 unset($BookmarkFolder);
787 $title = $Bookmark->getTitle();
788 $target = $Bookmark->getTarget();
800 $cgui->addItem(
"id[]", $obj_id, $caption);
803 $this->tpl->setContent($cgui->getHTML());
822 global
$tree, $rbacsystem, $rbacadmin;
826 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"), $this->ilias->error_obj->MESSAGE);
835 if($this->tree->isInTree($id))
837 $node_data = $this->tree->getNodeData($id);
838 $subtree_nodes = $this->tree->getSubTree($node_data);
846 $this->tree->deleteTree($node_data);
849 foreach($subtree_nodes as $node)
851 switch($node[
"type"])
855 $BookmarkFolder->delete();
879 "delete" => $this->lng->txt(
"delete"),
880 "export" => $this->lng->txt(
"export"),
881 "sendmail"=> $this->lng->txt(
"bkm_sendmail"),
884 $subobj = array(
"bm",
"bmf");
886 if(is_array($subobj))
891 $this->tpl->setCurrentBlock(
"add_object");
892 $this->tpl->setVariable(
"COLUMN_COUNTS", 7);
893 $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
894 $this->tpl->setVariable(
"BTN_NAME",
"newForm");
895 $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"add"));
896 $this->tpl->parseCurrentBlock();
899 $this->tpl->setVariable(
"TPLPATH", $this->tpl->tplPath);
901 $this->tpl->setCurrentBlock(
"tbl_action_select");
902 $this->tpl->setVariable(
"SELECT_ACTION",
ilUtil::formSelect(
$_SESSION[
"error_post_vars"][
'action'],
"action", $actions,
false,
true));
903 $this->tpl->setVariable(
"BTN_NAME",
"executeAction");
904 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"execute"));
915 $this->tpl->parseCurrentBlock();
924 include_once(
"./Services/Bookmarks/classes/class.ilBookmarkBlockGUI.php");
927 return $bookmark_block_gui->getHTML();
938 if(!$this->tree->isInTree($this->id))
940 $this->ctrl->setParameter($this,
'bmf_id',
'');
941 $this->ctrl->redirect($this);
944 if($_FILES[
"bkmfile"][
"error"] > UPLOAD_ERR_OK)
950 require_once (
"./Services/Bookmarks/classes/class.ilBookmarkImportExport.php");
952 if($objects ===
false)
959 $num_create = array(
'bm'=> 0,
'bmf'=> 0);
963 $num_create[
'bmf']));
979 if(is_array($objects[$start_key]))
981 foreach($objects[$start_key] as $obj_key=> $object)
983 switch($object[
'type'])
986 if(!$object[
"title"])
continue;
987 if(!$object[
"target"])
continue;
989 $bm->setTitle($object[
"title"]);
990 $bm->setDescription($object[
"description"]);
991 $bm->setTarget($object[
"target"]);
992 $bm->setParent($folder_id);
997 if(!$object[
"title"])
continue;
999 $bmf->setTitle($object[
"title"]);
1000 $bmf->setParent($folder_id);
1002 $num_create[
'bmf']++;
1003 if(is_array($objects[$obj_key]))
1006 $bmf->getId(), $obj_key);
1019 if(!$bm_ids &&
$_GET[
"bm_id_tgt"] ==
"")
1022 return $this->
view();
1025 $ilTabs->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTarget($this));
1027 $this->ctrl->setParameter($this,
"bm_id_tgt",
$_GET[
"bm_id_tgt"] ?
$_GET[
"bm_id_tgt"] : implode(
";", $bm_ids));
1029 include_once(
"./Services/Bookmarks/classes/class.ilBookmarkMoveExplorerGUI.php");
1031 if (!$exp->handleCommand())
1033 $this->mode =
"flat";
1034 $this->tpl->setContent($exp->getHTML());
1043 $bm_ids = explode(
";",
$_REQUEST[
'bm_id_tgt']);
1044 if(!$bm_ids || !$tgt)
1047 return $this->
view();
1051 $tree->setTableNames(
'bookmark_tree',
'bookmark_data');
1053 $tgt_node =
$tree->getNodeData($tgt);
1056 foreach($bm_ids as $node_id)
1058 if(
$tree->isGrandChild($node_id, $tgt))
1061 $this->ctrl->redirect($this,
"view");
1064 $node =
$tree->getNodeData($node_id);
1067 if($node[
"parent"] == $tgt)
1072 $tree->moveTree($node_id, $tgt);
1076 $this->ctrl->setParameter($this,
"bmf_id", $tgt);
1077 $this->ctrl->redirect($this,
"view");