5require_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
6require_once(
"./Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
7require_once(
"./Modules/StudyProgramme/classes/helpers/class.ilAsyncOutputHandler.php");
8require_once(
"./Modules/StudyProgramme/classes/helpers/class.ilAsyncPropertyFormGUI.php");
9require_once(
"./Services/UIComponent/Button/classes/class.ilLinkButton.php");
91 $ilToolbar =
$DIC[
'ilToolbar'];
92 $ilLocator =
$DIC[
'ilLocator'];
98 $this->parent_gui = $a_parent_gui;
99 $this->ref_id = $a_ref_id;
100 $this->parent_gui = $a_parent_gui;
105 $this->ilLocator = $ilLocator;
107 $this->toolbar = $ilToolbar;
111 $this->input_factory =
$DIC->ui()->factory()->input();
112 $this->renderer =
$DIC->ui()->renderer();
113 $this->request =
$DIC->http()->request();
114 $this->trafo_factory = new \ILIAS\Transformation\Factory();
115 $this->
data = new \ILIAS\Data\Factory();
116 $this->validation = new \ILIAS\Validation\Factory($this->
data, $this->lng);
118 $this->
object =
null;
120 $lng->loadLanguageModule(
"prg");
125 $cmd = $this->ctrl->getCmd();
136 $content = $this->$cmd();
139 throw new ilException(
"ilObjStudyProgrammeSettingsGUI: " .
140 "Command not supported: $cmd");
143 if (!$this->ctrl->isAsynch()) {
144 $this->tpl->setContent($content);
147 $heading = $this->lng->txt(
"prg_async_" . $this->ctrl->getCmd());
148 if (isset($this->tmp_heading)) {
151 $output_handler->setHeading($heading);
152 $output_handler->setContent($content);
153 $output_handler->terminate();
162 return $this->renderer->render(
$form);
168 ->buildForm($this->
getObject(), $this->ctrl->getFormAction($this,
"update"))
169 ->withRequest($this->request);
170 $content =
$form->getData();
175 $update_possible = !is_null($content);
176 if ($update_possible) {
178 ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"),
true);
180 if ($this->ctrl->isAsynch()) {
184 $this->ctrl->redirect($this);
189 if ($this->ctrl->isAsynch()) {
193 return $this->renderer->render(
$form);
202 $this->ctrl->redirect($this->parent_gui);
207 if (!$current_node) {
208 $this->ctrl->saveParameterByClass(
'ilobjstudyprogrammesettingsgui',
'ref_id');
210 $heading_button->setCaption(
'prg_open_node');
211 $heading_button->setUrl($this->ctrl->getLinkTargetByClass(
'ilobjstudyprogrammetreegui',
'view'));
213 $heading =
"<div class=''>" . $label .
"<div class='pull-right'>" . $heading_button->render() .
"</div></div>";
214 $this->tmp_heading = $heading;
216 $this->tmp_heading =
"<div class=''>" . $label .
"</div>";
228 $ff = $this->input_factory->field();
231 return $this->lng->txt(
$id);
235 return $this->input_factory->container()->form()->standard(
241 $ff->text(
$txt(
"title"))
243 ->withRequired(
true),
245 $ff->textarea(
$txt(
"description"))
254 $ff->select(
$txt(
"type"), $sp_types)
256 ->withAdditionalTransformation($tf->custom(function ($v) {
269 $ff->numeric(
$txt(
"prg_points"))
271 ->withAdditionalConstraint($this->validation->greaterThan(-1)),
273 $ff->select(
$txt(
"prg_status"), $status_options)
277 $txt(
"prg_assessment"),
282 ->withAdditionalTransformation($tf->custom(function (
$values) {
286 return call_user_func_array(
"array_merge",
$values);
297 $prg->updateCustomIcon();
298 $this->parent_gui->setTitleAndDescription();
309 if ($this->
object ===
null) {
321 =>
$lng->txt(
"prg_status_draft")
323 =>
$lng->txt(
"prg_status_active")
325 =>
$lng->txt(
"prg_status_outdated")
An exception for terminatinating execution or to throw for unit testing.
Class ilAsyncOutputHandler Handles the output for async-requests.
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.
Base class for ILIAS Exception handling.
Class ilObjStudyProgrammeSettingsGUI.
static getStatusOptions()
buildForm(\ilObjStudyProgramme $prg, string $submit_action)
updateWith(\ilObjStudyProgramme $prg, array $data)
__construct($a_parent_gui, $a_ref_id)
buildModalHeading($label, $current_node)
Class ilObjStudyProgramme.
setStatus($a_status)
Set the status of the node.
getSubtypeId()
Gets the meta-data subtype id (allows to add additional meta-data based on a type)
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
getPoints()
Get the amount of points.
setPoints($a_points)
Set the amount of points.
setSubtypeId($a_subtype_id)
Sets the meta-data subtype id.
getStatus()
Get the status.
setTitle($a_title)
set object title
setDescription($a_desc)
set object description
getDescription()
get object description
getTitle()
get object title @access public
static getAllTypesArray()
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
if(!array_key_exists('StateId', $_REQUEST)) $id
redirection script todo: (a better solution should control the processing via a xml file)
if(isset($_POST['submit'])) $form