Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezwaituntildate.php
Go to the documentation of this file.
1 <?php
16 class eZWaitUntilDate
17 {
22 public function __construct( $eventID, $eventVersion )
23 {
24 $this->WorkflowEventID = $eventID;
25 $this->WorkflowEventVersion = $eventVersion;
26 $this->Entries = eZWaitUntilDateValue::fetchAllElements( $eventID, $eventVersion );
27 }
28
29 function attributes()
30 {
31 return array( 'workflow_event_id',
32 'workflow_event_version',
33 'entry_list',
34 'classattribute_id_list' );
35 }
36
37 function hasAttribute( $attr )
38 {
39 return in_array( $attr, $this->attributes() );
40 }
41
42 function attribute( $attr )
43 {
44 switch ( $attr )
45 {
46 case "workflow_event_id" :
47 {
48 return $this->WorkflowEventID;
49 }break;
50 case "workflow_event_version" :
51 {
52 return $this->WorkflowEventVersion;
53 }break;
54 case "entry_list" :
55 {
56 return $this->Entries;
57 }break;
58 case 'classattribute_id_list' :
59 {
60 return $this->classAttributeIDList();
61 }
62 default :
63 {
64 eZDebug::writeError( "Attribute '$attr' does not exist", __METHOD__ );
65 return null;
66 }break;
67 }
68 }
69 static function removeWaitUntilDateEntries( $workflowEventID, $workflowEventVersion )
70 {
71 eZWaitUntilDateValue::removeAllElements( $workflowEventID, $workflowEventVersion );
72 }
76 function addEntry( $contentClassAttributeID, $contentClassID = false )
77 {
78 if ( !isset( $contentClassAttributeID ) )
79 {
80 return;
81 }
82 if ( !$contentClassID )
83 {
84 $contentClassAttribute = eZContentClassAttribute::fetch( $contentClassAttributeID );
85 $contentClassID = $contentClassAttribute->attribute( 'contentclass_id' );
86 }
87 // Checking if $contentClassAttributeID and $contentClassID already exist (in Entries)
88 foreach ( $this->Entries as $entrie )
89 {
90 if ( $entrie->attribute( 'contentclass_attribute_id' ) == $contentClassAttributeID and
91 $entrie->attribute( 'contentclass_id' ) == $contentClassID )
92 return;
93 }
94 $waitUntilDateValue = eZWaitUntilDateValue::create( $this->WorkflowEventID, $this->WorkflowEventVersion, $contentClassAttributeID, $contentClassID );
95 $waitUntilDateValue->store();
96 $this->Entries = eZWaitUntilDateValue::fetchAllElements( $this->WorkflowEventID, $this->WorkflowEventVersion );
97 }
98
99 function removeEntry( $workflowEventID, $id, $version )
100 {
101 eZWaitUntilDateValue::removeByID( $id, $version );
102 $this->Entries = eZWaitUntilDateValue::fetchAllElements( $workflowEventID, $version );
103 }
104
105 function classAttributeIDList()
106 {
107 $attributeIDList = array();
108 foreach ( $this->Entries as $entry )
109 {
110 $attributeIDList[] = $entry->attribute( 'contentclass_attribute_id' );
111 }
112 return $attributeIDList;
113 }
114
115 function setVersion( $version )
116 {
117 if ( $version == 1 && count( $this->Entries ) == 0 )
118 {
119 $this->Entries = eZWaitUntilDateValue::fetchAllElements( $this->WorkflowEventID, 0 );
120 foreach( $this->Entries as $entry )
121 {
122 $entry->setAttribute( "workflow_event_version", 1 );
123 $entry->store();
124 }
125 }
126 if ( $version == 0 )
127 {
128 eZWaitUntilDateValue::removeAllElements( $this->WorkflowEventID, 0 );
129 foreach( $this->Entries as $entry )
130 {
131 $oldversion = $entry->attribute( "workflow_event_version" );
132 $id = $entry->attribute( "id" );
133 $workflowEventID = $entry->attribute( "workflow_event_id" );
134 $contentClassID = $entry->attribute( "contentclass_id" );
135 $contentClassAttributeID = $entry->attribute( "contentclass_attribute_id" );
136 $entryCopy = eZWaitUntilDateValue::createCopy( $id,
137 $workflowEventID,
138 0,
139 $contentClassID,
140 $contentClassAttributeID );
141
142 $entryCopy->store();
143 }
144 }
145 }
146
147
148 public $WorkflowEventID;
149 public $WorkflowEventVersion;
150 public $Entries;
151
152 }
153
154
155 ?>
eZContentClassAttribute\fetch
static fetch( $id, $asObject=true, $version=eZContentClass::VERSION_STATUS_DEFINED, $field_filters=null)
Definition: ezcontentclassattribute.php:380
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:545
eZWaitUntilDateValue\fetchAllElements
static fetchAllElements( $workflowEventID, $version, $asObject=true)
Definition: ezwaituntildatevalue.php:148
eZWaitUntilDateValue\removeAllElements
static removeAllElements( $workflowEventID, $version)
Definition: ezwaituntildatevalue.php:125
eZWaitUntilDateValue\removeByID
static removeByID( $id, $version)
Definition: ezwaituntildatevalue.php:132
eZWaitUntilDateValue\create
static create( $workflowEventID, $workflowEventVersion, $contentClassAttributeID, $contentClassID)
Definition: ezwaituntildatevalue.php:103
eZWaitUntilDateValue\createCopy
static createCopy( $id, $workflowEventID, $workflowEventVersion, $contentClassID, $contentClassAttributeID)
Definition: ezwaituntildatevalue.php:114
eZWaitUntilDate
The class eZWaitUntilDate does.
Definition: ezwaituntildate.php:17
eZWaitUntilDate\hasAttribute
hasAttribute( $attr)
Definition: ezwaituntildate.php:37
eZWaitUntilDate\$WorkflowEventID
$WorkflowEventID
Definition: ezwaituntildate.php:148
eZWaitUntilDate\$WorkflowEventVersion
$WorkflowEventVersion
Definition: ezwaituntildate.php:149
eZWaitUntilDate\$Entries
$Entries
Definition: ezwaituntildate.php:150
eZWaitUntilDate\removeEntry
removeEntry( $workflowEventID, $id, $version)
Definition: ezwaituntildate.php:99
eZWaitUntilDate\removeWaitUntilDateEntries
static removeWaitUntilDateEntries( $workflowEventID, $workflowEventVersion)
Definition: ezwaituntildate.php:69
eZWaitUntilDate\classAttributeIDList
classAttributeIDList()
Definition: ezwaituntildate.php:105
eZWaitUntilDate\attribute
attribute( $attr)
Definition: ezwaituntildate.php:42
eZWaitUntilDate\addEntry
addEntry( $contentClassAttributeID, $contentClassID=false)
Definition: ezwaituntildate.php:76
eZWaitUntilDate\__construct
__construct( $eventID, $eventVersion)
Definition: ezwaituntildate.php:22
eZWaitUntilDate\setVersion
setVersion( $version)
Definition: ezwaituntildate.php:115
eZWaitUntilDate\attributes
attributes()
Definition: ezwaituntildate.php:29
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.