Class ilChatroomSmileyGUI Provides methods to show, add, edit and delete smilies consisting of icon and keywords.
More...
Class ilChatroomSmileyGUI 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.ilChatroomAdminSmileyGUI.php.
◆ _checkSetup()
static ilChatroomAdminSmileyGUI::_checkSetup |
( |
| ) |
|
|
static |
Definition at line 52 of file class.ilChatroomAdminSmileyGUI.php.
References $lng, $path, array, ilUtil\makeDirParents(), ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\sendSuccess().
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))
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.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
◆ _getSmileyDir()
static ilChatroomAdminSmileyGUI::_getSmileyDir |
( |
| ) |
|
|
static |
◆ _insertDefaultValues()
static ilChatroomAdminSmileyGUI::_insertDefaultValues |
( |
| ) |
|
|
staticprivate |
Definition at line 115 of file class.ilChatroomAdminSmileyGUI.php.
References array.
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]);
Create styles array
The data for the language used.
◆ _setupFolder()
static ilChatroomAdminSmileyGUI::_setupFolder |
( |
| ) |
|
|
staticprivate |
◆ deleteSmileyObject()
ilChatroomAdminSmileyGUI::deleteSmileyObject |
( |
| ) |
|
Deletes a smiley by $_REQUEST["chatroom_smiley_id"] ilRbacSystem $rbacsystem ilCtrl $ilCtrl.
Definition at line 382 of file class.ilChatroomAdminSmileyGUI.php.
References ilChatroomGUIHandler\$ilCtrl, $lng, and ilChatroomGUIHandler\$rbacsystem.
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");
redirection script todo: (a better solution should control the processing via a xml file) ...
◆ editSmiliesObject()
ilChatroomAdminSmileyGUI::editSmiliesObject |
( |
| ) |
|
Shows existing smilies table Prepares existing smilies table and displays it.
ilRbacSystem $rbacsystem ilLanguage $lng ilTemplate $tpl
Definition at line 147 of file class.ilChatroomAdminSmileyGUI.php.
References $lng, ilChatroomGUIHandler\$rbacsystem, $tpl, ilChatroomSmilies\_checkSetup(), ilChatroomSmiliesGUI\_getExistingSmiliesTable(), and initSmiliesForm().
Referenced by view().
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());
static _getExistingSmiliesTable($a_ref)
Constructor public.
initSmiliesForm()
Initializes smilies form 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 _checkSetup()
Checks if smiley folder is available; if not it will try to create folder and performs actions for an...
◆ executeDefault()
ilChatroomAdminSmileyGUI::executeDefault |
( |
|
$requestedMethod | ) |
|
◆ initSmiliesEditForm()
ilChatroomAdminSmileyGUI::initSmiliesEditForm |
( |
|
$form_data | ) |
|
Initializes SmiliesEditForm and returns it.
ilCtrl2 $ilCtrl ilLanguage $lng
- Returns
- ilPropertyFormGUI
Definition at line 278 of file class.ilChatroomAdminSmileyGUI.php.
References ilChatroomGUIHandler\$ilCtrl, $lng, ilChatroomGUIHandler\$rbacsystem, $tpl, array, ilUtil\img(), ilFileInputGUI\setSuffixes(), ilChatroomSmiliesCurrentSmileyFormElement\setValue(), and ilTextAreaInputGUI\setValue().
Referenced by showEditSmileyEntryFormObject().
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;
setValue($a_value)
Set Value.
Create styles array
The data for the language used.
This class represents a text area property in a property form.
◆ initSmiliesForm()
ilChatroomAdminSmileyGUI::initSmiliesForm |
( |
| ) |
|
Initializes smilies form and returns it.
ilCtrl2 $ilCtrl ilLanguage $lng
- Returns
- ilPropertyFormGUI
Definition at line 190 of file class.ilChatroomAdminSmileyGUI.php.
References ilChatroomGUIHandler\$ilCtrl, $lng, array, ilFormPropertyGUI\setRequired(), and ilFileInputGUI\setSuffixes().
Referenced by editSmiliesObject(), and uploadSmileyObject().
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;
Create styles array
The data for the language used.
This class represents a text area property in a property form.
◆ showEditSmileyEntryFormObject()
ilChatroomAdminSmileyGUI::showEditSmileyEntryFormObject |
( |
| ) |
|
Shows EditSmileyEntryForm Prepares EditSmileyEntryForm and displays it.
ilRbacSystem $rbacsystem ilTemplate $tpl
Definition at line 238 of file class.ilChatroomAdminSmileyGUI.php.
References $lng, ilChatroomGUIHandler\$rbacsystem, $tpl, array, and initSmiliesEditForm().
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());
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) ...
Create styles array
The data for the language used.
◆ updateSmiliesObject()
ilChatroomAdminSmileyGUI::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 407 of file class.ilChatroomAdminSmileyGUI.php.
References $_POST, $data, ilChatroomGUIHandler\$ilCtrl, $lng, ilChatroomGUIHandler\$rbacsystem, $tpl, ilChatroomSmilies\_deleteMultipleSmilies(), ilChatroomSmilies\_getSmiliesBasePath(), ilChatroomSmilies\_prepareKeywords(), array, ilUtil\img(), ilUtil\moveUploadedFile(), ilUtil\sendFailure(), ilUtil\sendInfo(), ilUtil\stripSlashes(), and view().
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");
view()
Switches GUI to visible mode and calls editSmiliesObject method which prepares and displays the table...
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.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static _prepareKeywords($words)
Trims given keywords and returns them in one array.
◆ uploadSmileyObject()
ilChatroomAdminSmileyGUI::uploadSmileyObject |
( |
| ) |
|
Uploads and stores a new smiley with keywords from $_REQUEST["chatroom_smiley_keywords"] ilRbacSystem $rbacsystem ilCtrl2 $ilCtrl.
Definition at line 549 of file class.ilChatroomAdminSmileyGUI.php.
References ilChatroomGUIHandler\$ilCtrl, $lng, ilChatroomGUIHandler\$rbacsystem, $tpl, ilChatroomSmilies\_getSmiliesBasePath(), ilChatroomSmilies\_prepareKeywords(), initSmiliesForm(), ilUtil\moveUploadedFile(), ilUtil\stripSlashes(), time, and view().
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");
view()
Switches GUI to visible mode and calls editSmiliesObject method which prepares and displays the table...
initSmiliesForm()
Initializes smilies form and returns it.
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 _prepareKeywords($words)
Trims given keywords and returns them in one array.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
◆ view()
ilChatroomAdminSmileyGUI::view |
( |
| ) |
|
The documentation for this class was generated from the following file: