ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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
4include_once("./Services/Table/classes/class.ilTable2GUI.php");
5include_once("./Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php");
6include_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("actions"));
41
42 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
43 $this->setRowTemplate("tpl.portfolio_page_row.html", "Modules/Portfolio");
44
45 $this->addMultiCommand("confirmPortfolioPageDeletion", $lng->txt("delete"));
46 $this->addMultiCommand("copyPageForm", $lng->txt("prtf_copy_page"));
47
48 $this->addCommandButton("savePortfolioPagesOrdering",
49 $lng->txt("user_save_ordering_and_titles"));
50
51 $this->getItems();
52
53 $lng->loadLanguageModule("blog");
54 }
55
56 function getItems()
57 {
58 global $ilUser;
59
60 $data = ilPortfolioPage::getAllPages($this->portfolio->getId());
61 $this->setData($data);
62
63 if(!$this->is_template)
64 {
65 $this->blogs = array();
66 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
67 $tree = new ilWorkspaceTree($ilUser->getId());
68 $root = $tree->readRootId();
69 if($root)
70 {
71 $root = $tree->getNodeData($root);
72 foreach ($tree->getSubTree($root) as $node)
73 {
74 if ($node["type"] == "blog")
75 {
76 $this->blogs[$node["obj_id"]] = $node["wsp_id"];
77 }
78 }
79 }
80
81 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
82 include_once("./Modules/Blog/classes/class.ilObjBlog.php");
83 }
84 }
85
89 protected function fillRow($a_set)
90 {
91 global $lng, $lng, $ilCtrl;
92
93 switch($a_set["type"])
94 {
96 $this->tpl->setCurrentBlock("title_field");
97 $this->tpl->setVariable("ID", $a_set["id"]);
98 $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_set["title"]));
99 $this->tpl->parseCurrentBlock();
100
101 $this->tpl->setCurrentBlock("action");
102 $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit_page"));
103 $ilCtrl->setParameterByClass($this->page_gui,
104 "ppage", $a_set["id"]);
105 $this->tpl->setVariable("CMD_EDIT",
106 $ilCtrl->getLinkTargetByClass($this->page_gui, "edit"));
107 $this->tpl->parseCurrentBlock();
108 break;
109
111 if(!$this->is_template)
112 {
113 $this->tpl->setCurrentBlock("title_static");
114 $this->tpl->setVariable("VAL_TITLE_STATIC", $lng->txt("obj_blog").": ".ilObjBlog::_lookupTitle($a_set["title"]));
115 $this->tpl->parseCurrentBlock();
116
117 $obj_id = (int)$a_set["title"];
118 if(isset($this->blogs[$obj_id]))
119 {
120 $node_id = $this->blogs[$obj_id];
121 $link = ilWorkspaceAccessHandler::getGotoLink($node_id, $obj_id);
122
123 // #11519
124 $ilCtrl->setParameterByClass($this->page_gui,
125 "ppage", $a_set["id"]);
126 $link = $ilCtrl->getLinkTargetByClass(array($this->page_gui, "ilobjbloggui"), "render");
127
128 $this->tpl->setCurrentBlock("action");
129 $this->tpl->setVariable("TXT_EDIT", $lng->txt("blog_edit"));
130 $this->tpl->setVariable("CMD_EDIT", $link);
131 $this->tpl->parseCurrentBlock();
132 }
133 }
134 break;
135
137 if($this->is_template)
138 {
139 $this->tpl->setCurrentBlock("title_field");
140 $this->tpl->setVariable("ID", $a_set["id"]);
141 $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_set["title"]));
142 $this->tpl->parseCurrentBlock();
143
144 $this->tpl->setCurrentBlock("title_static");
145 $this->tpl->setVariable("VAL_TITLE_STATIC", $lng->txt("obj_blog"));
146 $this->tpl->parseCurrentBlock();
147 }
148 break;
149 }
150
151 $this->tpl->setVariable("ID", $a_set["id"]);
152 $this->tpl->setVariable("VAL_ORDER_NR", $a_set["order_nr"]);
153 }
154}
155
156?>
Portfolio view gui base class.
static _lookupTitle($a_id)
lookup object title
__construct(ilObjPortfolioBaseGUI $a_parent_obj, $a_parent_cmd)
Constructor.
static getAllPages($a_portfolio_id)
Get pages of portfolio.
Class ilTable2GUI.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static getGotoLink($a_node_id, $a_obj_id, $a_additional=null)
Tree handler for personal workspace.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
global $ilUser
Definition: imgupload.php:15