ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjStudyProgrammeSettingsGUI Class Reference

Class ilObjStudyProgrammeSettingsGUI. More...

+ Collaboration diagram for ilObjStudyProgrammeSettingsGUI:

Public Member Functions

 __construct ($a_parent_gui, $a_ref_id)
 
 executeCommand ()
 

Data Fields

 $ctrl
 
 $tpl
 
 $object
 
 $ilias
 
 $lng
 
const PROP_TITLE = "title"
 
const PROP_DESC = "desc"
 
const PROP_TYPE = "type"
 
const PROP_POINTS = "points"
 
const PROP_STATUS = "status"
 

Protected Member Functions

 view ()
 
 update ()
 
 cancel ()
 
 buildModalHeading ($label, $current_node)
 
 buildForm ()
 
 getObject ()
 
 fillForm ($a_form)
 
 checkForm ($a_form)
 
 updateFromFrom ($a_form)
 

Static Protected Member Functions

static getStatusOptions ()
 

Protected Attributes

 $ilAccess
 
 $ilLog
 
 $parent_gui
 
 $tmp_heading
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjStudyProgrammeSettingsGUI::__construct (   $a_parent_gui,
  $a_ref_id 
)

Definition at line 64 of file class.ilObjStudyProgrammeSettingsGUI.php.

64 {
65 global $DIC;
66 $tpl = $DIC['tpl'];
67 $ilCtrl = $DIC['ilCtrl'];
68 $ilAccess = $DIC['ilAccess'];
69 $ilToolbar = $DIC['ilToolbar'];
70 $ilLocator = $DIC['ilLocator'];
71 $tree = $DIC['tree'];
72 $lng = $DIC['lng'];
73 $ilLog = $DIC['ilLog'];
74 $ilias = $DIC['ilias'];
75
76 $this->parent_gui = $a_parent_gui;
77 $this->ref_id = $a_ref_id;
78 $this->parent_gui = $a_parent_gui;
79
80 $this->tpl = $tpl;
81 $this->ctrl = $ilCtrl;
82 $this->ilAccess = $ilAccess;
83 $this->ilLocator = $ilLocator;
84 $this->tree = $tree;
85 $this->toolbar = $ilToolbar;
86 $this->ilLog = $ilLog;
87 $this->ilias = $ilias;
88 $this->lng = $lng;
89
90 $this->object = null;
91
92 $lng->loadLanguageModule("prg");
93 }
logging
Definition: class.ilLog.php:19
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file)
global $DIC

References $DIC, $ilAccess, $ilCtrl, $ilias, $ilLog, $lng, and $tpl.

Member Function Documentation

◆ buildForm()

ilObjStudyProgrammeSettingsGUI::buildForm ( )
protected

Definition at line 194 of file class.ilObjStudyProgrammeSettingsGUI.php.

194 {
195 $form = new ilAsyncPropertyFormGUI();
196
197 if(!$this->ctrl->isAsynch()) {
198 $form->setAsync(false);
199 }
200
201 $form->setFormAction($this->ctrl->getFormAction($this));
202
204 $header->setTitle($this->lng->txt("prg_edit"));
205 $form->addItem($header);
206
207 $item = new ilTextInputGUI($this->lng->txt("title"), self::PROP_TITLE);
208 $item->setRequired(true);
209 $form->addItem($item);
210
211 $item = new ilTextAreaInputGUI($this->lng->txt("description"), self::PROP_DESC);
212 $form->addItem($item);
213
215 $header->setTitle($this->lng->txt("prg_type"));
216 $form->addItem($header);
217
218 $item = new ilSelectInputGUI($this->lng->txt("type"), self::PROP_TYPE);
219 $item->setOptions(ilStudyProgrammeType::getAllTypesArray());
220 $form->addItem($item);
221
223 $header->setTitle($this->lng->txt("prg_assessment"));
224 $form->addItem($header);
225
226 $item = new ilNumberInputGUI($this->lng->txt("prg_points"), self::PROP_POINTS);
227 $item->setMinValue(0);
228 $form->addItem($item);
229
230 $item = new ilSelectInputGUI($this->lng->txt("prg_status"), self::PROP_STATUS);
231 $item->setOptions(self::getStatusOptions());
232 $form->addItem($item);
233
234 $form->addCommandButton("update", $this->lng->txt("save"));
235 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
236
237 return $form;
238 }
Class ilAsyncPropertyFormGUI.
This class represents a section header in a property form.
This class represents a number property in a property form.
This class represents a selection list property in a property form.
static getAllTypesArray($add_empty_on_begin=true)
This class represents a text area property in a property form.
This class represents a text property in a property form.
$header

