5 require_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
6 require_once(
"./Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
7 require_once(
"./Modules/StudyProgramme/classes/helpers/class.ilAsyncOutputHandler.php");
8 require_once(
"./Modules/StudyProgramme/classes/helpers/class.ilAsyncPropertyFormGUI.php");
9 require_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);
234 $status_options = self::getStatusOptions();
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"),
286 return call_user_func_array(
"array_merge",
$values);
292 $prg->
setTitle($data[self::PROP_TITLE]);
297 $prg->updateCustomIcon();
298 $this->parent_gui->setTitleAndDescription();
301 $prg->
setPoints($data[self::PROP_POINTS]);
302 $prg->
setStatus($data[self::PROP_STATUS]);
309 if ($this->
object === null) {
321 =>
$lng->txt(
"prg_status_draft")
323 =>
$lng->txt(
"prg_status_active")
325 =>
$lng->txt(
"prg_status_outdated")
Class ilAsyncOutputHandler Handles the output for async-requests.
static getAllTypesArray()
setPoints($a_points)
Set the amount of points.
setSubtypeId($a_subtype_id)
Sets the meta-data subtype id.
getStatus()
Get the status.
if(!array_key_exists('StateId', $_REQUEST)) $id
setStatus($a_status)
Set the status of the node.
setTitle($a_title)
set object title
buildModalHeading($label, $current_node)
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
__construct($a_parent_gui, $a_ref_id)
static encodeAsyncResponse(array $data=array())
Encode data as json for async output.
if(isset($_POST['submit'])) $form
Class ilObjStudyProgramme.
static getStatusOptions()
getTitle()
get object title public
getDescription()
get object description
redirection script todo: (a better solution should control the processing via a xml file) ...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
updateWith(\ilObjStudyProgramme $prg, array $data)
getSubtypeId()
Gets the meta-data subtype id (allows to add additional meta-data based on a type) ...
setDescription($a_desc)
set object description
getPoints()
Get the amount of points.
buildForm(\ilObjStudyProgramme $prg, string $submit_action)
Class ilObjStudyProgrammeSettingsGUI.
static handleAsyncOutput($normal_content, $async_content=null, $apply_to_tpl=true)
Handles async output.