Alpha Framework alpha--controller
[ class tree: alpha--controller ] [ index: alpha--controller ] [ all elements ]

Source for file ListSequences.php

Documentation is available at ListSequences.php

  1. <?php
  2.  
  3. // include the config file
  4. if(!isset($config)) {
  5.     require_once '../util/configLoader.inc';
  6.     $config configLoader::getInstance();
  7. }
  8.  
  9. require_once $config->get('sysRoot').'alpha/controller/ListAll.php';
  10. require_once $config->get('sysRoot').'alpha/model/types/Sequence.inc';
  11. require_once $config->get('sysRoot').'alpha/controller/AlphaControllerInterface.inc';
  12.  
  13. /**
  14.  * 
  15.  * Controller used to list all Sequences
  16.  * 
  17.  * @package alpha::controller
  18.  * @since 1.0
  19.  * @author John Collins <dev@alphaframework.org>
  20.  * @version $Id: ListSequences.php 1461 2011-12-08 20:56:32Z johnc $
  21.  * @license http://www.opensource.org/licenses/bsd-license.php The BSD License
  22.  * @copyright Copyright (c) 2011, John Collins (founder of Alpha Framework).
  23.  *  All rights reserved.
  24.  * 
  25.  *  <pre>
  26.  *  Redistribution and use in source and binary forms, with or
  27.  *  without modification, are permitted provided that the
  28.  *  following conditions are met:
  29.  * 
  30.  *  * Redistributions of source code must retain the above
  31.  *    copyright notice, this list of conditions and the
  32.  *    following disclaimer.
  33.  *  * Redistributions in binary form must reproduce the above
  34.  *    copyright notice, this list of conditions and the
  35.  *    following disclaimer in the documentation and/or other
  36.  *    materials provided with the distribution.
  37.  *  * Neither the name of the Alpha Framework nor the names
  38.  *    of its contributors may be used to endorse or promote
  39.  *    products derived from this software without specific
  40.  *    prior written permission.
  41.  *   
  42.  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  43.  *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  44.  *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  45.  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  46.  *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  47.  *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  48.  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  49.  *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  50.  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  51.  *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  52.  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  53.  *  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  54.  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  55.  *  </pre>
  56.  *  
  57.  */
  58. class ListSequences extends ListAll implements AlphaControllerInterface {
  59.     /**
  60.      * Trace logger
  61.      * 
  62.      * @var Logger 
  63.      * @since 1.0
  64.      */
  65.     private static $logger null;
  66.     
  67.     /**
  68.      * constructor to set up the object
  69.      * 
  70.      * @since 1.0
  71.      */
  72.     public function __construct({
  73.         self::$logger new Logger('ListSequences');
  74.         self::$logger->debug('>>__construct()');
  75.         
  76.         // ensure that the super class constructor is called, indicating the rights group
  77.         parent::__construct('Admin');
  78.         
  79.         $BO new Sequence();
  80.         
  81.         // make sure that the Sequence tables exist
  82.         if(!$BO->checkTableExists()) {
  83.             echo AlphaView::displayErrorMessage('Warning! The Sequence table do not exist, attempting to create it now...');
  84.             $BO->makeTable();
  85.         }
  86.         
  87.         // set up the title and meta details
  88.         $this->setTitle('Listing all Sequences');
  89.         $this->setDescription('Page to list all Sequences.');
  90.         $this->setKeywords('list,all,Sequences');
  91.         
  92.         self::$logger->debug('<<__construct');
  93.     }
  94.     
  95.     /**
  96.      * Handle GET requests
  97.      * 
  98.      * @param array $params 
  99.      * @since 1.0
  100.      */
  101.     public function doGET($params{
  102.         self::$logger->debug('>>doGET($params=['.var_export($paramstrue).'])');
  103.         
  104.         echo AlphaView::displayPageHead($this);
  105.         
  106.         // get all of the BOs and invoke the list_view on each one
  107.         $temp new Sequence();
  108.         // set the start point for the list pagination
  109.         if (isset($params['start']$this->startPoint = $params['start']$this->startPoint = 1);
  110.             
  111.         $objects $temp->loadAll($this->startPoint);
  112.         
  113.         AlphaDAO::disconnect();
  114.         
  115.         $BO new Sequence();
  116.         $this->BOCount = $BO->getCount();
  117.         
  118.         echo AlphaView::renderDeleteForm();
  119.         
  120.         foreach($objects as $object{
  121.             $temp AlphaView::getInstance($object);
  122.             echo $temp->listView();
  123.         }
  124.         
  125.         echo AlphaView::displayPageFoot($this);
  126.         
  127.         self::$logger->debug('<<doGET');        
  128.     }
  129.     
  130.     /**
  131.      * Handle POST requests
  132.      * 
  133.      * @param array $params 
  134.      * @since 1.0
  135.      */
  136.     public function doPOST($params{
  137.         self::$logger->debug('>>doPOST($params=['.var_export($paramstrue).'])');
  138.         
  139.         self::$logger->debug('<<doPOST');        
  140.     }
  141. }
  142.  
  143. // now build the new controller if this file is called directly
  144. if ('ListSequences.php' == basename($_SERVER['PHP_SELF'])) {
  145.     $controller new ListSequences();
  146.     
  147.     if(!empty($_POST)) {            
  148.         $controller->doPOST($_POST);
  149.     }else{
  150.         $controller->doGET($_GET);
  151.     }
  152. }
  153.  
  154. ?>

Documentation generated on Tue, 13 Dec 2011 20:27:10 +0000 by phpDocumentor 1.4.3