ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilBookmarkAdministrationGUI Class Reference

GUI class for personal bookmark administration. More...

+ Collaboration diagram for ilBookmarkAdministrationGUI:

Public Member Functions

 ilBookmarkAdministrationGUI ()
 Constructor @access public. More...
 
executeCommand ()
 execute command More...
 
 executeAction ()
 
 getMode ()
 return display mode flat or tree More...
 
 explorer ()
 output explorer tree with bookmark folders More...
 
 displayHeader ()
 display header and locator More...
 
 view ()
 
 add_cell ($val, $link="")
 output a cell in object list More...
 
 displayLocator ()
 display locator More...
 
 newForm ($type)
 new form More...
 
 newFormBookmarkFolder ()
 display new bookmark folder form More...
 
 editFormBookmarkFolder ()
 display edit bookmark folder form More...
 
 newFormBookmark ()
 display new bookmark form More...
 
 get_last ($a_var, $a_value)
 get stored post var in case of an error/warning otherwise return passed value More...
 
 editFormBookmark ()
 display edit bookmark form More...
 
 createBookmarkFolder ()
 create new bookmark folder in db More...
 
 updateBookmarkFolder ()
 update bookmark folder More...
 
 createBookmark ()
 create new bookmark in db More...
 
 updateBookmark ()
 update bookmark in db More...
 
 export ($deliver=true)
 export bookmarks More...
 
 sendmail ()
 send bookmarks as attachment More...
 
 delete ()
 display deletion conformation screen More...
 
 cancel ()
 cancel deletion,insert, update More...
 
 confirm ()
 deletion confirmed -> delete folders / bookmarks More...
 
 showPossibleSubObjects ()
 display subobject addition selection More...
 
 getHTML ()
 Get Bookmark list for personal desktop. More...
 
 importFile ()
 imports a bookmark file into database display status information or report errors messages in case of error @access public More...
 
 __importBookmarks (&$objects, &$num_create, $folder_id, $start_key=0)
 creates the bookmarks and folders More...
 
 move ()
 
 confirmedMove ()
 

Data Fields

 $user_id
 
 $ilias
 
 $tpl
 
 $lng
 
 $tree
 
 $id
 
 $data
 
 $textwidth = 100
 

Private Member Functions

 initFormBookmarkFolder ($action='createBookmarkFolder')
 init bookmark folder create/edit form More...
 
 initFormBookmark ($action='createBookmark')
 init Bookmark create/edit form More...
 
 initImportBookmarksForm ()
 Init import bookmark form. More...
 

Detailed Description

GUI class for personal bookmark administration.

It manages folders and bookmarks with the help of the two corresponding core classes ilBookmarkFolder and ilBookmark. Their methods are called in this User Interface class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Manfred Thaler manfr.nosp@m.ed.t.nosp@m.haler.nosp@m.@end.nosp@m.o7.co.nosp@m.m
Version
$Id$

@ilCtrl_Calls ilBookmarkAdministrationGUI:

Definition at line 19 of file class.ilBookmarkAdministrationGUI.php.

Member Function Documentation

◆ __importBookmarks()

ilBookmarkAdministrationGUI::__importBookmarks ( $objects,
$num_create,
  $folder_id,
  $start_key = 0 
)

creates the bookmarks and folders

Parameters
arrayarray of objects
arraystores the number of created objects
folder_idid where to store the bookmarks
start_keykey of the objects array where to start @access private

Definition at line 973 of file class.ilBookmarkAdministrationGUI.php.

974 {
975 if(is_array($objects[$start_key]))
976 {
977 foreach($objects[$start_key] as $obj_key=> $object)
978 {
979 switch($object['type'])
980 {
981 case 'bm':
982 if(!$object["title"]) continue;
983 if(!$object["target"]) continue;
984 $bm = new ilBookmark();
985 $bm->setTitle($object["title"]);
986 $bm->setDescription($object["description"]);
987 $bm->setTarget($object["target"]);
988 $bm->setParent($folder_id);
989 $bm->create();
990 $num_create['bm']++;
991 break;
992 case 'bmf':
993 if(!$object["title"]) continue;
994 $bmf = new ilBookmarkFolder();
995 $bmf->setTitle($object["title"]);
996 $bmf->setParent($folder_id);
997 $bmf->create();
998 $num_create['bmf']++;
999 if(is_array($objects[$obj_key]))
1000 {
1001 $this->__importBookmarks($objects, $num_create,
1002 $bmf->getId(), $obj_key);
1003 }
1004 break;
1005 }
1006 }
1007 }
1008 }
__importBookmarks(&$objects, &$num_create, $folder_id, $start_key=0)
creates the bookmarks and folders
bookmark folder (note: this class handles personal bookmarks folders only)
Class Bookmarks Bookmark management.

References __importBookmarks().

Referenced by __importBookmarks(), and importFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_cell()

ilBookmarkAdministrationGUI::add_cell (   $val,
  $link = "" 
)

output a cell in object list

Definition at line 194 of file class.ilBookmarkAdministrationGUI.php.

195 {
196 if(!empty($link))
197 {
198 $this->tpl->setCurrentBlock("begin_link");
199 $this->tpl->setVariable("LINK_TARGET", $link);
200 $this->tpl->parseCurrentBlock();
201 $this->tpl->touchBlock("end_link");
202 }
203
204 $this->tpl->setCurrentBlock("text");
205 $this->tpl->setVariable("TEXT_CONTENT", $val);
206 $this->tpl->parseCurrentBlock();
207 $this->tpl->setCurrentBlock("table_cell");
208 $this->tpl->parseCurrentBlock();
209 }

◆ cancel()

ilBookmarkAdministrationGUI::cancel ( )

