[ 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/ -> adminnewpostaction.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/adminnewpostview.class.php" );
   5      lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
   6      lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );    
   7  
   8      /**
   9       * \ingroup Action
  10       * @private
  11       *
  12       * Action that adds a new post to the database. It also lets the user
  13       * preview the article before posting it.
  14       */
  15      class AdminNewPostAction extends AdminAction 
  16      {
  17  
  18          /**
  19           * Constructor. If nothing else, it also has to call the constructor of the parent
  20           * class, BlogAction with the same parameters
  21           */
  22          function AdminNewPostAction( $actionInfo, $request )
  23          {
  24              $this->AdminAction( $actionInfo, $request );
  25  
  26              // security checks
  27              $this->requirePermission( "add_post" );
  28          }
  29                  
  30          /**
  31           * Carries out the specified action
  32           */
  33          function perform()
  34          {
  35              $blogSettings = $this->_blogInfo->getSettings();
  36              $categories = new ArticleCategories();
  37              $blogCategories = $categories->getBlogCategories( $this->_blogInfo->getId() );
  38              // but make sure that we have at least one!
  39              if( count($blogCategories) == 0) {
  40                  $this->_view = new AdminTemplatedView( $this->_blogInfo, "newpostcategory" );
  41                  $this->_view->setSuccessMessage( $this->_locale->tr("error_must_have_one_category"));
  42                  $this->setCommonData();
  43                  return false;
  44              }            
  45              
  46              // initialize the view
  47              $this->_view = new AdminNewPostView( $this->_blogInfo );
  48              $this->_view->setValue( "sendNotification", $blogSettings->getValue( "default_send_notification" ));
  49              $this->setCommonData();
  50  
  51              // better to return true if everything fine
  52              return true;
  53          }
  54      }
  55  ?>


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