ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
45 public function getBlockType() : string
46 {
47 return self::$block_type;
48 }
49
53 protected function isRepositoryObject() : bool
54 {
55 return false;
56 }
57
61 public static function getScreenMode()
62 {
63 switch ($_GET['cmd']) {
64 case '...':
65 return IL_SCREEN_CENTER;
66 break;
67
68 default:
69 return IL_SCREEN_SIDE;
70 break;
71 }
72 }
73
77 public function executeCommand()
78 {
80
81 $cmd = $ilCtrl->getCmd('getHTML');
82
83 return $this->$cmd();
84 }
85
89 public function getHTML()
90 {
95
96 if (!$ilSetting->get('user_portfolios')) {
97 return '';
98 }
99
100 if ($this->getCurrentDetailLevel() == 0) {
101 return '';
102 } else {
103 include_once("./Modules/Portfolio/classes/class.ilObjPortfolio.php");
104 $this->default_portfolio = ilObjPortfolio::getDefaultPortfolio($ilUser->getId());
105
106 $lng->loadLanguageModule("prtf");
107 $this->setTitle($lng->txt('prtf_tab_portfolios'));
108 $this->addBlockCommand(
109 $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui"), ""),
110 $lng->txt("prtf_manage_portfolios")
111 );
112 $this->addBlockCommand(
113 $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "create"),
114 $lng->txt("prtf_add_portfolio")
115 );
116
117 $html = parent::getHTML();
118 return $html;
119 }
120 }
121
125 public function fillDataSection()
126 {
128
129 include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
131 $this->setData($data);
132
133 if ($this->getCurrentDetailLevel() > 1 && count($this->getData()) > 0) {
134 $this->setRowTemplate("tpl.pd_portf_block_row.html", "Modules/Portfolio");
135 if ($this->getCurrentDetailLevel() > 2) {
136 $this->setColSpan(2);
137 }
138 parent::fillDataSection();
139 } else {
140 $this->setEnableNumInfo(false);
141 if (count($this->getData()) == 0) {
142 $this->setEnableDetailRow(false);
143 }
144 $this->setDataSection($this->getOverview());
145 }
146 }
147
151 public function fillRow($p)
152 {
155
156 if ($this->getCurrentDetailLevel() > 1) {
157 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $p["id"]);
158 $this->tpl->setVariable("HREF", $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "preview"));
159 $this->tpl->setVariable("TITLE", trim($p["title"]));
160
161 if ($this->default_portfolio == $p["id"]) {
162 // #16490
163 $this->tpl->setVariable("DESC", $lng->txt("prtf_default_portfolio"));
164 }
165
166 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", "");
167 }
168 }
169
173 protected function getOverview()
174 {
177
178 if (count($this->getData()) == 0) {
179 // ilias.php?cmd=create&cmdClass=ilobjportfoliogui&cmdNode=5f:o8:oh&baseClass=ilPersonalDesktopGUI
180 return '<div class="small"><a href="' .
181 $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "create") .
182 '">' . $lng->txt("prtf_add_portfolio") . '</a></div>';
183 } else {
184 $t = (count($this->getData()) == 1)
185 ? $lng->txt("obj_prtf")
186 : $lng->txt("prtf_portfolios");
187 return '<div class="small"><a href="' .
188 $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui"), "") .
189 '">' . ((int) count($this->getData())) . " " . $t . "</a></div>";
190 }
191 }
192}
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 getScreenMode()
Get Screen Mode for current command.
isRepositoryObject()
Returns whether block has a corresponding repository object.bool
fillRow($p)
get flat bookmark list for personal desktop
$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