25 require
'../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/bookmarks/class/bookmark.class.php';
29 $langs->loadLangs(array(
'bookmarks',
'admin'));
32 $action =
GETPOST(
'action',
'aZ09');
33 $massaction =
GETPOST(
'massaction',
'alpha');
34 $show_files =
GETPOST(
'show_files',
'int');
35 $confirm =
GETPOST(
'confirm',
'alpha');
36 $toselect =
GETPOST(
'toselect',
'array');
37 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'bookmarklist';
39 $optioncss =
GETPOST(
'optioncss',
'alpha');
42 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
43 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
44 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
46 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
50 $offset = $limit * $page;
51 $pageprev = $page - 1;
52 $pagenext = $page + 1;
54 $sortfield =
'b.position';
67 $permissiontoread = !empty($user->rights->bookmark->lire);
68 $permissiontoadd = !empty($user->rights->bookmark->creer);
69 $permissiontodelete = !empty($user->rights->bookmark->supprimer);
76 if (
GETPOST(
'cancel',
'alpha')) {
80 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
84 if ($action ==
'delete') {
85 $res = $object->remove($id);
87 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
102 $title = $langs->trans(
"Bookmarks");
106 $sql =
"SELECT b.rowid, b.dateb, b.fk_user, b.url, b.target, b.title, b.favicon, b.position,";
107 $sql .=
" u.login, u.lastname, u.firstname";
111 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bookmark as b LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON b.fk_user=u.rowid";
112 $sql .=
" WHERE 1=1";
113 $sql .=
" AND b.entity IN (".getEntity(
'bookmark').
")";
115 $sql .=
" AND (b.fk_user = ".((int) $user->id).
" OR b.fk_user is NULL OR b.fk_user = 0)";
120 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
122 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
123 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
124 $resql = $db->query($sqlforcount);
126 $objforcount = $db->fetch_object(
$resql);
140 $sql .= $db->order($sortfield.
", position", $sortorder);
142 $sql .= $db->plimit($limit + 1, $offset);
145 $resql = $db->query($sql);
151 $num = $db->num_rows(
$resql);
154 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
155 $param .=
'&contextpage='.urlencode($contextpage);
157 if ($limit > 0 && $limit != $conf->liste_limit) {
158 $param .=
'&limit='.urlencode($limit);
160 if ($optioncss !=
'') {
161 $param .=
'&optioncss='.urlencode($optioncss);
167 $arrayofmassactions = array(
173 if (!empty($permissiontodelete)) {
174 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
176 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
177 $arrayofmassactions = array();
179 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
181 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
182 if ($optioncss !=
'') {
183 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
185 print
'<input type="hidden" name="token" value="'.newToken().
'">';
186 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
187 print
'<input type="hidden" name="action" value="list">';
188 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
189 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
190 print
'<input type="hidden" name="page" value="'.$page.
'">';
191 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
192 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
195 $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));
197 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'bookmark', 0, $newcardbutton,
'', $limit, 0, 0, 1);
199 print
'<div class="div-table-responsive">';
200 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
202 print
'<tr class="liste_titre">';
207 print_liste_field_titre(
"Target", $_SERVER[
"PHP_SELF"],
"b.target",
"", $param,
'', $sortfield, $sortorder,
'center ');
208 print_liste_field_titre(
"Visibility", $_SERVER[
"PHP_SELF"],
"u.lastname",
"", $param,
'', $sortfield, $sortorder,
'center ');
209 print_liste_field_titre(
"DateCreation", $_SERVER[
"PHP_SELF"],
"b.dateb",
"", $param,
'', $sortfield, $sortorder,
'center ');
210 print_liste_field_titre(
"Position", $_SERVER[
"PHP_SELF"],
"b.position",
"", $param,
'', $sortfield, $sortorder,
'right ');
214 $cacheOfUsers = array();
217 while ($i < min($num, $limit)) {
218 $obj = $db->fetch_object(
$resql);
220 $object->id = $obj->rowid;
221 $object->ref = $obj->rowid;
223 print
'<tr class="oddeven">';
226 print
'<td class="nowraponall">';
227 print $object->getNomUrl(1);
231 if (preg_match(
'/^http/i', $obj->url)) {
234 $title = $obj->title;
236 $canedit = $user->rights->bookmark->supprimer;
237 $candelete = $user->rights->bookmark->creer;
240 print
'<td class="tdoverflowmax200" alt="'.dol_escape_htmltag($title).
'">';
245 print
'<td class="tdoverflowmax200">';
246 if (empty($linkintern)) {
247 print
img_picto(
'',
'url',
'class="pictofixedwidth"');
248 print
'<a class="" href="'.$obj->url.
'"'.($obj->target ?
' target="newlink" rel="noopener"' :
'').
'>';
251 print
'<a class="" href="'.$obj->url.
'">';
258 print
'<td class="center">';
259 if ($obj->target == 0) {
260 print $langs->trans(
"BookmarkTargetReplaceWindowShort");
262 if ($obj->target == 1) {
263 print $langs->trans(
"BookmarkTargetNewWindowShort");
268 print
'<td class="center">';
270 if (empty($cacheOfUsers[$obj->fk_user])) {
271 $tmpuser =
new User($db);
272 $tmpuser->fetch($obj->fk_user);
273 $cacheOfUsers[$obj->fk_user] = $tmpuser;
275 $tmpuser = $cacheOfUsers[$obj->fk_user];
276 print $tmpuser->getNomUrl(1);
278 print
'<span class="opacitymedium">'.$langs->trans(
"Everybody").
'</span>';
287 print
'<td class="center" title="'.dol_escape_htmltag(
dol_print_date($db->jdate($obj->dateb),
'dayhour')).
'">'.
dol_print_date($db->jdate($obj->dateb),
'day').
"</td>";
290 print
'<td class="right">'.$obj->position.
"</td>";
293 print
'<td class="nowraponall right">';
295 print
'<a class="editfielda marginleftonly" href="'.DOL_URL_ROOT.
'/bookmarks/card.php?action=edit&token='.
newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"]).
'">'.
img_edit().
"</a>";
298 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.$obj->rowid.
'">'.
img_delete().
'</a>';
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bookmarks.
Class to manage Dolibarr users.
if(isModEnabled('facture') &&!empty($user->rights->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') &&!empty($user->rights->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)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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 from a POST of a form.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
$nbtotalofrecords
Count total nb of records.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.