Class ilChatroomSmileyTask Provides methods to show, add, edit and delete smilies consisting of icon and keywords.
More...
Class ilChatroomSmileyTask Provides methods to show, add, edit and delete smilies consisting of icon and keywords.
- Author
- Andreas Kordosz akord.nosp@m.osz@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
- Version
- $Id$
Definition at line 12 of file class.ilChatroomAdminSmileyTask.php.
◆ __construct()
◆ _checkSetup()
static ilChatroomAdminSmileyTask::_checkSetup |
( |
| ) |
|
|
static |
Definition at line 570 of file class.ilChatroomAdminSmileyTask.php.
References $lng, $path, ilUtil\makeDirParents(), ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\sendSuccess().
574 $path = self::_getSmileyDir();
602 "icon_thumbdown.gif",
605 foreach($smilies as $smiley)
607 copy(
"templates/default/images/emoticons/$smiley",
$path .
"/$smiley");
610 self::_insertDefaultValues();
617 if(!is_writable(
$path))
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
◆ _getSmileyDir()
static ilChatroomAdminSmileyTask::_getSmileyDir |
( |
| ) |
|
|
static |
◆ _insertDefaultValues()
static ilChatroomAdminSmileyTask::_insertDefaultValues |
( |
| ) |
|
|
staticprivate |
Definition at line 512 of file class.ilChatroomAdminSmileyTask.php.
References $ilDB, and $row.
517 array(
"icon_smile.gif",
":)\n:-)\n:smile:"),
518 array(
"icon_wink.gif",
";)\n;-)\n:wink:"),
519 array(
"icon_laugh.gif",
":D\n:-D\n:laugh:\n:grin:\n:biggrin:"),
520 array(
"icon_sad.gif",
":(\n:-(\n:sad:"),
521 array(
"icon_shocked.gif",
":o\n:-o\n:shocked:"),
522 array(
"icon_tongue.gif",
":p\n:-p\n:tongue:"),
523 array(
"icon_cool.gif",
":cool:"),
524 array(
"icon_eek.gif",
":eek:"),
525 array(
"icon_angry.gif",
":||\n:-||\n:angry:"),
526 array(
"icon_flush.gif",
":flush:"),
527 array(
"icon_idea.gif",
":idea:"),
528 array(
"icon_thumbup.gif",
":thumbup:"),
529 array(
"icon_thumbdown.gif",
":thumbdown:"),
532 $stmt = $ilDB->prepare(
" 533 INSERT INTO chatroom_smilies (smiley_id, smiley_keywords, smiley_path) 535 array(
"integer",
"text",
"text")
538 foreach($values as $val)
541 $ilDB->nextID(
"chatroom_smilies"),
545 $stmt->execute(
$row);
◆ _setupFolder()
static ilChatroomAdminSmileyTask::_setupFolder |
( |
| ) |
|
|
staticprivate |
◆ deleteSmileyObject()
ilChatroomAdminSmileyTask::deleteSmileyObject |
( |
| ) |
|
Deletes a smiley by $_REQUEST["chatroom_smiley_id"] ilRbacSystem $rbacsystem ilCtrl2 $ilCtrl.
Definition at line 139 of file class.ilChatroomAdminSmileyTask.php.
References $_REQUEST, $ilCtrl, $lng, and ilChatroomSmilies\_deleteSmiley().
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");
static _deleteSmiley($a_id)
Deletes smiliey by given id from database.
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']
◆ editSmiliesObject()
ilChatroomAdminSmileyTask::editSmiliesObject |
( |
| ) |
|
Shows existing smilies table Prepares existing smilies table and displays it.
ilRbacSystem $rbacsystem ilLanguage $lng ilTemplate $tpl
Definition at line 164 of file class.ilChatroomAdminSmileyTask.php.
References $lng, $tpl, ilChatroomSmilies\_checkSetup(), ilChatroomSmiliesGUI\_getExistingSmiliesTable(), and initSmiliesForm().
Referenced by view().
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());
static _getExistingSmiliesTable($a_ref)
Instantiates ilChatroomSmiliesTableGUI and returns its table's HTML.
special template class to simplify handling of ITX/PEAR
redirection script todo: (a better solution should control the processing via a xml file) ...
static _checkSetup()
Checks if smiley folder is available; if not it will try to create folder and performs actions for an...
initSmiliesForm()
Initializes smilies form and returns it.
◆ executeDefault()
ilChatroomAdminSmileyTask::executeDefault |
( |
|
$method | ) |
|
Default execute command.
Calls view method.
- Parameters
-
Definition at line 32 of file class.ilChatroomAdminSmileyTask.php.
References view().
view()
Switches GUI to visible mode and calls editSmiliesObject method which prepares and displays the table...
◆ initSmiliesEditForm()
ilChatroomAdminSmileyTask::initSmiliesEditForm |
( |
|
$form_data | ) |
|
Initializes SmiliesEditForm and returns it.
ilCtrl2 $ilCtrl ilLanguage $lng
- Returns
- ilPropertyFormGUI
Definition at line 398 of file class.ilChatroomAdminSmileyTask.php.
References $_REQUEST, $ilCtrl, $lng, ilFileInputGUI\setSuffixes(), ilChatroomSmiliesCurrentSmileyFormElement\setValue(), and ilTextAreaInputGUI\setValue().
Referenced by showEditSmileyEntryFormObject().
402 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
406 $this->form_gui->setValuesByArray($form_data);
410 $ilCtrl->saveParameter($this->gui,
'smiley_id');
412 $this->form_gui->setFormAction(
413 $ilCtrl->getFormAction($this->gui,
'smiley-updateSmiliesObject') . $table_nav
418 $sec_l->setTitle($lng->txt(
'chatroom_edit_smiley'));
419 $this->form_gui->addItem($sec_l);
421 include_once
"Modules/Chatroom/classes/class.ilChatroomSmiliesCurrentSmileyFormElement.php";
424 $lng->txt(
'chatroom_current_smiley_image_path'),
425 'chatroom_current_smiley_image_path' 428 $inp->
setValue($form_data[
'chatroom_current_smiley_image_path']);
429 $this->form_gui->addItem($inp);
432 $lng->txt(
'chatroom_image_path'),
'chatroom_image_path' 434 $inp->
setSuffixes(array(
"jpg",
"jpeg",
"png",
"gif",
"svg"));
436 $inp->setRequired(
false);
437 $inp->setInfo($lng->txt(
'chatroom_smiley_image_only_if_changed'));
438 $this->form_gui->addItem($inp);
441 $lng->txt(
'chatroom_smiley_keywords'),
'chatroom_smiley_keywords' 444 $inp->
setValue($form_data[
'chatroom_smiley_keywords']);
445 $inp->setUseRte(
false);
446 $inp->setRequired(
true);
447 $inp->setInfo($lng->txt(
'chatroom_smiley_keywords_one_per_line_note'));
448 $this->form_gui->addItem($inp);
452 $this->form_gui->addItem($inp);
453 $this->form_gui->addCommandButton(
454 'smiley-updateSmiliesObject', $lng->txt(
'submit')
456 $this->form_gui->addCommandButton(
'smiley', $lng->txt(
'cancel'));
457 return $this->form_gui;
setValue($a_value)
Set Value.
This class represents a text area property in a property form.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
◆ initSmiliesForm()
ilChatroomAdminSmileyTask::initSmiliesForm |
( |
| ) |
|
Initializes smilies form and returns it.
ilCtrl2 $ilCtrl ilLanguage $lng
- Returns
- ilPropertyFormGUI
Definition at line 267 of file class.ilChatroomAdminSmileyTask.php.
References $_POST, $_REQUEST, $ilCtrl, $lng, $tpl, ilChatroomSmilies\_deleteMultipleSmilies(), ilChatroomSmilies\_getSmiliesById(), ilUtil\img(), ilUtil\sendInfo(), ilFormPropertyGUI\setRequired(), and ilFileInputGUI\setSuffixes().
Referenced by editSmiliesObject(), and uploadSmileyObject().
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' 289 $inp->
setSuffixes(array(
"jpg",
"jpeg",
"png",
"gif",
"svg"));
291 $inp->setRequired(
true);
292 $this->form_gui->addItem($inp);
295 $lng->txt(
'chatroom_smiley_keywords'),
'chatroom_smiley_keywords' 299 $inp->setUseRte(
false);
300 $inp->setInfo($lng->txt(
'chatroom_smiley_keywords_one_per_line_note'));
301 $this->form_gui->addItem($inp);
302 $this->form_gui->addCommandButton(
303 'smiley-uploadSmileyObject', $lng->txt(
'chatroom_upload_smiley')
306 return $this->form_gui;
This class represents a text area property in a property form.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
◆ showEditSmileyEntryFormObject()
ilChatroomAdminSmileyTask::showEditSmileyEntryFormObject |
( |
| ) |
|
Shows EditSmileyEntryForm Prepares EditSmileyEntryForm and displays it.
ilRbacSystem $rbacsystem ilTemplate $tpl
Definition at line 63 of file class.ilChatroomAdminSmileyTask.php.
References $_REQUEST, $ilCtrl, $lng, $tpl, ilChatroomSmilies\_getSmiley(), ilUtil\img(), and initSmiliesEditForm().
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());
initSmiliesEditForm($form_data)
Initializes SmiliesEditForm and returns it.
special template class to simplify handling of ITX/PEAR
redirection script todo: (a better solution should control the processing via a xml file) ...
static _getSmiley($a_id)
Looks up and returns smiley with id, throws exception if id is not found.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
◆ updateSmiliesObject()
ilChatroomAdminSmileyTask::updateSmiliesObject |
( |
| ) |
|
Updates a smiley and/or its keywords Updates a smiley icon and/or its keywords by $_REQUEST["chatroom_smiley_id"] and gets keywords from $_REQUEST["chatroom_smiley_keywords"].
ilRbacSystem $rbacsystem ilCtrl2 $ilCtrl
Definition at line 208 of file class.ilChatroomAdminSmileyTask.php.
References $_REQUEST, $data, $ilCtrl, $lng, $tpl, ilChatroomSmilies\_getSmiliesBasePath(), ilChatroomSmilies\_prepareKeywords(), ilChatroomSmilies\_updateSmiley(), ilUtil\moveUploadedFile(), ilUtil\sendFailure(), ilUtil\stripSlashes(), and view().
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"],
248 $_FILES[
"chatroom_image_path"][
"name"],
252 $data[
"smiley_path"] = $_FILES[
"chatroom_image_path"][
"name"];
258 $ilCtrl->redirect($this->gui,
"smiley");
static _updateSmiley($data)
Updates smiley in DB by keyword and id from given array ($data["smiley_keywords"], $data["smiley_id"])
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
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.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static _prepareKeywords($words)
Trims given keywords and returns them in one array.
view()
Switches GUI to visible mode and calls editSmiliesObject method which prepares and displays the table...
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
◆ uploadSmileyObject()
ilChatroomAdminSmileyTask::uploadSmileyObject |
( |
| ) |
|
Uploads and stores a new smiley with keywords from $_REQUEST["chatroom_smiley_keywords"] ilRbacSystem $rbacsystem ilCtrl2 $ilCtrl.
Definition at line 466 of file class.ilChatroomAdminSmileyTask.php.
References $_REQUEST, $ilCtrl, $lng, $tpl, ilChatroomSmilies\_getSmiliesBasePath(), ilChatroomSmilies\_prepareKeywords(), ilChatroomSmilies\_storeSmiley(), initSmiliesForm(), ilUtil\moveUploadedFile(), ilUtil\stripSlashes(), and view().
470 if(!$rbacsystem->checkAccess(
'write', $this->gui->ref_id))
472 $this->
ilias->raiseError(
473 $lng->txt(
'msg_no_perm_write'), $this->
ilias->error_obj->MESSAGE
479 include_once
"Modules/Chatroom/classes/class.ilChatroomSmilies.php";
480 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
484 $this->form_gui->setValuesByPost();
490 $keywordscheck = count($keywords) > 0;
492 if(!$this->form_gui->checkInput())
494 $tpl->setContent($this->form_gui->getHtml());
495 return $this->
view();
498 $pathinfo = pathinfo($_FILES[
"chatroom_image_path"][
"name"]);
499 $target_file = md5(time() + $pathinfo[
'basename']) .
"." . $pathinfo[
'extension'];
502 $_FILES[
"chatroom_image_path"][
"tmp_name"],
509 $ilCtrl->redirect($this->gui,
"smiley");
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
redirection script todo: (a better solution should control the processing via a xml file) ...
static _storeSmiley($keywords, $path)
Stores smiley with given keywords and path in database.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static _getSmiliesBasePath()
Returns smilies basepath.
initSmiliesForm()
Initializes smilies form and returns it.
static _prepareKeywords($words)
Trims given keywords and returns them in one array.
view()
Switches GUI to visible mode and calls editSmiliesObject method which prepares and displays the table...
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
◆ view()
ilChatroomAdminSmileyTask::view |
( |
| ) |
|
◆ $gui
ilChatroomAdminSmileyTask::$gui |
|
private |
The documentation for this class was generated from the following file: