[ 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: box_bookmarks.php,v 1.5 2005/10/03 10:48:38 eldy Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/boxes/box_bookmarks.php,v $ 20 */ 21 22 /** 23 \file htdocs/includes/boxes/box_bookmarks.php 24 \ingroup bookmark 25 \brief Module de génération de l'affichage de la box bookmark 26 */ 27 28 29 include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); 30 31 32 class box_bookmarks extends ModeleBoxes { 33 34 var $boxcode="bookmarks"; 35 var $boximg="object_bookmark"; 36 var $boxlabel; 37 var $depends = array(); 38 39 var $info_box_head = array(); 40 var $info_box_contents = array(); 41 42 /** 43 * \brief Constructeur de la classe 44 */ 45 function box_bookmarks() 46 { 47 global $langs; 48 $langs->load("boxes"); 49 50 $this->boxlabel=$langs->trans("BoxMyLastBookmarks"); 51 } 52 53 /** 54 * \brief Charge les données en mémoire pour affichage ultérieur 55 * \param $max Nombre maximum d'enregistrements à charger 56 */ 57 function loadBox($max=5) 58 { 59 global $user, $langs, $db; 60 $langs->load("boxes"); 61 62 $this->info_box_head = array('text' => $langs->trans("BoxMyLastBookmarks",$max), 63 'sublink' => DOL_URL_ROOT.'/bookmarks/liste.php'); 64 if ($user->rights->bookmark->creer) 65 { 66 $this->info_box_head['subpicto']='object_bookmark'; 67 $this->info_box_head['subtext']=$langs->trans("BookmarksManagement"); 68 } 69 else 70 { 71 $this->info_box_head['subpicto']='object_bookmark'; 72 $this->info_box_head['subtext']=$langs->trans("ListOfBookmark"); 73 } 74 75 if ($user->rights->bookmark->lire) 76 { 77 $sql = "SELECT b.title, b.url, b.target, b.favicon"; 78 $sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b"; 79 $sql.= " WHERE fk_user = ".$user->id; 80 $sql .= " ORDER BY b.dateb DESC "; 81 $sql .= $db->plimit($max, 0); 82 83 $result = $db->query($sql); 84 85 if ($result) 86 { 87 $num = $db->num_rows($result); 88 89 $i = 0; 90 91 while ($i < $num) 92 { 93 $objp = $db->fetch_object($result); 94 95 $this->info_box_contents[$i][0] = array('align' => 'left', 96 'logo' => $this->boximg, 97 'text' => stripslashes($objp->title), 98 'url' => $objp->url, 99 'target' => $objp->target?'newtab':''); 100 101 $i++; 102 } 103 104 $i=$num; 105 while ($i < $max) 106 { 107 if ($num==0 && $i==$num) 108 { 109 $this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoRecordedBookmarks",DOL_URL_ROOT.'/bookmarks/liste.php')); 110 $this->info_box_contents[$i][1] = array('text'=>' '); 111 } else { 112 $this->info_box_contents[$i][0] = array('text'=>' '); 113 $this->info_box_contents[$i][1] = array('text'=>' '); 114 } 115 $i++; 116 } 117 118 } 119 else 120 { 121 dolibarr_print_error($db); 122 } 123 } 124 else { 125 $this->info_box_contents[0][0] = array('align' => 'left', 126 'text' => $langs->trans("ReadPermissionNotAllowed")); 127 } 128 } 129 130 function showBox() 131 { 132 parent::showBox($this->info_box_head, $this->info_box_contents); 133 } 134 135 } 136 137 ?>
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 |
![]() |