[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZWorkflowGroup class 4 // 5 // Created on: <16-Apr-2002 11:08:14 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 /*! 30 \class eZWorkflowGroup ezworkflowgroup.php 31 \brief Handles grouping of workflows 32 33 */ 34 35 include_once ( "kernel/classes/ezpersistentobject.php" ); 36 37 class eZWorkflowGroup extends eZPersistentObject 38 { 39 function eZWorkflowGroup( $row ) 40 { 41 $this->eZPersistentObject( $row ); 42 } 43 44 function definition() 45 { 46 return array( "fields" => array( "id" => array( 'name' => 'ID', 47 'datatype' => 'integer', 48 'default' => 0, 49 'required' => true ), 50 "name" => array( 'name' => "Name", 51 'datatype' => 'string', 52 'default' => '', 53 'required' => true ), 54 "creator_id" => array( 'name' => "CreatorID", 55 'datatype' => 'integer', 56 'default' => 0, 57 'required' => true, 58 'foreign_class' => 'eZUser', 59 'foreign_attribute' => 'contentobject_id', 60 'multiplicity' => '1..*' ), 61 "modifier_id" => array( 'name' => "ModifierID", 62 'datatype' => 'integer', 63 'default' => 0, 64 'required' => true, 65 'foreign_class' => 'eZUser', 66 'foreign_attribute' => 'contentobject_id', 67 'multiplicity' => '1..*' ), 68 "created" => array( 'name' => "Created", 69 'datatype' => 'integer', 70 'default' => 0, 71 'required' => true ), 72 "modified" => array( 'name' => "Modified", 73 'datatype' => 'integer', 74 'default' => 0, 75 'required' => true ) ), 76 "keys" => array( "id" ), 77 'function_attributes' => array( 'creator' => 'creator', 78 'modifier' => 'modifier' ), 79 "increment_key" => "id", 80 "class_name" => "eZWorkflowGroup", 81 "sort" => array( "name" => "asc" ), 82 "name" => "ezworkflow_group" ); 83 } 84 85 function create( $user_id ) 86 { 87 $date_time = time(); 88 $row = array( 89 "id" => null, 90 "name" => "", 91 "creator_id" => $user_id, 92 "modifier_id" => $user_id, 93 "created" => $date_time, 94 "modified" => $date_time ); 95 return new eZWorkflowGroup( $row ); 96 } 97 98 function fetch( $id, $asObject = true ) 99 { 100 return eZPersistentObject::fetchObject( eZWorkflowGroup::definition(), 101 null, 102 array( "id" => $id ), 103 $asObject ); 104 } 105 106 function fetchList( $asObject = true ) 107 { 108 return eZPersistentObject::fetchObjectList( eZWorkflowGroup::definition(), 109 null, null, null, null, 110 $asObject ); 111 } 112 113 /*! 114 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 115 the calls within a db transaction; thus within db->begin and db->commit. 116 */ 117 function removeSelected ( $id ) 118 { 119 eZPersistentObject::removeObject( eZWorkflowGroup::definition(), 120 array( "id" => $id ) ); 121 } 122 123 /* function &fetchWorkflowList( $asObject = true, $id = false ) 124 { 125 if ( $id === false ) 126 $id = $this->attribute( "id" ); 127 $db =& eZDB::instance(); 128 if ( $asObject ) 129 { 130 $def = eZWorkflowGroup::definition(); 131 $fields =& $def['fields']; 132 $select_sql = ''; 133 $i = 0; 134 foreach( $fields as $field => $variable ) 135 { 136 if ( $i > 0 ) 137 $select_sql .= ', '; 138 $select_sql .= 'ezworkflow.' . $field . ' AS ' . $field; 139 ++$i; 140 } 141 } 142 else 143 $select_sql = "ezworkflow_group_link.workflow_id AS workflow_id"; 144 $query = "SELECT $select_sql 145 FROM ezworkflow_group_link, 146 ezworkflow 147 WHERE ezworkflow_group_link.workflow_id=ezworkflow.id AND 148 ezworkflow.is_enabled='1' AND 149 ezworkflow_group_link.group_id='$id' 150 ORDER BY ezworkflow.name ASC"; 151 $rows = $db->arrayQuery( $query ); 152 $workflows = array(); 153 if ( $asObject ) 154 { 155 foreach( $rows as $row ) 156 $workflows[] = new eZWorkflowGroup( $row ); 157 } 158 else 159 { 160 foreach( $rows as $row ) 161 $workflows[] = $row['workflow_id']; 162 } 163 return $workflows; 164 }*/ 165 166 function &creator() 167 { 168 if ( isset( $this->CreatorID ) and $this->CreatorID ) 169 { 170 include_once ( "kernel/classes/datatypes/ezuser/ezuser.php" ); 171 $user = eZUser::fetch( $this->CreatorID ); 172 } 173 else 174 $user = null; 175 return $user; 176 } 177 178 function &modifier() 179 { 180 if ( isset( $this->ModifierID ) and $this->ModifierID ) 181 { 182 include_once ( "kernel/classes/datatypes/ezuser/ezuser.php" ); 183 $user = eZUser::fetch( $this->ModifierID ); 184 } 185 else 186 $user = null; 187 return $user; 188 } 189 190 /// \privatesection 191 var $ID; 192 var $Name; 193 var $CreatorID; 194 var $ModifierID; 195 var $Created; 196 var $Modified; 197 } 198 199 ?>
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 |