21 public static function _initForm($formhandlerObject, $mode =
"create", $id = 0)
24 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
26 $form->setMultipart(
true);
31 $in_title->setSize(40);
32 $in_title->setRequired(
true);
33 $form->addItem($in_title);
38 $in_link->setSize(40);
39 $in_link->setRequired(
true);
40 $in_link->setInfo($lng->txt(
'socialbm_link_description'));
41 $form->addItem($in_link);
45 $in_file->
setSuffixes(array(
'bmp',
'gif',
'jpg',
'jpeg',
'png'));
46 $form->addItem($in_file);
51 $form->addItem($in_activate);
54 if ($mode ==
"create")
56 $form->addCommandButton(
"createSocialBookmark", $lng->txt(
"create"));
57 $form->addCommandButton(
"editSocialBookmarks", $lng->txt(
"cancel"));
58 $form->setTitle($lng->txt(
"social_bm_create"));
59 $in_file->setRequired(
true);
61 else if ($mode ==
"update")
64 $form->addItem($in_hidden);
66 $form->addCommandButton(
"updateSocialBookmark", $lng->txt(
"update"));
67 $form->addCommandButton(
"cancel", $lng->txt(
"cancel"));
68 $form->setTitle($lng->txt(
"social_bm_edit"));
69 $in_file->setRequired(
false);
72 $form->setTableWidth(
"60%");
74 $form->setFormAction($ilCtrl->getFormAction($formhandlerObject));
90 $id = $ilDB->nextId(
'bookmark_social_bm');
92 $q =
'INSERT INTO bookmark_social_bm (sbm_id, sbm_title, sbm_link, sbm_icon, sbm_active) VALUES (%s, %s, %s, %s, %s)';
96 array(
'integer',
'text',
'text',
'text',
'integer'),
97 array($id,
$title, $link, $icon_path, $active)
117 $q =
'UPDATE bookmark_social_bm SET sbm_title=%s, sbm_link=%s, sbm_icon=%s, sbm_active=%s WHERE sbm_id=%s';
121 array(
'text',
'text',
'text',
'integer',
'integer'),
122 array(
$title, $link, $icon_path, $active, $id)
127 $q =
'UPDATE bookmark_social_bm SET sbm_title=%s, sbm_link=%s, sbm_active=%s WHERE sbm_id=%s';
131 array(
'text',
'text',
'integer',
'integer'),
132 array(
$title, $link, $active, $id)
149 $q =
'UPDATE bookmark_social_bm SET sbm_active=%s WHERE sbm_id=%s';
153 array(
'integer',
'integer'),
159 $q =
'UPDATE bookmark_social_bm SET sbm_active=%s WHERE ';
163 $parts[] =
'sbm_id=' . $ilDB->quote($i,
'integer');
165 $q .=
' ' . join(
' OR ', $parts);
189 $q =
'DELETE FORM bookmark_social_bm WHERE sbm_id=%s';
199 $q =
'DELETE FROM bookmark_social_bm WHERE ';
204 $parts[] =
'sbm_id=' . $ilDB->quote($i,
'integer');
206 $q .=
' ' . join(
' OR ', $parts);
224 $q =
'SELECT sbm_icon FROM bookmark_social_bm WHERE sbm_id=%s';
225 $rset = $ilDB->queryF
231 $row = $ilDB->fetchObject($rset);
233 if (
$row->sbm_icon && is_file(
$row->sbm_icon) && substr(
$row->sbm_icon, 0, strlen(
'templates')) !=
'templates')
234 unlink(
$row->sbm_icon);
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
250 return $ilDB->fetchObject($rset);
254 $q =
'SELECT sbm_id, sbm_title, sbm_link, sbm_icon, sbm_active FROM bookmark_social_bm';
255 $rset = $ilDB->query($q);
258 while(
$row = $ilDB->fetchObject($rset))