ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilChatroomSmileyTask Class Reference

Class ilChatroomSmileyTask. More...

+ Inheritance diagram for ilChatroomSmileyTask:
+ Collaboration diagram for ilChatroomSmileyTask:

Public Member Functions

 __construct (ilChatroomObjectGUI $gui)
 Constructor. More...
 
 executeDefault ($method)
 Default execute command. More...
 
 view ()
 Switches GUI to visible mode and calls editSmiliesObject method which prepares and displays the table of existing smilies. More...
 
 showEditSmileyEntryFormObject ()
 Shows EditSmileyEntryForm. More...
 
 showDeleteSmileyFormObject ()
 Shows DeleteSmileyForm. More...
 
 deleteSmileyObject ()
 Deletes a smiley by $_REQUEST["chatroom_smiley_id"]. More...
 
 editSmiliesObject ()
 Shows existing smilies table. More...
 
 updateSmiliesObject ()
 Updates a smiley and/or its keywords. More...
 
 initSmiliesForm ()
 Initializes smilies form and returns it. More...
 
 deleteMultipleObject ()
 Shows confirmation view for deleting multiple smilies. More...
 
 confirmedDeleteMultipleObject ()
 Deletes multiple smilies by $_REQUEST["sel_ids"]. More...
 
 initSmiliesEditForm ($form_data)
 Initializes SmiliesEditForm and returns it. More...
 
 uploadSmileyObject ()
 Uploads and stores a new smiley with keywords from $_REQUEST["chatroom_smiley_keywords"]. More...
 
- Public Member Functions inherited from ilChatroomTaskHandler
 __construct (ilChatroomObjectGUI $gui)
 
 executeDefault ($requestedMethod)
 

Static Public Member Functions

static _getSmileyDir ()
 
static _checkSetup ()
 

Static Private Member Functions

static _insertDefaultValues ()
 
static _setupFolder ()
 setup directory More...
 

Private Attributes

 $gui
 

Detailed Description

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 16 of file class.ilChatroomSmileyTask.php.

Constructor & Destructor Documentation

◆ __construct()

ilChatroomSmileyTask::__construct ( ilChatroomObjectGUI  $gui)

Constructor.

Sets $this->gui

Parameters
ilChatroomObjectGUI$gui

Definition at line 28 of file class.ilChatroomSmileyTask.php.

References $gui.

29  {
30  $this->gui = $gui;
31  }

Member Function Documentation

◆ _checkSetup()

static ilChatroomSmileyTask::_checkSetup ( )
static

Definition at line 611 of file class.ilChatroomSmileyTask.php.

References $lng, $path, ilUtil\makeDirParents(), ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\sendSuccess().

612  {
613  global $lng;
614 
615  $path = self::_getSmileyDir();
616 
617  if( !is_dir($path) )
618  {
619  ilUtil::sendInfo($lng->txt('chat_smilies_dir_not_exists'));
621 
622  if( !is_dir($path) )
623  {
624  ilUtil::sendFailure($lng->txt('chat_smilies_dir_not_available'));
625  return false;
626  }
627  else
628  {
629  $smilies = array
630  (
631  "icon_smile.gif",
632  "icon_wink.gif",
633  "icon_laugh.gif",
634  "icon_sad.gif",
635  "icon_shocked.gif",
636  "icon_tongue.gif",
637  "icon_cool.gif",
638  "icon_eek.gif",
639  "icon_angry.gif",
640  "icon_flush.gif",
641  "icon_idea.gif",
642  "icon_thumbup.gif",
643  "icon_thumbdown.gif",
644  );
645 
646  foreach($smilies as $smiley)
647  {
648  copy("templates/default/images/emoticons/$smiley", $path . "/$smiley");
649  }
650 
651  self::_insertDefaultValues();
652 
653  ilUtil::sendSuccess($lng->txt('chat_smilies_initialized'));
654  }
655 
656  }
657 
658  if (!is_writable($path))
659  {
660  ilUtil::sendInfo($lng->txt('chat_smilies_dir_not_writable'));
661  }
662 
663  return true;
664  }
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.
global $lng
Definition: privfeed.php:40
$path
Definition: index.php:22
+ Here is the call graph for this function:

◆ _getSmileyDir()

static ilChatroomSmileyTask::_getSmileyDir ( )
static
Returns
string path to smilies

Definition at line 606 of file class.ilChatroomSmileyTask.php.

References ilUtil\getWebspaceDir().

