[ Index ] |
|
Code source de CMS made simple 1.0.5 |
1 <?php 2 #CMS - CMS Made Simple 3 #(c)2004 by Ted Kulp (tedkulp@users.sf.net) 4 #This project's homepage is: http://cmsmadesimple.org 5 # 6 #This program is free software; you can redistribute it and/or modify 7 #it under the terms of the GNU General Public License as published by 8 #the Free Software Foundation; either version 2 of the License, or 9 #(at your option) any later version. 10 # 11 #This program is distributed in the hope that it will be useful, 12 #BUT withOUT ANY WARRANTY; without even the implied warranty of 13 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 #GNU General Public License for more details. 15 #You should have received a copy of the GNU General Public License 16 #along with this program; if not, write to the Free Software 17 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 # 19 #$Id: class.bookmark.inc.php 3352 2006-08-21 18:07:51Z wishy $ 20 21 /** 22 * Bookmark class for admin 23 * 24 * @package CMS 25 */ 26 class Bookmark 27 { 28 /** 29 * Bookmark ID 30 */ 31 var $bookmark_id; 32 33 /** 34 * User(owner) ID 35 */ 36 var $user_id; 37 38 /** 39 * Title 40 */ 41 var $title; 42 43 /** 44 * Url 45 */ 46 var $url; 47 48 /** 49 * Generic constructor. Runs the SetInitialValues fuction. 50 */ 51 function Bookmark() 52 { 53 $this->SetInitialValues(); 54 } 55 56 /** 57 * Sets object to some sane initial values 58 * 59 */ 60 function SetInitialValues() 61 { 62 $this->bookmark_id = -1; 63 $this->title = ''; 64 $this->url = ''; 65 $this->user_id = -1; 66 } 67 68 69 /** 70 * Saves the bookmark to the database. If no id is set, then a new record 71 * is created. If the id is set, then the record is updated to all values 72 * in the Bookmark object. 73 * 74 * @returns mixed If successful, true. If it fails, false. 75 */ 76 function Save() 77 { 78 $result = false; 79 global $gCms; 80 $bookops =& $gCms->GetBookmarkOperations(); 81 82 if ($this->bookmark_id > -1) 83 { 84 $result = $bookops->UpdateBookmark($this); 85 } 86 else 87 { 88 $newid = $bookops->InsertBookmark($this); 89 if ($newid > -1) 90 { 91 $this->bookmark_id = $newid; 92 $result = true; 93 } 94 95 } 96 97 return $result; 98 } 99 100 /** 101 * Delete the record for this Bookmark from the database and resets 102 * all values to their initial values. 103 * 104 * @returns mixed If successful, true. If it fails, false. 105 */ 106 function Delete() 107 { 108 $result = false; 109 global $gCms; 110 $bookops =& $gCms->GetBookmarkOperations(); 111 112 if ($this->bookmark_id > -1) 113 { 114 $result = $bookops->DeleteBookmarkByID($this->bookmark_id); 115 if ($result) 116 { 117 $this->SetInitialValues(); 118 } 119 } 120 121 return $result; 122 } 123 } 124 125 # vim:ts=4 sw=4 noet 126 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Tue Apr 3 18:50:37 2007 | par Balluche grâce à PHPXref 0.7 |