| [ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> 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: bookmark.php,v 1.14 2005/08/15 15:44:45 eldy Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/comm/bookmark.php,v $ 20 * 21 */ 22 23 /** 24 \file htdocs/comm/bookmark.php 25 \brief Page affichage des bookmarks 26 \version $Revision: 1.14 $ 27 */ 28 29 30 require ("./pre.inc.php"); 31 32 33 llxHeader(); 34 35 $page=$_GET["page"]; 36 $sortorder=$_GET["sortorder"]; 37 $sortfield=$_GET["sortfield"]; 38 if (! $sortorder) $sortorder="DESC"; 39 if (! $sortfield) $sortfield="bid"; 40 41 if ($page == -1) { $page = 0 ; } 42 $limit = 26; 43 $offset = $limit * $page ; 44 $pageprev = $page - 1; 45 $pagenext = $page + 1; 46 47 /* 48 * Actions 49 */ 50 51 if ($_GET["action"] == 'add') 52 { 53 $bookmark=new Bookmark($db); 54 $bookmark->fk_user=$user->id; 55 $bookmark->url=$user->id; 56 $bookmark->target=$user->id; 57 $bookmark->title='xxx'; 58 $bookmark->favicon='xxx'; 59 60 $res=$bookmark->create(); 61 if ($res > 0) 62 { 63 header("Location: ".$_SERVER["PHP_SELF"]); 64 } 65 else 66 { 67 $mesg='<div class="error">'.$bookmark->error.'</div>'; 68 } 69 } 70 71 if ($_GET["action"] == 'delete') 72 { 73 $bookmark=new Bookmark($db); 74 $bookmark->id=$_GET["bid"]; 75 $bookmark->url=$user->id; 76 $bookmark->target=$user->id; 77 $bookmark->title='xxx'; 78 $bookmark->favicon='xxx'; 79 80 $res=$bookmark->remove(); 81 if ($res > 0) 82 { 83 header("Location: ".$_SERVER["PHP_SELF"]); 84 } 85 else 86 { 87 $mesg='<div class="error">'.$bookmark->error.'</div>'; 88 } 89 } 90 91 92 93 print_fiche_titre($langs->trans("Bookmarks")); 94 95 $sql = "SELECT s.idp, s.nom, ".$db->pdate("b.dateb")." as dateb, b.rowid as bid, b.fk_user, b.url, b.target, u.name, u.firstname, u.code"; 96 $sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."user as u"; 97 $sql.= " WHERE b.fk_soc = s.idp AND b.fk_user=u.rowid"; 98 if (! $user->admin) $sql.= " AND b.fk_user = ".$user->id; 99 $sql.= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset); 100 101 $resql=$db->query($sql); 102 if ($resql) 103 { 104 $num = $db->num_rows($resql); 105 $i = 0; 106 107 if ($sortorder == "DESC") $sortorder="ASC"; 108 else $sortorder="DESC"; 109 110 print "<table class=\"noborder\" width=\"100%\">"; 111 112 print "<tr class=\"liste_titre\">"; 113 //print "<td> </td>"; 114 print_liste_field_titre($langs->trans("Id"),$_SERVER["PHP_SELF"],"bid","","",'align="center"',$sortfield); 115 print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"],"u.name","","","",$sortfield); 116 print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"b.dateb","","",'align="center"',$sortfield); 117 print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","","",$sortfield); 118 print_liste_field_titre($langs->trans("Url"),$_SERVER["PHP_SELF"],"b.url","","",'',$sortfield); 119 print "<td>".$langs->trans("Target")."</td>"; 120 print "<td> </td>"; 121 print "</tr>\n"; 122 123 $var=True; 124 while ($i < $num) 125 { 126 $obj = $db->fetch_object($resql); 127 128 $var=!$var; 129 print "<tr $bc[$var]>"; 130 //print "<td>" . ($i + 1 + ($limit * $page)) . "</td>"; 131 print "<td align=\"center\"><b>".$obj->bid."</b></td>"; 132 print "<td><a href='".DOL_URL_ROOT."/user/fiche.php?id=".$obj->fk_user."'>".img_object($langs->trans("ShowUser"),"user").' '.$obj->name." ".$obj->firstname."</a></td>\n"; 133 print '<td align="center">'.dolibarr_print_date($obj->dateb) ."</td>"; 134 print "<td><a href=\"index.php?socid=$obj->idp\">".img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom."</a></td>\n"; 135 print '<td align="center">'.$obj->url."</td>"; 136 print '<td align="center">'.$obj->target."</td>"; 137 print "<td><a href=\"bookmark.php?action=delete&bid=$obj->bid\">".img_delete()."</a></td>\n"; 138 print "</tr>\n"; 139 $i++; 140 } 141 print "</table>"; 142 $db->free($resql); 143 } 144 else 145 { 146 dolibarr_print_error($db); 147 } 148 149 150 $db->close(); 151 152 llxFooter('$Date: 2005/08/15 15:44:45 $ - $Revision: 1.14 $'); 153 ?>
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 |
|