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());
161 $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);
177 include_once
'Services/Bookmarks/classes/class.ilBookmarkAdministrationTableGUI.php';
179 $table->setId(
'bookmark_adm_table');
180 $table->setData($objects);
181 $this->tpl->setVariable(
"ADM_CONTENT", $table->getHTML());
191 $this->tpl->setCurrentBlock(
"begin_link");
192 $this->tpl->setVariable(
"LINK_TARGET", $link);
193 $this->tpl->parseCurrentBlock();
194 $this->tpl->touchBlock(
"end_link");
197 $this->tpl->setCurrentBlock(
"text");
198 $this->tpl->setVariable(
"TEXT_CONTENT", $val);
199 $this->tpl->parseCurrentBlock();
200 $this->tpl->setCurrentBlock(
"table_cell");
201 $this->tpl->parseCurrentBlock();
216 if(!$this->tree->isInTree($this->id))
221 $this->tpl->addBlockFile(
"LOCATOR",
"locator",
"tpl.locator.html",
"Services/Locator");
223 $path = $this->tree->getPathFull($this->
id);
228 $this->tpl->setVariable(
"TXT_LOCATOR", $this->lng->txt(
"locator"));
229 $this->tpl->touchBlock(
"locator_separator");
230 $this->tpl->touchBlock(
"locator_item");
240 if($key < count(
$path) - $modifier)
242 $this->tpl->touchBlock(
"locator_separator");
245 $this->tpl->setCurrentBlock(
"locator_item");
246 $title = (
$row[
"child"] == 1) ?
247 $lng->txt(
"bookmarks") :
249 $this->tpl->setVariable(
"ITEM", $title);
250 $this->ctrl->setParameter($this,
"bmf_id",
$row[
"child"]);
251 $this->tpl->setVariable(
"LINK_ITEM",
252 $this->ctrl->getLinkTarget($this));
253 $this->tpl->parseCurrentBlock();
256 $this->tpl->setCurrentBlock(
"locator");
258 $this->tpl->parseCurrentBlock();
285 if(!$this->tree->isInTree($this->id))
287 $this->ctrl->setParameter($this,
'bmf_id',
'');
288 $this->ctrl->redirect($this);
292 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
303 if(!$this->tree->isInTree($this->id))
305 $this->ctrl->setParameter($this,
'bmf_id',
'');
306 $this->ctrl->redirect($this);
309 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
311 $form->setTopAnchor(
"bookmark_top");
313 $form->setTitle($lng->txt(
"bookmark_folder_new"));
315 if($action ==
'updateBookmarkFolder')
317 $ilCtrl->setParameter($this,
'bmf_id', $this->
id);
318 $ilCtrl->setParameter($this,
'obj_id',
$_GET[
"obj_id"]);
321 $hash = ($ilUser->prefs[
"screen_reader_optimization"])
325 $form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
327 $ilCtrl->clearParameters($this);
332 $form->addItem($prop);
335 $form->addCommandButton($action, $lng->txt(
'save'));
336 $form->addCommandButton(
'cancel', $lng->txt(
'cancel'));
345 if(!$this->tree->isInTree(
$_GET[
"obj_id"]))
347 $this->ctrl->setParameter($this,
'bmf_id',
'');
348 $this->ctrl->setParameter($this,
'obj_id',
'');
349 $this->ctrl->redirect($this);
354 $form->setValuesByArray
358 "title" => $this->
get_last(
"title", $bmf->getTitle()),
359 "obj_id" =>
$_GET[
"obj_id"],
362 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
374 if(!$this->tree->isInTree($this->id))
376 $this->ctrl->setParameter($this,
'bmf_id',
'');
377 $this->ctrl->redirect($this);
380 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
382 $form->setTopAnchor(
"bookmark_top");
384 $form->setTitle($lng->txt(
"bookmark_new"));
386 if($action ==
'updateBookmark')
388 $ilCtrl->setParameter($this,
'bmf_id', $this->
id);
389 $ilCtrl->setParameter($this,
'obj_id',
$_GET[
"obj_id"]);
392 $hash = ($ilUser->prefs[
"screen_reader_optimization"])
396 $form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
397 $ilCtrl->clearParameters($this);
401 $prop->setRequired(
true);
402 $form->addItem($prop);
406 $form->addItem($prop);
409 $prop =
new ilTextInputGUI($lng->txt(
'bookmark_target'),
'target');
411 $prop->setRequired(
true);
412 $form->addItem($prop);
415 if(
$_GET[
'return_to'])
418 $prop->setValue(
$_GET[
'return_to']);
419 $form->addItem($prop);
422 if(
$_GET[
'return_to_url'])
423 $prop->setValue(
$_GET[
'return_to_url']);
425 $prop->setValue(
$_GET[
'bm_link']);
426 $form->addItem($prop);
430 $form->addCommandButton($action, $lng->txt(
'save'));
431 $form->addCommandButton(
'cancel', $lng->txt(
'cancel'));
454 if(!$this->tree->isInTree($this->id))
456 $this->ctrl->setParameter($this,
'bmf_id',
'');
457 $this->ctrl->redirect($this);
460 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
462 $form->setFormAction($ilCtrl->getFormAction($this,
"importFile"));
463 $form->setTopAnchor(
"bookmark_top");
464 $form->setTitle($lng->txt(
"bkm_import"));
470 $form->addCommandButton(
"importFile", $lng->txt(
'import'));
471 $form->addCommandButton(
'cancel', $lng->txt(
'cancel'));
482 $html1 = $form->getHTML();
487 $html2 =
"<br />" . $form2->getHTML();
489 $this->tpl->setVariable(
"ADM_CONTENT", $html1 . $html2);
498 return (!empty(
$_POST[$a_var])) ?
510 if(!$this->tree->isInTree(
$_GET[
"obj_id"]))
512 $this->ctrl->setParameter($this,
'obj_id',
'');
513 $this->ctrl->setParameter($this,
'bmf_id',
'');
514 $this->ctrl->redirect($this);
519 $form->setValuesByArray
523 "title" => $bookmark->getTitle(),
524 "target" => $bookmark->getTarget(),
525 "description" => $bookmark->getDescription(),
526 "obj_id" =>
$_GET[
"obj_id"],
529 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
538 if(!$this->tree->isInTree($this->id))
540 $this->ctrl->setParameter($this,
'bmf_id',
'');
541 $this->ctrl->redirect($this);
545 if(empty(
$_POST[
"title"]))
555 $bmf->setParent($this->
id);
559 $ilCtrl->saveParameter($this,
'bmf_id');
560 $ilCtrl->redirect($this,
'view');
570 if(!$this->tree->isInTree(
$_GET[
"obj_id"]))
572 $this->ctrl->setParameter($this,
'obj_id',
'');
573 $this->ctrl->setParameter($this,
'bmf_id',
'');
574 $this->ctrl->redirect($this);
578 if(empty(
$_POST[
"title"]))
591 $ilCtrl->saveParameter($this,
'bmf_id');
592 $ilCtrl->redirect($this,
'view');
604 if(!$this->tree->isInTree($this->id))
606 $this->ctrl->setParameter($this,
'bmf_id',
'');
607 $this->ctrl->redirect($this);
611 if(empty(
$_POST[
"title"]))
616 else if(empty(
$_POST[
"target"]))
628 $bm->setParent($this->
id);
637 $ilCtrl->saveParameter($this,
'bmf_id');
638 $ilCtrl->redirect($this,
'view');
648 if(!$this->tree->isInTree(
$_GET[
"obj_id"]))
650 $this->ctrl->setParameter($this,
'obj_id',
'');
651 $this->ctrl->setParameter($this,
'bmf_id',
'');
652 $this->ctrl->redirect($this);
656 if(empty(
$_POST[
"title"]))
661 else if(empty(
$_POST[
"target"]))
687 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"), $this->ilias->error_obj->MESSAGE);
689 $export_ids = array();
690 foreach($bm_ids as
$id)
692 if($this->tree->isInTree($id))
700 require_once (
"./Services/Bookmarks/classes/class.ilBookmarkImportExport.php");
702 $this->lng->txt(
"bookmarks_of") .
" " . $this->ilias->account->getFullname());
710 return $html_content;
720 include_once
'./Services/Mail/classes/class.ilFileDataMail.php';
721 require_once
"Services/Mail/classes/class.ilFormatMail.php";
725 $html_content = $this->
export(
false);
727 $fp = fopen($tempfile,
'w');
728 fwrite($fp, $html_content);
731 $mfile->copyAttachmentFile($tempfile,
$filename);
732 $umail->savePostData($ilUser->getId(), array(
$filename),
737 require_once
'Services/Mail/classes/class.ilMailFormCall.php';
749 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"), $this->ilias->error_obj->MESSAGE);
752 $this->ctrl->setParameter($this,
"bmf_id", $this->
id);
755 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
757 $cgui->setFormAction($this->ctrl->getFormAction($this));
758 $cgui->setHeaderText($this->lng->txt(
"info_delete_sure"));
759 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancel");
760 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirm");
762 foreach($bm_ids as $obj_id)
766 if(!$this->tree->isInTree($obj_id))
775 $title = $BookmarkFolder->getTitle();
777 unset($BookmarkFolder);
782 $title = $Bookmark->getTitle();
783 $target = $Bookmark->getTarget();
795 $cgui->addItem(
"id[]", $obj_id, $caption);
798 $this->tpl->setContent($cgui->getHTML());
817 global
$tree, $rbacsystem, $rbacadmin;
821 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"), $this->ilias->error_obj->MESSAGE);
830 if($this->tree->isInTree($id))
832 $node_data = $this->tree->getNodeData($id);
833 $subtree_nodes = $this->tree->getSubTree($node_data);
841 $this->tree->deleteTree($node_data);
844 foreach($subtree_nodes as $node)
846 switch($node[
"type"])
850 $BookmarkFolder->delete();
874 "delete" => $this->lng->txt(
"delete"),
875 "export" => $this->lng->txt(
"export"),
876 "sendmail"=> $this->lng->txt(
"bkm_sendmail"),
879 $subobj = array(
"bm",
"bmf");
881 if(is_array($subobj))
886 $this->tpl->setCurrentBlock(
"add_object");
887 $this->tpl->setVariable(
"COLUMN_COUNTS", 7);
888 $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
889 $this->tpl->setVariable(
"BTN_NAME",
"newForm");
890 $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"add"));
891 $this->tpl->parseCurrentBlock();
894 $this->tpl->setVariable(
"TPLPATH", $this->tpl->tplPath);
896 $this->tpl->setCurrentBlock(
"tbl_action_select");
897 $this->tpl->setVariable(
"SELECT_ACTION",
ilUtil::formSelect(
$_SESSION[
"error_post_vars"][
'action'],
"action", $actions,
false,
true));
898 $this->tpl->setVariable(
"BTN_NAME",
"executeAction");
899 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"execute"));
910 $this->tpl->parseCurrentBlock();
919 include_once(
"./Services/Bookmarks/classes/class.ilBookmarkBlockGUI.php");
922 return $bookmark_block_gui->getHTML();
933 if(!$this->tree->isInTree($this->id))
935 $this->ctrl->setParameter($this,
'bmf_id',
'');
936 $this->ctrl->redirect($this);
939 if($_FILES[
"bkmfile"][
"error"] > UPLOAD_ERR_OK)
945 require_once (
"./Services/Bookmarks/classes/class.ilBookmarkImportExport.php");
947 if($objects ===
false)
954 $num_create = array(
'bm'=> 0,
'bmf'=> 0);
958 $num_create[
'bmf']));
974 if(is_array($objects[$start_key]))
976 foreach($objects[$start_key] as $obj_key=> $object)
978 switch($object[
'type'])
981 if(!$object[
"title"])
continue;
982 if(!$object[
"target"])
continue;
984 $bm->setTitle($object[
"title"]);
985 $bm->setDescription($object[
"description"]);
986 $bm->setTarget($object[
"target"]);
987 $bm->setParent($folder_id);
992 if(!$object[
"title"])
continue;
994 $bmf->setTitle($object[
"title"]);
995 $bmf->setParent($folder_id);
997 $num_create[
'bmf']++;
998 if(is_array($objects[$obj_key]))
1001 $bmf->getId(), $obj_key);
1014 if(!$bm_ids &&
$_GET[
"bm_id_tgt"] ==
"")
1017 return $this->
view();
1020 $ilTabs->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTarget($this));
1022 $this->ctrl->setParameter($this,
"bm_id_tgt",
$_GET[
"bm_id_tgt"] ?
$_GET[
"bm_id_tgt"] : implode(
";", $bm_ids));
1024 include_once(
"./Services/Bookmarks/classes/class.ilBookmarkMoveExplorerGUI.php");
1026 if (!$exp->handleCommand())
1028 $this->mode =
"flat";
1029 $this->tpl->setContent($exp->getHTML());
1038 $bm_ids = explode(
";",
$_REQUEST[
'bm_id_tgt']);
1039 if(!$bm_ids || !$tgt)
1042 return $this->
view();
1046 $tree->setTableNames(
'bookmark_tree',
'bookmark_data');
1048 $tgt_node =
$tree->getNodeData($tgt);
1051 foreach($bm_ids as $node_id)
1053 if(
$tree->isGrandChild($node_id, $tgt))
1056 $this->ctrl->redirect($this,
"view");
1059 $node =
$tree->getNodeData($node_id);
1062 if($node[
"parent"] == $tgt)
1067 $tree->moveTree($node_id, $tgt);
1071 $this->ctrl->setParameter($this,
"bmf_id", $tgt);
1072 $this->ctrl->redirect($this,
"view");