ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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{
16 static $block_type = 'pdportf';
17 protected $default_portfolio = 0;
18
22 public function __construct()
23 {
24 global $lng;
25
26 parent::__construct();
27
28 $this->setLimit(5);
30 }
31
36 static function getBlockType()
37 {
38 return self::$block_type;
39 }
40
45 static function isRepositoryObject()
46 {
47 return false;
48 }
49
53 static function getScreenMode()
54 {
55 switch($_GET['cmd'])
56 {
57 case '...':
58 return IL_SCREEN_CENTER;
59 break;
60
61 default:
62 return IL_SCREEN_SIDE;
63 break;
64 }
65 }
66
70 public function executeCommand()
71 {
72 global $ilCtrl;
73
74 $cmd = $ilCtrl->getCmd('getHTML');
75
76 return $this->$cmd();
77 }
78
82 public function getHTML()
83 {
85
86 if (!$ilSetting->get('user_portfolios'))
87 {
88 return '';
89 }
90
91 if($this->getCurrentDetailLevel() == 0)
92 {
93 return '';
94 }
95 else
96 {
97 include_once("./Modules/Portfolio/classes/class.ilObjPortfolio.php");
98 $this->default_portfolio = ilObjPortfolio::getDefaultPortfolio($ilUser->getId());
99
100 $lng->loadLanguageModule("prtf");
101 $this->setTitle($lng->txt('prtf_tab_portfolios'));
102 $this->addBlockCommand($ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui"), ""),
103 $lng->txt("prtf_manage_portfolios"));
104 $this->addBlockCommand($ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "create"),
105 $lng->txt("prtf_add_portfolio"));
106
107 $html = parent::getHTML();
108 return $html;
109 }
110 }
111
115 public function fillDataSection()
116 {
117 global $ilUser;
118
119 include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
121 $this->setData($data);
122
123 if($this->getCurrentDetailLevel() > 1 && count($this->getData()) > 0)
124 {
125 $this->setRowTemplate("tpl.pd_portf_block_row.html", "Modules/Portfolio");
126 if($this->getCurrentDetailLevel() > 2)
127 {
128 $this->setColSpan(2);
129 }
130 parent::fillDataSection();
131 }
132 else
133 {
134 $this->setEnableNumInfo(false);
135 if (count($this->getData()) == 0)
136 {
137 $this->setEnableDetailRow(false);
138 }
139 $this->setDataSection($this->getOverview());
140 }
141 }
142
146 public function fillRow($p)
147 {
148 global $ilCtrl, $lng;
149
150 if($this->getCurrentDetailLevel() > 1)
151 {
152 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $p["id"]);
153 $this->tpl->setVariable("HREF", $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "preview"));
154 $this->tpl->setVariable("TITLE", trim($p["title"]));
155
156 if ($this->default_portfolio == $p["id"])
157 {
158 // #16490
159 $this->tpl->setVariable("DESC", $lng->txt("prtf_default_portfolio"));
160 }
161
162 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", "");
163 }
164 }
165
169 protected function getOverview()
170 {
171 global $lng, $ilCtrl;
172
173 if (count($this->getData()) == 0)
174 {
175 // ilias.php?cmd=create&cmdClass=ilobjportfoliogui&cmdNode=5f:o8:oh&baseClass=ilPersonalDesktopGUI
176 return '<div class="small"><a href="'.
177 $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "create").
178 '">'.$lng->txt("prtf_add_portfolio").'</a></div>';
179 }
180 else
181 {
182 $t = (count($this->getData()) == 1)
183 ? $lng->txt("obj_prtf")
184 : $lng->txt("prtf_portfolios");
185 return '<div class="small"><a href="'.
186 $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui"), "").
187 '">'.((int)count($this->getData()))." ".$t."</a></div>";
188 }
189 }
190
191}
192?>
$_GET["client_id"]
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.
addBlockCommand($a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
setColSpan($a_colspan)
Set Columns Span.
setTitle($a_title)
Set Title.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
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 $lng
Definition: privfeed.php:40
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35
global $ilUser
Definition: imgupload.php:15