[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 * $Id: liste.php,v 1.6 2005/09/17 14:18:40 eldy Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/bookmarks/liste.php,v $ 20 */ 21 22 /** 23 \file htdocs/bookmarks/liste.php 24 \brief Page affichage des bookmarks 25 \ingroup bookmark 26 \version $Revision: 1.6 $ 27 */ 28 29 require ("./pre.inc.php"); 30 require_once(DOL_DOCUMENT_ROOT."/bookmarks/bookmark.class.php"); 31 32 33 $page=$_GET["page"]; 34 $sortorder=$_GET["sortorder"]; 35 $sortfield=$_GET["sortfield"]; 36 if (! $sortorder) $sortorder="DESC"; 37 if (! $sortfield) $sortfield="bid"; 38 39 if ($page == -1) { $page = 0 ; } 40 $limit = 26; 41 $offset = $limit * $page ; 42 $pageprev = $page - 1; 43 $pagenext = $page + 1; 44 45 46 /* 47 * Actions 48 */ 49 50 if ($_GET["action"] == 'delete') 51 { 52 $bookmark=new Bookmark($db); 53 $res=$bookmark->remove($_GET["bid"]); 54 if ($res > 0) 55 { 56 header("Location: ".$_SERVER["PHP_SELF"]); 57 } 58 else 59 { 60 $mesg='<div class="error">'.$bookmark->error.'</div>'; 61 } 62 } 63 64 65 /* 66 * Affichage liste 67 */ 68 69 llxHeader(); 70 71 print_fiche_titre($langs->trans("Bookmarks")); 72 73 if ($mesg) print $mesg; 74 75 $sql = "SELECT b.fk_soc as idp, ".$db->pdate("b.dateb")." as dateb, b.rowid as bid, b.fk_user, b.url, b.target, b.title, b.favicon,"; 76 $sql.= " u.name, u.firstname, u.code"; 77 $sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b, ".MAIN_DB_PREFIX."user as u"; 78 $sql.= " WHERE b.fk_user=u.rowid"; 79 if (! $user->admin) $sql.= " AND (b.fk_user = ".$user->id." OR b.fk_user is NULL)"; 80 $sql.= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset); 81 82 $resql=$db->query($sql); 83 if ($resql) 84 { 85 $num = $db->num_rows($resql); 86 $i = 0; 87 88 print "<table class=\"noborder\" width=\"100%\">"; 89 90 print "<tr class=\"liste_titre\">"; 91 //print "<td> </td>"; 92 print_liste_field_titre($langs->trans("Id"),$_SERVER["PHP_SELF"],"bid","","",'align="left"',$sortfield); 93 print '<td>'.$langs->trans("Title")."</td>"; 94 print '<td>'.$langs->trans("Link")."</td>"; 95 print '<td align="center">'.$langs->trans("Target")."</td>"; 96 print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"],"u.name","","",'align="center"',$sortfield); 97 print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"b.dateb","","",'align="center"',$sortfield); 98 print "<td> </td>"; 99 print "</tr>\n"; 100 101 $var=True; 102 while ($i < $num) 103 { 104 $obj = $db->fetch_object($resql); 105 106 $var=!$var; 107 print "<tr $bc[$var]>"; 108 109 // Id 110 print '<td align="left">'; 111 print "<a href=\"fiche.php?id=".$obj->bid."\">".img_object($langs->trans("ShowBookmark"),"bookmark").' '.$obj->bid."</a>"; 112 print '</td>'; 113 114 $lieninterne=0; 115 $title=dolibarr_trunc($obj->title,24); 116 $lien=dolibarr_trunc($obj->url,24); 117 118 // Title 119 print "<td>"; 120 if ($obj->idp) 121 { 122 // Lien interne societe 123 $lieninterne=1; 124 $lien="Dolibarr"; 125 if (! $obj->title) 126 { 127 // Pour compatibilite avec anciens bookmarks 128 require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); 129 $societe=new Societe($db); 130 $societe->fetch($obj->idp); 131 $obj->title=$societe->nom; 132 } 133 $title=img_object($langs->trans("ShowCompany"),"company").' '.$obj->title; 134 } 135 if ($lieninterne) print "<a href=\"".$obj->url."\">"; 136 print $title; 137 if ($lieninterne) print "</a>"; 138 print "</td>\n"; 139 140 // Url 141 print "<td>"; 142 if (! $lieninterne) print '<a href="'.$obj->url.'"'.($obj->target?' target="newlink"':'').'>'; 143 print $lien; 144 if (! $lieninterne) print '</a>'; 145 print "</td>\n"; 146 147 // Target 148 print '<td align="center">'; 149 if ($obj->target == 0) print $langs->trans("BookmarkTargetReplaceWindowShort"); 150 if ($obj->target == 1) print $langs->trans("BookmarkTargetNewWindowShort"); 151 print "</td>\n"; 152 153 // Auteur 154 print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->fk_user.'">'.img_object($langs->trans("ShowUser"),"user").' '.$obj->code."</a></td>\n"; 155 156 // Date creation 157 print '<td align="center">'.dolibarr_print_date($obj->dateb) ."</td>"; 158 159 // Actions 160 print "<td>"; 161 if ($user->rights->bookmark->supprimer) 162 { 163 print "<a href=\"".$_SERVER["PHP_SELF"]."?action=delete&bid=$obj->bid\">".img_delete()."</a>"; 164 } 165 else 166 { 167 print " "; 168 } 169 print "</td>"; 170 print "</tr>\n"; 171 $i++; 172 } 173 print "</table>"; 174 $db->free($resql); 175 } 176 else 177 { 178 dolibarr_print_error($db); 179 } 180 181 182 183 print "<div class=\"tabsAction\">\n"; 184 185 if ($user->rights->bookmark->creer) 186 { 187 print '<a class="butAction" href="fiche.php?action=create">'.$langs->trans("NewBookmark").'</a>'; 188 } 189 190 print '</div>'; 191 192 193 $db->close(); 194 195 llxFooter('$Date: 2005/09/17 14:18:40 $ - $Revision: 1.6 $'); 196 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |