46 include_once
'Modules/Chatroom/classes/class.ilChatroom.php';
50 $this->gui->switchToVisibleMode();
67 $this->gui->switchToVisibleMode();
69 if(!$rbacsystem->checkAccess(
'read', $this->gui->ref_id))
71 $this->ilias->raiseError(
72 $lng->txt(
'msg_no_perm_read'), $this->ilias->error_obj->MESSAGE
76 include_once
"Modules/Chatroom/classes/class.ilChatroomSmilies.php";
81 "chatroom_smiley_id" => $smiley[
"smiley_id"],
82 "chatroom_smiley_keywords" => $smiley[
"smiley_keywords"],
83 "chatroom_current_smiley_image_path" => $smiley[
"smiley_fullpath"],
89 "tpl.chatroom_edit_smilies.html",
true,
true,
"Modules/Chatroom"
92 $tpl_form->setVariable(
"SMILEY_FORM", $form->getHTML());
94 $tpl->setContent($tpl_form->get());
101 public function showDeleteSmileyFormObject()
111 $this->gui->switchToVisibleMode();
113 if(!$rbacsystem->checkAccess(
'write', $this->gui->ref_id))
115 $this->ilias->raiseError(
116 $lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->MESSAGE
120 include_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
123 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
125 $confirmation->setFormAction($ilCtrl->getFormAction($this->gui,
'smiley'));
126 $confirmation->setHeaderText($lng->txt(
'chatroom_confirm_delete_smiley'));
127 $confirmation->addButton($lng->txt(
'confirm'),
'smiley-deleteSmileyObject');
128 $confirmation->addButton($lng->txt(
'cancel'),
'smiley');
129 $confirmation->addItem(
'chatroom_smiley_id', $smiley[
'smiley_id'],
ilUtil::img($smiley[
'smiley_fullpath'], $smiley[
'smiley_keywords']) .
' ' . $smiley[
'smiley_keywords']);
131 $tpl->setContent($confirmation->getHTML());
143 if(!$rbacsystem->checkAccess(
'write', $this->gui->ref_id))
145 $this->ilias->raiseError(
146 $lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->MESSAGE
150 include_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
154 $ilCtrl->redirect($this->gui,
"smiley");
168 if(!$rbacsystem->checkAccess(
'read', $this->gui->ref_id))
170 $this->ilias->raiseError(
171 $lng->txt(
'msg_no_perm_read'), $this->gui->ilias->error_obj->MESSAGE
175 include_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
185 $form = $this->form_gui;
188 include_once
"Modules/Chatroom/classes/class.ilChatroomSmiliesGUI.php";
193 "tpl.chatroom_edit_smilies.html",
true,
true,
"Modules/Chatroom"
195 $tpl_smilies->setVariable(
"SMILEY_TABLE", $table);
196 $tpl_smilies->setVariable(
"SMILEY_FORM", $form->getHtml());
198 $tpl->setContent($tpl_smilies->get());
212 if(!$rbacsystem->checkAccess(
'write', $this->gui->ref_id))
214 $this->ilias->raiseError(
215 $lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->MESSAGE
219 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
224 include_once
"Modules/Chatroom/classes/class.ilChatroomSmilies.php";
230 $keywordscheck = count($keywords) > 0;
232 if(!$this->form_gui->checkInput() || !$keywordscheck)
234 $tpl->setContent($this->form_gui->getHtml());
236 return $this->
view();
241 $data[
"smiley_keywords"] = join(
"\n", $keywords);
242 $data[
"smiley_id"] =
$_REQUEST[
"smiley_id"];
244 if($_FILES[
"chatroom_image_path"])
247 $_FILES[
"chatroom_image_path"][
"tmp_name"],
249 $_FILES[
"chatroom_image_path"][
"name"]
252 $data[
"smiley_path"] = $_FILES[
"chatroom_image_path"][
"name"];
258 $ilCtrl->redirect($this->gui,
"smiley");
271 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
276 $this->form_gui->setFormAction(
277 $ilCtrl->getFormAction($this->gui,
'smiley-uploadSmileyObject') . $table_nav
283 $sec_l->setTitle($lng->txt(
'chatroom_add_smiley'));
284 $this->form_gui->addItem($sec_l);
287 $lng->txt(
'chatroom_image_path'),
'chatroom_image_path'
291 $this->form_gui->addItem($inp);
294 $lng->txt(
'chatroom_smiley_keywords'),
'chatroom_smiley_keywords'
298 $inp->setUseRte(
false);
299 $inp->setInfo($lng->txt(
'chatroom_smiley_keywords_one_per_line_note'));
300 $this->form_gui->addItem($inp);
301 $this->form_gui->addCommandButton(
302 'smiley-uploadSmileyObject', $lng->txt(
'chatroom_upload_smiley')
305 return $this->form_gui;
312 public function deleteMultipleObject()
322 $this->gui->switchToVisibleMode();
324 if(!$rbacsystem->checkAccess(
'write', $this->gui->ref_id))
326 $this->ilias->raiseError(
327 $this->lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->MESSAGE
332 if(count($items) == 0)
335 $ilCtrl->redirect($this->gui,
'smiley');
338 include_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
340 if(count($smilies) == 0)
343 $ilCtrl->redirect($this->gui,
'smiley');
346 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
348 $confirmation->setFormAction($ilCtrl->getFormAction($this->gui,
'smiley'));
349 $confirmation->setHeaderText($lng->txt(
'chatroom_confirm_delete_smiley'));
350 $confirmation->addButton($lng->txt(
'confirm'),
'smiley-confirmedDeleteMultipleObject');
351 $confirmation->addButton($lng->txt(
'cancel'),
'smiley');
353 foreach($smilies as $s)
355 $confirmation->addItem(
'sel_ids[]', $s[
'smiley_id'],
ilUtil::img($s[
'smiley_fullpath'], $s[
'smiley_keywords']) .
' ' . $s[
'smiley_keywords']);
358 $tpl->setContent($confirmation->getHTML());
364 public function confirmedDeleteMultipleObject()
372 if(!$rbacsystem->checkAccess(
'write', $this->gui->ref_id))
374 $this->ilias->raiseError(
375 $this->lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->MESSAGE
379 $parts =
$_POST[
"sel_ids"];
380 if(count($parts) == 0)
382 $ilCtrl->redirect($this->gui,
"smiley");
385 include_once
"Modules/Chatroom/classes/class.ilChatroomSmilies.php";
388 $ilCtrl->redirect($this->gui,
"smiley");
401 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
405 $this->form_gui->setValuesByArray($form_data);
409 $ilCtrl->saveParameter($this->gui,
'smiley_id');
411 $this->form_gui->setFormAction(
412 $ilCtrl->getFormAction($this->gui,
'smiley-updateSmiliesObject') . $table_nav
417 $sec_l->setTitle($lng->txt(
'chatroom_edit_smiley'));
418 $this->form_gui->addItem($sec_l);
420 include_once
"Modules/Chatroom/classes/class.ilChatroomSmiliesCurrentSmileyFormElement.php";
423 $lng->txt(
'chatroom_current_smiley_image_path'),
424 'chatroom_current_smiley_image_path'
427 $inp->
setValue($form_data[
'chatroom_current_smiley_image_path']);
428 $this->form_gui->addItem($inp);
431 $lng->txt(
'chatroom_image_path'),
'chatroom_image_path'
435 $inp->setInfo($lng->txt(
'chatroom_smiley_image_only_if_changed'));
436 $this->form_gui->addItem($inp);
439 $lng->txt(
'chatroom_smiley_keywords'),
'chatroom_smiley_keywords'
442 $inp->
setValue($form_data[
'chatroom_smiley_keywords']);
443 $inp->setUseRte(
false);
444 $inp->setRequired(
true);
445 $inp->setInfo($lng->txt(
'chatroom_smiley_keywords_one_per_line_note'));
446 $this->form_gui->addItem($inp);
450 $this->form_gui->addItem($inp);
451 $this->form_gui->addCommandButton(
452 'smiley-updateSmiliesObject', $lng->txt(
'submit')
454 $this->form_gui->addCommandButton(
'smiley', $lng->txt(
'cancel'));
455 return $this->form_gui;
468 if(!$rbacsystem->checkAccess(
'write', $this->gui->ref_id))
470 $this->ilias->raiseError(
471 $lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->MESSAGE
477 include_once
"Modules/Chatroom/classes/class.ilChatroomSmilies.php";
478 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
482 $this->form_gui->setValuesByPost();
488 $keywordscheck = count($keywords) > 0;
490 if(!$this->form_gui->checkInput())
492 $tpl->setContent($this->form_gui->getHtml());
493 return $this->
view();
496 $pathinfo = pathinfo($_FILES[
"chatroom_image_path"][
"name"]);
497 $target_file = md5(time() + $pathinfo[
'basename']) .
"." . $pathinfo[
'extension'];
500 $_FILES[
"chatroom_image_path"][
"tmp_name"],
506 $ilCtrl->redirect($this->gui,
"smiley");
514 array(
"icon_smile.gif",
":)\n:-)\n:smile:"),
515 array(
"icon_wink.gif",
";)\n;-)\n:wink:"),
516 array(
"icon_laugh.gif",
":D\n:-D\n:laugh:\n:grin:\n:biggrin:"),
517 array(
"icon_sad.gif",
":(\n:-(\n:sad:"),
518 array(
"icon_shocked.gif",
":o\n:-o\n:shocked:"),
519 array(
"icon_tongue.gif",
":p\n:-p\n:tongue:"),
520 array(
"icon_cool.gif",
":cool:"),
521 array(
"icon_eek.gif",
":eek:"),
522 array(
"icon_angry.gif",
":||\n:-||\n:angry:"),
523 array(
"icon_flush.gif",
":flush:"),
524 array(
"icon_idea.gif",
":idea:"),
525 array(
"icon_thumbup.gif",
":thumbup:"),
526 array(
"icon_thumbdown.gif",
":thumbdown:"),
529 $stmt = $ilDB->prepare(
"
530 INSERT INTO chatroom_smilies (smiley_id, smiley_keywords, smiley_path)
532 array(
"integer",
"text",
"text")
535 foreach($values as $val)
538 $ilDB->nextID(
"chat_smilies"),
542 $stmt->execute(
$row);
555 mkdir(
$path, 0755,
true);
599 "icon_thumbdown.gif",
602 foreach($smilies as $smiley)
604 copy(
"templates/default/images/emoticons/$smiley",
$path .
"/$smiley");
614 if(!is_writable(
$path))