24 require
'../main.inc.php';
25 require_once DOL_DOCUMENT_ROOT.
'/bookmarks/class/bookmark.class.php';
28 $langs->loadLangs(array(
'bookmarks',
'admin'));
30 $action =
GETPOST(
'action',
'aZ09');
31 $massaction =
GETPOST(
'massaction',
'alpha');
32 $show_files =
GETPOST(
'show_files',
'int');
33 $confirm =
GETPOST(
'confirm',
'alpha');
34 $toselect =
GETPOST(
'toselect',
'array');
35 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'bookmarklist';
38 if (!$user->rights->bookmark->lire) {
41 $optioncss =
GETPOST(
'optioncss',
'alpha');
44 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
45 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
46 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
48 if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) { $page = 0; }
49 $offset = $limit * $page;
50 $pageprev = $page - 1;
51 $pagenext = $page + 1;
52 if (!$sortfield) $sortfield =
'position';
53 if (!$sortorder) $sortorder =
'ASC';
59 $permissiontoread = $user->rights->bookmark->lire;
60 $permissiontoadd = $user->rights->bookmark->write;
61 $permissiontodelete = $user->rights->bookmark->delete;
68 if ($action ==
'delete')
70 $res = $object->remove($id);
73 header(
"Location: ".
$_SERVER[
"PHP_SELF"]);
85 $userstatic =
new User($db);
87 $title = $langs->trans(
"ListOfBookmarks");
91 $sql =
"SELECT b.rowid, b.dateb, b.fk_user, b.url, b.target, b.title, b.favicon, b.position,";
92 $sql .=
" u.login, u.lastname, u.firstname";
93 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bookmark as b LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON b.fk_user=u.rowid";
95 $sql .=
" AND b.entity IN (".getEntity(
'bookmark').
")";
96 if (!$user->admin) $sql .=
" AND (b.fk_user = ".$user->id.
" OR b.fk_user is NULL OR b.fk_user = 0)";
98 $sql .= $db->order($sortfield.
", position", $sortorder);
101 $nbtotalofrecords =
'';
102 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
104 $resql = $db->query($sql);
105 $nbtotalofrecords = $db->num_rows(
$resql);
106 if (($page * $limit) > $nbtotalofrecords)
113 if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
115 $num = $nbtotalofrecords;
117 $sql .= $db->plimit($limit + 1, $offset);
119 $resql = $db->query($sql);
126 $num = $db->num_rows(
$resql);
130 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.urlencode($contextpage);
131 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.urlencode($limit);
132 if ($optioncss !=
'') $param =
'&optioncss='.urlencode($optioncss);
137 $arrayofmassactions = array(
143 if ($permissiontodelete) $arrayofmassactions[
'predelete'] =
'<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans(
"Delete");
144 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) $arrayofmassactions = array();
145 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
147 print '<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
148 if ($optioncss !=
'')
print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
149 print '<input type="hidden" name="token" value="'.newToken().
'">';
150 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
151 print '<input type="hidden" name="action" value="list">';
152 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
153 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
154 print '<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
157 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/bookmarks/card.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.
'/bookmarks/list.php'),
'', !empty($user->rights->bookmark->creer));
159 print_barre_liste($title, $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bookmark', 0, $newcardbutton,
'', $limit, 0, 0, 1);
161 print '<div class="div-table-responsive">';
162 print '<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
164 print "<tr class=\"liste_titre\">";
176 $cacheOfUsers = array();
179 while ($i < min($num, $limit))
181 $obj = $db->fetch_object(
$resql);
183 $object->id = $obj->rowid;
184 $object->ref = $obj->rowid;
186 print
'<tr class="oddeven">';
189 print
'<td class="left">';
190 print $object->getNomUrl(1);
194 $title = $obj->title;
200 if ($linkintern) print
'<a href="'.$obj->url.
'">';
202 if ($linkintern) print
"</a>";
206 print
'<td class="tdoverflowmax200">';
207 if (!$linkintern) print
'<a href="'.$obj->url.
'"'.($obj->target ?
' target="newlink" rel="noopener"' :
'').
'>';
209 if (!$linkintern) print
'</a>';
213 print
'<td class="center">';
214 if ($obj->target == 0) print $langs->trans(
"BookmarkTargetReplaceWindowShort");
215 if ($obj->target == 1) print $langs->trans(
"BookmarkTargetNewWindowShort");
219 print
'<td class="center">';
222 if (empty($cacheOfUsers[$obj->fk_user])) {
223 $tmpuser =
new User($db);
224 $tmpuser->fetch($obj->fk_user);
225 $cacheOfUsers[$obj->fk_user] = $tmpuser;
227 $tmpuser = $cacheOfUsers[$obj->fk_user];
228 print $tmpuser->getNomUrl(1);
230 print $langs->trans(
"Public");
235 print
'<td class="center">'.dol_print_date($db->jdate($obj->dateb),
'day').
"</td>";
238 print
'<td class="right">'.$obj->position.
"</td>";
241 print
'<td class="nowrap right">';
242 if ($user->rights->bookmark->creer)
244 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/bookmarks/card.php?action=edit&token='.
newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode(
$_SERVER[
"PHP_SELF"]).
'">'.
img_edit().
"</a>";
246 if ($user->rights->bookmark->supprimer)
248 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.$obj->rowid.
'">'.
img_delete().
'</a>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
dolGetButtonTitle($label, $helpText= '', $iconClass= 'fa fa-file', $url= '', $id= '', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
Class to manage Dolibarr users.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
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...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
img_delete($titlealt= 'default', $other= 'class="pictodelete"', $morecss= '')
Show delete logo.
Class to manage bookmarks.