/kernel/state/view.php

http://github.com/ezsystems/ezpublish · PHP · 58 lines · 39 code · 13 blank · 6 comment · 5 complexity · 479fdfeeed69c5148a5385c2a7b1fc9f MD5 · raw file

  1. <?php
  2. /**
  3. * @copyright Copyright (C) eZ Systems AS. All rights reserved.
  4. * @license For full copyright and license information view LICENSE file distributed with this source code.
  5. * @version //autogentag//
  6. * @package kernel
  7. */
  8. $Module = $Params['Module'];
  9. $GroupIdentifier = $Params['GroupIdentifier'];
  10. $StateIdentifier = $Params['StateIdentifier'];
  11. $LanguageCode = $Params['Language'];
  12. $group = eZContentObjectStateGroup::fetchByIdentifier( $GroupIdentifier );
  13. if ( !is_object( $group ) )
  14. {
  15. return $Module->handleError( eZError::KERNEL_NOT_FOUND, 'kernel' );
  16. }
  17. $state = $group->stateByIdentifier( $StateIdentifier );
  18. if ( !is_object( $state ) )
  19. {
  20. return $Module->handleError( eZError::KERNEL_NOT_FOUND, 'kernel' );
  21. }
  22. $currentAction = $Module->currentAction();
  23. if ( $currentAction == 'Edit' )
  24. {
  25. return $Module->redirectTo( "state/edit/$GroupIdentifier/$StateIdentifier" );
  26. }
  27. if ( $LanguageCode )
  28. {
  29. $state->setCurrentLanguage( $LanguageCode );
  30. }
  31. $tpl = eZTemplate::factory();
  32. $tpl->setVariable( 'group', $group );
  33. $tpl->setVariable( 'state', $state );
  34. $Result = array(
  35. 'content' => $tpl->fetch( 'design:state/view.tpl' ),
  36. 'path' => array(
  37. array( 'url' => false,
  38. 'text' => ezpI18n::tr( 'kernel/state', 'State' ) ),
  39. array( 'url' => 'state/group/' . $group->attribute( 'identifier' ),
  40. 'text' => $group->attribute( 'identifier' ) ),
  41. array( 'url' => false,
  42. 'text' => $state->attribute( 'identifier' ) )
  43. )
  44. );
  45. ?>