[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZCollaborationItemGroupLink class 4 // 5 // Created on: <22-Jan-2003 15:51:09 amos> 6 // 7 // SOFTWARE NAME: eZ publish 8 // SOFTWARE RELEASE: 3.9.0 9 // BUILD VERSION: 17785 10 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 11 // SOFTWARE LICENSE: GNU General Public License v2.0 12 // NOTICE: > 13 // This program is free software; you can redistribute it and/or 14 // modify it under the terms of version 2.0 of the GNU General 15 // Public License as published by the Free Software Foundation. 16 // 17 // This program is distributed in the hope that it will be useful, 18 // but WITHOUT ANY WARRANTY; without even the implied warranty of 19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 // GNU General Public License for more details. 21 // 22 // You should have received a copy of version 2.0 of the GNU General 23 // Public License along with this program; if not, write to the Free 24 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 25 // MA 02110-1301, USA. 26 // 27 // 28 29 /*! \file ezcollaborationitemgrouplink.php 30 */ 31 32 /*! 33 \class eZCollaborationItemGroupLink ezcollaborationitemgrouplink.php 34 \brief The class eZCollaborationItemGroupLink does 35 36 */ 37 38 include_once ( 'kernel/classes/ezpersistentobject.php' ); 39 include_once ( 'kernel/classes/datatypes/ezuser/ezuser.php' ); 40 include_once ( 'lib/ezlocale/classes/ezdatetime.php' ); 41 42 class eZCollaborationItemGroupLink extends eZPersistentObject 43 { 44 /*! 45 Constructor 46 */ 47 function eZCollaborationItemGroupLink( $row ) 48 { 49 $this->eZPersistentObject( $row ); 50 } 51 52 function definition() 53 { 54 return array( 'fields' => array( 'collaboration_id' => array( 'name' => 'CollaborationID', 55 'datatype' => 'integer', 56 'default' => 0, 57 'required' => true, 58 'foreign_class' => 'eZCollaborationItem', 59 'foreign_attribute' => 'id', 60 'multiplicity' => '1..*' ), 61 'group_id' => array( 'name' => 'GroupID', 62 'datatype' => 'integer', 63 'default' => 0, 64 'required' => true, 65 'foreign_class' => 'eZCollaborationGroup', 66 'foreign_attribute' => 'id', 67 'multiplicity' => '1..*' ), 68 'user_id' => array( 'name' => 'UserID', 69 'datatype' => 'integer', 70 'default' => 0, 71 'required' => true, 72 'foreign_class' => 'eZUser', 73 'foreign_attribute' => 'contentobject_id', 74 'multiplicity' => '1..*' ), 75 'is_read' => array( 'name' => 'IsRead', 76 'datatype' => 'integer', 77 'default' => 0, 78 'required' => true ), 79 'is_active' => array( 'name' => 'IsActive', 80 'datatype' => 'integer', 81 'default' => 1, 82 'required' => true ), 83 'last_read' => array( 'name' => 'LastRead', 84 'datatype' => 'integer', 85 'default' => 0, 86 'required' => true ), 87 'created' => array( 'name' => 'Created', 88 'datatype' => 'integer', 89 'default' => 0, 90 'required' => true ), 91 'modified' => array( 'name' => 'Modified', 92 'datatype' => 'integer', 93 'default' => 0, 94 'required' => true ) ), 95 'keys' => array( 'collaboration_id', 'group_id', 'user_id' ), 96 'function_attributes' => array( 'user' => 'user', 97 'collaboration_item' => 'collaborationItem', 98 'collaboration_group' => 'collaborationGroup' ), 99 'class_name' => 'eZCollaborationItemGroupLink', 100 'sort' => array( 'modified' => 'asc' ), 101 'name' => 'ezcollab_item_group_link' ); 102 } 103 104 function create( $collaborationID, $groupID, $userID ) 105 { 106 $date_time = time(); 107 $row = array( 108 'collaboration_id' => $collaborationID, 109 'group_id' => $groupID, 110 'is_read' => false, 111 'is_active' => true, 112 'last_read' => 0, 113 'user_id' => $userID, 114 'created' => $date_time, 115 'modified' => $date_time ); 116 return new eZCollaborationItemGroupLink( $row ); 117 } 118 119 function addItem( $groupID, $collaborationID, $userID ) 120 { 121 $groupLink = eZCollaborationItemGroupLink::create( $collaborationID, $groupID, $userID ); 122 123 $db =& eZDB::instance(); 124 $db->begin(); 125 $groupLink->store(); 126 $itemStatus = eZCollaborationItemStatus::create( $collaborationID, $userID ); 127 $itemStatus->store(); 128 $db->commit(); 129 130 return $groupLink; 131 } 132 133 function fetch( $collaborationID, $groupID, $userID = false, $asObject = true ) 134 { 135 if ( $userID == false ) 136 $userID == eZUser::currentUserID(); 137 return eZPersistentObject::fetchObject( eZCollaborationItemGroupLink::definition(), 138 null, 139 array( 'collaboration_id' => $collaborationID, 140 'group_id' => $groupID, 141 'user_id' => $userID ), 142 $asObject ); 143 } 144 145 function fetchList( $collaborationID, $userID = false, $asObject = true ) 146 { 147 if ( $userID == false ) 148 $userID == eZUser::currentUserID(); 149 return eZPersistentObject::fetchObjectList( eZCollaborationItemGroupLink::definition(), 150 null, 151 array( 'collaboration_id' => $collaborationID, 152 'user_id' => $userID ), 153 null, null, 154 $asObject ); 155 } 156 157 function &user() 158 { 159 if ( isset( $this->UserID ) and $this->UserID ) 160 { 161 include_once ( 'kernel/classes/datatypes/ezuser/ezuser.php' ); 162 $user = eZUser::fetch( $this->UserID ); 163 } 164 else 165 $user = null; 166 return $user; 167 } 168 169 function &collaborationItem() 170 { 171 if ( isset( $this->CollaborationID ) and $this->CollaborationID ) 172 { 173 include_once ( 'kernel/classes/ezcollaborationitem.php' ); 174 $item = eZCollaborationItem::fetch( $this->CollaborationID, $this->UserID ); 175 } 176 else 177 $item = null; 178 return $item; 179 } 180 181 function &collaborationGroup() 182 { 183 if ( isset( $this->GroupID ) and $this->GroupID ) 184 { 185 include_once ( 'kernel/classes/ezcollaborationitem.php' ); 186 $group = eZCollaborationGroup::fetch( $this->GroupID, $this->UserID ); 187 } 188 else 189 $group = null; 190 return $group; 191 } 192 193 194 /// \privatesection 195 var $CollaborationID; 196 var $GroupID; 197 var $UserID; 198 var $Created; 199 var $Modified; 200 } 201 202 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |