19 $path = self::_getSmileyDir();
23 mkdir(
$path, 0755,
true);
41 include_once
'Modules/Chatroom/classes/class.ilChatroom.php';
45 $this->gui->switchToVisibleMode();
56 $path = self::_getSmileyDir();
87 foreach($smilies as $smiley)
89 copy(
"templates/default/images/emoticons/$smiley",
$path .
"/$smiley");
92 self::_insertDefaultValues();
99 if(!is_writable(
$path))
118 array(
"icon_smile.gif",
":)\n:-)\n:smile:"),
119 array(
"icon_wink.gif",
";)\n;-)\n:wink:"),
120 array(
"icon_laugh.gif",
":D\n:-D\n:laugh:\n:grin:\n:biggrin:"),
121 array(
"icon_sad.gif",
":(\n:-(\n:sad:"),
122 array(
"icon_shocked.gif",
":o\n:-o\n:shocked:"),
123 array(
"icon_tongue.gif",
":p\n:-p\n:tongue:"),
124 array(
"icon_cool.gif",
":cool:"),
125 array(
"icon_eek.gif",
":eek:"),
126 array(
"icon_angry.gif",
":||\n:-||\n:angry:"),
127 array(
"icon_flush.gif",
":flush:"),
128 array(
"icon_idea.gif",
":idea:"),
129 array(
"icon_thumbup.gif",
":thumbup:"),
130 array(
"icon_thumbdown.gif",
":thumbdown:"),
133 require_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
134 foreach($values as $val)
136 ilChatroomSmilies::_storeSmiley($val[1], $val[0]);
151 if(!$rbacsystem->checkAccess(
'read', $this->gui->ref_id))
153 $this->
ilias->raiseError(
154 $lng->txt(
'msg_no_perm_read'), $this->gui->ilias->error_obj->MESSAGE
158 include_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
168 $form = $this->form_gui;
171 include_once
"Modules/Chatroom/classes/class.ilChatroomSmiliesGUI.php";
176 "tpl.chatroom_edit_smilies.html",
true,
true,
"Modules/Chatroom" 178 $tpl_smilies->setVariable(
"SMILEY_TABLE", $table);
179 $tpl_smilies->setVariable(
"SMILEY_FORM", $form->getHtml());
181 $tpl->setContent($tpl_smilies->get());
194 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
198 $table_nav = $_REQUEST[
"_table_nav"] ?
"&_table_nav=" . $_REQUEST[
"_table_nav"] :
"";
199 $this->form_gui->setFormAction(
200 $ilCtrl->getFormAction($this->gui,
'smiley-uploadSmileyObject') . $table_nav
206 $sec_l->setTitle($lng->txt(
'chatroom_add_smiley'));
207 $this->form_gui->addItem($sec_l);
210 $lng->txt(
'chatroom_image_path'),
'chatroom_image_path' 214 $inp->setRequired(
true);
215 $this->form_gui->addItem($inp);
218 $lng->txt(
'chatroom_smiley_keywords'),
'chatroom_smiley_keywords' 222 $inp->setUseRte(
false);
223 $inp->setInfo($lng->txt(
'chatroom_smiley_keywords_one_per_line_note'));
224 $this->form_gui->addItem($inp);
225 $this->form_gui->addCommandButton(
226 'smiley-uploadSmileyObject', $lng->txt(
'chatroom_upload_smiley')
229 return $this->form_gui;
242 $this->gui->switchToVisibleMode();
244 if(!$rbacsystem->checkAccess(
'read', $this->gui->ref_id))
246 $this->
ilias->raiseError(
247 $lng->txt(
'msg_no_perm_read'), $this->
ilias->error_obj->MESSAGE
251 include_once
"Modules/Chatroom/classes/class.ilChatroomSmilies.php";
253 $smiley = ilChatroomSmilies::_getSmiley($_REQUEST[
"smiley_id"]);
256 "chatroom_smiley_id" => $smiley[
"smiley_id"],
257 "chatroom_smiley_keywords" => $smiley[
"smiley_keywords"],
258 "chatroom_current_smiley_image_path" => $smiley[
"smiley_fullpath"],
264 "tpl.chatroom_edit_smilies.html",
true,
true,
"Modules/Chatroom" 267 $tpl_form->setVariable(
"SMILEY_FORM", $form->getHTML());
269 $tpl->setContent($tpl_form->get());
282 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
286 $this->form_gui->setValuesByArray($form_data);
288 $table_nav = $_REQUEST[
"_table_nav"] ?
"&_table_nav=" . $_REQUEST[
"_table_nav"] :
"";
290 $ilCtrl->saveParameter($this->gui,
'smiley_id');
292 $this->form_gui->setFormAction(
293 $ilCtrl->getFormAction($this->gui,
'smiley-updateSmiliesObject') . $table_nav
298 $sec_l->setTitle($lng->txt(
'chatroom_edit_smiley'));
299 $this->form_gui->addItem($sec_l);
301 include_once
"Modules/Chatroom/classes/class.ilChatroomSmiliesCurrentSmileyFormElement.php";
304 $lng->txt(
'chatroom_current_smiley_image_path'),
305 'chatroom_current_smiley_image_path' 308 $inp->
setValue($form_data[
'chatroom_current_smiley_image_path']);
309 $this->form_gui->addItem($inp);
312 $lng->txt(
'chatroom_image_path'),
'chatroom_image_path' 316 $inp->setRequired(
false);
317 $inp->setInfo($lng->txt(
'chatroom_smiley_image_only_if_changed'));
318 $this->form_gui->addItem($inp);
321 $lng->txt(
'chatroom_smiley_keywords'),
'chatroom_smiley_keywords' 324 $inp->
setValue($form_data[
'chatroom_smiley_keywords']);
325 $inp->setUseRte(
false);
326 $inp->setRequired(
true);
327 $inp->setInfo($lng->txt(
'chatroom_smiley_keywords_one_per_line_note'));
328 $this->form_gui->addItem($inp);
332 $this->form_gui->addItem($inp);
333 $this->form_gui->addCommandButton(
334 'smiley-updateSmiliesObject', $lng->txt(
'submit')
336 $this->form_gui->addCommandButton(
'smiley', $lng->txt(
'cancel'));
337 return $this->form_gui;
344 public function showDeleteSmileyFormObject()
354 $this->gui->switchToVisibleMode();
356 if(!$rbacsystem->checkAccess(
'write', $this->gui->ref_id))
358 $this->
ilias->raiseError(
359 $lng->txt(
'msg_no_perm_write'), $this->
ilias->error_obj->MESSAGE
363 include_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
364 $smiley = ilChatroomSmilies::_getSmiley((
int)$_REQUEST[
'smiley_id']);
366 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
368 $confirmation->setFormAction($ilCtrl->getFormAction($this->gui,
'smiley'));
369 $confirmation->setHeaderText($lng->txt(
'chatroom_confirm_delete_smiley'));
370 $confirmation->addButton($lng->txt(
'confirm'),
'smiley-deleteSmileyObject');
371 $confirmation->addButton($lng->txt(
'cancel'),
'smiley');
372 $confirmation->addItem(
'chatroom_smiley_id', $smiley[
'smiley_id'],
ilUtil::img($smiley[
'smiley_fullpath'], $smiley[
'smiley_keywords']) .
' ' . $smiley[
'smiley_keywords']);
374 $tpl->setContent($confirmation->getHTML());
386 if(!$rbacsystem->checkAccess(
'write', $this->gui->ref_id))
388 $this->
ilias->raiseError(
389 $lng->txt(
'msg_no_perm_write'), $this->
ilias->error_obj->MESSAGE
393 include_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
395 ilChatroomSmilies::_deleteSmiley($_REQUEST[
"chatroom_smiley_id"]);
397 $ilCtrl->redirect($this->gui,
"smiley");
411 if(!$rbacsystem->checkAccess(
'write', $this->gui->ref_id))
413 $this->
ilias->raiseError(
414 $lng->txt(
'msg_no_perm_write'), $this->
ilias->error_obj->MESSAGE
418 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
423 include_once
"Modules/Chatroom/classes/class.ilChatroomSmilies.php";
429 $keywordscheck = count($keywords) > 0;
431 if(!$this->form_gui->checkInput() || !$keywordscheck)
433 $tpl->setContent($this->form_gui->getHtml());
435 return $this->
view();
440 $data[
"smiley_keywords"] = join(
"\n", $keywords);
441 $data[
"smiley_id"] = $_REQUEST[
"smiley_id"];
443 if($_FILES[
"chatroom_image_path"])
446 $_FILES[
"chatroom_image_path"][
"tmp_name"],
447 $_FILES[
"chatroom_image_path"][
"name"],
451 $data[
"smiley_path"] = $_FILES[
"chatroom_image_path"][
"name"];
454 ilChatroomSmilies::_updateSmiley(
$data);
457 $ilCtrl->redirect($this->gui,
"smiley");
464 public function deleteMultipleObject()
474 $this->gui->switchToVisibleMode();
476 if(!$rbacsystem->checkAccess(
'write', $this->gui->ref_id))
478 $this->
ilias->raiseError(
479 $this->lng->txt(
'msg_no_perm_write'), $this->
ilias->error_obj->MESSAGE
483 $items = (
array)$_REQUEST[
'smiley_id'];
484 if(count($items) == 0)
487 $ilCtrl->redirect($this->gui,
'smiley');
490 include_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
491 $smilies = ilChatroomSmilies::_getSmiliesById($items);
492 if(count($smilies) == 0)
495 $ilCtrl->redirect($this->gui,
'smiley');
498 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
500 $confirmation->setFormAction($ilCtrl->getFormAction($this->gui,
'smiley'));
501 $confirmation->setHeaderText($lng->txt(
'chatroom_confirm_delete_smiley'));
502 $confirmation->addButton($lng->txt(
'confirm'),
'smiley-confirmedDeleteMultipleObject');
503 $confirmation->addButton($lng->txt(
'cancel'),
'smiley');
505 foreach($smilies as $s)
507 $confirmation->addItem(
'sel_ids[]', $s[
'smiley_id'],
ilUtil::img($s[
'smiley_fullpath'], $s[
'smiley_keywords']) .
' ' . $s[
'smiley_keywords']);
510 $tpl->setContent($confirmation->getHTML());
516 public function confirmedDeleteMultipleObject()
524 if(!$rbacsystem->checkAccess(
'write', $this->gui->ref_id))
526 $this->
ilias->raiseError(
527 $this->lng->txt(
'msg_no_perm_write'), $this->
ilias->error_obj->MESSAGE
531 $parts =
$_POST[
"sel_ids"];
532 if(count($parts) == 0)
534 $ilCtrl->redirect($this->gui,
"smiley");
537 include_once
"Modules/Chatroom/classes/class.ilChatroomSmilies.php";
540 $ilCtrl->redirect($this->gui,
"smiley");
553 if(!$rbacsystem->checkAccess(
'write', $this->gui->ref_id))
555 $this->
ilias->raiseError(
556 $lng->txt(
'msg_no_perm_write'), $this->
ilias->error_obj->MESSAGE
562 include_once
"Modules/Chatroom/classes/class.ilChatroomSmilies.php";
563 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
567 $this->form_gui->setValuesByPost();
573 $keywordscheck = count($keywords) > 0;
575 if(!$this->form_gui->checkInput())
577 $tpl->setContent($this->form_gui->getHtml());
578 return $this->
view();
581 $pathinfo = pathinfo($_FILES[
"chatroom_image_path"][
"name"]);
582 $target_file = md5(
time() + $pathinfo[
'basename']) .
"." . $pathinfo[
'extension'];
585 $_FILES[
"chatroom_image_path"][
"tmp_name"],
590 ilChatroomSmilies::_storeSmiley(join(
"\n", $keywords), $target_file);
592 $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.
view()
Switches GUI to visible mode and calls editSmiliesObject method which prepares and displays the table...
static _setupFolder()
setup directory
setValue($a_value)
Set Value.
initSmiliesForm()
Initializes smilies form and returns it.
uploadSmileyObject()
Uploads and stores a new smiley with keywords from $_REQUEST["chatroom_smiley_keywords"] ilRbacSyste...
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.
updateSmiliesObject()
Updates a smiley and/or its keywords Updates a smiley icon and/or its keywords by $_REQUEST["chatroom...
Class ilChatroomGUIHandler.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
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
static _getSmiliesBasePath()
Returns smilies basepath.
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 _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.
executeDefault($requestedMethod)
{}
static getWebspaceDir($mode="filesystem")
get webspace directory
static _deleteMultipleSmilies($ids=array())
Deletes multiple smilies by given id array.
Confirmation screen class.