cancel deletion,insert, update

Definition at line 808 of file class.ilBookmarkAdministrationGUI.php.

References view().

+ Here is the call graph for this function:

◆ confirm()

ilBookmarkAdministrationGUI::confirm ( )

deletion confirmed -> delete folders / bookmarks

Definition at line 816 of file class.ilBookmarkAdministrationGUI.php.

817 {
818 global $tree, $rbacsystem, $rbacadmin;
819 // AT LEAST ONE OBJECT HAS TO BE CHOSEN.
820 if(!$_POST["id"])
821 {
822 $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
823 }
824
825 // FOR ALL SELECTED OBJECTS
826 foreach($_POST["id"] as $id)
827 {
829
830 // get node data and subtree nodes
831 if($this->tree->isInTree($id))
832 {
833 $node_data = $this->tree->getNodeData($id);
834 $subtree_nodes = $this->tree->getSubTree($node_data);
835 }
836 else
837 {
838 continue;
839 }
840
841 // delete tree
842 $this->tree->deleteTree($node_data);
843
844 // delete objects of subtree nodes
845 foreach($subtree_nodes as $node)
846 {
847 switch($node["type"])
848 {
849 case "bmf":
850 $BookmarkFolder = new ilBookmarkFolder($node["obj_id"]);
851 $BookmarkFolder->delete();
852 break;
853
854 case "bm":
855 $Bookmark = new ilBookmark($node["obj_id"]);
856 $Bookmark->delete();
857 break;
858 }
859 }
860 }
861
862 // Feedback
863 ilUtil::sendSuccess($this->lng->txt("info_deleted"), true);
864
865 $this->view();
866 }
static _getTypeOfId($a_id)
get type of a given id
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
redirection script todo: (a better solution should control the processing via a xml file)

References $_POST, $id, $tree, ilBookmark\_getTypeOfId(), ilUtil\sendSuccess(), and view().

+ Here is the call graph for this function:

◆ confirmedMove()

ilBookmarkAdministrationGUI::confirmedMove ( )

Definition at line 1034 of file class.ilBookmarkAdministrationGUI.php.

1035 {
1036 global $ilUser;
1037
1038 $tgt = (int)$_REQUEST["bmfmv_id"];
1039 $bm_ids = explode(";", $_REQUEST['bm_id_tgt']);
1040 if(!$bm_ids || !$tgt)
1041 {
1042 ilUtil::sendFailure($this->lng->txt("no_checkbox"));
1043 return $this->view();
1044 }
1045
1046 $tree = new ilTree($ilUser->getId());
1047 $tree->setTableNames('bookmark_tree', 'bookmark_data');
1048
1049 $tgt_node = $tree->getNodeData($tgt);
1050
1051 // sanity check
1052 foreach($bm_ids as $node_id)
1053 {
1054 if($tree->isGrandChild($node_id, $tgt))
1055 {
1056 ilUtil::sendFailure($this->lng->txt("error"), true);
1057 $this->ctrl->redirect($this, "view");
1058 }
1059
1060 $node = $tree->getNodeData($node_id);
1061
1062 // already at correct position
1063 if($node["parent"] == $tgt)
1064 {
1065 continue;
1066 }
1067
1068 $tree->moveTree($node_id, $tgt);
1069 }
1070
1071 ilUtil::sendSuccess($this->lng->txt("bookmark_moved_ok"), true);
1072 $this->ctrl->setParameter($this, "bmf_id", $tgt);
1073 $this->ctrl->redirect($this, "view");
1074 }
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
global $ilUser
Definition: imgupload.php:15

References $_REQUEST, $ilUser, $tree, ilUtil\sendFailure(), ilUtil\sendSuccess(), and view().

+ Here is the call graph for this function:

◆ createBookmark()

ilBookmarkAdministrationGUI::createBookmark ( )

create new bookmark in db

Definition at line 609 of file class.ilBookmarkAdministrationGUI.php.