607  {
608  return ilUtil::getWebspaceDir().'/chatroom/smilies';
609  }
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ _insertDefaultValues()

static ilChatroomSmileyTask::_insertDefaultValues ( )
staticprivate

Definition at line 553 of file class.ilChatroomSmileyTask.php.

References $row.

554  {
555  global $ilDB;
556 
557  $values = array (
558  array("icon_smile.gif", ":)\n:-)\n:smile:"),
559  array("icon_wink.gif", ";)\n;-)\n:wink:"),
560  array("icon_laugh.gif", ":D\n:-D\n:laugh:\n:grin:\n:biggrin:"),
561  array("icon_sad.gif", ":(\n:-(\n:sad:"),
562  array("icon_shocked.gif", ":o\n:-o\n:shocked:"),
563  array("icon_tongue.gif", ":p\n:-p\n:tongue:"),
564  array("icon_cool.gif", ":cool:"),
565  array("icon_eek.gif", ":eek:"),
566  array("icon_angry.gif", ":||\n:-||\n:angry:"),
567  array("icon_flush.gif", ":flush:"),
568  array("icon_idea.gif", ":idea:"),
569  array("icon_thumbup.gif", ":thumbup:"),
570  array("icon_thumbdown.gif", ":thumbdown:"),
571  );
572 
573  $stmt = $ilDB->prepare("
574  INSERT INTO chatroom_smilies (smiley_id, smiley_keywords, smiley_path)
575  VALUES (?, ?, ?)",
576  array( "integer", "text", "text" )
577  );
578 
579  foreach($values as $val)
580  {
581  $row = array(
582  $ilDB->nextID("chat_smilies"),
583  $val[1],
584  $val[0]
585  );
586  $stmt->execute($row);
587  }
588  }

◆ _setupFolder()

static ilChatroomSmileyTask::_setupFolder ( )
staticprivate

setup directory

Definition at line 593 of file class.ilChatroomSmileyTask.php.

References $path.

594  {
595  $path = self::_getSmileyDir();
596 
597  if( !is_dir($path) )
598  {
599  mkdir($path, 0755, true);
600  }
601  }
$path
Definition: index.php:22

◆ confirmedDeleteMultipleObject()

ilChatroomSmileyTask::confirmedDeleteMultipleObject ( )

Deletes multiple smilies by $_REQUEST["sel_ids"].

ilRbacSystem $rbacsystem ilCtrl2 $ilCtrl

Definition at line 405 of file class.ilChatroomSmileyTask.php.

References $_REQUEST, $ilCtrl, and ilChatroomSmilies\_deleteMultipleSmilies().

406  {
407  //global $rbacsystem, $ilSetting, $lng, $ilCtrl;
408  global $rbacsystem, $ilCtrl;
409 
410  if( !$rbacsystem->checkAccess( 'write', $this->gui->ref_id ) )
411  {
412  $this->ilias->raiseError(
413  $this->lng->txt( 'msg_no_perm_write' ), $this->ilias->error_obj->MESSAGE
414  );
415  }
416 
417  $ids = $_REQUEST["sel_ids"];
418  $parts = explode( ",", $ids );
419 
420  if( count( $parts ) == 0 )
421  {
422  $ilCtrl->redirect( $this->gui, "smiley" );
423  }
424 
425  include_once "Modules/Chatroom/classes/class.ilChatroomSmilies.php";
426 
428 
429  $ilCtrl->redirect( $this->gui, "smiley" );
430  }
global $ilCtrl
Definition: ilias.php:18
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']
Definition: index.php:7
static _deleteMultipleSmilies($ids=array())
Deletes multiple smilies by given id array.
+ Here is the call graph for this function:

◆ deleteMultipleObject()

ilChatroomSmileyTask::deleteMultipleObject ( )

Shows confirmation view for deleting multiple smilies.

Prepares confirmation view for deleting multiple smilies and displays it.

ilRbacSystem $rbacsystem ilLanguage $lng ilCtrl2 $ilCtrl ilTemplate $tpl

Definition at line 345 of file class.ilChatroomSmileyTask.php.

References $_REQUEST, $ilCtrl, $lng, $tpl, ilChatroomSmilies\_getSmiliesById(), and ilUtil\sendInfo().

346  {
347  //global $rbacsystem, $ilSetting, $lng, $ilCtrl, $tpl;
348  global $rbacsystem, $lng, $ilCtrl, $tpl;
349 
350  $this->gui->switchToVisibleMode();
351 
352  if( !$rbacsystem->checkAccess( 'write', $this->gui->ref_id ) )
353  {
354  $this->ilias->raiseError(
355  $this->lng->txt( 'msg_no_perm_write' ), $this->ilias->error_obj->MESSAGE
356  );
357  }
358 
359  $items = $_REQUEST["smiley_id"];
360 
361  if( count( $items ) == 0 )
362  {
363  ilUtil::sendInfo( $lng->txt( 'select_one' ), true );
364  $ilCtrl->redirect( $this->gui, "smiley" );
365  }
366 
367  include_once 'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
368 
369  $smilies = ilChatroomSmilies::_getSmiliesById( $items );
370 
371  $tpl_form = new ilTemplate(
372  "tpl.chatroom_smilies_delete_multiple_confirm.html", true, true, "Modules/Chatroom"
373  );
374 
375  $tpl_form->setVariable(
376  "SMILIES_DELETE_INTRO", $lng->txt( 'chatroom_confirm_delete_smiley' )
377  );
378  $tpl_form->setVariable( "TXT_SUBMIT", $lng->txt( 'confirm' ) );
379  $tpl_form->setVariable( "TXT_CANCEL", $lng->txt( 'cancel' ) );
380  $tpl_form->setVariable( "SMILIES_IDS", join( ",", $items ) );
381  $tpl_form->setVariable(
382  "FORMACTION", $ilCtrl->getFormAction( $this->gui, 'update' )
383  );
384 
385  $i = 0;
386 
387  foreach( $smilies as $s )
388  {
389  $tpl_form->setCurrentBlock( "smilies_list" );
390  $tpl_form->setVariable( "SMILEY_PATH", $s["smiley_fullpath"] );
391  $tpl_form->setVariable( "SMILEY_KEYWORDS", $s["smiley_keywords"] );
392  $tpl_form->setVariable( "ROW_CNT", ($i++ % 2) + 1 );
393  $tpl_form->parseCurrentBlock();
394  }
395 
396  $tpl->setContent( $tpl_form->get() );
397  }
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
special template class to simplify handling of ITX/PEAR
redirection script todo: (a better solution should control the processing via a xml file) ...
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static _getSmiliesById($ids=array())
Fetches smilies from database by id.
global $lng
Definition: privfeed.php:40
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ deleteSmileyObject()

ilChatroomSmileyTask::deleteSmileyObject ( )

Deletes a smiley by $_REQUEST["chatroom_smiley_id"].

ilRbacSystem $rbacsystem ilCtrl2 $ilCtrl

Definition at line 163 of file class.ilChatroomSmileyTask.php.

References $_REQUEST, $ilCtrl, $lng, and ilChatroomSmilies\_deleteSmiley().

164  {
165  global $rbacsystem, $ilCtrl, $lng;
166 
167  if( !$rbacsystem->checkAccess( 'write', $this->gui->ref_id ) )
168  {
169  $this->ilias->raiseError(
170  $lng->txt( 'msg_no_perm_write' ), $this->ilias->error_obj->MESSAGE
171  );
172  }
173 
174  include_once 'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
175 
176  ilChatroomSmilies::_deleteSmiley( $_REQUEST["chatroom_smiley_id"] );
177 
178  $ilCtrl->redirect( $this->gui, "smiley" );
179  }
static _deleteSmiley($a_id)
Deletes smiliey by given id from database.
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
global $lng
Definition: privfeed.php:40
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ editSmiliesObject()

ilChatroomSmileyTask::editSmiliesObject ( )

Shows existing smilies table.

Prepares existing smilies table and displays it.

ilRbacSystem $rbacsystem ilLanguage $lng ilTemplate $tpl

Definition at line 190 of file class.ilChatroomSmileyTask.php.

References $lng, $tpl, ilChatroomSmilies\_checkSetup(), ilChatroomSmiliesGUI\_getExistingSmiliesTable(), and initSmiliesForm().

Referenced by view().

