ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilPCAMDPageListGUI.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/Wiki/classes/class.ilPCAMDPageList.php");
6require_once("./Services/COPage/classes/class.ilPageContentGUI.php");
7
19{
24 function ilPCAMDPageListGUI($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
60
61 if(!$a_form)
62 {
63 $a_form = $this->initForm(true);
64 }
65 $tpl->setContent($a_form->getHTML());
66 }
67
73 function edit(ilPropertyFormGUI $a_form = null)
74 {
75 global $tpl;
76
78
79 if(!$a_form)
80 {
81 $a_form = $this->initForm();
82 }
83 $tpl->setContent($a_form->getHTML());
84 }
85
92 protected function initForm($a_insert = false)
93 {
94 global $ilCtrl;
95
96 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
97 $form = new ilPropertyFormGUI();
98 $form->setFormAction($ilCtrl->getFormAction($this));
99 if ($a_insert)
100 {
101 $form->setTitle($this->lng->txt("cont_insert_amd_page_list"));
102 }
103 else
104 {
105 $form->setTitle($this->lng->txt("cont_update_amd_page_list"));
106 }
107 $form->setDescription($this->lng->txt("wiki_page_list_form_info"));
108
109 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
110 $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_SEARCH,'wiki',$this->getPage()->getWikiId(),'wpg',$this->getPage()->getId());
111 $this->record_gui->setPropertyForm($form);
112
113 if (!$a_insert)
114 {
115 $this->record_gui->setSearchFormValues($this->content_obj->getFieldValues());
116 }
117
118 $this->record_gui->parse();
119
120 $no_fields = (count($form->getItems()) == 0);
121 if ($no_fields)
122 {
123 ilUtil::sendFailure($this->lng->txt("wiki_pg_list_no_search_fields"));
124 }
125
126 if ($a_insert)
127 {
128 if (!$no_fields)
129 {
130 $form->addCommandButton("create_amd_page_list", $this->lng->txt("select"));
131 }
132 $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
133 }
134 else
135 {
136 if (!$no_fields)
137 {
138 $form->addCommandButton("update", $this->lng->txt("select"));
139 }
140 $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
141 }
142
143 return $form;
144 }
145
149 function create()
150 {
151 $form = $this->initForm(true);
152 if($form->checkInput())
153 {
154 $elements = $this->record_gui->importSearchForm();
155 if(is_array($elements))
156 {
157 $this->content_obj = new ilPCAMDPageList($this->getPage());
158 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
159 $this->content_obj->setData($elements);
160 $this->updated = $this->pg_obj->update();
161 if ($this->updated === true)
162 {
163 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
164 }
165 }
166 }
167
168 // $form->setValuesByPost();
169 return $this->insert($form);
170 }
171
175 function update()
176 {
177 $form = $this->initForm();
178 if($form->checkInput())
179 {
180 $elements = $this->record_gui->importSearchForm();
181 if(is_array($elements))
182 {
183 $this->content_obj->setData($elements);
184 $this->updated = $this->pg_obj->update();
185 if ($this->updated === true)
186 {
187 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
188 }
189 }
190 }
191
192 $this->pg_obj->addHierIDs();
193 // $form->setValuesByPost();
194 return $this->edit($form);
195 }
196}
197
198?>
Class ilPCAMDPageListGUI.
create()
Create new courses.
insert(ilPropertyFormGUI $a_form=null)
Insert courses form.
edit(ilPropertyFormGUI $a_form=null)
Edit courses form.
initForm($a_insert=false)
Init courses form.
ilPCAMDPageListGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id="")
Constructor @access public.
& executeCommand()
execute command
Class ilPCAMDPageList.
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
displayValidationError()
display validation errors
This class represents a property form user interface.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilCtrl
Definition: ilias.php:18
$cmd
Definition: sahs_server.php:35