ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilChatroomSmilies Class Reference

Class ilChatroomSmilies. More...

+ Collaboration diagram for ilChatroomSmilies:

Static Public Member Functions

static _checkSetup ()
 Checks if smiley folder is available; if not it will try to create folder and performs actions for an initial smiley set. More...
 
static _getSmileyDir ()
 Path to smilies. More...
 
static _deleteMultipleSmilies ($ids=array())
 Deletes multiple smilies by given id array. More...
 
static getSmiliesBasePath ()
 Returns smilies basepath. More...
 
static _prepareKeywords ($words)
 Trims given keywords and returns them in one array. More...
 

Detailed Description

Class ilChatroomSmilies.

Author
Jan Posselt jposs.nosp@m.elt@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Version
$Id$

Definition at line 10 of file class.ilChatroomSmilies.php.

Member Function Documentation

◆ _checkSetup()

static ilChatroomSmilies::_checkSetup ( )
static

Checks if smiley folder is available; if not it will try to create folder and performs actions for an initial smiley set.

Returns
boolean

Definition at line 61 of file class.ilChatroomSmilies.php.

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

Referenced by ilChatroomAdminSmileyGUI\editSmiliesObject().

62  {
63  global $lng;
64 
65  $path = self::_getSmileyDir();
66 
67  if (!is_dir($path)) {
68  ilUtil::sendInfo($lng->txt('chatroom_smilies_dir_not_exists'));
70 
71  if (!is_dir($path)) {
72  ilUtil::sendFailure($lng->txt('chatroom_smilies_dir_not_available'));
73  return false;
74  } else {
75  $smilies = array(
76  "icon_smile.gif",
77  "icon_wink.gif",
78  "icon_laugh.gif",
79  "icon_sad.gif",
80  "icon_shocked.gif",
81  "icon_tongue.gif",
82  "icon_cool.gif",
83  "icon_eek.gif",
84  "icon_angry.gif",
85  "icon_flush.gif",
86  "icon_idea.gif",
87  "icon_thumbup.gif",
88  "icon_thumbdown.gif",
89  );
90 
91  foreach ($smilies as $smiley) {
92  copy("templates/default/images/emoticons/$smiley", $path . "/$smiley");
93  }
94 
95  self::_insertDefaultValues();
96  ilUtil::sendSuccess($lng->txt('chatroom_smilies_initialized'));
97  }
98  }
99 
100  if (!is_writable($path)) {
101  ilUtil::sendInfo($lng->txt('chatroom_smilies_dir_not_writable'));
102  }
103 
104  return true;
105  }
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.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _deleteMultipleSmilies()

static ilChatroomSmilies::_deleteMultipleSmilies (   $ids = array())
static

Deletes multiple smilies by given id array.

ilDBInterface $ilDB

Parameters
array$ids

Definition at line 147 of file class.ilChatroomSmilies.php.

References $data, $id, $ilDB, $res, $result, $row, $s, array, and ilUtil\getWebspaceDir().

Referenced by ilChatroomAdminSmileyGUI\deleteSmileyObject().

148  {
149  global $ilDB;
150 
151  $smilies = self::_getSmiliesById($ids);
152 
153  if (count($smilies) <= 0) {
154  return;
155  }
156 
157  $sql_parts = array();
158 
159  foreach ($smilies as $s) {
160  unlink($s["smiley_fullpath"]);
161  $sql_parts[] = "smiley_id = " . $ilDB->quote($s["smiley_id"], 'integer');
162  }
163 
164  $ilDB->manipulate("DELETE FROM chatroom_smilies WHERE " . implode(" OR ", $sql_parts));
165  }
$s
Definition: pwgen.php:45
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getSmileyDir()

static ilChatroomSmilies::_getSmileyDir ( )
static

Path to smilies.

Returns
string

Definition at line 111 of file class.ilChatroomSmilies.php.

References $ilDB, $res, $result, $row, array, and ilUtil\getWebspaceDir().

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

◆ _prepareKeywords()

static ilChatroomSmilies::_prepareKeywords (   $words)
static

Trims given keywords and returns them in one array.

Parameters
string$words
Returns
array

Definition at line 351 of file class.ilChatroomSmilies.php.

References array.

Referenced by ilChatroomAdminSmileyGUI\deleteSmileyObject().

352  {
353  $keywordscheck = true;
354 
355  // check keywords
356  $keywords_unchecked = explode("\n", $words);
357  if (count($keywords_unchecked) <= 0) {
358  $keywordscheck = false;
359  }
360 
361  if ($keywordscheck) {
362  $keywords = array();
363 
364  foreach ($keywords_unchecked as $word) {
365  if (trim($word)) {
366  $keywords[] = trim($word);
367  }
368  }
369  }
370 
371  if ($keywordscheck && count($keywords) <= 0) {
372  $keywordscheck = false;
373  }
374 
375  if ($keywordscheck) {
376  return $keywords;
377  } else {
378  return array();
379  }
380  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getSmiliesBasePath()

static ilChatroomSmilies::getSmiliesBasePath ( )
static

Returns smilies basepath.

Returns
string

Definition at line 283 of file class.ilChatroomSmilies.php.

References $ilDB, $path, $row, array, and ilUtil\getWebspaceDir().

Referenced by ilChatroomAdminSmileyGUI\deleteSmileyObject().

284  {
285  return 'chatroom/smilies';
286  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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