191  {
192  global $rbacsystem, $lng, $tpl;
193 
194  if( !$rbacsystem->checkAccess( 'read', $this->gui->ref_id ) )
195  {
196  $this->ilias->raiseError(
197  $lng->txt( 'msg_no_perm_read' ), $this->gui->ilias->error_obj->MESSAGE
198  );
199  }
200 
201  include_once 'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
202 
204 
205  if (!$this->form_gui) {
206  $form = $this->initSmiliesForm();
207  }
208  else {
209  $form = $this->form_gui;
210  }
211 
212  include_once "Modules/Chatroom/classes/class.ilChatroomSmiliesGUI.php";
213 
214  $table = ilChatroomSmiliesGUI::_getExistingSmiliesTable( $this->gui );
215 
216  $tpl_smilies = new ilTemplate(
217  "tpl.chatroom_edit_smilies.html", true, true, "Modules/Chatroom"
218  );
219  $tpl_smilies->setVariable( "SMILEY_TABLE", $table );
220  $tpl_smilies->setVariable( "SMILEY_FORM", $form->getHtml() );
221 
222  $tpl->setContent( $tpl_smilies->get() );
223  }
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) ...
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
initSmiliesForm()
Initializes smilies form and returns it.
static _checkSetup()
Checks if smiley folder is available; if not it will try to create folder and performs actions for an...
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeDefault()

ilChatroomSmileyTask::executeDefault (   $method)

Default execute command.

Calls view method.

Parameters
string$method

Definition at line 39 of file class.ilChatroomSmileyTask.php.

References view().

40  {
41  //include_once 'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
42  //ilChatroomSmilies::_initial();
43  $this->view();
44  }
view()
Switches GUI to visible mode and calls editSmiliesObject method which prepares and displays the table...
+ Here is the call graph for this function:

◆ initSmiliesEditForm()

ilChatroomSmileyTask::initSmiliesEditForm (   $form_data)

Initializes SmiliesEditForm and returns it.

ilCtrl2 $ilCtrl ilLanguage $lng

Returns
ilPropertyFormGUI

Definition at line 439 of file class.ilChatroomSmileyTask.php.

References $_REQUEST, $ilCtrl, $lng, ilFormPropertyGUI\setRequired(), ilChatroomSmiliesCurrentSmileyFormElement\setValue(), and ilTextAreaInputGUI\setValue().

Referenced by showEditSmileyEntryFormObject().

440  {
441  global $ilCtrl, $lng;
442 
443  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
444 
445  $this->form_gui = new ilPropertyFormGUI();
446 
447  $this->form_gui->setValuesByArray( $form_data );
448 
449  $table_nav = $_REQUEST["_table_nav"] ? "&_table_nav=" . $_REQUEST["_table_nav"] : "";
450 
451  $ilCtrl->saveParameter($this->gui, 'smiley_id');
452 
453  $this->form_gui->setFormAction(
454  $ilCtrl->getFormAction( $this->gui, 'smiley-updateSmiliesObject' ) . $table_nav
455  );
456 
457  $sec_l = new ilFormSectionHeaderGUI();
458 
459  $sec_l->setTitle( $lng->txt( 'chatroom_edit_smiley' ) );
460  $this->form_gui->addItem( $sec_l );
461 
462  include_once "Modules/Chatroom/classes/class.ilChatroomSmiliesCurrentSmileyFormElement.php";
463 
465  $lng->txt( 'chatroom_current_smiley_image_path' ),
466  'chatroom_current_smiley_image_path'
467  );
468 
469  $inp->setValue($form_data['chatroom_current_smiley_image_path']);
470  $this->form_gui->addItem( $inp );
471 
472  $inp = new ilImageFileInputGUI(
473  $lng->txt( 'chatroom_image_path' ), 'chatroom_image_path'
474  );
475 
476  $inp->setRequired( false );
477  $inp->setInfo( $lng->txt( 'chatroom_smiley_image_only_if_changed' ) );
478  $this->form_gui->addItem( $inp );
479 
480  $inp = new ilTextAreaInputGUI(
481  $lng->txt( 'chatroom_smiley_keywords' ), 'chatroom_smiley_keywords'
482  );
483 
484  $inp->setValue($form_data['chatroom_smiley_keywords']);
485  $inp->setUseRte( false );
486  $inp->setRequired( true );
487  $inp->setInfo( $lng->txt( 'chatroom_smiley_keywords_one_per_line_note' ) );
488  $this->form_gui->addItem( $inp );
489 
490  $inp = new ilHiddenInputGUI( 'chatroom_smiley_id' );
491 
492  $this->form_gui->addItem( $inp );
493  $this->form_gui->addCommandButton(
494  'smiley-updateSmiliesObject', $lng->txt( 'submit' )
495  );
496  $this->form_gui->addCommandButton( 'smiley', $lng->txt( 'cancel' ) );
497  return $this->form_gui;
498  }
This class represents a property form user interface.
This class represents a section header in a property form.
setValue($a_value)
Set Value.
setValue($a_value)
Sets given value as $this->value in ilChatroomSmiliesCurrentSmileyFormElement.
global $ilCtrl
Definition: ilias.php:18
This class represents a hidden form property in a property form.
This class represents an image file property in a property form.
global $lng
Definition: privfeed.php:40
This class represents a text area property in a property form.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSmiliesForm()

