[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/kernel/classes/workflowtypes/event/ezwaituntildate/ -> ezwaituntildate.php (source)

   1  <?php
   2  //
   3  // Definition of eZWaitUntilDate class
   4  //
   5  // Created on: <09-Jan-2003 16:20:05 sp>
   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 ezwaituntildate.php
  30  */
  31  
  32  /*!
  33    \class eZWaitUntilDate ezwaituntildate.php
  34    \brief The class eZWaitUntilDate does
  35  
  36  */
  37  include_once ( 'kernel/classes/workflowtypes/event/ezwaituntildate/ezwaituntildatevalue.php' );
  38  
  39  class eZWaitUntilDate
  40  {
  41      function eZWaitUntilDate( $eventID, $eventVersion )
  42      {
  43          $this->WorkflowEventID = $eventID;
  44          $this->WorkflowEventVersion = $eventVersion;
  45          $this->Entries =& eZWaitUntilDateValue::fetchAllElements( $eventID, $eventVersion );
  46      }
  47  
  48      function attributes()
  49      {
  50          return array( 'workflow_event_id',
  51                        'workflow_event_version',
  52                        'entry_list',
  53                        'classattribute_id_list' );
  54      }
  55  
  56      function hasAttribute( $attr )
  57      {
  58          return in_array( $attr, $this->attributes() );
  59      }
  60  
  61      function &attribute( $attr )
  62      {
  63          switch ( $attr )
  64          {
  65              case "workflow_event_id" :
  66              {
  67                  return $this->WorkflowEventID;
  68              }break;
  69              case "workflow_event_version" :
  70              {
  71                  return $this->WorkflowEventVersion;
  72              }break;
  73              case "entry_list" :
  74              {
  75                  return $this->Entries;
  76              }break;
  77              case 'classattribute_id_list' :
  78              {
  79                  return $this->classAttributeIDList();
  80              }
  81              default :
  82              {
  83                  eZDebug::writeError( "Attribute '$attr' does not exist", 'eZWaitUntilDate::attribute' );
  84                  $retValue = null;
  85                  return $retValue;
  86              }break;
  87          }
  88      }
  89      function removeWaitUntilDateEntries( $workflowEventID, $workflowEventVersion )
  90      {
  91           eZWaitUntilDateValue::removeAllElements( $workflowEventID, $workflowEventVersion );
  92      }
  93      /*!
  94       Adds an enumeration
  95      */
  96      function addEntry( $contentClassAttributeID, $contentClassID = false )
  97      {
  98          if ( !isset( $contentClassAttributeID ) )
  99          {
 100              return;
 101          }
 102          if ( !$contentClassID )
 103          {
 104              $contentClassAttribute = eZContentClassAttribute::fetch( $contentClassAttributeID );
 105              $contentClassID = $contentClassAttribute->attribute( 'contentclass_id' );
 106          }
 107          // Checking if $contentClassAttributeID and $contentClassID already exist (in Entries)
 108          foreach ( $this->Entries as $entrie )
 109          {
 110              if ( $entrie->attribute( 'contentclass_attribute_id' ) == $contentClassAttributeID and
 111                   $entrie->attribute( 'contentclass_id' ) == $contentClassID )
 112                  return;
 113          }
 114          $waitUntilDateValue = eZWaitUntilDateValue::create( $this->WorkflowEventID, $this->WorkflowEventVersion, $contentClassAttributeID, $contentClassID );
 115          $waitUntilDateValue->store();
 116          $this->Entries =& eZWaitUntilDateValue::fetchAllElements( $this->WorkflowEventID, $this->WorkflowEventVersion );
 117      }
 118  
 119      function removeEntry( $workflowEventID, $id, $version )
 120      {
 121          eZDebug::writeDebug( "$workflowEventID - $id - $version ", 'remove params 2' );
 122  
 123         eZWaitUntilDateValue::remove( $id, $version );
 124         $this->Entries =& eZWaitUntilDateValue::fetchAllElements( $workflowEventID, $version );
 125      }
 126  
 127      function &classAttributeIDList()
 128      {
 129          $attributeIDList = array();
 130          foreach ( array_keys( $this->Entries ) as $key )
 131          {
 132              $entry =& $this->Entries[$key];
 133              $attributeIDList[] = $entry->attribute( 'contentclass_attribute_id' );
 134          }
 135          return $attributeIDList;
 136      }
 137  
 138      function setVersion( $version )
 139      {
 140          eZWaitUntilDateValue::removeAllElements( $this->WorkflowEventID, 0 );
 141          for ( $i = 0; $i < count( $this->Entries ); $i++ )
 142          {
 143              $entry =& $this->Entries[$i];
 144              $oldversion = $entry->attribute( "workflow_event_version" );
 145              $id = $entry->attribute( "id" );
 146              $workflowEventID = $entry->attribute( "workflow_event_id" );
 147              $contentClassID = $entry->attribute( "contentclass_id" );
 148              $contentClassAttributeID = $entry->attribute( "contentclass_attribute_id" );
 149              $entryCopy = eZWaitUntilDateValue::createCopy( $id,
 150                                                             $workflowEventID,
 151                                                             0,
 152                                                             $contentClassID,
 153                                                             $contentClassAttributeID );
 154  
 155              $entryCopy->store();
 156              if ( $oldversion != $version )
 157              {
 158                  $entry->setAttribute( 'workflow_event_version', $version );
 159                  $entry->store();
 160              }
 161          }
 162      }
 163  
 164  
 165      var $WorkflowEventID;
 166      var $WorkflowEventVersion;
 167      var $Entries;
 168  
 169  }
 170  
 171  
 172  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7