[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/kernel/class/ -> groupedit.php (source)

   1  <?php
   2  //
   3  // Created on: <16-Apr-2002 11:00:12 amos>
   4  //
   5  // SOFTWARE NAME: eZ publish
   6  // SOFTWARE RELEASE: 3.9.0
   7  // BUILD VERSION: 17785
   8  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
   9  // SOFTWARE LICENSE: GNU General Public License v2.0
  10  // NOTICE: >
  11  //   This program is free software; you can redistribute it and/or
  12  //   modify it under the terms of version 2.0  of the GNU General
  13  //   Public License as published by the Free Software Foundation.
  14  //
  15  //   This program is distributed in the hope that it will be useful,
  16  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  17  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18  //   GNU General Public License for more details.
  19  //
  20  //   You should have received a copy of version 2.0 of the GNU General
  21  //   Public License along with this program; if not, write to the Free
  22  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  23  //   MA 02110-1301, USA.
  24  //
  25  //
  26  
  27  include_once ( "kernel/classes/ezcontentclass.php" );
  28  include_once ( "kernel/classes/ezcontentclassattribute.php" );
  29  include_once ( "kernel/classes/ezcontentclassgroup.php" );
  30  include_once ( "kernel/classes/ezcontentclassclassgroup.php" );
  31  include_once ( "lib/ezutils/classes/ezhttptool.php" );
  32  
  33  $Module =& $Params["Module"];
  34  $GroupID = null;
  35  if ( isset( $Params["GroupID"] ) )
  36      $GroupID = $Params["GroupID"];
  37  
  38  if ( is_numeric( $GroupID ) )
  39  {
  40      $classgroup = eZContentClassGroup::fetch( $GroupID );
  41  }
  42  else
  43  {
  44      include_once ( "kernel/classes/datatypes/ezuser/ezuser.php" );
  45      $user =& eZUser::currentUser();
  46      $user_id = $user->attribute( "contentobject_id" );
  47      $classgroup = eZContentClassGroup::create( $user_id );
  48      $classgroup->setAttribute( "name", ezi18n( 'kernel/class/groupedit', "New Group" ) );
  49      $classgroup->store();
  50      $GroupID = $classgroup->attribute( "id" );
  51      $Module->redirectTo( $Module->functionURI( "groupedit" ) . "/" . $GroupID );
  52      return;
  53  }
  54  
  55  $http =& eZHttpTool::instance();
  56  if ( $http->hasPostVariable( "DiscardButton" ) )
  57  {
  58      $Module->redirectTo( $Module->functionURI( "grouplist" ) );
  59      return;
  60  }
  61  
  62  if ( $http->hasPostVariable( "StoreButton" ) )
  63  {
  64      if ( $http->hasPostVariable( "Group_name" ) )
  65      {
  66          $name = $http->postVariable( "Group_name" );
  67      }
  68      $classgroup->setAttribute( "name", $name );
  69      // Set new modification date
  70      $date_time = time();
  71      $classgroup->setAttribute( "modified", $date_time );
  72      include_once ( "kernel/classes/datatypes/ezuser/ezuser.php" );
  73      $user =& eZUser::currentUser();
  74      $user_id = $user->attribute( "contentobject_id" );
  75      $classgroup->setAttribute( "modifier_id", $user_id );
  76      $classgroup->store();
  77  
  78      eZContentClassClassGroup::update( null, $GroupID, $name );
  79  
  80      $Module->redirectToView( 'classlist', array( $classgroup->attribute( 'id' ) ) );
  81      return;
  82  }
  83  
  84  $Module->setTitle( "Edit class group " . $classgroup->attribute( "name" ) );
  85  
  86  // Template handling
  87  include_once ( "kernel/common/template.php" );
  88  $tpl =& templateInit();
  89  
  90  $res =& eZTemplateDesignResource::instance();
  91  $res->setKeys( array( array( "classgroup", $classgroup->attribute( "id" ) ) ) );
  92  
  93  $tpl->setVariable( "http", $http );
  94  $tpl->setVariable( "module", $Module );
  95  $tpl->setVariable( "classgroup", $classgroup );
  96  
  97  $Result = array();
  98  $Result['content'] =& $tpl->fetch( "design:class/groupedit.tpl" );
  99  
 100  ?>


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