5 require_once(
"./Services/COPage/classes/class.ilPCSourceCode.php");
6 require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
30 public function __construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id =
"")
34 $this->
user = $DIC->user();
35 parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
45 $next_class = $this->ctrl->getNextClass($this);
48 $cmd = $this->ctrl->getCmd();
50 switch ($next_class) {
66 if ($this->pg_obj->getParentType() ==
"lm") {
67 $this->tpl->setVariable(
69 $this->ctrl->getLinkTargetByClass(
"ilInternalLinkGUI",
"showLinkHelp")
71 $this->tpl->setVariable(
"TXT_ILINK",
"[" . $this->lng->txt(
"cont_internal_link") .
"]");
76 if (key(
$_POST[
"cmd"]) ==
"update") {
77 $form->setValuesByPost();
79 $form->getItemByPostVar(
"par_language")->setValue($this->content_obj->getLanguage());
80 $form->getItemByPostVar(
"par_subcharacteristic")->setValue($this->content_obj->getSubCharacteristic());
81 $form->getItemByPostVar(
"par_downloadtitle")->setValue($this->content_obj->getDownloadTitle());
82 $form->getItemByPostVar(
"par_showlinenumbers")->setChecked(
83 $this->content_obj->getShowLineNumbers() ==
"y"?
true:false
88 $par_content = $this->content_obj->xml2output($this->content_obj->getText());
91 $par_content = str_replace(
"{",
"{", $par_content);
92 $par_content = str_replace(
"}",
"}", $par_content);
94 $form->getItemByPostVar(
"par_content")->setValue($par_content);
98 $this->tpl->setContent(
$form->getHTML());
110 if ($this->pg_obj->getParentType() ==
"lm") {
111 $this->tpl->setVariable(
113 $this->ctrl->getLinkTargetByClass(
"ilInternalLinkGUI",
"showLinkHelp")
115 $this->tpl->setVariable(
"TXT_ILINK",
"[" . $this->lng->txt(
"cont_internal_link") .
"]");
120 if (key(
$_POST[
"cmd"]) ==
"create_src") {
121 $form->setValuesByPost();
124 $form->getItemByPostVar(
"par_language")->setValue(
$_SESSION[
"il_text_lang_" .
$_GET[
"ref_id"]]);
126 $form->getItemByPostVar(
"par_language")->setValue(
$ilUser->getLanguage());
129 $form->getItemByPostVar(
"par_showlinenumbers")->setChecked(
true);
131 $form->getItemByPostVar(
"par_subcharacteristic")->setValue(
"");
132 $form->getItemByPostVar(
"par_content")->setValue(
"");
135 $this->tpl->setContent(
$form->getHTML());
148 $this->content_obj->setLanguage(
$_POST[
"par_language"]);
149 $this->content_obj->setCharacteristic(
$_POST[
"par_characteristic"]);
155 $this->content_obj->setLanguage(
$_POST[
"par_language"]);
156 $this->content_obj->setSubCharacteristic(
$_POST[
"par_subcharacteristic"]);
158 $this->content_obj->setShowLineNumbers(
$_POST[
"par_showlinenumbers"]?
"y":
"n");
160 $this->content_obj->setSubCharacteristic(
$_POST[
"par_subcharacteristic"]);
161 $this->content_obj->setCharacteristic(
"Code");
163 $this->updated = $this->content_obj->setText(
164 $this->content_obj->input2xml(
$_POST[
"par_content"], 0,
false)
167 if ($this->updated !==
true) {
173 $this->updated = $this->pg_obj->update();
175 if ($this->updated ===
true && $this->ctrl->getCmd() !=
"upload") {
176 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
187 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
196 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
197 $this->content_obj->setLanguage(
$_POST[
"par_language"]);
203 $this->content_obj->setCharacteristic(
$_POST[
"par_characteristic"]);
204 $this->content_obj->setSubCharacteristic(
$_POST[
"par_subcharacteristic"]);
206 $this->content_obj->setShowLineNumbers(
$_POST[
"par_showlinenumbers"]?
'y':
'n');
207 $this->content_obj->setCharacteristic(
'Code');
215 $this->updated = $this->content_obj->setText(
216 $this->content_obj->input2xml(
$_POST[
"par_content"], 0,
false)
219 if ($this->updated !==
true) {
224 $this->updated = $this->pg_obj->update();
226 if ($this->updated ===
true && !$uploaded) {
227 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
238 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
243 if (isset($_FILES[
'userfile'][
'name'])) {
244 $userfile = $_FILES[
'userfile'][
'tmp_name'];
246 if ($userfile ==
"" || !is_uploaded_file($userfile)) {
247 $error_str =
"<b>Error(s):</b><br>Upload error: file name must not be empty!";
248 $this->tpl->setVariable(
"MESSAGE", $error_str);
249 $this->content_obj->setText($this->content_obj->input2xml(stripslashes(
$_POST[
"par_content"]), 0,
false));
253 $_POST[
"par_content"] = file_get_contents($userfile);
254 $_POST[
"par_downloadtitle"] = $_FILES[
'userfile'][
'name'];
271 include_once(
"./Services/UIComponent/SyntaxHighlighter/classes/class.ilSyntaxHighlighter.php");
273 $prog_langs[$k] = $v;
288 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
290 $form->setTitle($a_title);
291 $form->setFormAction($this->ctrl->getFormAction($this, $a_cmd));
292 $form->addCommandButton($a_cmd, $this->lng->txt(
"save"));
293 $form->addCommandButton($a_cmd_cancel, $this->lng->txt(
"cancel"));
296 require_once(
"Services/MetaData/classes/class.ilMDLanguageItem.php");
298 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
300 $lang->setOptions($lang_var);
304 $code_style =
new ilSelectInputGUI($this->lng->txt(
"cont_src"),
"par_subcharacteristic");
306 $form->addItem($code_style);
307 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
308 $line_number =
new ilCheckboxInputGUI($this->lng->txt(
"cont_show_line_numbers"),
"par_showlinenumbers");
309 $form->addItem($line_number);
314 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
319 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
320 $downlaod_title =
new ilTextInputGUI($this->lng->txt(
"cont_download_title"),
"par_downloadtitle");
322 $form->addItem($downlaod_title);
324 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
325 $file =
new ilFileInputGUI($this->lng->txt(
"import_file"),
"userfile");
326 $form->addItem($file);
create()
create new paragraph in dom and update page in db
edit()
edit paragraph form
initPropertyForm($a_title, $a_cmd, $a_cmd_cancel)
initiates property form GUI class
executeCommand()
execute command
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
if(isset($_POST['submit'])) $form
setSize($a_size)
Set Size.
displayValidationError()
display validation errors
This class represents a text property in a property form.
update()
update paragraph in dom and update page in db
cancelUpdate()
cancel update
cancelCreate()
cancel creating paragraph
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getSupportedLanguagesV51()
Get supported languages (keys are ILIAS <= 5.1 internal values, values are for representation) ...
__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id="")
Constructor public.
This class represents a text area property in a property form.
getProgLangOptions()
Get selectable programming languages.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
insert()
insert paragraph form