[ 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/ -> adminnewlinkaction.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/adminnewlinkview.class.php" );
   5      lt_include( PLOG_CLASS_PATH."class/view/admin/adminlinkslistview.class.php" );
   6      lt_include( PLOG_CLASS_PATH."class/dao/mylinkscategories.class.php" );
   7      lt_include( PLOG_CLASS_PATH."class/dao/mylinkscategory.class.php" );
   8  
   9      /**
  10       * \ingroup Action
  11       * @private
  12       *
  13       * Action that shows a form to add a link for the blogroll feature
  14       */
  15      class AdminNewLinkAction 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 AdminNewLinkAction( $actionInfo, $request )
  23          {
  24              $this->AdminAction( $actionInfo, $request );
  25  
  26              $this->requirePermission( "add_link" );
  27          }
  28          
  29          /**
  30           * Carries out the specified action
  31           */
  32          function perform()
  33          {
  34              // fetch all the link categories
  35              $blogSettings = $this->_blogInfo->getSettings();
  36              $linkCategoriesOrder = $blogSettings->getValue( "link_categories_order", MYLINKS_CATEGORIES_NO_ORDER );
  37              $linkCategories = new MyLinksCategories();
  38              $blogLinkCategories = $linkCategories->getMyLinksCategories( $this->_blogInfo->getId(), $linkCategoriesOrder );            
  39  
  40              // if there is none, we should not be allowed to add any link!
  41              if( empty($blogLinkCategories)) {
  42                  $this->_view = new AdminTemplatedView( $this->_blogInfo, "newlinkcategory" );
  43                  $this->_view->setErrorMessage( $this->_locale->tr("error_must_have_one_link_category" ));
  44                  $this->setCommonData();
  45  
  46                  return false;
  47              }
  48              
  49              $this->notifyEvent( EVENT_LINK_CATEGORIES_LOADED, Array( "linkcategories" => &$blogLinkCategories ));            
  50  
  51              // else, put that in the template and continue
  52              $this->_view = new AdminNewLinkView( $this->_blogInfo );
  53              $this->setCommonData();
  54  
  55              // better to return true if everything fine
  56              return true;
  57          }        
  58      }
  59  ?>


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