34 public $element =
'bookmark';
39 public $table_element =
'bookmark';
45 public $ismultientitymanaged = 1;
50 public $picto =
'bookmark';
123 $sql =
"SELECT rowid, fk_user, dateb as datec, url, target,";
124 $sql .=
" title, position, favicon";
125 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bookmark";
126 $sql .=
" WHERE rowid = ".((int) $id);
127 $sql .=
" AND entity = ".$conf->entity;
130 $resql = $this->db->query(
$sql);
132 $obj = $this->db->fetch_object($resql);
134 $this->
id = $obj->rowid;
135 $this->
ref = $obj->rowid;
137 $this->fk_user = $obj->fk_user;
138 $this->datec = $this->db->jdate($obj->datec);
139 $this->url = $obj->url;
140 $this->target = $obj->target;
141 $this->title = $obj->title;
143 $this->favicon = $obj->favicon;
145 $this->db->free($resql);
163 $this->url = trim($this->url);
164 $this->title = trim($this->title);
173 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"bookmark (fk_user,dateb,url,target";
174 $sql .=
",title,favicon,position";
176 $sql .=
") VALUES (";
177 $sql .= ($this->fk_user > 0 ? $this->fk_user :
"0").
",";
178 $sql .=
" '".$this->db->idate($now).
"',";
179 $sql .=
" '".$this->db->escape($this->url).
"', '".$this->db->escape($this->target).
"',";
180 $sql .=
" '".$this->db->escape($this->title).
"', '".$this->db->escape($this->favicon).
"', ".(int) $this->
position;
181 $sql .=
", ".(int) $conf->entity;
185 $resql = $this->db->query(
$sql);
187 $id = $this->db->last_insert_id(MAIN_DB_PREFIX.
"bookmark");
193 $this->error = $this->db->lasterror();
194 $this->errno = $this->db->lasterrno();
195 $this->db->rollback();
199 $this->error = $this->db->lasterror();
200 $this->errno = $this->db->lasterrno();
201 $this->db->rollback();
214 $this->url = trim($this->url);
215 $this->title = trim($this->title);
220 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"bookmark";
221 $sql .=
" SET fk_user = ".($this->fk_user > 0 ? $this->fk_user :
"0");
222 $sql .=
" ,dateb = '".$this->db->idate($this->datec).
"'";
223 $sql .=
" ,url = '".$this->db->escape($this->url).
"'";
224 $sql .=
" ,target = '".$this->db->escape($this->target).
"'";
225 $sql .=
" ,title = '".$this->db->escape($this->title).
"'";
226 $sql .=
" ,favicon = '".$this->db->escape($this->favicon).
"'";
228 $sql .=
" WHERE rowid = ".((int) $this->
id);
231 if ($this->db->query(
$sql)) {
234 $this->error = $this->db->lasterror();
245 public function delete($user)
247 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"bookmark";
248 $sql .=
" WHERE rowid = ".((int) $this->
id);
250 $resql = $this->db->query(
$sql);
254 $this->error = $this->db->lasterror();
297 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
299 global $conf, $langs, $hookmanager;
301 if (!empty($conf->dol_no_mouse_hover)) {
307 $label =
'<u>'.$langs->trans(
"Bookmark").
'</u>';
309 $label .=
'<b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
311 $url = DOL_URL_ROOT.
'/bookmarks/card.php?id='.$this->id;
313 if ($option !=
'nolink') {
315 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
316 if ($save_lastsearch_value == -1 && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
317 $add_save_lastsearch_values = 1;
319 if ($add_save_lastsearch_values) {
320 $url .=
'&save_lastsearch_values=1';
325 if (empty($notooltip)) {
326 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
327 $label = $langs->trans(
"ShowBookmark");
328 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
330 $linkclose .=
' title="'.dol_escape_htmltag($label, 1).
'"';
331 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
333 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
336 $linkstart =
'<a href="'.$url.
'"';
337 $linkstart .= $linkclose.
'>';
340 $result .= $linkstart;
342 $result .=
img_object(($notooltip ?
'' : $label), ($this->picto ? $this->picto :
'generic'), ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') :
'class="'.(($withpicto != 2) ?
'paddingright ' :
'').
'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
344 if ($withpicto != 2) {
345 $result .= $this->ref;
350 global $action, $hookmanager;
351 $hookmanager->initHooks(array(
'mybookmarkdao'));
352 $parameters = array(
'id'=>$this->
id,
'getnomurl' => &$result);
353 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
355 $result = $hookmanager->resPrint;
357 $result .= $hookmanager->resPrint;
Class to manage bookmarks.
create()
Insert bookmark into database.
static replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
Function used to replace a thirdparty id with another one.
update()
Update bookmark record.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionaly the picto)
fetch($id)
Directs the bookmark.
__construct($db)
Constructor.
getLibStatut($mode)
Return the label of the status.
Parent class of all other business classes (invoices, contracts, proposals, orders,...
static commonReplaceThirdparty(DoliDB $dbs, $origin_id, $dest_id, array $tables, $ignoreerrors=0)
Function used to replace a thirdparty id with another one.
Class to manage Dolibarr database access.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_now($mode='auto')
Return date for now.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.