ilChatroomSmileyTask::initSmiliesForm ( )

Initializes smilies form and returns it.

ilCtrl2 $ilCtrl ilLanguage $lng

Returns
ilPropertyFormGUI

Definition at line 294 of file class.ilChatroomSmileyTask.php.

References $_REQUEST, $ilCtrl, $lng, and ilFormPropertyGUI\setRequired().

Referenced by editSmiliesObject(), and uploadSmileyObject().

295  {
296  global $ilCtrl, $lng;
297 
298  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
299 
300  $this->form_gui = new ilPropertyFormGUI();
301 
302  $table_nav = $_REQUEST["_table_nav"] ? "&_table_nav=" . $_REQUEST["_table_nav"] : "";
303  $this->form_gui->setFormAction(
304  $ilCtrl->getFormAction( $this->gui, 'smiley-uploadSmileyObject' ) . $table_nav
305  );
306 
307  // chat server settings
308  $sec_l = new ilFormSectionHeaderGUI();
309 
310  $sec_l->setTitle( $lng->txt( 'chatroom_add_smiley' ) );
311  $this->form_gui->addItem( $sec_l );
312 
313  $inp = new ilImageFileInputGUI(
314  $lng->txt( 'chatroom_image_path' ), 'chatroom_image_path'
315  );
316 
317  $inp->setRequired( true );
318  $this->form_gui->addItem( $inp );
319 
320  $inp = new ilTextAreaInputGUI(
321  $lng->txt( 'chatroom_smiley_keywords' ), 'chatroom_smiley_keywords'
322  );
323 
324  $inp->setRequired( true );
325  $inp->setUseRte( false );
326  $inp->setInfo( $lng->txt( 'chatroom_smiley_keywords_one_per_line_note' ) );
327  $this->form_gui->addItem( $inp );
328  $this->form_gui->addCommandButton(
329  'smiley-uploadSmileyObject', $lng->txt( 'chatroom_upload_smiley' )
330  );
331 
332  return $this->form_gui;
333  }
This class represents a property form user interface.
This class represents a section header in a property form.
global $ilCtrl
Definition: ilias.php:18
This class represents an image file property in a property form.
global $lng
Definition: privfeed.php:40
This class represents a text area property in a property form.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showDeleteSmileyFormObject()

ilChatroomSmileyTask::showDeleteSmileyFormObject ( )

Shows DeleteSmileyForm.

Prepares DeleteSmileyForm and displays it.

ilRbacSystem $rbacsystem ilLanguage $lng ilCtrl2 $ilCtrl ilTemplate $tpl

Definition at line 116 of file class.ilChatroomSmileyTask.php.

References $_REQUEST, $ilCtrl, $lng, $tpl, and ilChatroomSmilies\_getSmiley().

117  {
118  global $rbacsystem, $lng, $ilCtrl, $tpl;
119 
120  $this->gui->switchToVisibleMode();
121 
122  if( !$rbacsystem->checkAccess( 'write', $this->gui->ref_id ) )
123  {
124  $this->ilias->raiseError(
125  $lng->txt( 'msg_no_perm_write' ), $this->ilias->error_obj->MESSAGE
126  );
127  }
128 
129  $tpl_form = new ilTemplate(
130  "tpl.chatroom_smiley_confirm_delete.html", true, true, "Modules/Chatroom"
131  );
132 
133  $tpl_form->setVariable(
134  "TXT_CONFIRM_DELETE_SMILEY", $lng->txt( 'chatroom_confirm_delete_smiley' )
135  );
136  $tpl_form->setVariable( "TXT_CONFIRM_DELETE", $lng->txt( 'confirm' ) );
137  $tpl_form->setVariable( "TXT_CANCEL_DELETE", $lng->txt( 'cancel' ) );
138  $tpl_form->setVariable( "SMILEY_ID", $_REQUEST["smiley_id"] );
139 
140  include_once 'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
141 
142  $smiley = ilChatroomSmilies::_getSmiley( $_REQUEST["smiley_id"] );
143 
144  $tpl_form->setVariable( "SMILEY_PATH", $smiley["smiley_fullpath"] );
145  $tpl_form->setVariable( "SMILEY_KEYWORDS", $smiley["smiley_keywords"] );
146 
147  $table_nav = $_REQUEST["_table_nav"] ? "&_table_nav=" . $_REQUEST["_table_nav"] : "";
148 
149  $tpl_form->setVariable(
150  "FORMACTION", $ilCtrl->getFormAction( $this->gui ) . $table_nav
151  );
152 
153  $tpl_form->parseCurrentBlock();
154  $tpl->setContent( $tpl_form->get() );
155  }
global $ilCtrl
Definition: ilias.php:18
special template class to simplify handling of ITX/PEAR
redirection script todo: (a better solution should control the processing via a xml file) ...
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $lng
Definition: privfeed.php:40
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']
Definition: index.php:7
+ Here is the call graph for this function:

