[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/action/admin/ -> admineditglobalarticlecategoryaction.class.php (source)

   1  <?php
   2        /**
   3         * GLobal artical Category files added by Ameng(Ameng.vVlogger.com) 2005-06-20
   4         * version 1.0 
   5         * Changed from original article category.
   6         */
   7  
   8          lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
   9          lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
  10          lt_include( PLOG_CLASS_PATH."class/view/admin/adminglobalarticlecategorieslistview.class.php" );
  11          lt_include( PLOG_CLASS_PATH."class/dao/globalarticlecategories.class.php" );
  12          lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
  13          lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
  14          lt_include( PLOG_CLASS_PATH."class/data/validator/emptyvalidator.class.php" );
  15  
  16      /**
  17       * \ingroup Action
  18       * @private
  19       *
  20       * Action that shows a form to change the settings of the article category
  21       */
  22      class AdminEditGlobalArticleCategoryAction extends AdminAction 
  23      {
  24  
  25          var $_categoryId;
  26  
  27          /**
  28           * Constructor. If nothing else, it also has to call the constructor of the parent
  29           * class, BlogAction with the same parameters
  30           */
  31          function AdminEditGlobalArticleCategoryAction( $actionInfo, $request )
  32          {
  33              $this->AdminAction( $actionInfo, $request );
  34              
  35              // stuff for the data validation
  36              $this->registerFieldValidator( "categoryId", new IntegerValidator());
  37              $this->_form->registerField( "categoryName" );
  38              $this->_form->registerField( "categoryDescription" );
  39              $errorView = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );
  40              $errorView->setErrorMessage( $this->_locale->tr("error_incorrect_category_id"));
  41              $this->setValidationErrorView( $errorView );
  42              
  43              $this->requireAdminPermission( "update_global_category" );            
  44          }
  45  
  46          /**
  47           * Carries out the specified action
  48           */
  49          function perform()
  50          {
  51              // fetch the category
  52              $this->_categoryId = $this->_request->getValue( "categoryId" );
  53              $categories = new GlobalArticleCategories();
  54              $category   = $categories->getGlobalArticleCategory( $this->_categoryId);
  55              // show an error if we couldn't fetch the category
  56              if( !$category ) {
  57                  $this->_view = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );
  58                  $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_category") );
  59                  $this->_view->setError( true );
  60                  $this->setCommonData();
  61                  return false;
  62              }
  63              
  64              $this->notifyEvent( EVENT_CATEGORY_LOADED, Array( "category" => &$category ));            
  65              // otherwise show the form to edit its fields
  66              $this->_view = new AdminTemplatedView( $this->_blogInfo, "editglobalarticlecategory" );
  67              $this->_view->setValue( "category", $category );
  68              $this->_view->setValue( "categoryName", $category->getName());
  69              $this->_view->setValue( "categoryDescription", $category->getDescription());
  70              $this->_view->setValue( "categoryId", $category->getId());
  71              $this->setCommonData();
  72  
  73              // better to return true if everything fine
  74             return true;
  75          }
  76      }
  77  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics