ILIAS  release_4-4 Revision
ilSocialBookmarks Class Reference
+ Collaboration diagram for ilSocialBookmarks:

Static Public Member Functions

static _initForm ($formhandlerObject, $mode="create", $id=0)
 Init Social Bookmark edit/create Form. More...
 
static _insertSocialBookmark ($title, $link, $active, $icon_path)
 insert new social bookmark service More...
 
static _updateSocialBookmark ($id, $title, $link, $active, $icon_path=false)
 update a social bookmark service More...
 
static _setActive ($id, $active=true)
 update a social bookmark service More...
 
static _delete ($id)
 update a social bookmark service More...
 
static _deleteImage ($id)
 delete image of an service More...
 
static _getEntry ($id=0)
 

Detailed Description

Definition at line 13 of file class.ilSocialBookmarks.php.

Member Function Documentation

◆ _delete()

static ilSocialBookmarks::_delete (   $id)
static

update a social bookmark service

Parameters
intthe id to edit
boolset the active status to param

Definition at line 181 of file class.ilSocialBookmarks.php.

Referenced by ilObjExternalToolsSettingsGUI\confirmDeleteSocialBookmarksObject().

182  {
183  global $ilDB;
184 
185  if (!is_array($id))
186  {
187  self::_deleteImage($id);
188 
189  $q = 'DELETE FORM bookmark_social_bm WHERE sbm_id=%s';
190  $ilDB->manipulateF
191  (
192  $q,
193  array('integer'),
194  array($id)
195  );
196  }
197  else if (count($id))
198  {
199  $q = 'DELETE FROM bookmark_social_bm WHERE ';
200  $parts = array();
201  foreach($id as $i)
202  {
203  self::_deleteImage($i);
204  $parts[] = 'sbm_id=' . $ilDB->quote($i, 'integer');
205  }
206  $q .= ' ' . join(' OR ', $parts);
207  $ilDB->manipulateF
208  (
209  $q,
210  array('integer'),
211  array($active)
212  );
213  }
214  }
+ Here is the caller graph for this function:

◆ _deleteImage()

static ilSocialBookmarks::_deleteImage (   $id)
static

delete image of an service

Parameters
intthe id to edit

Definition at line 221 of file class.ilSocialBookmarks.php.

References $row.

Referenced by ilObjExternalToolsSettingsGUI\updateSocialBookmarkObject().

222  {
223  global $ilDB;
224  $q = 'SELECT sbm_icon FROM bookmark_social_bm WHERE sbm_id=%s';
225  $rset = $ilDB->queryF
226  (
227  $q,
228  array('integer'),
229  array($id)
230  );
231  $row = $ilDB->fetchObject($rset);
232  //$path = ilUtil::getWebspaceDir() . DIRECTORY_SEPARATOR . 'social_bm_icons' . DIRECTORY_SEPARATOR . $row->sbm_icon;
233  if ($row->sbm_icon && is_file($row->sbm_icon) && substr($row->sbm_icon, 0, strlen('templates')) != 'templates')
234  unlink($row->sbm_icon);
235  }
+ Here is the caller graph for this function:

◆ _getEntry()

static ilSocialBookmarks::_getEntry (   $id = 0)
static

Definition at line 237 of file class.ilSocialBookmarks.php.

References $result, and $row.

Referenced by ilObjExternalToolsSettingsGUI\deleteSocialBookmarksObject(), ilObjExternalToolsSettingsGUI\editSocialBookmarkObject(), and ilObjExternalToolsSettingsGUI\editSocialBookmarksObject().

238  {
239  global $ilDB;
240  if ($id)
241  {
242  $q = 'SELECT sbm_id, sbm_title, sbm_link, sbm_icon, sbm_active FROM bookmark_social_bm WHERE sbm_id=%s';
243  $rset = $ilDB->queryF
244  (
245  $q,
246  array('integer'),
247  array($id)
248  );
249 
250  return $ilDB->fetchObject($rset);
251  }
252  else
253  {
254  $q = 'SELECT sbm_id, sbm_title, sbm_link, sbm_icon, sbm_active FROM bookmark_social_bm';
255  $rset = $ilDB->query($q);
256 
257  $result = array();
258  while($row = $ilDB->fetchObject($rset))
259  {
260  $result[] = $row;
261  }
262  return $result;
263  }
264  }
$result
+ Here is the caller graph for this function:

◆ _initForm()

static ilSocialBookmarks::_initForm (   $formhandlerObject,
  $mode = "create",
  $id = 0 
)
static

Init Social Bookmark edit/create Form.

Parameters
ilObjectGUI$formhandlerObjecttaken as form target
int$mode"create" / "edit"

Definition at line 21 of file class.ilSocialBookmarks.php.

References $ilCtrl, $lng, ilTextInputGUI\setMaxLength(), ilFileInputGUI\setSuffixes(), and ilCheckboxInputGUI\setValue().

Referenced by ilObjExternalToolsSettingsGUI\addSocialBookmarkObject(), ilObjExternalToolsSettingsGUI\createSocialBookmarkObject(), ilObjExternalToolsSettingsGUI\editSocialBookmarkObject(), and ilObjExternalToolsSettingsGUI\updateSocialBookmarkObject().

