ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 {
21  protected $user;
22 
23  protected $portfolio; // [ilObjPortfolio]
24  protected $is_template; // [bool]
25  protected $page_gui; // [string]
26 
30  public function __construct(ilObjPortfolioBaseGUI $a_parent_obj, $a_parent_cmd)
31  {
32  global $DIC;
33 
34  $this->ctrl = $DIC->ctrl();
35  $this->lng = $DIC->language();
36  $this->user = $DIC->user();
37  $ilCtrl = $DIC->ctrl();
38  $lng = $DIC->language();
39 
40  parent::__construct($a_parent_obj, $a_parent_cmd);
41 
42  $this->portfolio = $a_parent_obj->object;
43  $this->page_gui = $this->parent_obj->getPageGUIClassName();
44  $this->is_template = ($this->portfolio->getType() == "prtt");
45 
46  $this->setTitle($lng->txt("pages"));
47 
48  $this->addColumn($this->lng->txt(""), "", "1");
49  $this->addColumn($this->lng->txt("user_order"));
50  $this->addColumn($this->lng->txt("title"));
51  $this->addColumn($this->lng->txt("type"));
52  $this->addColumn($this->lng->txt("actions"));
53 
54  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
55  $this->setRowTemplate("tpl.portfolio_page_row.html", "Modules/Portfolio");
56 
57  $this->addMultiCommand("confirmPortfolioPageDeletion", $lng->txt("delete"));
58  $this->addMultiCommand("copyPageForm", $lng->txt("prtf_copy_page"));
59 
60  $this->addCommandButton(
61  "savePortfolioPagesOrdering",
62  $lng->txt("user_save_ordering_and_titles")
63  );
64 
65  $this->getItems();
66 
67  $lng->loadLanguageModule("blog");
68  }
69 
70  public function getItems()
71  {
73 
74  $data = ilPortfolioPage::getAllPortfolioPages($this->portfolio->getId());
75  $this->setData($data);
76 
77  if (!$this->is_template) {
78  $this->blogs = array();
79  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
80  $tree = new ilWorkspaceTree($ilUser->getId());
81  $root = $tree->readRootId();
82  if ($root) {
83  $root = $tree->getNodeData($root);
84  foreach ($tree->getSubTree($root) as $node) {
85  if ($node["type"] == "blog") {
86  $this->blogs[$node["obj_id"]] = $node["wsp_id"];
87  }
88  }
89  }
90 
91  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
92  include_once("./Modules/Blog/classes/class.ilObjBlog.php");
93  }
94  }
95 
99  protected function fillRow($a_set)
100  {
101  $lng = $this->lng;
102  $lng = $this->lng;
104 
105  switch ($a_set["type"]) {
107  $this->tpl->setCurrentBlock("title_field");
108  $this->tpl->setVariable("ID", $a_set["id"]);
109  $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_set["title"]));
110  $this->tpl->parseCurrentBlock();
111 
112  $this->tpl->setCurrentBlock("action");
113  $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit_page"));
114  $ilCtrl->setParameterByClass(
115  $this->page_gui,
116  "ppage",
117  $a_set["id"]
118  );
119  $this->tpl->setVariable(
120  "CMD_EDIT",
121  $ilCtrl->getLinkTargetByClass($this->page_gui, "edit")
122  );
123  $this->tpl->parseCurrentBlock();
124  $this->tpl->setVariable("TYPE", $lng->txt("page"));
125  break;
126 
128  if (!$this->is_template) {
129  $this->tpl->setCurrentBlock("title_static");
130  $this->tpl->setVariable("VAL_TITLE_STATIC", ilObjBlog::_lookupTitle($a_set["title"]));
131  $this->tpl->parseCurrentBlock();
132 
133  $obj_id = (int) $a_set["title"];
134  if (isset($this->blogs[$obj_id])) {
135  $node_id = $this->blogs[$obj_id];
136  $link = ilWorkspaceAccessHandler::getGotoLink($node_id, $obj_id);
137 
138  // #11519
139  $ilCtrl->setParameterByClass(
140  $this->page_gui,
141  "ppage",
142  $a_set["id"]
143  );
144  $link = $ilCtrl->getLinkTargetByClass(array($this->page_gui, "ilobjbloggui"), "render");
145 
146  $this->tpl->setCurrentBlock("action");
147  $this->tpl->setVariable("TXT_EDIT", $lng->txt("blog_edit"));
148  $this->tpl->setVariable("CMD_EDIT", $link);
149  $this->tpl->parseCurrentBlock();
150  }
151  $this->tpl->setVariable("TYPE", $lng->txt("obj_blog"));
152  }
153  break;
154 
156  if ($this->is_template) {
157  $this->tpl->setCurrentBlock("title_field");
158  $this->tpl->setVariable("ID", $a_set["id"]);
159  $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_set["title"]));
160  $this->tpl->parseCurrentBlock();
161 
162  $this->tpl->setCurrentBlock("title_static");
163  //$this->tpl->setVariable("VAL_TITLE_STATIC", $lng->txt("obj_blog"));
164  $this->tpl->parseCurrentBlock();
165  $this->tpl->setVariable("TYPE", $lng->txt("obj_blog"));
166  }
167  break;
168  }
169 
170  $this->tpl->setVariable("ID", $a_set["id"]);
171  $this->tpl->setVariable("VAL_ORDER_NR", $a_set["order_nr"]);
172  }
173 }
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)
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
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.
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