[ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" ); 4 lt_include( PLOG_CLASS_PATH."class/view/admin/adminnewresourceview.class.php" ); 5 lt_include( PLOG_CLASS_PATH."class/view/admin/adminnewalbumview.class.php" ); 6 lt_include( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" ); 7 lt_include( PLOG_CLASS_PATH."class/view/admin/adminresourceslistview.class.php" ); 8 lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" ); 9 lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" ); 10 11 /** 12 * \ingroup Action 13 * @private 14 * 15 * Adds a new resource to an album 16 */ 17 class AdminNewResourceAction extends AdminAction 18 { 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 AdminNewResourceAction( $actionInfo, $request ) 25 { 26 $this->AdminAction( $actionInfo, $request ); 27 28 $this->requirePermission( "add_resource" ); 29 } 30 31 function validate() 32 { 33 // check that all the folders are in place 34 if( !GalleryResourceStorage::checkBaseStorageFolder()) { 35 $this->_view = new AdminErrorView( $this->_blogInfo ); 36 $this->_view->setMessage( $this->_locale->tr("error_gallery_folder_missing" )); 37 $this->setCommonData(); 38 39 return false; 40 } 41 42 return true; 43 } 44 45 /** 46 * Carries out the specified action 47 */ 48 function perform() 49 { 50 // are resources enabled? 51 $config =& Config::getConfig(); 52 if( !$config->getValue( "resources_enabled", true )) { 53 $this->_view = new AdminResourcesListView( $this->_blogInfo ); 54 $this->_view->setErrorMessage( $this->_locale->tr("error_resources_disabled")); 55 $this->setCommonData(); 56 return false; 57 } 58 59 // check that we have at least one album where to put our pictures 60 $albums = new GalleryAlbums(); 61 $blogAlbums = $albums->getNestedAlbumList( $this->_blogInfo->getId()); 62 if( count( $blogAlbums ) == 0 ) { 63 $this->_view = new AdminNewAlbumView( $this->_blogInfo ); 64 $this->_view->setErrorMessage( $this->_locale->tr("error_must_create_album_first")); 65 $this->setCommonData(); 66 67 return false; 68 } 69 70 // if all's fine, continue... 71 $this->_view = new AdminNewResourceView( $this->_blogInfo ); 72 $this->setCommonData(); 73 $this->_view->setValue( "albums", $blogAlbums ); 74 75 // better to return true if everything fine 76 return true; 77 } 78 } 79 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |