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"],
 
  248                                        $_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' 
  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' 
  298                $inp->setRequired(
true);
 
  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;
 
  313        public function deleteMultipleObject()
 
  323                $this->gui->switchToVisibleMode();
 
  325                if(!$rbacsystem->checkAccess(
'write', $this->gui->ref_id))
 
  327                        $this->
ilias->raiseError(
 
  328                                $this->lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->MESSAGE
 
  333                if(count($items) == 0)
 
  336                        $ilCtrl->redirect($this->gui, 
'smiley');
 
  339                include_once 
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
 
  341                if(count($smilies) == 0)
 
  344                        $ilCtrl->redirect($this->gui, 
'smiley');
 
  347                require_once 
'Services/Utilities/classes/class.ilConfirmationGUI.php';
 
  349                $confirmation->setFormAction(
$ilCtrl->getFormAction($this->gui, 
'smiley'));
 
  350                $confirmation->setHeaderText(
$lng->txt(
'chatroom_confirm_delete_smiley'));
 
  351                $confirmation->addButton(
$lng->txt(
'confirm'), 
'smiley-confirmedDeleteMultipleObject');
 
  352                $confirmation->addButton(
$lng->txt(
'cancel'), 
'smiley');
 
  354                foreach($smilies as $s)
 
  356                        $confirmation->addItem(
'sel_ids[]', $s[
'smiley_id'], 
ilUtil::img($s[
'smiley_fullpath'], $s[
'smiley_keywords']) . 
' ' . $s[
'smiley_keywords']);
 
  359                $tpl->setContent($confirmation->getHTML());
 
  365        public function confirmedDeleteMultipleObject()
 
  373                if(!$rbacsystem->checkAccess(
'write', $this->gui->ref_id))
 
  375                        $this->
ilias->raiseError(
 
  376                                $this->lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->MESSAGE
 
  380                $parts = 
$_POST[
"sel_ids"];
 
  381                if(count($parts) == 0)
 
  383                        $ilCtrl->redirect($this->gui, 
"smiley");
 
  386                include_once 
"Modules/Chatroom/classes/class.ilChatroomSmilies.php";
 
  389                $ilCtrl->redirect($this->gui, 
"smiley");
 
  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;
 
  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");
 
  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);
 
  558                        mkdir(
$path, 0755, 
true);
 
  602                                        "icon_thumbdown.gif",
 
  605                                foreach($smilies as $smiley)
 
  607                                        copy(
"templates/default/images/emoticons/$smiley", 
$path . 
"/$smiley");
 
  617                if(!is_writable(
$path))
 
Class ilChatroomSmileyTask Provides methods to show, add, edit and delete smilies consisting of icon ...
uploadSmileyObject()
Uploads and stores a new smiley with keywords from $_REQUEST["chatroom_smiley_keywords"] @global ilRb...
static _insertDefaultValues()
initSmiliesForm()
Initializes smilies form and returns it.
executeDefault($method)
Default execute command.
deleteSmileyObject()
Deletes a smiley by $_REQUEST["chatroom_smiley_id"] @global ilRbacSystem $rbacsystem @global ilCtrl2 ...
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.
static _setupFolder()
setup directory
view()
Switches GUI to visible mode and calls editSmiliesObject method which prepares and displays the table...
editSmiliesObject()
Shows existing smilies table Prepares existing smilies table and displays it.
initSmiliesEditForm($form_data)
Initializes SmiliesEditForm and returns it.
showEditSmileyEntryFormObject()
Shows EditSmileyEntryForm Prepares EditSmileyEntryForm 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 moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
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']