|
eZ Publish
[4.0]
|
00001 <?php 00002 // 00003 // Definition of eZGeneralDigestUserSettings class 00004 // 00005 // Created on: <16-May-2003 13:06:24 sp> 00006 // 00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00008 // SOFTWARE NAME: eZ Publish 00009 // SOFTWARE RELEASE: 4.0.x 00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS 00011 // SOFTWARE LICENSE: GNU General Public License v2.0 00012 // NOTICE: > 00013 // This program is free software; you can redistribute it and/or 00014 // modify it under the terms of version 2.0 of the GNU General 00015 // Public License as published by the Free Software Foundation. 00016 // 00017 // This program is distributed in the hope that it will be useful, 00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 // GNU General Public License for more details. 00021 // 00022 // You should have received a copy of version 2.0 of the GNU General 00023 // Public License along with this program; if not, write to the Free 00024 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00025 // MA 02110-1301, USA. 00026 // 00027 // 00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00029 // 00030 00031 /*! \file ezgeneraldigestusersettings.php 00032 */ 00033 00034 /*! 00035 \class eZGeneralDigestUserSettings ezgeneraldigestusersettings.php 00036 \brief The class eZGeneralDigestUserSettings does 00037 00038 */ 00039 00040 //include_once( 'kernel/classes/ezpersistentobject.php' ); 00041 00042 class eZGeneralDigestUserSettings extends eZPersistentObject 00043 { 00044 const TYPE_NONE = 0; 00045 const TYPE_WEEKLY = 1; 00046 const TYPE_MONTHLY = 2; 00047 const TYPE_DAILY = 3; 00048 00049 /*! 00050 Constructor 00051 */ 00052 function eZGeneralDigestUserSettings( $row ) 00053 { 00054 $this->eZPersistentObject( $row ); 00055 } 00056 00057 static function definition() 00058 { 00059 return array( "fields" => array( "id" => array( 'name' => 'ID', 00060 'datatype' => 'integer', 00061 'default' => 0, 00062 'required' => true ), 00063 "address" => array( 'name' => "Address", 00064 'datatype' => 'string', 00065 'default' => '', 00066 'required' => true ), 00067 "receive_digest" => array( 'name' => "ReceiveDigest", 00068 'datatype' => 'integer', 00069 'default' => 0, 00070 'required' => true ), 00071 "digest_type" => array( 'name' => "DigestType", 00072 'datatype' => 'integer', 00073 'default' => 0, 00074 'required' => true ), 00075 "day" => array( 'name' => "Day", 00076 'datatype' => 'string', 00077 'default' => '', 00078 'required' => true ), 00079 "time" => array( 'name' => "Time", 00080 'datatype' => 'string', 00081 'default' => '', 00082 'required' => true ) ), 00083 "keys" => array( "id" ), 00084 "increment_key" => "id", 00085 "sort" => array( "id" => "asc" ), 00086 "class_name" => "eZGeneralDigestUserSettings", 00087 "name" => "ezgeneral_digest_user_settings" ); 00088 } 00089 00090 00091 static function create( $address, $receiveDigest = 0, $digestType = self::TYPE_NONE, $day = '', $time = '' ) 00092 { 00093 return new eZGeneralDigestUserSettings( array( 'address' => $address, 00094 'receive_digest' => $receiveDigest, 00095 'digest_type' => $digestType, 00096 'day' => $day, 00097 'time' => $time ) ); 00098 } 00099 00100 static function fetchForUser( $address, $asObject = true ) 00101 { 00102 return eZPersistentObject::fetchObject( eZGeneralDigestUserSettings::definition(), 00103 null, 00104 array( 'address' => $address ), 00105 $asObject ); 00106 } 00107 00108 /*! 00109 \static 00110 Removes all general digest settings for all users. 00111 */ 00112 static function cleanup() 00113 { 00114 $db = eZDB::instance(); 00115 $db->query( "DELETE FROM ezgeneral_digest_user_settings" ); 00116 } 00117 } 00118 00119 ?>