ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilPDPortfolioBlockGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once 'Services/Block/classes/class.ilBlockGUI.php';
6
15{
19 protected $settings;
20
21 public static $block_type = 'pdportf';
22 protected $default_portfolio = 0;
23
27 public function __construct()
28 {
29 global $DIC;
30
31 $this->lng = $DIC->language();
32 $this->ctrl = $DIC->ctrl();
33 $this->settings = $DIC->settings();
34 $this->user = $DIC->user();
35
36 parent::__construct();
37
38 $this->setLimit(5);
40 }
41
46 public static function getBlockType()
47 {
48 return self::$block_type;
49 }
50
55 public static function isRepositoryObject()
56 {
57 return false;
58 }
59
63 public static function getScreenMode()
64 {
65 switch ($_GET['cmd']) {
66 case '...':
67 return IL_SCREEN_CENTER;
68 break;
69
70 default:
71 return IL_SCREEN_SIDE;
72 break;
73 }
74 }
75
79 public function executeCommand()
80 {
82
83 $cmd = $ilCtrl->getCmd('getHTML');
84
85 return $this->$cmd();
86 }
87
91 public function getHTML()
92 {
97
98 if (!$ilSetting->get('user_portfolios')) {
99 return '';
100 }
101
102 if ($this->getCurrentDetailLevel() == 0) {
103 return '';
104 } else {
105 include_once("./Modules/Portfolio/classes/class.ilObjPortfolio.php");
106 $this->default_portfolio = ilObjPortfolio::getDefaultPortfolio($ilUser->getId());
107
108 $lng->loadLanguageModule("prtf");
109 $this->setTitle($lng->txt('prtf_tab_portfolios'));
110 $this->addBlockCommand(
111 $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui"), ""),
112 $lng->txt("prtf_manage_portfolios")
113 );
114 $this->addBlockCommand(
115 $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "create"),
116 $lng->txt("prtf_add_portfolio")
117 );
118
119 $html = parent::getHTML();
120 return $html;
121 }
122 }
123
127 public function fillDataSection()
128 {
130
131 include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
133 $this->setData($data);
134
135 if ($this->getCurrentDetailLevel() > 1 && count($this->getData()) > 0) {
136 $this->setRowTemplate("tpl.pd_portf_block_row.html", "Modules/Portfolio");
137 if ($this->getCurrentDetailLevel() > 2) {
138 $this->setColSpan(2);
139 }
140 parent::fillDataSection();
141 } else {
142 $this->setEnableNumInfo(false);
143 if (count($this->getData()) == 0) {
144 $this->setEnableDetailRow(false);
145 }
146 $this->setDataSection($this->getOverview());
147 }
148 }
149
153 public function fillRow($p)
154 {
157
158 if ($this->getCurrentDetailLevel() > 1) {
159 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $p["id"]);
160 $this->tpl->setVariable("HREF", $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "preview"));
161 $this->tpl->setVariable("TITLE", trim($p["title"]));
162
163 if ($this->default_portfolio == $p["id"]) {
164 // #16490
165 $this->tpl->setVariable("DESC", $lng->txt("prtf_default_portfolio"));
166 }
167
168 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", "");
169 }
170 }
171
175 protected function getOverview()
176 {
179
180 if (count($this->getData()) == 0) {
181 // ilias.php?cmd=create&cmdClass=ilobjportfoliogui&cmdNode=5f:o8:oh&baseClass=ilPersonalDesktopGUI
182 return '<div class="small"><a href="' .
183 $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "create") .
184 '">' . $lng->txt("prtf_add_portfolio") . '</a></div>';
185 } else {
186 $t = (count($this->getData()) == 1)
187 ? $lng->txt("obj_prtf")
188 : $lng->txt("prtf_portfolios");
189 return '<div class="small"><a href="' .
190 $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui"), "") .
191 '">' . ((int) count($this->getData())) . " " . $t . "</a></div>";
192 }
193 }
194}
user()
Definition: user.php:4
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
const IL_SCREEN_SIDE
const IL_SCREEN_CENTER
This class represents a block method of a block.
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
setLimit($a_limit)
Set Limit.
getCurrentDetailLevel()
Get Current Detail Level.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
setEnableDetailRow($a_enabledetailrow)
Set EnableDetailRow.
setData($a_data)
Set Data.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
setColSpan($a_colspan)
Set Columns Span.
setTitle($a_title)
Set Title.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
addBlockCommand( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
getData()
Get Data.
static getDefaultPortfolio($a_user_id)
Get default portfolio of user.
static getPortfoliosOfUser($a_user_id)
Get views of user.
static getBlockType()
Get block type.
static getScreenMode()
Get Screen Mode for current command.
fillRow($p)
get flat bookmark list for personal desktop
static isRepositoryObject()
Get block type.
$html
Definition: example_001.php:87
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:17
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2
$ilUser
Definition: imgupload.php:18