610 {
611 global $lng, $ilCtrl;
612
613 if(!$this->tree->isInTree($this->id))
614 {
615 $this->ctrl->setParameter($this, 'bmf_id', '');
616 $this->ctrl->redirect($this);
617 }
618
619 // check title and target
620 if(empty($_POST["title"]))
621 {
622 ilUtil::sendFailure($this->lng->txt("please_enter_title"));
623 $this->newFormBookmark();
624 }
625 else if(empty($_POST["target"]))
626 {
627 ilUtil::sendFailure($this->lng->txt("please_enter_target"));
628 $this->newFormBookmark();
629 }
630 else
631 {
632 // create bookmark
633 $bm = new ilBookmark();
634 $bm->setTitle(ilUtil::stripSlashes($_POST["title"]));
635 $bm->setDescription(ilUtil::stripSlashes($_POST["description"]));
636 $bm->setTarget(ilUtil::stripSlashes($_POST["target"]));
637 $bm->setParent($this->id);
638 $bm->create();
639
640 ilUtil::sendInfo($lng->txt('bookmark_added'), true);
641
642 $ilCtrl->saveParameter($this, 'bmf_id');
643 $ilCtrl->redirect($this, 'view');
644 }
645 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $ilCtrl
Definition: ilias.php:18

References $_POST, $ilCtrl, $lng, newFormBookmark(), ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ createBookmarkFolder()

ilBookmarkAdministrationGUI::createBookmarkFolder ( )

create new bookmark folder in db

Definition at line 543 of file class.ilBookmarkAdministrationGUI.php.

544 {
545 if(!$this->tree->isInTree($this->id))
546 {
547 $this->ctrl->setParameter($this, 'bmf_id', '');
548 $this->ctrl->redirect($this);
549 }
550
551 // check title
552 if(empty($_POST["title"]))
553 {
554 ilUtil::sendFailure($this->lng->txt("please_enter_title"));
555 $this->newFormBookmarkFolder();
556 }
557 else
558 {
559 // create bookmark folder
560 $bmf = new ilBookmarkFolder();
561 $bmf->setTitle(ilUtil::stripSlashes($_POST["title"]));
562 $bmf->setParent($this->id);
563 $bmf->create();
564
565 ilUtil::sendSuccess($this->lng->txt("bkm_fold_created"), true);
566
567 global $ilCtrl;
568 $ilCtrl->saveParameter($this, 'bmf_id');
569 $ilCtrl->redirect($this, 'view');
570 }
571 }
newFormBookmarkFolder()
display new bookmark folder form

References $_POST, $ilCtrl, newFormBookmarkFolder(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ delete()

ilBookmarkAdministrationGUI::delete ( )

display deletion conformation screen

Definition at line 748 of file class.ilBookmarkAdministrationGUI.php.

749 {
750 $bm_ids = $_GET['bm_id'] ? array($_GET['bm_id']) : $_POST['bm_id'];
751 if(!$bm_ids)
752 {
753 $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
754 }
755
756 $this->ctrl->setParameter($this, "bmf_id", $this->id);
757
758 // display confirmation message
759 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
760 $cgui = new ilConfirmationGUI();
761 $cgui->setFormAction($this->ctrl->getFormAction($this));
762 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
763 $cgui->setCancel($this->lng->txt("cancel"), "cancel");
764 $cgui->setConfirm($this->lng->txt("confirm"), "confirm");
765
766 foreach($bm_ids as $obj_id)
767 {
768 $type = ilBookmark::_getTypeOfId($obj_id);
769
770 if(!$this->tree->isInTree($obj_id))
771 {
772 continue;
773 }
774
775 switch($type)
776 {
777 case "bmf":
778 $BookmarkFolder = new ilBookmarkFolder($obj_id);
779 $title = $BookmarkFolder->getTitle();
780 $target = "";
781 unset($BookmarkFolder);
782 break;
783
784 case "bm":
785 $Bookmark = new ilBookmark($obj_id);
786 $title = $Bookmark->getTitle();
787 $target = $Bookmark->getTarget();
788 unset($Bookmark);
789 break;
790 }
791
792 $caption = ilUtil::getImageTagByType($type, $this->tpl->tplPath) .
793 " " . $title;
794 if($target)
795 {
796 $caption .= " (" . ilUtil::shortenText($target, $this->textwidth, true) . ")";
797 }
798
799 $cgui->addItem("id[]", $obj_id, $caption);
800 }
801
802 $this->tpl->setContent($cgui->getHTML());
803 }
$_GET["client_id"]
Confirmation screen class.
static shortenText($a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
static getImageTagByType($a_type, $a_path, $a_big=false)
Builds an html image tag TODO: function still in use, but in future use getImagePath and move HTML-Co...

References $_GET, $_POST, ilBookmark\_getTypeOfId(), ilUtil\getImageTagByType(), and ilUtil\shortenText().

+ Here is the call graph for this function:

◆ displayHeader()

ilBookmarkAdministrationGUI::displayHeader ( )

display header and locator

Definition at line 149 of file class.ilBookmarkAdministrationGUI.php.

150 {
151 // output locator
152 $this->displayLocator();
153
154 // output message
155 if($this->message)
156 {
157 ilUtil::sendInfo($this->message);
158 }
160
161 $this->tpl->setTitle($this->lng->txt("bookmarks"));
162 }
static infoPanel($a_keep=true)

References displayLocator(), ilUtil\infoPanel(), and ilUtil\sendInfo().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displayLocator()

ilBookmarkAdministrationGUI::displayLocator ( )

display locator

Definition at line 214 of file class.ilBookmarkAdministrationGUI.php.

215 {
216 global $lng;
217
218 if(empty($this->id))
219 {
220 return;
221 }
222
223 if(!$this->tree->isInTree($this->id))
224 {
225 return;
226 }
227
228 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html", "Services/Locator");
229
230 $path = $this->tree->getPathFull($this->id);
231//print_r($path);
232 $modifier = 1;
233
234 return;
235 $this->tpl->setVariable("TXT_LOCATOR", $this->lng->txt("locator"));
236 $this->tpl->touchBlock("locator_separator");
237 $this->tpl->touchBlock("locator_item");
238 //$this->tpl->setCurrentBlock("locator_item");
239 //$this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
240 //$this->tpl->setVariable("LINK_ITEM", $this->ctrl->getLinkTargetByClass("ilpersonaldesktopgui"));
241 //$this->tpl->setVariable("LINK_TARGET","target=\"".
242 // ilFrameTargetInfo::_getFrame("MainContent")."\"");
243 //$this->tpl->parseCurrentBlock();
244
245 foreach($path as $key => $row)
246 {
247 if($key < count($path) - $modifier)
248 {
249 $this->tpl->touchBlock("locator_separator");
250 }
251
252 $this->tpl->setCurrentBlock("locator_item");
253 $title = ($row["child"] == 1) ?
254 $lng->txt("bookmarks") :
255 $row["title"];
256 $this->tpl->setVariable("ITEM", $title);
257 $this->ctrl->setParameter($this, "bmf_id", $row["child"]);
258 $this->tpl->setVariable("LINK_ITEM",
259 $this->ctrl->getLinkTarget($this));
260 $this->tpl->parseCurrentBlock();
261 }
262
263 $this->tpl->setCurrentBlock("locator");
264
265 $this->tpl->parseCurrentBlock();
266 }
$path
Definition: index.php:22

References $lng, $path, and $row.

Referenced by displayHeader().

+ Here is the caller graph for this function:

◆ editFormBookmark()

ilBookmarkAdministrationGUI::editFormBookmark ( )

display edit bookmark form

Definition at line 513 of file class.ilBookmarkAdministrationGUI.php.

514 {
515 global $lng, $ilCtrl;
516
517 if(!$this->tree->isInTree($_GET["obj_id"]))
518 {
519 $this->ctrl->setParameter($this, 'obj_id', '');
520 $this->ctrl->setParameter($this, 'bmf_id', '');
521 $this->ctrl->redirect($this);
522 }
523
524 $form = $this->initFormBookmark('updateBookmark');
525 $bookmark = new ilBookmark($_GET["obj_id"]);
526 $form->setValuesByArray
527 (
528 array
529 (
530 "title" => $bookmark->getTitle(),
531 "target" => $bookmark->getTarget(),
532 "description" => $bookmark->getDescription(),
533 "obj_id" => $_GET["obj_id"],
534 )
535 );
536 $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
537 }
initFormBookmark($action='createBookmark')
init Bookmark create/edit form

References $_GET, $ilCtrl, $lng, and initFormBookmark().

Referenced by updateBookmark().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editFormBookmarkFolder()

ilBookmarkAdministrationGUI::editFormBookmarkFolder ( )

display edit bookmark folder form

Definition at line 350 of file class.ilBookmarkAdministrationGUI.php.

351 {
352 if(!$this->tree->isInTree($_GET["obj_id"]))
353 {
354 $this->ctrl->setParameter($this, 'bmf_id', '');
355 $this->ctrl->setParameter($this, 'obj_id', '');
356 $this->ctrl->redirect($this);
357 }
358
359 $bmf = new ilBookmarkFolder($_GET["obj_id"]);
360 $form = $this->initFormBookmarkFolder('updateBookmarkFolder', $this->id);
361 $form->setValuesByArray
362 (
363 array
364 (
365 "title" => $this->get_last("title", $bmf->getTitle()),
366 "obj_id" => $_GET["obj_id"],
367 )
368 );
369 $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
370 }
initFormBookmarkFolder($action='createBookmarkFolder')
init bookmark folder create/edit form
get_last($a_var, $a_value)
get stored post var in case of an error/warning otherwise return passed value

References $_GET, get_last(), and initFormBookmarkFolder().

Referenced by updateBookmarkFolder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeAction()

ilBookmarkAdministrationGUI::executeAction ( )

Definition at line 101 of file class.ilBookmarkAdministrationGUI.php.

102 {
103 switch($_POST["selected_cmd"])
104 {
105 case "delete":
106 $this->delete();
107 break;
108 case "export":
109 $this->export();
110 break;
111 case "sendmail":
112 $this->sendmail();
113 break;
114 default:
115 $this->view();
116 break;
117 }
118 return true;
119 }

References $_POST, export(), sendmail(), and view().

+ Here is the call graph for this function:

◆ executeCommand()

& ilBookmarkAdministrationGUI::executeCommand ( )

execute command

Definition at line 81 of file class.ilBookmarkAdministrationGUI.php.

82 {
83 $next_class = $this->ctrl->getNextClass();
84
85 switch($next_class)
86 {
87 default:
88 $cmd = $this->ctrl->getCmd("view");
89 $this->displayHeader();
90 $this->$cmd();
91 if($this->getMode() == 'tree')
92 {
93 $this->explorer();
94 }
95 break;
96 }
97 $this->tpl->show(true);
98 return true;
99 }
explorer()
output explorer tree with bookmark folders
getMode()
return display mode flat or tree
$cmd
Definition: sahs_server.php:35

References $cmd, displayHeader(), explorer(), and getMode().

+ Here is the call graph for this function:

◆ explorer()

ilBookmarkAdministrationGUI::explorer ( )

output explorer tree with bookmark folders

Definition at line 133 of file class.ilBookmarkAdministrationGUI.php.

134 {
135 global $tpl;
136
137 include_once("./Services/Bookmarks/classes/class.ilBookmarkExplorerGUI.php");
138 $exp = new ilBookmarkExplorerGUI($this, "explorer");
139 if (!$exp->handleCommand())
140 {
141 $tpl->setLeftNavContent($exp->getHTML());
142 }
143 }
Bookmark explorer GUI class.

References $tpl.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ export()

ilBookmarkAdministrationGUI::export (   $deliver = true)

export bookmarks

Definition at line 686 of file class.ilBookmarkAdministrationGUI.php.

687 {
688 $bm_ids = $_GET['bm_id'] ? array($_GET['bm_id']) : $_POST['bm_id'];
689 if(!$bm_ids)
690 {
691 $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
692 }
693 $export_ids = array();
694 foreach($bm_ids as $id)
695 {
696 if($this->tree->isInTree($id))
697 {
698 //list($type, $obj_id) = explode(":", $id);
699 //$export_ids[]=$obj_id;
700 $export_ids[] = $id;
701 }
702 }
703
704 require_once ("./Services/Bookmarks/classes/class.ilBookmarkImportExport.php");
705 $html_content = ilBookmarkImportExport::_exportBookmark($export_ids, true,
706 $this->lng->txt("bookmarks_of") . " " . $this->ilias->account->getFullname());
707
708 if($deliver)
709 {
710 ilUtil::deliverData($html_content, 'bookmarks.html', "application/save", $charset = "");
711 }
712 else
713 {
714 return $html_content;
715 }
716 }
_exportBookmark($obj_ids, $recursive=true, $title='')
export bookmarks static method return html string
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.

References $_GET, $_POST, $id, ilBookmarkImportExport\_exportBookmark(), and ilUtil\deliverData().

Referenced by executeAction(), and sendmail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_last()

ilBookmarkAdministrationGUI::get_last (   $a_var,
  $a_value 
)

get stored post var in case of an error/warning otherwise return passed value

Definition at line 503 of file class.ilBookmarkAdministrationGUI.php.

504 {
505 return (!empty($_POST[$a_var])) ?
506 ilUtil::prepareFormOutput(($_POST[$a_var]), true) :
507 ilUtil::prepareFormOutput($a_value);
508 }
Util class various functions, usage as namespace.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

References $_POST, and ilUtil\prepareFormOutput().

Referenced by editFormBookmarkFolder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilBookmarkAdministrationGUI::getHTML ( )

Get Bookmark list for personal desktop.

Definition at line 918 of file class.ilBookmarkAdministrationGUI.php.

919 {
920 include_once("./Services/Bookmarks/classes/class.ilBookmarkBlockGUI.php");
921 $bookmark_block_gui = new ilBookmarkBlockGUI("ilpersonaldesktopgui", "show");
922
923 return $bookmark_block_gui->getHTML();
924 }
BlockGUI class for Bookmarks block.

◆ getMode()

ilBookmarkAdministrationGUI::getMode ( )

return display mode flat or tree

Definition at line 125 of file class.ilBookmarkAdministrationGUI.php.

126 {
127 return $this->mode;
128 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ ilBookmarkAdministrationGUI()

ilBookmarkAdministrationGUI::ilBookmarkAdministrationGUI ( )

Constructor @access public.

Parameters
integeruser_id (optional)

Definition at line 47 of file class.ilBookmarkAdministrationGUI.php.

48 {
49 global $ilias, $tpl, $lng, $ilCtrl, $ilUser;
50
51// $tpl->enableAdvancedColumnLayout(true, false);
52
53 $tpl->getStandardTemplate();
54
55 //print_r($_SESSION["error_post_vars"]);
56 // if no bookmark folder id is given, take dummy root node id (that is 1)
57 $this->id = (empty($_GET["bmf_id"]))
58 ? 1
59 : $_GET["bmf_id"];
60
61 // initiate variables
62 $this->ilias = $ilias;
63 $this->tpl = $tpl;
64 $this->lng = $lng;
65 $this->ctrl = $ilCtrl;
66 $this->ctrl->setParameter($this, "bmf_id", $this->id);
67 $this->user_id = $ilUser->getId();
68
69 $this->tree = new ilTree($this->user_id);
70 $this->tree->setTableNames('bookmark_tree', 'bookmark_data');
71 $this->root_id = $this->tree->readRootId();
72
73 $this->lng->loadLanguageModule("bkm");
74
75 $this->mode = "tree";
76 }

References $_GET, $ilCtrl, $ilias, $ilUser, $lng, and $tpl.

◆ importFile()

ilBookmarkAdministrationGUI::importFile ( )

imports a bookmark file into database display status information or report errors messages in case of error @access public

Definition at line 932 of file class.ilBookmarkAdministrationGUI.php.

933 {
934 if(!$this->tree->isInTree($this->id))
935 {
936 $this->ctrl->setParameter($this, 'bmf_id', '');
937 $this->ctrl->redirect($this);
938 }
939
940 if($_FILES["bkmfile"]["error"] > UPLOAD_ERR_OK)
941 {
942 ilUtil::sendFailure($this->lng->txt("import_file_not_valid"));
943 $this->newFormBookmark();
944 return;
945 }
946 require_once ("./Services/Bookmarks/classes/class.ilBookmarkImportExport.php");
947 $objects = ilBookmarkImportExport::_parseFile($_FILES["bkmfile"]['tmp_name']);
948 if($objects === false)
949 {
950 ilUtil::sendFailure($this->lng->txt("import_file_not_valid"));
951 $this->newFormBookmark();
952 return;
953 }
954 // holds the number of created objects
955 $num_create = array('bm'=> 0, 'bmf'=> 0);
956 $this->__importBookmarks($objects, $num_create, $this->id, 0);
957
958 ilUtil::sendSuccess(sprintf($this->lng->txt("bkm_import_ok"), $num_create['bm'],
959 $num_create['bmf']));
960 $this->view();
961
962
963 }
_parseFile($file)
parse Bookmark file static method returns 3 dimensional array of bookmarks and folders

References __importBookmarks(), ilBookmarkImportExport\_parseFile(), newFormBookmark(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and view().

+ Here is the call graph for this function:

◆ initFormBookmark()

ilBookmarkAdministrationGUI::initFormBookmark (   $action = 'createBookmark')
private

init Bookmark create/edit form

Parameters
stringform action type; valid values: createBookmark, updateBookmark

Definition at line 377 of file class.ilBookmarkAdministrationGUI.php.

378 {
379 global $lng, $ilCtrl, $ilUser;
380
381 if(!$this->tree->isInTree($this->id))
382 {
383 $this->ctrl->setParameter($this, 'bmf_id', '');
384 $this->ctrl->redirect($this);
385 }
386
387 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
388 $form = new ilPropertyFormGUI();
389 $form->setTopAnchor("bookmark_top");
390
391 $form->setTitle($lng->txt("bookmark_new"));
392
393 if($action == 'updateBookmark')
394 {
395 $ilCtrl->setParameter($this, 'bmf_id', $this->id);
396 $ilCtrl->setParameter($this, 'obj_id', $_GET["obj_id"]);
397 }
398
399 $hash = ($ilUser->prefs["screen_reader_optimization"])
400 ? "bookmark_top"
401 : "";
402
403 $form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
404 $ilCtrl->clearParameters($this);
405 // title
406 $prop = new ilTextInputGUI($lng->txt("title"), "title");
407 $prop->setValue($_GET['bm_title']);
408 $prop->setRequired(true);
409 $form->addItem($prop);
410
411 // description
412 $prop = new ilTextAreaInputGUI($lng->txt('description'), 'description');
413 $form->addItem($prop);
414
415 // target link
416 $prop = new ilTextInputGUI($lng->txt('bookmark_target'), 'target');
417 $prop->setValue($_GET['bm_link']);
418 $prop->setRequired(true);
419 $form->addItem($prop);
420
421 // hidden redirect field
422 if($_GET['return_to'])
423 {
424 $prop = new ilHiddenInputGUI('return_to');
425 $prop->setValue($_GET['return_to']);
426 $form->addItem($prop);
427
428 $prop = new ilHiddenInputGUI('return_to_url');
429 if($_GET['return_to_url'])
430 $prop->setValue($_GET['return_to_url']);
431 else
432 $prop->setValue($_GET['bm_link']);
433 $form->addItem($prop);
434 }
435
436 // buttons
437 $form->addCommandButton($action, $lng->txt('save'));
438 $form->addCommandButton('cancel', $lng->txt('cancel'));
439
440 // keep imports?
441 /*
442 $this->tpl->setCurrentBlock('bkm_import');
443 $this->tpl->setVariable("TXT_IMPORT_BKM", $this->lng->txt("bkm_import"));
444 $this->tpl->setVariable("TXT_FILE", $this->lng->txt("file_add"));
445 $this->tpl->setVariable("TXT_IMPORT", $this->lng->txt("import"));
446 $this->tpl->parseCurrentBlock();
447 //vd($_POST);
448 */
449
450 return $form;
451 }
This class represents a hidden form property in a property form.
This class represents a property form user interface.
This class represents a text area property in a property form.
This class represents a text property in a property form.

References $_GET, $ilCtrl, $ilUser, and $lng.

Referenced by editFormBookmark(), and newFormBookmark().

+ Here is the caller graph for this function:

◆ initFormBookmarkFolder()

ilBookmarkAdministrationGUI::initFormBookmarkFolder (   $action = 'createBookmarkFolder')
private

init bookmark folder create/edit form

Parameters
stringform action type; valid values: createBookmark, updateBookmark

Definition at line 306 of file class.ilBookmarkAdministrationGUI.php.

307 {
308 global $lng, $ilCtrl, $ilUser;
309
310 if(!$this->tree->isInTree($this->id))
311 {
312 $this->ctrl->setParameter($this, 'bmf_id', '');
313 $this->ctrl->redirect($this);
314 }
315
316 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
317 $form = new ilPropertyFormGUI();
318 $form->setTopAnchor("bookmark_top");
319
320 $form->setTitle($lng->txt("bookmark_folder_new"));
321
322 if($action == 'updateBookmarkFolder')
323 {
324 $ilCtrl->setParameter($this, 'bmf_id', $this->id);
325 $ilCtrl->setParameter($this, 'obj_id', $_GET["obj_id"]);
326 }
327
328 $hash = ($ilUser->prefs["screen_reader_optimization"])
329 ? "bookmark_top"
330 : "";
331
332 $form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
333
334 $ilCtrl->clearParameters($this);
335
336 // title
337 $prop = new ilTextInputGUI($lng->txt("title"), "title");
338 $prop->setRequired(true);
339 $form->addItem($prop);
340
341 // buttons
342 $form->addCommandButton($action, $lng->txt('save'));
343 $form->addCommandButton('cancel', $lng->txt('cancel'));
344 return $form;
345 }

References $_GET, $ilCtrl, $ilUser, and $lng.

Referenced by editFormBookmarkFolder(), and newFormBookmarkFolder().

+ Here is the caller graph for this function:

◆ initImportBookmarksForm()

ilBookmarkAdministrationGUI::initImportBookmarksForm ( )
private

Init import bookmark form.

Definition at line 457 of file class.ilBookmarkAdministrationGUI.php.

458 {
459 global $lng, $ilCtrl, $ilUser;
460
461 if(!$this->tree->isInTree($this->id))
462 {
463 $this->ctrl->setParameter($this, 'bmf_id', '');
464 $this->ctrl->redirect($this);
465 }
466
467 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
468 $form = new ilPropertyFormGUI();
469 $form->setFormAction($ilCtrl->getFormAction($this, "importFile")); // #16133
470 $form->setTopAnchor("bookmark_top");
471 $form->setTitle($lng->txt("bkm_import"));
472
473 $fi = new ilFileInputGUI($lng->txt("file_add"), "bkmfile");
474 $fi->setRequired(true);
475 $form->addItem($fi);
476
477 $form->addCommandButton("importFile", $lng->txt('import'));
478 $form->addCommandButton('cancel', $lng->txt('cancel'));
479
480 return $form;
481 }
This class represents a file property in a property form.

References $ilCtrl, $ilUser, and $lng.

Referenced by newFormBookmark().

+ Here is the caller graph for this function:

◆ move()

ilBookmarkAdministrationGUI::move ( )

Definition at line 1010 of file class.ilBookmarkAdministrationGUI.php.

1011 {
1012 global $ilUser, $ilTabs, $tpl;
1013
1014 $bm_ids = $_REQUEST['bm_id'];
1015 if(!$bm_ids && $_GET["bm_id_tgt"] == "")
1016 {
1017 ilUtil::sendFailure($this->lng->txt("no_checkbox"));
1018 return $this->view();
1019 }
1020
1021 $ilTabs->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this));
1022
1023 $this->ctrl->setParameter($this, "bm_id_tgt", $_GET["bm_id_tgt"] ? $_GET["bm_id_tgt"] : implode(";", $bm_ids));
1024 ilUtil::sendInfo($this->lng->txt("bookmark_select_target"));
1025 include_once("./Services/Bookmarks/classes/class.ilBookmarkMoveExplorerGUI.php");
1026 $exp = new ilBookmarkMoveExplorerGUI($this, "move");
1027 if (!$exp->handleCommand())
1028 {
1029 $this->mode = "flat";
1030 $this->tpl->setContent($exp->getHTML());
1031 }
1032 }

References $_GET, $_REQUEST, $ilUser, $tpl, ilUtil\sendFailure(), ilUtil\sendInfo(), and view().

+ Here is the call graph for this function:

◆ newForm()

ilBookmarkAdministrationGUI::newForm (   $type)

new form

Definition at line 271 of file class.ilBookmarkAdministrationGUI.php.

272 {
273 if(!$type)
274 $type = $_POST["type"];
275 switch($type)
276 {
277 case "bmf":
278 $this->newFormBookmarkFolder();
279 break;
280
281 case "bm":
282 $this->newFormBookmark();
283 break;
284 }
285 }

References $_POST, newFormBookmark(), and newFormBookmarkFolder().

+ Here is the call graph for this function:

◆ newFormBookmark()

ilBookmarkAdministrationGUI::newFormBookmark ( )

display new bookmark form

Definition at line 486 of file class.ilBookmarkAdministrationGUI.php.

487 {
488 $form = $this->initFormBookmark();
489 $html1 = $form->getHTML();
490 $html2 = '';
491 if(!$_REQUEST["bm_link"])
492 {
493 $form2 = $this->initImportBookmarksForm();
494 $html2 = "<br />" . $form2->getHTML();
495 }
496 $this->tpl->setVariable("ADM_CONTENT", $html1 . $html2);
497 }
initImportBookmarksForm()
Init import bookmark form.
$html1
$html2

References $_REQUEST, $html1, $html2, initFormBookmark(), and initImportBookmarksForm().

Referenced by createBookmark(), importFile(), and newForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ newFormBookmarkFolder()

ilBookmarkAdministrationGUI::newFormBookmarkFolder ( )

display new bookmark folder form

Definition at line 290 of file class.ilBookmarkAdministrationGUI.php.

291 {
292 if(!$this->tree->isInTree($this->id))
293 {
294 $this->ctrl->setParameter($this, 'bmf_id', '');
295 $this->ctrl->redirect($this);
296 }
297
298 $form = $this->initFormBookmarkFolder();
299 $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
300 }

References initFormBookmarkFolder().

Referenced by createBookmarkFolder(), and newForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendmail()

ilBookmarkAdministrationGUI::sendmail ( )

send bookmarks as attachment

Definition at line 721 of file class.ilBookmarkAdministrationGUI.php.

722 {
723 global $ilUser;
724 include_once './Services/Mail/classes/class.ilFileDataMail.php';
725 require_once "Services/Mail/classes/class.ilFormatMail.php";
726 $mfile = new ilFileDataMail($ilUser->getId());
727 $umail = new ilFormatMail($ilUser->getId());
728
729 $html_content = $this->export(false);
730 $tempfile = ilUtil::ilTempnam();
731 $fp = fopen($tempfile, 'w');
732 fwrite($fp, $html_content);
733 fclose($fp);
734 $filename = 'bookmarks.html';
735 $mfile->copyAttachmentFile($tempfile, $filename);
736 $umail->savePostData($ilUser->getId(), array($filename),
737 '', '', '', '', '',
738 '',
739 '', 0);
740
741 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
742 ilUtil::redirect(ilMailFormCall::getRedirectTarget($this, '', array(), array('type' => 'attach')));
743 }
$filename
Definition: buildRTE.php:89
This class handles all operations on files (attachments) in directory ilias_data/mail.
Class UserMail this class handles user mails.
static getRedirectTarget($gui, $cmd, array $gui_params=array(), array $mail_params=array(), array $context_params=array())
static redirect($a_script)
http redirect to other script
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.

References $filename, $ilUser, export(), ilMailFormCall\getRedirectTarget(), ilUtil\ilTempnam(), and ilUtil\redirect().

Referenced by executeAction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showPossibleSubObjects()

ilBookmarkAdministrationGUI::showPossibleSubObjects ( )

display subobject addition selection

Definition at line 872 of file class.ilBookmarkAdministrationGUI.php.

873 {
874 $actions = array(
875 "delete" => $this->lng->txt("delete"),
876 "export" => $this->lng->txt("export"),
877 "sendmail"=> $this->lng->txt("bkm_sendmail"),
878 );
879
880 $subobj = array("bm", "bmf");
881
882 if(is_array($subobj))
883 {
884 //build form
885 $opts = ilUtil::formSelect("", "type", $subobj);
886
887 $this->tpl->setCurrentBlock("add_object");
888 $this->tpl->setVariable("COLUMN_COUNTS", 7);
889 $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
890 $this->tpl->setVariable("BTN_NAME", "newForm");
891 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
892 $this->tpl->parseCurrentBlock();
893 }
894
895 $this->tpl->setVariable("TPLPATH", $this->tpl->tplPath);
896
897 $this->tpl->setCurrentBlock("tbl_action_select");
898 $this->tpl->setVariable("SELECT_ACTION", ilUtil::formSelect($_SESSION["error_post_vars"]['action'], "action", $actions, false, true));
899 $this->tpl->setVariable("BTN_NAME", "executeAction");
900 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("execute"));
901
902 /*
903 $this->tpl->setVariable("BTN_NAME","delete");
904 $this->tpl->setVariable("BTN_VALUE",$this->lng->txt("delete"));
905 $this->tpl->parseCurrentBlock();
906
907 $this->tpl->setVariable("BTN_NAME","export");
908 $this->tpl->setVariable("BTN_VALUE",$this->lng->txt("export"));
909 $this->tpl->parseCurrentBlock();
910 */
911 $this->tpl->parseCurrentBlock();
912
913 }
$_SESSION["AccountId"]
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.

References $_SESSION, and ilUtil\formSelect().

+ Here is the call graph for this function:

◆ updateBookmark()

ilBookmarkAdministrationGUI::updateBookmark ( )

update bookmark in db

Definition at line 650 of file class.ilBookmarkAdministrationGUI.php.

651 {
652 if(!$this->tree->isInTree($_GET["obj_id"]))
653 {
654 $this->ctrl->setParameter($this, 'obj_id', '');
655 $this->ctrl->setParameter($this, 'bmf_id', '');
656 $this->ctrl->redirect($this);
657 }
658
659 // check title and target
660 if(empty($_POST["title"]))
661 {
662 ilUtil::sendFailure($this->lng->txt("please_enter_title"));
663 $this->editFormBookmark();
664 }
665 else if(empty($_POST["target"]))
666 {
667 ilUtil::sendFailure($this->lng->txt("please_enter_target"));
668 $this->editFormBookmark();
669 }
670 else
671 {
672 // update bookmark
673 $bm = new ilBookmark($_GET["obj_id"]);
674 $bm->setTitle(ilUtil::stripSlashes($_POST["title"]));
675 $bm->setTarget(ilUtil::stripSlashes($_POST["target"]));
676 $bm->setDescription(ilUtil::stripSlashes($_POST["description"]));
677 $bm->update();
678
679 $this->view();
680 }
681 }

References $_GET, $_POST, editFormBookmark(), ilUtil\sendFailure(), ilUtil\stripSlashes(), and view().

+ Here is the call graph for this function:

◆ updateBookmarkFolder()

ilBookmarkAdministrationGUI::updateBookmarkFolder ( )

update bookmark folder

Definition at line 577 of file class.ilBookmarkAdministrationGUI.php.

578 {
579 if(!$this->tree->isInTree($_GET["obj_id"]))
580 {
581 $this->ctrl->setParameter($this, 'obj_id', '');
582 $this->ctrl->setParameter($this, 'bmf_id', '');
583 $this->ctrl->redirect($this);
584 }
585
586 // check title
587 if(empty($_POST["title"]))
588 {
589 ilUtil::sendFailure($this->lng->txt("please_enter_title"));
590 $this->editFormBookmarkFolder();
591 }
592 else
593 {
594 // update bookmark folder
595 $bmf = new ilBookmarkFolder($_GET["obj_id"]);
596 $bmf->setTitle(ilUtil::stripSlashes($_POST["title"]));
597 $bmf->update();
598
599 global $ilCtrl;
600 $ilCtrl->saveParameter($this, 'bmf_id');
601 $ilCtrl->redirect($this, 'view');
602 }
603 }
editFormBookmarkFolder()
display edit bookmark folder form

References $_GET, $_POST, $ilCtrl, editFormBookmarkFolder(), ilUtil\sendFailure(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ view()

ilBookmarkAdministrationGUI::view ( )

Definition at line 167 of file class.ilBookmarkAdministrationGUI.php.

168 {
169 global $ilToolbar;
170
171 if($this->id > 0 && !$this->tree->isInTree($this->id))
172 {
173 $this->ctrl->setParameter($this, 'bmf_id', '');
174 $this->ctrl->redirect($this);
175 }
176
177 $ilToolbar->addButton($this->lng->txt("bookmark_new"),
178 $this->ctrl->getLinkTarget($this, "newFormBookmark"));
179 $ilToolbar->addButton($this->lng->txt("bookmark_folder_new"),
180 $this->ctrl->getLinkTarget($this, "newFormBookmarkFolder"));
181
182 $objects = ilBookmarkFolder::getObjects($this->id);
183
184 include_once 'Services/Bookmarks/classes/class.ilBookmarkAdministrationTableGUI.php';
185 $table = new ilBookmarkAdministrationTableGUI($this);
186 $table->setId('bookmark_adm_table');
187 $table->setData($objects);
188 $this->tpl->setVariable("ADM_CONTENT", $table->getHTML());
189 }

References ilBookmarkFolder\getObjects().

Referenced by cancel(), confirm(), confirmedMove(), executeAction(), importFile(), move(), and updateBookmark().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $data

ilBookmarkAdministrationGUI::$data

Definition at line 39 of file class.ilBookmarkAdministrationGUI.php.

◆ $id

ilBookmarkAdministrationGUI::$id

Definition at line 38 of file class.ilBookmarkAdministrationGUI.php.

Referenced by confirm(), and export().

◆ $ilias

ilBookmarkAdministrationGUI::$ilias

Definition at line 33 of file class.ilBookmarkAdministrationGUI.php.

Referenced by ilBookmarkAdministrationGUI().

◆ $lng

◆ $textwidth

ilBookmarkAdministrationGUI::$textwidth = 100

Definition at line 40 of file class.ilBookmarkAdministrationGUI.php.

◆ $tpl

ilBookmarkAdministrationGUI::$tpl

◆ $tree

ilBookmarkAdministrationGUI::$tree

Definition at line 37 of file class.ilBookmarkAdministrationGUI.php.

Referenced by confirm(), and confirmedMove().

◆ $user_id

ilBookmarkAdministrationGUI::$user_id

Definition at line 26 of file class.ilBookmarkAdministrationGUI.php.


The documentation for this class was generated from the following file: