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);
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'
290 $inp->setRequired(
true);
291 $this->form_gui->addItem($inp);
294 $lng->txt(
'chatroom_smiley_keywords'),
'chatroom_smiley_keywords'
297 $inp->setRequired(
true);
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'
434 $inp->setRequired(
false);
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))
Class ilChatroomSmileyTask Provides methods to show, add, edit and delete smilies consisting of icon ...
initSmiliesEditForm($form_data)
Initializes SmiliesEditForm and returns it.
static _setupFolder()
setup directory
executeDefault($method)
Default execute command.
showEditSmileyEntryFormObject()
Shows EditSmileyEntryForm Prepares EditSmileyEntryForm and displays it.
static _insertDefaultValues()
view()
Switches GUI to visible mode and calls editSmiliesObject method which prepares and displays the table...
initSmiliesForm()
Initializes smilies form and returns it.
deleteSmileyObject()
Deletes a smiley by $_REQUEST["chatroom_smiley_id"] @global ilRbacSystem $rbacsystem @global ilCtrl2 ...
uploadSmileyObject()
Uploads and stores a new smiley with keywords from $_REQUEST["chatroom_smiley_keywords"] @global ilRb...
updateSmiliesObject()
Updates a smiley and/or its keywords Updates a smiley icon and/or its keywords by $_REQUEST["chatroom...
__construct(ilChatroomObjectGUI $gui)
Constructor Sets $this->gui.
editSmiliesObject()
Shows existing smilies table Prepares existing smilies table and displays it.
static _getExistingSmiliesTable($a_ref)
Instantiates ilChatroomSmiliesTableGUI and returns its table's HTML.
static _storeSmiley($keywords, $path)
Stores smiley with given keywords and path in database.
static _getSmiliesBasePath()
Returns smilies basepath.
static _getSmiliesById($ids=array())
Fetches smilies from database by id.
static _getSmiley($a_id)
Looks up and returns smiley with id, throws exception if id is not found.
static _checkSetup()
Checks if smiley folder is available; if not it will try to create folder and performs actions for an...
static _deleteMultipleSmilies($ids=array())
Deletes multiple smilies by given id array.
static _prepareKeywords($words)
Trims given keywords and returns them in one array.
static _deleteSmiley($a_id)
Deletes smiliey by given id from database.
static _updateSmiley($data)
Updates smiley in DB by keyword and id from given array ($data["smiley_keywords"],...
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
Confirmation screen class.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
static getWebspaceDir($mode="filesystem")
get webspace directory
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
redirection script todo: (a better solution should control the processing via a xml file)
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']