[ 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/ -> adminresourcesaction.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
   4      lt_include( PLOG_CLASS_PATH."class/view/admin/adminresourceslistview.class.php" );
   5      lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
   6      lt_include( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" );
   7      lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );
   8  
   9      /**
  10       * \ingroup Action
  11       * @private
  12       *
  13       * shows all the resources of a blog
  14       */
  15      class AdminResourcesAction extends AdminAction
  16      {
  17  
  18          var $_albumId;
  19  
  20          /**
  21           * Constructor. If nothing else, it also has to call the constructor of the parent
  22           * class, BlogAction with the same parameters
  23           */
  24          function AdminResourcesAction( $actionInfo, $request )
  25          {
  26              $this->AdminAction( $actionInfo, $request );
  27              
  28              // data validation
  29              $this->registerFieldValidator( "albumId", new IntegerValidator(), true );
  30              $view = new AdminResourcesListView( $this->_blogInfo, Array( "albumId" => 0 ));
  31              $view->setErrorMessage( $this->_locale->tr("error_incorrect_album_id"));
  32              $this->setValidationErrorView( $view );
  33              
  34              $this->requirePermission( "view_resources" );
  35          }
  36  
  37  		function checkFolders()
  38          {
  39              $baseFolder = GalleryResourceStorage::getResourcesStorageFolder();
  40              $userFolder = GalleryResourceStorage::getUserFolder( $this->_blogInfo->getId());
  41              $previewsFolder = GalleryResourceStorage::getPreviewsFolder( $this->_blogInfo->getId());
  42              $folders = "$baseFolder<br/>$userFolder<br/>$previewsFolder";
  43  
  44              $message = "";
  45  
  46              // check if the storage folder exists and it is readable
  47              if( !GalleryResourceStorage::checkBaseStorageFolder() || 
  48                          !GalleryResourceStorage::checkUserStorageFolder( $this->_blogInfo->getId()) ||
  49                          !GalleryResourceStorage::checkPreviewsStorageFolder( $this->_blogInfo->getId()) ||
  50                          !GalleryResourceStorage::checkMediumSizePreviewsStorageFolder( $this->_blogInfo->getId())) {
  51                  $message = $this->_locale->pr("error_base_storage_folder_missing_or_unreadable", $folders);
  52              }
  53  
  54              return $message;
  55          }
  56  
  57          /**
  58           * Carries out the specified action
  59           */
  60          function perform()
  61          {
  62              $this->_albumId = $this->_request->getValue( "albumId", 0 );
  63              $this->_searchTerms = $this->_request->getValue( "searchTerms" );
  64  
  65              $errorMessage = $this->checkFolders();
  66              if( $errorMessage ) {
  67                  // something happened, we leave it here...
  68                  $this->_view = new AdminErrorView( $this->_blogInfo );
  69                  $this->_view->setMessage( $errorMessage );
  70              }
  71              else {
  72                  $this->_view = new AdminResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_albumId,
  73                                                                                      "searchTerms" => $this->_searchTerms ));
  74              }
  75  
  76              $this->setCommonData();
  77  
  78              return true;
  79          }
  80      }
  81  ?>


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