adminresourceinfoaction.class.php
来自「一个用PHP编写的」· PHP 代码 · 共 68 行
PHP
68 行
<?php lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" ); lt_include( PLOG_CLASS_PATH."class/view/admin/admineditresourceview.class.php" ); lt_include( PLOG_CLASS_PATH."class/view/admin/adminresourceslistview.class.php" ); lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresource.class.php" ); lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" ); lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" ); /** * \ingroup Action * @private * * Shows information about a resource */ class AdminResourceInfoAction extends AdminAction { var $_resourceId; /** * Constructor. If nothing else, it also has to call the constructor of the parent * class, BlogAction with the same parameters */ function AdminResourceInfoAction( $actionInfo, $request ) { $this->AdminAction( $actionInfo, $request ); // data validation $this->registerFieldValidator( "resourceId", new IntegerValidator()); $view = new AdminResourcesListView( $this->_blogInfo ); $view->setErrorMessage( $this->_locale->tr( "error_fetching_resource" )); $this->setValidationErrorView( $view ); $this->requirePermission( "update_resource" ); } /** * Carries out the specified action */ function perform() { // load the resource $this->_resourceId = $this->_request->getValue( "resourceId" ); $resources = new GalleryResources(); $resource = $resources->getResource( $this->_resourceId, $this->_blogInfo->getId()); if( !$resource ) { $this->_view = new AdminResourcesListView( $this->_blogInfo ); $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_resource")); } else { $this->_view = new AdminEditResourceView( $this->_blogInfo ); $this->notifyEvent( EVENT_RESOURCE_LOADED, Array( "resource" => &$resource )); $this->_view->setValue( "resource", $resource ); // export some useful information $this->_view->setValue( "resourceDescription", $resource->getDescription()); $this->_view->setValue( "albumId", $resource->getAlbumId()); } $this->setCommonData(); // better to return true if everything fine return true; } }?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?