ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 $tpl, $ilCtrl, $ilAccess, $ilToolbar, $ilLocator, $tree, $lng, $ilLog, $ilias;
66
67 $this->parent_gui = $a_parent_gui;
68 $this->ref_id = $a_ref_id;
69 $this->parent_gui = $a_parent_gui;
70
71 $this->tpl = $tpl;
72 $this->ctrl = $ilCtrl;
73 $this->ilAccess = $ilAccess;
74 $this->ilLocator = $ilLocator;
75 $this->tree = $tree;
76 $this->toolbar = $ilToolbar;
77 $this->ilLog = $ilLog;
78 $this->ilias = $ilias;
79 $this->lng = $lng;
80
81 $this->object = null;
82
83 $lng->loadLanguageModule("prg");
84 }
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)

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

Member Function Documentation

◆ buildForm()

ilObjStudyProgrammeSettingsGUI::buildForm ( )
protected

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

185 {
186 $form = new ilAsyncPropertyFormGUI();
187
188 if(!$this->ctrl->isAsynch()) {
189 $form->setAsync(false);
190 }
191
192 $form->setFormAction($this->ctrl->getFormAction($this));
193
195 $header->setTitle($this->lng->txt("prg_edit"));
196 $form->addItem($header);
197
198 $item = new ilTextInputGUI($this->lng->txt("title"), self::PROP_TITLE);
199 $item->setRequired(true);
200 $form->addItem($item);
201
202 $item = new ilTextAreaInputGUI($this->lng->txt("description"), self::PROP_DESC);
203 $form->addItem($item);
204
206 $header->setTitle($this->lng->txt("prg_type"));
207 $form->addItem($header);
208
209 $item = new ilSelectInputGUI($this->lng->txt("type"), self::PROP_TYPE);
210 $item->setOptions(ilStudyProgrammeType::getAllTypesArray());
211 $form->addItem($item);
212
214 $header->setTitle($this->lng->txt("prg_assessment"));
215 $form->addItem($header);
216
217 $item = new ilNumberInputGUI($this->lng->txt("prg_points"), self::PROP_POINTS);
218 $item->setMinValue(0);
219 $form->addItem($item);
220
221 $item = new ilSelectInputGUI($this->lng->txt("prg_status"), self::PROP_STATUS);
222 $item->setOptions(self::getStatusOptions());
223 $form->addItem($item);
224
225 $form->addCommandButton("update", $this->lng->txt("save"));
226 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
227
228 return $form;
229 }
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 164 of file class.ilObjStudyProgrammeSettingsGUI.php.

164 {
165 if(!$current_node) {
166 $this->ctrl->saveParameterByClass('ilobjstudyprogrammesettingsgui', 'ref_id');
167 $heading_button = ilLinkButton::getInstance();
168 $heading_button->setCaption('prg_open_node');
169 $heading_button->setUrl($this->ctrl->getLinkTargetByClass('ilobjstudyprogrammetreegui', 'view'));
170
171 $heading = "<div class=''>".$label."<div class='pull-right'>".$heading_button->render()."</div></div>";
172 $this->tmp_heading = $heading;
173 } else {
174 $this->tmp_heading = "<div class=''>".$label."</div>";
175 }
176
177 }
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 158 of file class.ilObjStudyProgrammeSettingsGUI.php.

158 {
160
161 $this->ctrl->redirect($this->parent_gui);
162 }
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 250 of file class.ilObjStudyProgrammeSettingsGUI.php.

250 {
251 if (!$a_form->checkInput()) {
252 return false;
253 }
254 return true;
255 }

Referenced by update().

+ Here is the caller graph for this function:

◆ executeCommand()

ilObjStudyProgrammeSettingsGUI::executeCommand ( )

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

86 {
87 $cmd = $this->ctrl->getCmd();
88
89
90 if ($cmd == "") {
91 $cmd = "view";
92 }
93
94 switch ($cmd) {
95 case "view":
96 case "update":
97 case "cancel":
98 $content = $this->$cmd();
99 break;
100 default:
101 throw new ilException("ilObjStudyProgrammeSettingsGUI: ".
102 "Command not supported: $cmd");
103 }
104
105 if(!$this->ctrl->isAsynch()) {
106 $this->tpl->setContent($content);
107 } else {
108 $output_handler = new ilAsyncOutputHandler();
109 $heading = $this->lng->txt("prg_async_".$this->ctrl->getCmd());
110 if(isset($this->tmp_heading)) {
111 $heading = $this->tmp_heading;
112 }
113 $output_handler->setHeading($heading);
114 $output_handler->setContent($content);
115 $output_handler->terminate();
116 }
117 }
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 238 of file class.ilObjStudyProgrammeSettingsGUI.php.

