ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilPortfolioPageTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Table/classes/class.ilTable2GUI.php");
5 include_once("./Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php");
6 include_once("./Modules/Portfolio/classes/class.ilPortfolioPage.php");
7 
17 {
18  protected $portfolio; // [ilObjPortfolio]
19  protected $is_template; // [bool]
20  protected $page_gui; // [string]
21 
25  function __construct(ilObjPortfolioBaseGUI $a_parent_obj, $a_parent_cmd)
26  {
27  global $ilCtrl, $lng;
28 
29  parent::__construct($a_parent_obj, $a_parent_cmd);
30 
31  $this->portfolio = $a_parent_obj->object;
32  $this->page_gui = $this->parent_obj->getPageGUIClassName();
33  $this->is_template = ($this->portfolio->getType() == "prtt");
34 
35  $this->setTitle($lng->txt("pages"));
36 
37  $this->addColumn($this->lng->txt(""), "", "1");
38  $this->addColumn($this->lng->txt("user_order"));
39  $this->addColumn($this->lng->txt("title"));
40  $this->addColumn($this->lng->txt("type"));
41  $this->addColumn($this->lng->txt("actions"));
42 
43  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
44  $this->setRowTemplate("tpl.portfolio_page_row.html", "Modules/Portfolio");
45 
46  $this->addMultiCommand("confirmPortfolioPageDeletion", $lng->txt("delete"));
47  $this->addMultiCommand("copyPageForm", $lng->txt("prtf_copy_page"));
48 
49  $this->addCommandButton("savePortfolioPagesOrdering",
50  $lng->txt("user_save_ordering_and_titles"));
51 
52  $this->getItems();
53 
54  $lng->loadLanguageModule("blog");
55  }
56 
57  function getItems()
58  {
59  global $ilUser;
60 
61  $data = ilPortfolioPage::getAllPortfolioPages($this->portfolio->getId());
62  $this->setData($data);
63 
64  if(!$this->is_template)
65  {
66  $this->blogs = array();
67  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
68  $tree = new ilWorkspaceTree($ilUser->getId());
69  $root = $tree->readRootId();
70  if($root)
71  {
72  $root = $tree->getNodeData($root);
73  foreach ($tree->getSubTree($root) as $node)
74  {
75  if ($node["type"] == "blog")
76  {
77  $this->blogs[$node["obj_id"]] = $node["wsp_id"];
78  }
79  }
80  }
81 
82  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
83  include_once("./Modules/Blog/classes/class.ilObjBlog.php");
84  }
85  }
86 
90  protected function fillRow($a_set)
91  {
92  global $lng, $lng, $ilCtrl;
93 
94  switch($a_set["type"])
95  {
97  $this->tpl->setCurrentBlock("title_field");
98  $this->tpl->setVariable("ID", $a_set["id"]);
99  $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_set["title"]));
100  $this->tpl->parseCurrentBlock();
101 
102  $this->tpl->setCurrentBlock("action");
103  $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit_page"));
104  $ilCtrl->setParameterByClass($this->page_gui,
105  "ppage", $a_set["id"]);
106  $this->tpl->setVariable("CMD_EDIT",
107  $ilCtrl->getLinkTargetByClass($this->page_gui, "edit"));
108  $this->tpl->parseCurrentBlock();
109  $this->tpl->setVariable("TYPE", $lng->txt("page"));
110  break;
111 
113  if(!$this->is_template)
114  {
115  $this->tpl->setCurrentBlock("title_static");
116  $this->tpl->setVariable("VAL_TITLE_STATIC", ilObjBlog::_lookupTitle($a_set["title"]));
117  $this->tpl->parseCurrentBlock();
118 
119  $obj_id = (int)$a_set["title"];
120  if(isset($this->blogs[$obj_id]))
121  {
122  $node_id = $this->blogs[$obj_id];
123  $link = ilWorkspaceAccessHandler::getGotoLink($node_id, $obj_id);
124 
125  // #11519
126  $ilCtrl->setParameterByClass($this->page_gui,
127  "ppage", $a_set["id"]);
128  $link = $ilCtrl->getLinkTargetByClass(array($this->page_gui, "ilobjbloggui"), "render");
129 
130  $this->tpl->setCurrentBlock("action");
131  $this->tpl->setVariable("TXT_EDIT", $lng->txt("blog_edit"));
132  $this->tpl->setVariable("CMD_EDIT", $link);
133  $this->tpl->parseCurrentBlock();
134  }
135  $this->tpl->setVariable("TYPE", $lng->txt("obj_blog"));
136  }
137  break;
138 
140  if($this->is_template)
141  {
142  $this->tpl->setCurrentBlock("title_field");
143  $this->tpl->setVariable("ID", $a_set["id"]);
144  $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_set["title"]));
145  $this->tpl->parseCurrentBlock();
146 
147  $this->tpl->setCurrentBlock("title_static");
148  //$this->tpl->setVariable("VAL_TITLE_STATIC", $lng->txt("obj_blog"));
149  $this->tpl->parseCurrentBlock();
150  $this->tpl->setVariable("TYPE", $lng->txt("obj_blog"));
151  }
152  break;
153  }
154 
155  $this->tpl->setVariable("ID", $a_set["id"]);
156  $this->tpl->setVariable("VAL_ORDER_NR", $a_set["order_nr"]);
157  }
158 }
159 
160 ?>
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static getAllPortfolioPages($a_portfolio_id)
Get pages of portfolio.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static _lookupTitle($a_id)
Tree handler for personal workspace.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
static getGotoLink($a_node_id, $a_obj_id, $a_additional=null)
getNodeData($a_node_id, $a_tree_pk=null)
get all information of a node.
addMultiCommand($a_cmd, $a_text)
Add Command button.
$ilUser
Definition: imgupload.php:18
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
Portfolio view gui base class.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $lng
Definition: privfeed.php:17
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
__construct(ilObjPortfolioBaseGUI $a_parent_obj, $a_parent_cmd)
Constructor.
readRootId()
read root id from database