ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilPCMyCoursesGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5require_once("./Modules/Portfolio/classes/class.ilPCMyCourses.php");
6require_once("./Services/COPage/classes/class.ilPageContentGUI.php");
7
19{
24 function ilPCMyCoursesGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id = "")
25 {
26 parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
27 }
28
32 function &executeCommand()
33 {
34 // get next class that processes or forwards current command
35 $next_class = $this->ctrl->getNextClass($this);
36
37 // get current command
38 $cmd = $this->ctrl->getCmd();
39
40 switch($next_class)
41 {
42 default:
43 $ret =& $this->$cmd();
44 break;
45 }
46
47 return $ret;
48 }
49
55 function insert(ilPropertyFormGUI $a_form = null)
56 {
57 global $tpl;
58
59 /* #12816 - no form needed yet
60 $this->create();
61 */
62
64
65 if(!$a_form)
66 {
67 $a_form = $this->initForm(true);
68 }
69 $tpl->setContent($a_form->getHTML());
70 }
71
77 function edit(ilPropertyFormGUI $a_form = null)
78 {
79 global $tpl;
80
82
83 if(!$a_form)
84 {
85 $a_form = $this->initForm();
86 }
87 $tpl->setContent($a_form->getHTML());
88 }
89
96 protected function initForm($a_insert = false)
97 {
98 global $ilCtrl;
99
100 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
101 $form = new ilPropertyFormGUI();
102 $form->setFormAction($ilCtrl->getFormAction($this));
103 if ($a_insert)
104 {
105 $form->setTitle($this->lng->txt("cont_insert_my_courses"));
106 }
107 else
108 {
109 $form->setTitle($this->lng->txt("cont_update_my_courses"));
110 }
111
112 $sort = new ilRadioGroupInputGUI($this->lng->txt("cont_mycourses_sortorder"), "sort");
113 $sort->setInfo($this->lng->txt("cont_mycourses_sortorder_info")); //#15511
114 $sort->setRequired(true);
115 $form->addItem($sort);
116
117 $sort->addOption(new ilRadioOption($this->lng->txt("cont_mycourses_sortorder_alphabetical"), "alpha"));
118 $sort->addOption(new ilRadioOption($this->lng->txt("cont_mycourses_sortorder_location"), "loc"));
119
120 if ($a_insert)
121 {
122 $sort->setValue("alpha");
123
124 $form->addCommandButton("create_my_courses", $this->lng->txt("save"));
125 $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
126 }
127 else
128 {
129 $sort->setValue($this->content_obj->getSorting());
130
131 $form->addCommandButton("update", $this->lng->txt("save"));
132 $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
133 }
134
135 return $form;
136 }
137
141 function create()
142 {
143 $form = $this->initForm(true);
144 if($form->checkInput())
145 {
146 $sort = $form->getInput("sort");
147
148 $this->content_obj = new ilPCMyCourses($this->getPage());
149 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
150 $this->content_obj->setData($sort);
151 $this->updated = $this->pg_obj->update();
152 if ($this->updated === true)
153 {
154 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
155 }
156 }
157
158 $form->setValuesByPost();
159 return $this->insert($form);
160 }
161
165 function update()
166 {
167 $form = $this->initForm();
168 if($form->checkInput())
169 {
170 $sort = $form->getInput("sort");
171
172 $this->content_obj->setData($sort);
173 $this->updated = $this->pg_obj->update();
174 if ($this->updated === true)
175 {
176 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
177 }
178 }
179
180 $this->pg_obj->addHierIDs();
181 $form->setValuesByPost();
182 return $this->edit($form);
183 }
184}
185
186?>
Class ilPCMyCoursesGUI.
initForm($a_insert=false)
Init courses form.
create()
Create new courses.
edit(ilPropertyFormGUI $a_form=null)
Edit courses form.
ilPCMyCoursesGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id="")
Constructor @access public.
insert(ilPropertyFormGUI $a_form=null)
Insert courses form.
& executeCommand()
execute command
Class ilPCMyCourses.
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
displayValidationError()
display validation errors
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
global $ilCtrl
Definition: ilias.php:18
$cmd
Definition: sahs_server.php:35