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'));
 
  422                 if(!$this->tree->isInTree(
$_GET[
"obj_id"]))
 
  429                 $form->setValuesByArray
 
  433                                 "title" => $this->
get_last(
"title", $bmf->getTitle()),
 
  434                                 "obj_id" => 
$_GET[
"obj_id"],
 
  437                 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
 
  449                 if (!$this->tree->isInTree($this->id))
 
  454                 include_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
  456                 $form->setTopAnchor(
"bookmark_top");
 
  458                 $form->setTitle($lng->txt(
"bookmark_new"));
 
  460                 if ($action == 
'updateBookmark')
 
  462                         $ilCtrl->setParameter($this, 
'bmf_id', $this->
id);
 
  463                         $ilCtrl->setParameter($this, 
'obj_id', 
$_GET[
"obj_id"]);
 
  466                 $hash = ($ilUser->prefs[
"screen_reader_optimization"])
 
  470                 $form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
 
  471                 $ilCtrl->clearParameters($this);
 
  475                 $prop->setRequired(
true);
 
  476                 $form->addItem($prop);
 
  480                 $form->addItem($prop);
 
  483                 $prop = 
new ilTextInputGUI($lng->txt(
'bookmark_target'), 
'target');
 
  485                 $prop->setRequired(
true);
 
  486                 $form->addItem($prop);
 
  489                 if (
$_GET[
'return_to'])
 
  492                         $prop->setValue(
$_GET[
'return_to']);
 
  493                         $form->addItem($prop);
 
  496                         if (
$_GET[
'return_to_url'])
 
  497                                 $prop->setValue(
$_GET[
'return_to_url']);
 
  499                                 $prop->setValue(
$_GET[
'bm_link']);              
 
  500                         $form->addItem($prop);
 
  504                 $form->addCommandButton($action, $lng->txt(
'save'));
 
  505                 $form->addCommandButton(
'cancel', $lng->txt(
'cancel'));
 
  528                 if (!$this->tree->isInTree($this->id))
 
  533                 include_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
  535                 $form->setTopAnchor(
"bookmark_top");
 
  536                 $form->setTitle($lng->txt(
"bkm_import"));
 
  542                 $form->addCommandButton(
"importFile", $lng->txt(
'import'));
 
  543                 $form->addCommandButton(
'cancel', $lng->txt(
'cancel'));
 
  554                 $html1 = $form->getHTML();
 
  559                         $html2 = 
"<br />" . $form2->getHTML();
 
  561                 $this->tpl->setVariable(
"ADM_CONTENT", $html1.$html2);
 
  570                 return  (!empty(
$_POST[$a_var])) ?
 
  581                 if (!$this->tree->isInTree(
$_GET[
"obj_id"]))
 
  587                 $form->setValuesByArray
 
  591                                 "title" => $bookmark->getTitle(),
 
  592                                 "target" => $bookmark->getTarget(),
 
  593                                 "description" => $bookmark->getDescription(),
 
  594                                 "obj_id" => 
$_GET[
"obj_id"],
 
  597                 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
 
  606                 if (!$this->tree->isInTree($this->id))
 
  612                 if (empty(
$_POST[
"title"]))
 
  622                         $bmf->setParent($this->
id);
 
  635                 if (!$this->tree->isInTree(
$_GET[
"obj_id"]))
 
  641                 if (empty(
$_POST[
"title"]))
 
  664                 if (!$this->tree->isInTree($this->id))
 
  670                 if (empty(
$_POST[
"title"]))
 
  675                 else if (empty(
$_POST[
"target"]))
 
  687                         $bm->setParent($this->
id);
 
  704                 if (!$this->tree->isInTree(
$_GET[
"obj_id"]))
 
  710                 if (empty(
$_POST[
"title"]))
 
  715                 else if (empty(
$_POST[
"target"]))
 
  741                         $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
 
  744                 foreach($bm_ids as 
$id)
 
  746                         if ($this->tree->isInTree($id))
 
  754                 require_once (
"./Services/PersonalDesktop/classes/class.ilBookmarkImportExport.php");
 
  756                         $this->lng->txt(
"bookmarks_of").
" ".$this->ilias->account->getFullname());
 
  764                         return $html_content;
 
  773                 include_once 
'classes/class.ilFileDataMail.php';
 
  774                 require_once 
"Services/Mail/classes/class.ilFormatMail.php";
 
  778                 $html_content=$this->