◆ showEditSmileyEntryFormObject()

ilChatroomSmileyTask::showEditSmileyEntryFormObject ( )

Shows EditSmileyEntryForm.

Prepares EditSmileyEntryForm and displays it.

ilRbacSystem $rbacsystem ilTemplate $tpl

Definition at line 72 of file class.ilChatroomSmileyTask.php.

References $_REQUEST, $lng, $tpl, ilChatroomSmilies\_getSmiley(), and initSmiliesEditForm().

73  {
74  global $rbacsystem, $tpl, $lng;
75 
76  $this->gui->switchToVisibleMode();
77 
78  if( !$rbacsystem->checkAccess( 'read', $this->gui->ref_id ) )
79  {
80  $this->ilias->raiseError(
81  $lng->txt( 'msg_no_perm_read' ), $this->ilias->error_obj->MESSAGE
82  );
83  }
84 
85  include_once "Modules/Chatroom/classes/class.ilChatroomSmilies.php";
86 
87  $smiley = ilChatroomSmilies::_getSmiley( $_REQUEST["smiley_id"] );
88 
89  $form_data = array(
90  "chatroom_smiley_id" => $smiley["smiley_id"],
91  "chatroom_smiley_keywords" => $smiley["smiley_keywords"],
92  "chatroom_current_smiley_image_path" => $smiley["smiley_fullpath"],
93  );
94 
95  $form = $this->initSmiliesEditForm($form_data);
96 
97  $tpl_form = new ilTemplate(
98  "tpl.chatroom_edit_smilies.html", true, true, "Modules/Chatroom"
99  );
100 
101  $tpl_form->setVariable( "SMILEY_FORM", $form->getHTML() );
102 
103  $tpl->setContent( $tpl_form->get() );
104  }
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) ...
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $lng
Definition: privfeed.php:40
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']
Definition: index.php:7
+ Here is the call graph for this function:

◆ updateSmiliesObject()

ilChatroomSmileyTask::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 234 of file class.ilChatroomSmileyTask.php.

References $_REQUEST, $data, $ilCtrl, $lng, $tpl, ilChatroomSmilies\_getSmiliesBasePath(), ilChatroomSmilies\_prepareKeywords(), ilChatroomSmilies\_updateSmiley(), ilUtil\sendFailure(), ilUtil\stripSlashes(), and view().

