Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezcollaborationprofile.php
Go to the documentation of this file.
1 <?php
17 class eZCollaborationProfile extends eZPersistentObject
18 {
19 static function definition()
20 {
21 return array( 'fields' => array( 'id' => array( 'name' => 'ID',
22 'datatype' => 'integer',
23 'default' => 0,
24 'required' => true ),
25 'user_id' => array( 'name' => 'UserID',
26 'datatype' => 'integer',
27 'default' => 0,
28 'required' => true,
29 'foreign_class' => 'eZUser',
30 'foreign_attribute' => 'contentobject_id',
31 'multiplicity' => '1..*' ),
32 'main_group' => array( 'name' => 'MainGroup',
33 'datatype' => 'integer',
34 'default' => 0,
35 'required' => true,
36 'foreign_class' => 'eZCollaborationGroup',
37 'foreign_attribute' => 'id',
38 'multiplicity' => '1..*' ),
39 'data_text1' => array( 'name' => 'DataText1',
40 'datatype' => 'text',
41 'default' => '',
42 'required' => true ),
43 'created' => array( 'name' => 'Created',
44 'datatype' => 'integer',
45 'default' => 0,
46 'required' => true ),
47 'modified' => array( 'name' => 'Modified',
48 'datatype' => 'integer',
49 'default' => 0,
50 'required' => true ) ),
51 'keys' => array( 'id' ),
52 'increment_key' => 'id',
53 'class_name' => 'eZCollaborationProfile',
54 'name' => 'ezcollab_profile' );
55 }
56
57 static function create( $userID, $mainGroup = 0 )
58 {
59 $date_time = time();
60 $row = array( 'id' => null,
61 'user_id' => $userID,
62 'main_group' => $mainGroup,
63 'created' => $date_time,
64 'modified' => $date_time );
65 $newCollaborationProfile = new eZCollaborationProfile( $row );
66 return $newCollaborationProfile;
67 }
68
69 static function fetch( $id, $asObject = true )
70 {
71 $conditions = array( "id" => $id );
72 return eZPersistentObject::fetchObject( eZCollaborationProfile::definition(),
73 null,
74 $conditions,
75 $asObject );
76 }
77
78 static function fetchByUser( $userID, $asObject = true )
79 {
80 $conditions = array( "user_id" => $userID );
81 return eZPersistentObject::fetchObject( eZCollaborationProfile::definition(),
82 null,
83 $conditions,
84 $asObject );
85 }
86
96 static function instance( $userID = false )
97 {
98 if ( $userID === false )
99 {
100 $user = eZUser::currentUser();
101 $userID = $user->attribute( 'contentobject_id' );
102 }
103 $instance =& $GLOBALS["eZCollaborationProfile-$userID"];
104 if ( !isset( $instance ) )
105 {
106 $instance = eZCollaborationProfile::fetchByUser( $userID );
107 if ( $instance === null )
108 {
109 $group = eZCollaborationGroup::instantiate( $userID, ezpI18n::tr( 'kernel/classes', 'Inbox' ) );
110 $instance = eZCollaborationProfile::create( $userID, $group->attribute( 'id' ) );
111 $instance->store();
112 }
113 }
114 return $instance;
115 }
116
117 }
118
119 ?>
eZCollaborationGroup\instantiate
static instantiate( $userID, $title, $parentGroupID=0, $isOpen=true)
Definition: ezcollaborationgroup.php:97
eZCollaborationProfile
The class eZCollaborationProfile does.
Definition: ezcollaborationprofile.php:18
eZCollaborationProfile\instance
static instance( $userID=false)
Definition: ezcollaborationprofile.php:96
eZCollaborationProfile\create
static create( $userID, $mainGroup=0)
Definition: ezcollaborationprofile.php:57
eZCollaborationProfile\fetch
static fetch( $id, $asObject=true)
Definition: ezcollaborationprofile.php:69
eZCollaborationProfile\fetchByUser
static fetchByUser( $userID, $asObject=true)
Definition: ezcollaborationprofile.php:78
eZCollaborationProfile\definition
static definition()
Definition: ezcollaborationprofile.php:19
eZPersistentObject
Definition: ezpersistentobject.php:33
eZPersistentObject\fetchObject
static fetchObject( $def, $field_filters, $conds, $asObject=true, $grouping=null, $custom_fields=null)
Definition: ezpersistentobject.php:213
eZUser\currentUser
static currentUser()
Definition: ezuser.php:1716
ezpI18n\tr
static tr( $context, $source, $comment=null, $arguments=null)
Definition: ezpi18n.php:86
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.