export(
false);
 
  780                 $fp=fopen($tempfile,
'w');
 
  781                 fwrite($fp, $html_content);
 
  784                 $mfile->copyAttachmentFile($tempfile,
$filename);
 
  785                 $umail->savePostData($ilUser->getId(),array(
$filename),
 
  790         require_once 
'Services/Mail/classes/class.ilMailFormCall.php';
 
  801                         $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
 
  804                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"objects", 
"tpl.obj_confirm.html");
 
  807                 $this->ctrl->setParameter($this, 
"bmf_id", $this->
id);
 
  808                 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
 
  811                 $cols = array(
"type", 
"title");
 
  812                 foreach ($cols as $key)
 
  814                         $this->tpl->setCurrentBlock(
"table_header");
 
  815                         $this->tpl->setVariable(
"TEXT",$this->lng->txt($key));
 
  816                         $this->tpl->parseCurrentBlock();
 
  821                 foreach($bm_ids as $obj_id)
 
  825                         if (!$this->tree->isInTree($obj_id))
 
  833                                         $title = $BookmarkFolder->getTitle();
 
  835                                         unset($BookmarkFolder);
 
  840                                         $title = $Bookmark->getTitle();
 
  841                                         $target = $Bookmark->getTarget();
 
  847                         $this->tpl->setCurrentBlock(
"table_cell");
 
  849                         $this->tpl->parseCurrentBlock();
 
  852                         $this->tpl->setCurrentBlock(
"table_cell");
 
  859                                         $target,$this->textwidth, 
true)));
 
  861                         $this->tpl->parseCurrentBlock();
 
  864                         $this->tpl->setCurrentBlock(
"table_row");
 
  866                         $this->tpl->parseCurrentBlock();
 
  870                 $buttons = array( 
"cancel"  => $this->lng->txt(
"cancel"),
 
  871                         "confirm"  => $this->lng->txt(
"confirm"));
 
  874                 foreach($buttons as $name => $value)
 
  876                         $this->tpl->setCurrentBlock(
"operation_btn");
 
  877                         $this->tpl->setVariable(
"BTN_NAME",$name);
 
  878                         $this->tpl->setVariable(
"BTN_VALUE",$value);
 
  879                         $this->tpl->parseCurrentBlock();
 
  888                 session_unregister(
"saved_post");
 
  900                 global 
$tree, $rbacsystem, $rbacadmin;
 
  904                         $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
 
  913                         if ($this->tree->isInTree($id))
 
  915                                 $node_data = $this->tree->getNodeData($id);
 
  916                                 $subtree_nodes = $this->tree->getSubTree($node_data);
 
  924                         $this->tree->deleteTree($node_data);
 
  927                         foreach ($subtree_nodes as $node)
 
  929                                 switch ($node[
"type"])
 
  933                                                 $BookmarkFolder->delete();
 
  957                                 "delete"=>$this->lng->txt(
"delete"),
 
  958                                 "export"=>$this->lng->txt(
"export"),
 
  959                                 "sendmail"=>$this->lng->txt(
"bkm_sendmail"),
 
  962                 $subobj = array(
"bm", 
"bmf");
 
  964                 if (is_array($subobj))
 
  969                         $this->tpl->setCurrentBlock(
"add_object");
 
  970                         $this->tpl->setVariable(
"COLUMN_COUNTS", 7);
 
  971                         $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
 
  972                         $this->tpl->setVariable(
"BTN_NAME", 
"newForm");
 
  973                         $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"add"));
 
  974                         $this->tpl->parseCurrentBlock();
 
  977                 $this->tpl->setVariable(
"TPLPATH",$this->tpl->tplPath);
 
  979                 $this->tpl->setCurrentBlock(
"tbl_action_select");
 
  981                 $this->tpl->setVariable(
"BTN_NAME",
"executeAction");
 
  982                 $this->tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"execute"));
 
  993                 $this->tpl->parseCurrentBlock();
 
 1002                 include_once(
"./Services/PersonalDesktop/classes/class.ilBookmarkBlockGUI.php");
 
 1005                 return $bookmark_block_gui->getHTML();
 
 1017                 if (!$this->tree->isInTree($this->id))
 
 1022                 if ($_FILES[
"bkmfile"][
"error"] > UPLOAD_ERR_OK)
 
 1028                 require_once (
"./Services/PersonalDesktop/classes/class.ilBookmarkImportExport.php");
 
 1030                 if ($objects===
false)
 
 1037                 $num_create=array(
'bm'=>0,
'bmf'=>0);
 
 1041                         $num_create[ 
'bmf']));
 
 1056                 if (is_array($objects[$start_key]))
 
 1058                         foreach ($objects[$start_key] as $obj_key=>$object)
 
 1060                                 switch ($object[
'type'])
 
 1063                                                 if (!$object[
"title"]) 
continue;
 
 1064                                                 if (!$object[
"target"]) 
continue;
 
 1066                                                 $bm->setTitle($object[
"title"]);
 
 1067                                                 $bm->setDescription($object[
"description"]);
 
 1068                                                 $bm->setTarget($object[
"target"]);
 
 1069                                                 $bm->setParent($folder_id);
 
 1071                                                 $num_create[
'bm']++;
 
 1074                                                 if (!$object[
"title"]) 
continue;
 
 1076                                                 $bmf->setTitle($object[
"title"]);
 
 1077                                                 $bmf->setParent($folder_id);
 
 1079                                                 $num_create[
'bmf']++;
 
 1080                                                 if (is_array($objects[$obj_key]))
 
 1083                                                                 $bmf->getId(),$obj_key);