33 include_once
'Modules/Chatroom/classes/class.ilChatroom.php';
37 $this->gui->switchToVisibleMode();
48 $path = self::_getSmileyDir();
74 foreach ($smilies as $smiley) {
75 copy(
"templates/default/images/emoticons/$smiley",
$path .
"/$smiley");
78 self::_insertDefaultValues();
84 if (!is_writable(
$path)) {
97 $path =
'chatroom/smilies';
109 array(
"icon_smile.gif",
":)\n:-)\n:smile:"),
110 array(
"icon_wink.gif",
";)\n;-)\n:wink:"),
111 array(
"icon_laugh.gif",
":D\n:-D\n:laugh:\n:grin:\n:biggrin:"),
112 array(
"icon_sad.gif",
":(\n:-(\n:sad:"),
113 array(
"icon_shocked.gif",
":o\n:-o\n:shocked:"),
114 array(
"icon_tongue.gif",
":p\n:-p\n:tongue:"),
115 array(
"icon_cool.gif",
":cool:"),
116 array(
"icon_eek.gif",
":eek:"),
117 array(
"icon_angry.gif",
":||\n:-||\n:angry:"),
118 array(
"icon_flush.gif",
":flush:"),
119 array(
"icon_idea.gif",
":idea:"),
120 array(
"icon_thumbup.gif",
":thumbup:"),
121 array(
"icon_thumbdown.gif",
":thumbdown:"),
124 require_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
125 foreach ($values as $val) {
126 ilChatroomSmilies::_storeSmiley($val[1], $val[0]);
141 if (!$rbacsystem->checkAccess(
'read', $this->gui->ref_id)) {
142 $this->
ilias->raiseError(
143 $lng->txt(
'msg_no_perm_read'),
144 $this->gui->ilias->error_obj->MESSAGE
148 include_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
152 if (!$this->form_gui) {
158 include_once
"Modules/Chatroom/classes/class.ilChatroomSmiliesGUI.php";
163 "tpl.chatroom_edit_smilies.html",
168 $tpl_smilies->setVariable(
"SMILEY_TABLE",
$table);
169 $tpl_smilies->setVariable(
"SMILEY_FORM",
$form->getHtml());
171 $tpl->setContent($tpl_smilies->get());
184 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
188 $table_nav = $_REQUEST[
"_table_nav"] ?
"&_table_nav=" . $_REQUEST[
"_table_nav"] :
"";
189 $this->form_gui->setFormAction(
190 $ilCtrl->getFormAction($this->gui,
'smiley-uploadSmileyObject') . $table_nav
196 $sec_l->setTitle($lng->txt(
'chatroom_add_smiley'));
197 $this->form_gui->addItem($sec_l);
200 $lng->txt(
'chatroom_image_path'),
201 'chatroom_image_path' 205 $inp->setRequired(
true);
206 $this->form_gui->addItem($inp);
209 $lng->txt(
'chatroom_smiley_keywords'),
210 'chatroom_smiley_keywords' 214 $inp->setUseRte(
false);
215 $inp->setInfo($lng->txt(
'chatroom_smiley_keywords_one_per_line_note'));
216 $this->form_gui->addItem($inp);
217 $this->form_gui->addCommandButton(
218 'smiley-uploadSmileyObject',
219 $lng->txt(
'chatroom_upload_smiley')
235 $this->gui->switchToVisibleMode();
237 if (!$rbacsystem->checkAccess(
'read', $this->gui->ref_id)) {
238 $this->
ilias->raiseError(
239 $lng->txt(
'msg_no_perm_read'),
240 $this->
ilias->error_obj->MESSAGE
244 if (!$this->form_gui) {
251 "tpl.chatroom_edit_smilies.html",
257 $tpl_form->setVariable(
"SMILEY_FORM",
$form->getHTML());
259 $tpl->setContent($tpl_form->get());
269 require_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
270 $smiley = ilChatroomSmilies::_getSmiley($smileyId);
273 'chatroom_smiley_id' => $smiley[
'smiley_id'],
274 'chatroom_smiley_keywords' => $smiley[
'smiley_keywords'],
275 'chatroom_current_smiley_image_path' => $smiley[
'smiley_fullpath'],
291 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
295 $this->form_gui->setValuesByArray($form_data);
297 $table_nav = $_REQUEST[
"_table_nav"] ?
"&_table_nav=" . $_REQUEST[
"_table_nav"] :
"";
299 $ilCtrl->saveParameter($this->gui,
'smiley_id');
301 $this->form_gui->setFormAction(
302 $ilCtrl->getFormAction($this->gui,
'smiley-updateSmiliesObject') . $table_nav
307 $sec_l->setTitle($lng->txt(
'chatroom_edit_smiley'));
308 $this->form_gui->addItem($sec_l);
310 include_once
"Modules/Chatroom/classes/class.ilChatroomSmiliesCurrentSmileyFormElement.php";
313 $lng->txt(
'chatroom_current_smiley_image_path'),
314 'chatroom_current_smiley_image_path' 317 $inp->
setValue($form_data[
'chatroom_current_smiley_image_path']);
318 $this->form_gui->addItem($inp);
321 $lng->txt(
'chatroom_image_path'),
322 'chatroom_image_path' 326 $inp->setRequired(
false);
327 $inp->setInfo($lng->txt(
'chatroom_smiley_image_only_if_changed'));
328 $this->form_gui->addItem($inp);
331 $lng->txt(
'chatroom_smiley_keywords'),
332 'chatroom_smiley_keywords' 335 $inp->
setValue($form_data[
'chatroom_smiley_keywords']);
336 $inp->setUseRte(
false);
337 $inp->setRequired(
true);
338 $inp->setInfo($lng->txt(
'chatroom_smiley_keywords_one_per_line_note'));
339 $this->form_gui->addItem($inp);
343 $this->form_gui->addItem($inp);
344 $this->form_gui->addCommandButton(
345 'smiley-updateSmiliesObject',
348 $this->form_gui->addCommandButton(
'smiley', $lng->txt(
'cancel'));
356 public function showDeleteSmileyFormObject()
366 $this->gui->switchToVisibleMode();
368 if (!$rbacsystem->checkAccess(
'write', $this->gui->ref_id)) {
369 $this->
ilias->raiseError(
370 $lng->txt(
'msg_no_perm_write'),
371 $this->
ilias->error_obj->MESSAGE
375 include_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
376 $smiley = ilChatroomSmilies::_getSmiley((
int) $_REQUEST[
'smiley_id']);
378 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
380 $confirmation->setFormAction($ilCtrl->getFormAction($this->gui,
'smiley'));
381 $confirmation->setHeaderText($lng->txt(
'chatroom_confirm_delete_smiley'));
382 $confirmation->addButton($lng->txt(
'confirm'),
'smiley-deleteSmileyObject');
383 $confirmation->addButton($lng->txt(
'cancel'),
'smiley');
384 $confirmation->addItem(
'chatroom_smiley_id', $smiley[
'smiley_id'],
ilUtil::img($smiley[
'smiley_fullpath'], $smiley[
'smiley_keywords']) .
' ' . $smiley[
'smiley_keywords']);
386 $tpl->setContent($confirmation->getHTML());
398 if (!$rbacsystem->checkAccess(
'write', $this->gui->ref_id)) {
399 $this->
ilias->raiseError(
400 $lng->txt(
'msg_no_perm_write'),
401 $this->
ilias->error_obj->MESSAGE
405 include_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
407 ilChatroomSmilies::_deleteSmiley($_REQUEST[
"chatroom_smiley_id"]);
409 $ilCtrl->redirect($this->gui,
"smiley");
417 public function updateSmiliesObject()
421 if (!$rbacsystem->checkAccess(
'write', $this->gui->ref_id)) {
422 $this->
ilias->raiseError(
423 $lng->txt(
'msg_no_perm_write'),
424 $this->
ilias->error_obj->MESSAGE
430 require_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
435 $keywordscheck = count($keywords) > 0;
437 if (!($isFormValid = $this->form_gui->checkInput()) || !$keywordscheck) {
442 $this->form_gui->setValuesByPost();
448 $data[
"smiley_keywords"] = join(
"\n", $keywords);
449 $data[
"smiley_id"] = (int) $_REQUEST[
'smiley_id'];
451 if ($this->upload->hasUploads() && !$this->upload->hasBeenProcessed()) {
452 $this->upload->process();
455 $result = array_values($this->upload->getResults())[0];
457 $this->upload->moveOneFileTo(
460 \
ILIAS\FileUpload\Location::WEB,
469 \ilChatroomSmilies::_updateSmiley(
$data);
472 $ilCtrl->redirect($this->gui,
"smiley");
479 public function deleteMultipleObject()
489 $this->gui->switchToVisibleMode();
491 if (!$rbacsystem->checkAccess(
'write', $this->gui->ref_id)) {
492 $this->
ilias->raiseError(
493 $this->lng->txt(
'msg_no_perm_write'),
494 $this->
ilias->error_obj->MESSAGE
498 $items = (
array) $_REQUEST[
'smiley_id'];
499 if (count($items) == 0) {
501 $ilCtrl->redirect($this->gui,
'smiley');
504 include_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
505 $smilies = ilChatroomSmilies::_getSmiliesById($items);
506 if (count($smilies) == 0) {
508 $ilCtrl->redirect($this->gui,
'smiley');
511 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
513 $confirmation->setFormAction($ilCtrl->getFormAction($this->gui,
'smiley'));
514 $confirmation->setHeaderText($lng->txt(
'chatroom_confirm_delete_smiley'));
515 $confirmation->addButton($lng->txt(
'confirm'),
'smiley-confirmedDeleteMultipleObject');
516 $confirmation->addButton($lng->txt(
'cancel'),
'smiley');
518 foreach ($smilies as
$s) {
519 $confirmation->addItem(
'sel_ids[]', $s[
'smiley_id'],
ilUtil::img($s[
'smiley_fullpath'], $s[
'smiley_keywords']) .
' ' . $s[
'smiley_keywords']);
522 $tpl->setContent($confirmation->getHTML());
528 public function confirmedDeleteMultipleObject()
536 if (!$rbacsystem->checkAccess(
'write', $this->gui->ref_id)) {
537 $this->
ilias->raiseError(
538 $this->lng->txt(
'msg_no_perm_write'),
539 $this->
ilias->error_obj->MESSAGE
543 $parts =
$_POST[
"sel_ids"];
544 if (count($parts) == 0) {
545 $ilCtrl->redirect($this->gui,
"smiley");
548 include_once
"Modules/Chatroom/classes/class.ilChatroomSmilies.php";
551 $ilCtrl->redirect($this->gui,
"smiley");
558 public function uploadSmileyObject()
562 if (!$rbacsystem->checkAccess(
'write', $this->gui->ref_id)) {
563 $this->
ilias->raiseError(
564 $lng->txt(
'msg_no_perm_write'),
565 $this->
ilias->error_obj->MESSAGE
571 require_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
576 $keywordscheck = count($keywords) > 0;
578 if (!($isFormValid = $this->form_gui->checkInput()) || !$keywordscheck) {
583 $this->form_gui->setValuesByPost();
585 return $this->
view();
588 $pathinfo = pathinfo($_FILES[
"chatroom_image_path"][
"name"]);
589 $target_file = md5(
time() + $pathinfo[
'basename']) .
"." . $pathinfo[
'extension'];
591 if ($this->upload->hasUploads() && !$this->upload->hasBeenProcessed()) {
592 $this->upload->process();
595 $result = array_values($this->upload->getResults())[0];
597 $this->upload->moveOneFileTo(
600 \
ILIAS\FileUpload\Location::WEB,
605 ilChatroomSmilies::_storeSmiley(join(
"\n", $keywords), $target_file);
610 $ilCtrl->redirect($this->gui,
"smiley");
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
deleteSmileyObject()
Deletes a smiley by $_REQUEST["chatroom_smiley_id"] ilRbacSystem $rbacsystem ilCtrl $ilCtrl...
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static _getExistingSmiliesTable($a_ref)
Constructor public.
static _getSmileyDir($withBaseDir=true)
view()
Switches GUI to visible mode and calls editSmiliesObject method which prepares and displays the table...
setValue($a_value)
Set Value.
initSmiliesForm()
Initializes smilies form and returns it.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
initSmiliesEditForm($form_data)
Initializes SmiliesEditForm and returns it.
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
if(isset($_POST['submit'])) $form
Class ilChatroomGUIHandler.
special template class to simplify handling of ITX/PEAR
redirection script todo: (a better solution should control the processing via a xml file) ...
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
getSmileyFormDataById($smileyId)
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static _checkSetup()
Checks if smiley folder is available; if not it will try to create folder and performs actions for an...
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
This class represents a text area property in a property form.
static getSmiliesBasePath()
Returns smilies basepath.
static _insertDefaultValues()
static _prepareKeywords($words)
Trims given keywords and returns them in one array.
Class ilChatroomSmileyGUI Provides methods to show, add, edit and delete smilies consisting of icon a...
showEditSmileyEntryFormObject()
Shows EditSmileyEntryForm Prepares EditSmileyEntryForm and displays it.
editSmiliesObject()
Shows existing smilies table Prepares existing smilies table and displays it.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
if(empty($password)) $table
executeDefault($requestedMethod)
{}
static getWebspaceDir($mode="filesystem")
get webspace directory
static _deleteMultipleSmilies($ids=array())
Deletes multiple smilies by given id array.
Confirmation screen class.