235  {
236  global $rbacsystem, $ilCtrl, $tpl, $lng;
237 
238  if( !$rbacsystem->checkAccess( 'write', $this->gui->ref_id ) )
239  {
240  $this->ilias->raiseError(
241  $lng->txt( 'msg_no_perm_write' ), $this->ilias->error_obj->MESSAGE
242  );
243  }
244 
245  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
246  $this->form_gui = new ilPropertyFormGUI();
247 
248  // $this->initSmiliesEditForm();
249 
250  include_once "Modules/Chatroom/classes/class.ilChatroomSmilies.php";
251 
253  ilUtil::stripSlashes( $_REQUEST["chatroom_smiley_keywords"] )
254  );
255 
256  $keywordscheck = count( $keywords ) > 0;
257 
258  if( !$this->form_gui->checkInput() || !$keywordscheck )
259  {
260  $tpl->setContent( $this->form_gui->getHtml() );
261  ilUtil::sendFailure('test', true);
262  return $this->view();
263  }
264  else
265  {
266  $data = array();
267  $data["smiley_keywords"] = join( "\n", $keywords );
268  $data["smiley_id"] = $_REQUEST["smiley_id"];
269 
270  if( $_FILES["chatroom_image_path"] )
271  {
272  move_uploaded_file(
273  $_FILES["chatroom_image_path"]["tmp_name"],
275  $_FILES["chatroom_image_path"]["name"]
276  );
277 
278  $data["smiley_path"] = $_FILES["chatroom_image_path"]["name"];
279  }
280 
282  }
283 
284  $ilCtrl->redirect( $this->gui, "smiley" );
285  }
This class represents a property form user interface.
view()
Switches GUI to visible mode and calls editSmiliesObject method which prepares and displays the table...
global $ilCtrl
Definition: ilias.php:18
static _updateSmiley($data)
Updates smiley in DB by keyword and id from given array ($data["smiley_keywords"], $data["smiley_id"])
redirection script todo: (a better solution should control the processing via a xml file) ...
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
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.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
global $lng
Definition: privfeed.php:40
static _prepareKeywords($words)
Trims given keywords and returns them in one array.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ uploadSmileyObject()

ilChatroomSmileyTask::uploadSmileyObject ( )

Uploads and stores a new smiley with keywords from $_REQUEST["chatroom_smiley_keywords"].

ilRbacSystem $rbacsystem ilCtrl2 $ilCtrl

Definition at line 507 of file class.ilChatroomSmileyTask.php.

References $_REQUEST, $ilCtrl, $lng, $tpl, ilChatroomSmilies\_getSmiliesBasePath(), ilChatroomSmilies\_prepareKeywords(), ilChatroomSmilies\_storeSmiley(), initSmiliesForm(), ilUtil\stripSlashes(), and view().

508  {
509  global $rbacsystem, $ilCtrl, $tpl, $lng;
510 
511  if( !$rbacsystem->checkAccess( 'write', $this->gui->ref_id ) )
512  {
513  $this->ilias->raiseError(
514  $lng->txt( 'msg_no_perm_write' ), $this->ilias->error_obj->MESSAGE
515  );
516  }
517 
518  $this->initSmiliesForm();
519 
520  include_once "Modules/Chatroom/classes/class.ilChatroomSmilies.php";
521  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
522 
523  //$this->form_gui = new ilPropertyFormGUI();
524 
525  $this->form_gui->setValuesByPost();
526 
528  ilUtil::stripSlashes( $_REQUEST["chatroom_smiley_keywords"] )
529  );
530 
531  $keywordscheck = count( $keywords ) > 0;
532 
533  if( !$this->form_gui->checkInput() )
534  {
535  $tpl->setContent( $this->form_gui->getHtml() );
536  return $this->view();
537  }
538 
539  $pathinfo = pathinfo( $_FILES["chatroom_image_path"]["name"] );
540  $target_file = md5( time() + $pathinfo['basename'] ) . "." . $pathinfo['extension'];
541 
542  move_uploaded_file(
543  $_FILES["chatroom_image_path"]["tmp_name"],
545  );
546 
547  ilChatroomSmilies::_storeSmiley( join( "\n", $keywords ), $target_file );
548 
549  $ilCtrl->redirect( $this->gui, "smiley" );
550  }
view()
Switches GUI to visible mode and calls editSmiliesObject method which prepares and displays the table...
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
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.
global $lng
Definition: privfeed.php:40
static _prepareKeywords($words)
Trims given keywords and returns them in one array.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ view()

ilChatroomSmileyTask::view ( )

Switches GUI to visible mode and calls editSmiliesObject method which prepares and displays the table of existing smilies.

Definition at line 51 of file class.ilChatroomSmileyTask.php.

References ilChatroom\checkUserPermissions(), and editSmiliesObject().

Referenced by executeDefault(), updateSmiliesObject(), and uploadSmileyObject().

52  {
53  include_once 'Modules/Chatroom/classes/class.ilChatroom.php';
54 
55  ilChatroom::checkUserPermissions( 'read', $this->gui->ref_id );
56 
57  $this->gui->switchToVisibleMode();
58 
59  self::_checkSetup();
60 
61  $this->editSmiliesObject();
62  }
editSmiliesObject()
Shows existing smilies table.
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $gui

ilChatroomSmileyTask::$gui
private

Definition at line 19 of file class.ilChatroomSmileyTask.php.

Referenced by __construct().


The documentation for this class was generated from the following file: