ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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/Blog/classes/class.ilObjBlog.php");
6 
16 {
17  protected $portfolio;
18 
22  function __construct($a_parent_obj, $a_parent_cmd, ilObjPortfolio $a_portfolio)
23  {
24  global $ilCtrl, $lng, $ilAccess, $lng, $ilUser;
25 
26  $this->portfolio = $a_portfolio;
27 
28  parent::__construct($a_parent_obj, $a_parent_cmd);
29 
30  $this->setTitle($lng->txt("pages"));
31 
32  $this->addColumn($this->lng->txt(""), "", "1");
33  $this->addColumn($this->lng->txt("user_order"));
34  $this->addColumn($this->lng->txt("title"));
35  $this->addColumn($this->lng->txt("actions"));
36 
37  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
38  $this->setRowTemplate("tpl.portfolio_page_row.html", "Services/Portfolio");
39 
40  $this->addMultiCommand("confirmPortfolioPageDeletion", $lng->txt("delete"));
41  $this->addMultiCommand("copyPageForm", $lng->txt("prtf_copy_page"));
42 
43  $this->addCommandButton("savePortfolioPagesOrdering",
44  $lng->txt("user_save_ordering_and_titles"));
45 
46  $this->getItems();
47 
48  $lng->loadLanguageModule("blog");
49  }
50 
51  function getItems()
52  {
53  global $ilUser;
54 
55  include_once("./Services/Portfolio/classes/class.ilPortfolioPage.php");
56  $data = ilPortfolioPage::getAllPages($this->portfolio->getId());
57  $this->setData($data);
58 
59  $this->blogs = array();
60  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
61  $tree = new ilWorkspaceTree($ilUser->getId());
62  $root = $tree->readRootId();
63  if($root)
64  {
65  $root = $tree->getNodeData($root);
66  foreach ($tree->getSubTree($root) as $node)
67  {
68  if ($node["type"] == "blog")
69  {
70  $this->blogs[$node["obj_id"]] = $node["wsp_id"];
71  }
72  }
73  }
74 
75  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
76  }
77 
81  protected function fillRow($a_set)
82  {
83  global $lng, $lng, $ilCtrl;
84 
85  switch($a_set["type"])
86  {
88  $this->tpl->setCurrentBlock("title_field");
89  $this->tpl->setVariable("ID", $a_set["id"]);
90  $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_set["title"]));
91  $this->tpl->parseCurrentBlock();
92 
93  $this->tpl->setCurrentBlock("action");
94  $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit_page"));
95  $ilCtrl->setParameterByClass("ilportfoliopagegui",
96  "ppage", $a_set["id"]);
97  $this->tpl->setVariable("CMD_EDIT",
98  $ilCtrl->getLinkTargetByClass("ilportfoliopagegui", "edit"));
99  $this->tpl->parseCurrentBlock();
100  break;
101 
103  $this->tpl->setCurrentBlock("title_static");
104  $this->tpl->setVariable("VAL_TITLE", $lng->txt("obj_blog").": ".ilObjBlog::_lookupTitle($a_set["title"]));
105  $this->tpl->parseCurrentBlock();
106 
107  $obj_id = (int)$a_set["title"];
108  if(isset($this->blogs[$obj_id]))
109  {
110  $node_id = $this->blogs[$obj_id];
111  $link = ilWorkspaceAccessHandler::getGotoLink($node_id, $obj_id);
112 
113  $ilCtrl->setParameterByClass("ilportfoliopagegui",
114  "ppage", $a_set["id"]);
115  $link = $ilCtrl->getLinkTargetByClass(array("ilportfoliopagegui", "ilobjbloggui"), "edit");
116 
117  $this->tpl->setCurrentBlock("action");
118  $this->tpl->setVariable("TXT_EDIT", $lng->txt("blog_edit"));
119  $this->tpl->setVariable("CMD_EDIT", $link);
120  $this->tpl->parseCurrentBlock();
121  }
122  break;
123  }
124 
125  $this->tpl->setVariable("ID", $a_set["id"]);
126  $this->tpl->setVariable("VAL_ORDER_NR", $a_set["order_nr"]);
127  }
128 }
129 
130 ?>