ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
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 
5 require_once("./Modules/Portfolio/classes/class.ilPCMyCourses.php");
6 require_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  /*
63  $this->displayValidationError();
64 
65  if(!$a_form)
66  {
67  $a_form = $this->initForm(true);
68  }
69  $tpl->setContent($a_form->getHTML());
70  */
71  }
72 
78  function edit(ilPropertyFormGUI $a_form = null)
79  {
80  global $tpl;
81 
82  $this->displayValidationError();
83 
84  if(!$a_form)
85  {
86  $a_form = $this->initForm();
87  }
88  $tpl->setContent($a_form->getHTML());
89  }
90 
97  protected function initForm($a_insert = false)
98  {
99  global $ilCtrl;
100 
101  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
102  $form = new ilPropertyFormGUI();
103  $form->setFormAction($ilCtrl->getFormAction($this));
104  if ($a_insert)
105  {
106  $form->setTitle($this->lng->txt("cont_insert_my_courses"));
107  }
108  else
109  {
110  $form->setTitle($this->lng->txt("cont_update_my_courses"));
111  }
112 
113  $warn = new ilNonEditableValueGUI("");
114  $warn->setValue($this->lng->txt("cont_my_courses_no_settings"));
115  $form->addItem($warn);
116 
117  if ($a_insert)
118  {
119  $form->addCommandButton("create_my_courses", $this->lng->txt("select"));
120  $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
121  }
122  else
123  {
124  // $form->addCommandButton("update", $this->lng->txt("select"));
125  $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
126  }
127 
128  return $form;
129  }
130 
134  function create()
135  {
136  $form = $this->initForm(true);
137  if($form->checkInput())
138  {
139  $this->content_obj = new ilPCMyCourses($this->getPage());
140  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
141  $this->content_obj->setData();
142  $this->updated = $this->pg_obj->update();
143  if ($this->updated === true)
144  {
145  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
146  }
147  }
148 
149  $form->setValuesByPost();
150  return $this->insert($form);
151  }
152 
156  function update()
157  {
158  $form = $this->initForm();
159  if($form->checkInput())
160  {
161  $this->content_obj->setData();
162  $this->updated = $this->pg_obj->update();
163  if ($this->updated === true)
164  {
165  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
166  }
167  }
168 
169  $this->pg_obj->addHierIDs();
170  $form->setValuesByPost();
171  return $this->edit($form);
172  }
173 }
174 
175 ?>
This class represents a property form user interface.
$cmd
Definition: sahs_server.php:35
create()
Create new courses.
initForm($a_insert=false)
Init courses form.
global $ilCtrl
Definition: ilias.php:18
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
& executeCommand()
execute command
displayValidationError()
display validation errors
Class ilPCMyCoursesGUI.
edit(ilPropertyFormGUI $a_form=null)
Edit courses form.
Class ilPCMyCourses.
update()
Update courses.
This class represents a non editable value in a property form.
ilPCMyCoursesGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id="")
Constructor public.
insert(ilPropertyFormGUI $a_form=null)
Insert courses form.