22  {
23  global $lng, $ilCtrl;
24  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
25  $form = new ilPropertyFormGUI();
26  $form->setMultipart(true);
27 
28  // File Title
29  $in_title = new ilTextInputGUI($lng->txt("title"), "title");
30  $in_title->setMaxLength(128);
31  $in_title->setSize(40);
32  $in_title->setRequired(true);
33  $form->addItem($in_title);
34 
35  // Link
36  $in_link = new ilTextInputGUI($lng->txt("link"), "link");
37  $in_link->setMaxLength(300);
38  $in_link->setSize(40);
39  $in_link->setRequired(true);
40  $in_link->setInfo($lng->txt('socialbm_link_description'));
41  $form->addItem($in_link);
42 
43  // File
44  $in_file = new ilFileInputGUI($lng->txt("file"), "image_file");
45  $in_file->setSuffixes(array('bmp', 'gif', 'jpg', 'jpeg','png'));
46  $form->addItem($in_file);
47 
48  // Activate on submit
49  $in_activate = new ilCheckboxInputGUI($lng->txt("activate"), "activate");
50  $in_activate->setValue('1');
51  $form->addItem($in_activate);
52 
53  // save and cancel commands
54  if ($mode == "create")
55  {
56  $form->addCommandButton("createSocialBookmark", $lng->txt("create"));
57  $form->addCommandButton("editSocialBookmarks", $lng->txt("cancel"));
58  $form->setTitle($lng->txt("adm_social_bm_create"));
59  $in_file->setRequired(true);
60  }
61  else if ($mode == "update")
62  {
63  $in_hidden = new ilHiddenInputGUI("sbm_id", $id);
64  $form->addItem($in_hidden);
65 
66  $form->addCommandButton("updateSocialBookmark", $lng->txt("update"));
67  $form->addCommandButton("cancel", $lng->txt("cancel"));
68  $form->setTitle($lng->txt("adm_social_bm_edit"));
69  $in_file->setRequired(false);
70  }
71 
72  $form->setTableWidth("60%");
73 
74  $form->setFormAction($ilCtrl->getFormAction($formhandlerObject));
75  return $form;
76  }
This class represents a property form user interface.
This class represents a file property in a property form.
This class represents a checkbox property in a property form.
global $ilCtrl
Definition: ilias.php:18
This class represents a hidden form property in a property form.
setValue($a_value)
Set Value.
This class represents a text property in a property form.
setMaxLength($a_maxlength)
Set Max Length.
global $lng
Definition: privfeed.php:40
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _insertSocialBookmark()

static ilSocialBookmarks::_insertSocialBookmark (   $title,
  $link,
  $active,
  $icon_path 
)
static

insert new social bookmark service

Parameters
stringthe title to display
stringthe link with placeholders {TITLE} and {LINK}
intactivate on insert 0/1
stringa relative path (base is <datadir>/social_bm_icons

Definition at line 86 of file class.ilSocialBookmarks.php.

Referenced by ilObjExternalToolsSettingsGUI\createSocialBookmarkObject().

87  {
88  global $ilDB;
89 
90  $id = $ilDB->nextId('bookmark_social_bm');
91 
92  $q = 'INSERT INTO bookmark_social_bm (sbm_id, sbm_title, sbm_link, sbm_icon, sbm_active) VALUES (%s, %s, %s, %s, %s)';
93  $ilDB->manipulateF
94  (
95  $q,
96  array('integer', 'text', 'text', 'text', 'integer'),
97  array($id, $title, $link, $icon_path, $active)
98  );
99 
100  }
+ Here is the caller graph for this function:

◆ _setActive()

static ilSocialBookmarks::_setActive (   $id,
  $active = true 
)
static

update a social bookmark service

Parameters
intthe id to edit
boolset the active status to param

Definition at line 143 of file class.ilSocialBookmarks.php.

Referenced by ilObjExternalToolsSettingsGUI\disableSocialBookmarksObject(), and ilObjExternalToolsSettingsGUI\enableSocialBookmarksObject().

144  {
145  global $ilDB;
146 
147  if (!is_array($id))
148  {
149  $q = 'UPDATE bookmark_social_bm SET sbm_active=%s WHERE sbm_id=%s';
150  $ilDB->manipulateF
151  (
152  $q,
153  array('integer', 'integer'),
154  array($active, $id)
155  );
156  }
157  else if (count($id))
158  {
159  $q = 'UPDATE bookmark_social_bm SET sbm_active=%s WHERE ';
160  $parts = array();
161  foreach($id as $i)
162  {
163  $parts[] = 'sbm_id=' . $ilDB->quote($i, 'integer');
164  }
165  $q .= ' ' . join(' OR ', $parts);
166  $ilDB->manipulateF
167  (
168  $q,
169  array('integer'),
170  array($active)
171  );
172  }
173  }
+ Here is the caller graph for this function:

◆ _updateSocialBookmark()

static ilSocialBookmarks::_updateSocialBookmark (   $id,
  $title,
  $link,
  $active,
  $icon_path = false 
)
static

update a social bookmark service

Parameters
intthe id to edit
stringthe title to display
stringthe link with placeholders {TITLE} and {LINK}
intactivate on insert 0/1
stringa relative path (base is <datadir>/social_bm_icons. If none is given, the icon will not be altered

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

Referenced by ilObjExternalToolsSettingsGUI\updateSocialBookmarkObject().

112  {
113  global $ilDB;
114 
115  if ($icon_path)
116  {
117  $q = 'UPDATE bookmark_social_bm SET sbm_title=%s, sbm_link=%s, sbm_icon=%s, sbm_active=%s WHERE sbm_id=%s';
118  $ilDB->manipulateF
119  (
120  $q,
121  array('text', 'text', 'text', 'integer', 'integer'),
122  array($title, $link, $icon_path, $active, $id)
123  );
124  }
125  else
126  {
127  $q = 'UPDATE bookmark_social_bm SET sbm_title=%s, sbm_link=%s, sbm_active=%s WHERE sbm_id=%s';
128  $ilDB->manipulateF
129  (
130  $q,
131  array('text', 'text', 'integer', 'integer'),
132  array($title, $link, $active, $id)
133  );
134  }
135  }
+ Here is the caller graph for this function:

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