ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilPCVerificationGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24require_once("./Services/COPage/classes/class.ilPCVerification.php");
25require_once("./Services/COPage/classes/class.ilPageContentGUI.php");
26
38{
39
44 function ilPCVerificationGUI(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id = "")
45 {
46 parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
47 }
48
52 function &executeCommand()
53 {
54 // get next class that processes or forwards current command
55 $next_class = $this->ctrl->getNextClass($this);
56
57 // get current command
58 $cmd = $this->ctrl->getCmd();
59
60 switch($next_class)
61 {
62 default:
63 $ret =& $this->$cmd();
64 break;
65 }
66
67 return $ret;
68 }
69
75 function insert(ilPropertyFormGUI $a_form = null)
76 {
77 global $tpl;
78
80
81 if(!$a_form)
82 {
83 $a_form = $this->initForm(true);
84 }
85 $tpl->setContent($a_form->getHTML());
86 }
87
93 function edit(ilPropertyFormGUI $a_form = null)
94 {
95 global $tpl;
96
98
99 if(!$a_form)
100 {
101 $a_form = $this->initForm();
102 }
103 $tpl->setContent($a_form->getHTML());
104 }
105
112 protected function initForm($a_insert = false)
113 {
114 global $ilCtrl, $ilUser, $lng;
115
116 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
117 $form = new ilPropertyFormGUI();
118 $form->setFormAction($ilCtrl->getFormAction($this));
119 if ($a_insert)
120 {
121 $form->setTitle($this->lng->txt("cont_insert_verification"));
122 }
123 else
124 {
125 $form->setTitle($this->lng->txt("cont_update_verification"));
126 }
127
128 $lng->loadLanguageModule("wsp");
129 $options = array();
130 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
131 $tree = new ilWorkspaceTree($ilUser->getId());
132 $root = $tree->getRootId();
133 if($root)
134 {
135 $root = $tree->getNodeData($root);
136 foreach ($tree->getSubTree($root) as $node)
137 {
138 if (in_array($node["type"], array("excv", "tstv", "crsv", "scov")))
139 {
140 $options[$node["obj_id"]] = $node["title"]." (".$lng->txt("wsp_type_".$node["type"]).")";
141 }
142 }
143 asort($options);
144 }
145 $obj = new ilSelectInputGUI($this->lng->txt("cont_verification_object"), "object");
146 $obj->setRequired(true);
147 $obj->setOptions($options);
148 $form->addItem($obj);
149
150 if ($a_insert)
151 {
152
153 $form->addCommandButton("create_verification", $this->lng->txt("save"));
154 $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
155 }
156 else
157 {
158 $data = $this->content_obj->getData();
159 $obj->setValue($data["id"]);
160
161 $form->addCommandButton("update", $this->lng->txt("save"));
162 $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
163 }
164
165 return $form;
166 }
167
171 function create()
172 {
173 $form = $this->initForm(true);
174 if($form->checkInput())
175 {
176 $type = ilObject::_lookupType($form->getInput("object"));
177 if($type)
178 {
179 $this->content_obj = new ilPCVerification($this->getPage());
180 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
181 $this->content_obj->setData($type, $form->getInput("object"));
182 $this->updated = $this->pg_obj->update();
183 if ($this->updated === true)
184 {
185 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
186 }
187 }
188 }
189
190 $this->insert($form);
191 }
192
196 function update()
197 {
198 $form = $this->initForm(true);
199 if($form->checkInput())
200 {
201 $type = ilObject::_lookupType($form->getInput("object"));
202 if($type)
203 {
204 $this->content_obj->setData($type, $form->getInput("object"));
205 $this->updated = $this->pg_obj->update();
206 if ($this->updated === true)
207 {
208 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
209 }
210 }
211 }
212
213 $this->pg_obj->addHierIDs();
214 $this->edit($form);
215 }
216}
217
218?>
static _lookupType($a_id, $a_reference=false)
lookup object type
Class ilPCVerificationGUI.
insert(ilPropertyFormGUI $a_form=null)
Insert new verification form.
update()
Update verification.
& executeCommand()
execute command
edit(ilPropertyFormGUI $a_form=null)
Edit verification form.
initForm($a_insert=false)
Init verification form.
ilPCVerificationGUI(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
Constructor @access public.
create()
Create new verification.
Class ilPCVerification.
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 selection list property in a property form.
Tree handler for personal workspace.
$data
global $ilCtrl
Definition: ilias.php:18
$cmd
Definition: sahs_server.php:35
if(!is_array($argv)) $options
global $ilUser
Definition: imgupload.php:15