ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSocialBookmarks Class Reference
+ Collaboration diagram for ilSocialBookmarks:

Static Public Member Functions

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

Detailed Description

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

Member Function Documentation

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.

References $ilDB, $q, and _deleteImage().

Referenced by ilObjExternalToolsSettingsGUI\confirmDeleteSocialBookmarksObject().

{
global $ilDB;
if (!is_array($id))
{
$q = 'DELETE FORM bookmark_social_bm WHERE sbm_id=%s';
$ilDB->manipulateF
(
$q,
array('integer'),
array($id)
);
}
else if (count($id))
{
$q = 'DELETE FROM bookmark_social_bm WHERE ';
$parts = array();
foreach($id as $i)
{
$parts[] = 'sbm_id=' . $ilDB->quote($i, 'integer');
}
$q .= ' ' . join(' OR ', $parts);
$ilDB->manipulateF
(
$q,
array('integer'),
array($active)
);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 $ilDB, $q, and $row.

Referenced by _delete(), and ilObjExternalToolsSettingsGUI\updateSocialBookmarkObject().

{
global $ilDB;
$q = 'SELECT sbm_icon FROM bookmark_social_bm WHERE sbm_id=%s';
$rset = $ilDB->queryF
(
$q,
array('integer'),
array($id)
);
$row = $ilDB->fetchObject($rset);
//$path = ilUtil::getWebspaceDir() . DIRECTORY_SEPARATOR . 'social_bm_icons' . DIRECTORY_SEPARATOR . $row->sbm_icon;
if ($row->sbm_icon && is_file($row->sbm_icon) && substr($row->sbm_icon, 0, strlen('templates')) != 'templates')
unlink($row->sbm_icon);
}

+ Here is the caller graph for this function:

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

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

References $ilDB, $q, $result, and $row.

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

{
global $ilDB;
if ($id)
{
$q = 'SELECT sbm_id, sbm_title, sbm_link, sbm_icon, sbm_active FROM bookmark_social_bm WHERE sbm_id=%s';
$rset = $ilDB->queryF
(
$q,
array('integer'),
array($id)
);
return $ilDB->fetchObject($rset);
}
else
{
$q = 'SELECT sbm_id, sbm_title, sbm_link, sbm_icon, sbm_active FROM bookmark_social_bm';
$rset = $ilDB->query($q);
$result = array();
while($row = $ilDB->fetchObject($rset))
{
}
return $result;
}
}

+ Here is the caller graph for this function:

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().

{
global $lng, $ilCtrl;
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$form = new ilPropertyFormGUI();
$form->setMultipart(true);
// File Title
$in_title = new ilTextInputGUI($lng->txt("title"), "title");
$in_title->setMaxLength(128);
$in_title->setSize(40);
$in_title->setRequired(true);
$form->addItem($in_title);
// Link
$in_link = new ilTextInputGUI($lng->txt("link"), "link");
$in_link->setMaxLength(300);
$in_link->setSize(40);
$in_link->setRequired(true);
$in_link->setInfo($lng->txt('socialbm_link_description'));
$form->addItem($in_link);
// File
$in_file = new ilFileInputGUI($lng->txt("file"), "image_file");
$in_file->setSuffixes(array('bmp', 'gif', 'jpg', 'jpeg','png'));
$form->addItem($in_file);
// Activate on submit
$in_activate = new ilCheckboxInputGUI($lng->txt("activate"), "activate");
$in_activate->setValue('1');
$form->addItem($in_activate);
// save and cancel commands
if ($mode == "create")
{
$form->addCommandButton("createSocialBookmark", $lng->txt("create"));
$form->addCommandButton("editSocialBookmarks", $lng->txt("cancel"));
$form->setTitle($lng->txt("social_bm_create"));
$in_file->setRequired(true);
}
else if ($mode == "update")
{
$in_hidden = new ilHiddenInputGUI("sbm_id", $id);
$form->addItem($in_hidden);
$form->addCommandButton("updateSocialBookmark", $lng->txt("update"));
$form->addCommandButton("cancel", $lng->txt("cancel"));
$form->setTitle($lng->txt("social_bm_edit"));
$in_file->setRequired(false);
}
$form->setTableWidth("60%");
$form->setFormAction($ilCtrl->getFormAction($formhandlerObject));
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

References $ilDB, $q, and $title.

Referenced by ilObjExternalToolsSettingsGUI\createSocialBookmarkObject().

{
global $ilDB;
$id = $ilDB->nextId('bookmark_social_bm');
$q = 'INSERT INTO bookmark_social_bm (sbm_id, sbm_title, sbm_link, sbm_icon, sbm_active) VALUES (%s, %s, %s, %s, %s)';
$ilDB->manipulateF
(
$q,
array('integer', 'text', 'text', 'text', 'integer'),
array($id, $title, $link, $icon_path, $active)
);
}

+ Here is the caller graph for this function:

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.

References $ilDB, and $q.

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

{
global $ilDB;
if (!is_array($id))
{
$q = 'UPDATE bookmark_social_bm SET sbm_active=%s WHERE sbm_id=%s';
$ilDB->manipulateF
(
$q,
array('integer', 'integer'),
array($active, $id)
);
}
else if (count($id))
{
$q = 'UPDATE bookmark_social_bm SET sbm_active=%s WHERE ';
$parts = array();
foreach($id as $i)
{
$parts[] = 'sbm_id=' . $ilDB->quote($i, 'integer');
}
$q .= ' ' . join(' OR ', $parts);
$ilDB->manipulateF
(
$q,
array('integer'),
array($active)
);
}
}

+ Here is the caller graph for this function:

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.

References $ilDB, $q, and $title.

Referenced by ilObjExternalToolsSettingsGUI\updateSocialBookmarkObject().

{
global $ilDB;
if ($icon_path)
{
$q = 'UPDATE bookmark_social_bm SET sbm_title=%s, sbm_link=%s, sbm_icon=%s, sbm_active=%s WHERE sbm_id=%s';
$ilDB->manipulateF
(
$q,
array('text', 'text', 'text', 'integer', 'integer'),
array($title, $link, $icon_path, $active, $id)
);
}
else
{
$q = 'UPDATE bookmark_social_bm SET sbm_title=%s, sbm_link=%s, sbm_active=%s WHERE sbm_id=%s';
$ilDB->manipulateF
(
$q,
array('text', 'text', 'integer', 'integer'),
array($title, $link, $active, $id)
);
}
}

+ Here is the caller graph for this function:


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