238 {
239 $obj = $this->getObject();
240
241 $a_form->setValuesByArray(array
242 ( self::PROP_TITLE => $obj->getTitle()
243 , self::PROP_DESC => $obj->getDescription()
244 , self::PROP_TYPE => $obj->getSubtypeId()
245 , self::PROP_POINTS => $obj->getPoints()
246 , self::PROP_STATUS => $obj->getStatus()
247 ));
248 }

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 231 of file class.ilObjStudyProgrammeSettingsGUI.php.

231 {
232 if ($this->object === null) {
233 $this->object = ilObjStudyProgramme::getInstanceByRefId($this->ref_id);
234 }
235 return $this->object;
236 }
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 273 of file class.ilObjStudyProgrammeSettingsGUI.php.

273 {
274 global $lng;
275
276 return array( ilStudyProgramme::STATUS_DRAFT
277 => $lng->txt("prg_status_draft")
279 => $lng->txt("prg_status_active")
281 => $lng->txt("prg_status_outdated")
282 );
283 }

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

◆ update()

ilObjStudyProgrammeSettingsGUI::update ( )
protected

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

131 {
132
133 $form = $this->buildForm();
134 $form->setValuesByPost();
135 $update_possible = $this->checkForm($form);
136
137 if ($update_possible) {
138 $this->updateFromFrom($form);
139 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
140 $response = ilAsyncOutputHandler::encodeAsyncResponse(array("success"=>true, "message"=>$this->lng->txt("msg_obj_modified")));
141 } else {
142 // TODO:
143 ilUtil::sendFailure($this->lng->txt("msg_form_save_error"));
144 $response = ilAsyncOutputHandler::encodeAsyncResponse(array("success"=>false, "errors"=>$form->getErrors()));
145 }
146
147 if($this->ctrl->isAsynch()) {
148 return ilAsyncOutputHandler::handleAsyncOutput($form->getHTML(), $response, false);
149 } else {
150 if($update_possible) {
151 $this->ctrl->redirect($this);
152 } else {
153 return $form->getHTML();
154 }
155 }
156 }
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 257 of file class.ilObjStudyProgrammeSettingsGUI.php.

257 {
258 $obj = $this->getObject();
259
260 $obj->setTitle($a_form->getItemByPostVar(self::PROP_TITLE)->getValue());
261 $obj->setDescription($a_form->getItemByPostVar(self::PROP_DESC)->getValue());
262
263 if($obj->getSubtypeId() != $a_form->getItemByPostVar(self::PROP_TYPE)->getValue()) {
264 $obj->setSubtypeId($a_form->getItemByPostVar(self::PROP_TYPE)->getValue());
265 $obj->updateCustomIcon();
266 $this->parent_gui->setTitleAndDescription();
267 }
268
269 $obj->setPoints($a_form->getItemByPostVar(self::PROP_POINTS)->getValue());
270 $obj->setStatus($a_form->getItemByPostVar(self::PROP_STATUS)->getValue());
271 }

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 119 of file class.ilObjStudyProgrammeSettingsGUI.php.

119 {
120 $this->buildModalHeading($this->lng->txt('prg_async_settings'),isset($_GET["currentNode"]));
121
122 $form = $this->buildForm();
123 $this->fillForm($form);
124 return $form->getHTML();
125 }
$_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 180 of file class.ilObjStudyProgrammeSettingsGUI.php.

◆ PROP_POINTS

const ilObjStudyProgrammeSettingsGUI::PROP_POINTS = "points"

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

◆ PROP_STATUS

const ilObjStudyProgrammeSettingsGUI::PROP_STATUS = "status"

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

◆ PROP_TITLE

const ilObjStudyProgrammeSettingsGUI::PROP_TITLE = "title"

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

◆ PROP_TYPE

const ilObjStudyProgrammeSettingsGUI::PROP_TYPE = "type"

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


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