References $header, and ilStudyProgrammeType\getAllTypesArray().

Referenced by update(), and view().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildModalHeading()

ilObjStudyProgrammeSettingsGUI::buildModalHeading (   $label,
  $current_node 
)
protected

Definition at line 173 of file class.ilObjStudyProgrammeSettingsGUI.php.

173 {
174 if(!$current_node) {
175 $this->ctrl->saveParameterByClass('ilobjstudyprogrammesettingsgui', 'ref_id');
176 $heading_button = ilLinkButton::getInstance();
177 $heading_button->setCaption('prg_open_node');
178 $heading_button->setUrl($this->ctrl->getLinkTargetByClass('ilobjstudyprogrammetreegui', 'view'));
179
180 $heading = "<div class=''>".$label."<div class='pull-right'>".$heading_button->render()."</div></div>";
181 $this->tmp_heading = $heading;
182 } else {
183 $this->tmp_heading = "<div class=''>".$label."</div>";
184 }
185
186 }
static getInstance()
Factory.

References ilLinkButton\getInstance().

Referenced by view().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilObjStudyProgrammeSettingsGUI::cancel ( )
protected

Definition at line 167 of file class.ilObjStudyProgrammeSettingsGUI.php.

167 {
169
170 $this->ctrl->redirect($this->parent_gui);
171 }
static handleAsyncOutput($normal_content, $async_content=null, $apply_to_tpl=true)
Handles async output.
static encodeAsyncResponse(array $data=array())
Encode data as json for async output.

References ilAsyncOutputHandler\encodeAsyncResponse(), and ilAsyncOutputHandler\handleAsyncOutput().

+ Here is the call graph for this function:

◆ checkForm()

ilObjStudyProgrammeSettingsGUI::checkForm (   $a_form)
protected

Definition at line 259 of file class.ilObjStudyProgrammeSettingsGUI.php.

259 {
260 if (!$a_form->checkInput()) {
261 return false;
262 }
263 return true;
264 }

Referenced by update().

+ Here is the caller graph for this function:

◆ executeCommand()

ilObjStudyProgrammeSettingsGUI::executeCommand ( )

Definition at line 95 of file class.ilObjStudyProgrammeSettingsGUI.php.

95 {
96 $cmd = $this->ctrl->getCmd();
97
98
99 if ($cmd == "") {
100 $cmd = "view";
101 }
102
103 switch ($cmd) {
104 case "view":
105 case "update":
106 case "cancel":
107 $content = $this->$cmd();
108 break;
109 default:
110 throw new ilException("ilObjStudyProgrammeSettingsGUI: ".
111 "Command not supported: $cmd");
112 }
113
114 if(!$this->ctrl->isAsynch()) {
115 $this->tpl->setContent($content);
116 } else {
117 $output_handler = new ilAsyncOutputHandler();
118 $heading = $this->lng->txt("prg_async_".$this->ctrl->getCmd());
119 if(isset($this->tmp_heading)) {
120 $heading = $this->tmp_heading;
121 }
122 $output_handler->setHeading($heading);
123 $output_handler->setContent($content);
124 $output_handler->terminate();
125 }
126 }
Class ilAsyncOutputHandler Handles the output for async-requests.
Base class for ILIAS Exception handling.
$cmd
Definition: sahs_server.php:35

References $cmd, and $tmp_heading.

◆ fillForm()

ilObjStudyProgrammeSettingsGUI::fillForm (   $a_form)
protected

Definition at line 247 of file class.ilObjStudyProgrammeSettingsGUI.php.

247 {
248 $obj = $this->getObject();
249
250 $a_form->setValuesByArray(array
251 ( self::PROP_TITLE => $obj->getTitle()
252 , self::PROP_DESC => $obj->getDescription()
253 , self::PROP_TYPE => $obj->getSubtypeId()
254 , self::PROP_POINTS => $obj->getPoints()
255 , self::PROP_STATUS => $obj->getStatus()
256 ));
257 }

References getObject().

Referenced by view().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObject()

ilObjStudyProgrammeSettingsGUI::getObject ( )
protected

Definition at line 240 of file class.ilObjStudyProgrammeSettingsGUI.php.

240 {
241 if ($this->object === null) {
242 $this->object = ilObjStudyProgramme::getInstanceByRefId($this->ref_id);
243 }
244 return $this->object;
245 }
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.

References $object, and ilObjStudyProgramme\getInstanceByRefId().

Referenced by fillForm(), and updateFromFrom().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStatusOptions()

static ilObjStudyProgrammeSettingsGUI::getStatusOptions ( )
staticprotected

Definition at line 282 of file class.ilObjStudyProgrammeSettingsGUI.php.

282 {
283 global $DIC;
284 $lng = $DIC['lng'];
285
286 return array( ilStudyProgramme::STATUS_DRAFT
287 => $lng->txt("prg_status_draft")
289 => $lng->txt("prg_status_active")
291 => $lng->txt("prg_status_outdated")
292 );
293 }

References $DIC, $lng, ilStudyProgramme\STATUS_ACTIVE, ilStudyProgramme\STATUS_DRAFT, and ilStudyProgramme\STATUS_OUTDATED.

◆ update()

ilObjStudyProgrammeSettingsGUI::update ( )
protected

Definition at line 140 of file class.ilObjStudyProgrammeSettingsGUI.php.

140 {
141
142 $form = $this->buildForm();
143 $form->setValuesByPost();
144 $update_possible = $this->checkForm($form);
145
146 if ($update_possible) {
147 $this->updateFromFrom($form);
148 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
149 $response = ilAsyncOutputHandler::encodeAsyncResponse(array("success"=>true, "message"=>$this->lng->txt("msg_obj_modified")));
150 } else {
151 // TODO:
152 ilUtil::sendFailure($this->lng->txt("msg_form_save_error"));
153 $response = ilAsyncOutputHandler::encodeAsyncResponse(array("success"=>false, "errors"=>$form->getErrors()));
154 }
155
156 if($this->ctrl->isAsynch()) {
157 return ilAsyncOutputHandler::handleAsyncOutput($form->getHTML(), $response, false);
158 } else {
159 if($update_possible) {
160 $this->ctrl->redirect($this);
161 } else {
162 return $form->getHTML();
163 }
164 }
165 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References buildForm(), checkForm(), ilAsyncOutputHandler\encodeAsyncResponse(), ilAsyncOutputHandler\handleAsyncOutput(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and updateFromFrom().

+ Here is the call graph for this function:

◆ updateFromFrom()

ilObjStudyProgrammeSettingsGUI::updateFromFrom (   $a_form)
protected

Definition at line 266 of file class.ilObjStudyProgrammeSettingsGUI.php.

266 {
267 $obj = $this->getObject();
268
269 $obj->setTitle($a_form->getItemByPostVar(self::PROP_TITLE)->getValue());
270 $obj->setDescription($a_form->getItemByPostVar(self::PROP_DESC)->getValue());
271
272 if($obj->getSubtypeId() != $a_form->getItemByPostVar(self::PROP_TYPE)->getValue()) {
273 $obj->setSubtypeId($a_form->getItemByPostVar(self::PROP_TYPE)->getValue());
274 $obj->updateCustomIcon();
275 $this->parent_gui->setTitleAndDescription();
276 }
277
278 $obj->setPoints($a_form->getItemByPostVar(self::PROP_POINTS)->getValue());
279 $obj->setStatus($a_form->getItemByPostVar(self::PROP_STATUS)->getValue());
280 }

References getObject().

Referenced by update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ view()

ilObjStudyProgrammeSettingsGUI::view ( )
protected

Definition at line 128 of file class.ilObjStudyProgrammeSettingsGUI.php.

128 {
129 $this->buildModalHeading($this->lng->txt('prg_async_settings'),isset($_GET["currentNode"]));
130
131 $form = $this->buildForm();
132 $this->fillForm($form);
133 return $form->getHTML();
134 }
$_GET["client_id"]

References $_GET, buildForm(), buildModalHeading(), and fillForm().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilObjStudyProgrammeSettingsGUI::$ctrl

Definition at line 22 of file class.ilObjStudyProgrammeSettingsGUI.php.

◆ $ilAccess

ilObjStudyProgrammeSettingsGUI::$ilAccess
protected

Definition at line 32 of file class.ilObjStudyProgrammeSettingsGUI.php.

Referenced by __construct().

◆ $ilias

ilObjStudyProgrammeSettingsGUI::$ilias

Definition at line 47 of file class.ilObjStudyProgrammeSettingsGUI.php.

Referenced by __construct().

◆ $ilLog

ilObjStudyProgrammeSettingsGUI::$ilLog
protected

Definition at line 42 of file class.ilObjStudyProgrammeSettingsGUI.php.

Referenced by __construct().

◆ $lng

ilObjStudyProgrammeSettingsGUI::$lng

Definition at line 52 of file class.ilObjStudyProgrammeSettingsGUI.php.

Referenced by __construct(), and getStatusOptions().

◆ $object

ilObjStudyProgrammeSettingsGUI::$object

Definition at line 37 of file class.ilObjStudyProgrammeSettingsGUI.php.

Referenced by getObject().

◆ $parent_gui

ilObjStudyProgrammeSettingsGUI::$parent_gui
protected

Definition at line 57 of file class.ilObjStudyProgrammeSettingsGUI.php.

◆ $tmp_heading

ilObjStudyProgrammeSettingsGUI::$tmp_heading
protected

Definition at line 62 of file class.ilObjStudyProgrammeSettingsGUI.php.

Referenced by executeCommand().

◆ $tpl

ilObjStudyProgrammeSettingsGUI::$tpl

Definition at line 27 of file class.ilObjStudyProgrammeSettingsGUI.php.

Referenced by __construct().

◆ PROP_DESC

const ilObjStudyProgrammeSettingsGUI::PROP_DESC = "desc"

Definition at line 189 of file class.ilObjStudyProgrammeSettingsGUI.php.

◆ PROP_POINTS

const ilObjStudyProgrammeSettingsGUI::PROP_POINTS = "points"

Definition at line 191 of file class.ilObjStudyProgrammeSettingsGUI.php.

◆ PROP_STATUS

const ilObjStudyProgrammeSettingsGUI::PROP_STATUS = "status"

Definition at line 192 of file class.ilObjStudyProgrammeSettingsGUI.php.

◆ PROP_TITLE

const ilObjStudyProgrammeSettingsGUI::PROP_TITLE = "title"

Definition at line 188 of file class.ilObjStudyProgrammeSettingsGUI.php.

◆ PROP_TYPE

const ilObjStudyProgrammeSettingsGUI::PROP_TYPE = "type"

Definition at line 190 of file class.ilObjStudyProgrammeSettingsGUI.php.


The documentation for this class was generated from the following file: