Skip to content
Snippets Groups Projects
Select Git revision
  • 68d4f9c6933e72c6b62bead2ace58984129b8a45
  • 3.9 default
  • develop
  • 6.0
  • 5.0
  • 4.0
  • scrutinizer-patch-4
  • scrutinizer-patch-3
  • scrutinizer-patch-2
  • scrutinizer-patch-1
  • 3.7
  • 3.8
  • 3.6
  • 3.9_backported
  • 3.8_backported
  • 3.7_backported
  • 3.5
  • 3.6_backported
  • 3.5_backported
  • 3.4
  • 3.3_backported
  • 6.0.4
  • 6.0.3
  • 5.0.7
  • 6.0.2
  • 6.0.1
  • 5.0.6
  • 6.0.0
  • 5.0.5
  • 6.0.0-rc
  • 5.0.4
  • 6.0.0-beta
  • 5.0.3
  • 4.0.6
  • 5.0.2
  • 5.0.1
  • 4.0.5
  • 5.0.0
  • 4.0.4
  • 5.0.0-rc2
  • 5.0.0-rc1
41 results

mysql.lib.php

Blame
  • Action.php 2.93 KiB
    <?php
    /**
     * Action.php Defines the standard NMC Action class
     *
     * LICENSE: Some license information
     *
     * @copyright  2006 New Media Center - University of Nebraska-Lincoln
     * @license    http://www.gnu.org/licenses/gpl.txt GPL
     * @version    0.0.1
     * @link       http://nmc.unl.edu/
     * @since      File available since Release 0.0.1
    */
    
    Zend::loadClass('Nmc_Controller_Action_Plugin_Broker');
    
    /**
     * Nmc_Controller_Action: Extends the Zend action to include a default noRouteAction
     *
     * @copyright  2006 New Media Center - University of Nebraska Lincoln
     * @license    http://www.gnu.org/gpl.txt GPL
     * @version    Release: 0.0.1
     * @link       http://nmc.unl.edu/
     * @since      Class available since Release 0.0.1
     */
    
    abstract class Nmc_Controller_Action extends Zend_Controller_Action {
    
        /**
         * Plugin broker for current action
         *
         * @var Nmc_Controller_Action_Plugin_Broker
         */
        protected $_pluginBroker;
    
        public function __construct()
        {
            parent::__construct();
        }
    
        public function run(Zend_Controller_Dispatcher_Interface $dispatcher,
                                  Zend_Controller_Dispatcher_Token $action)
        {
            $this->_action = $action;
            $this->_params = $action->getParams();
            $this->_preAction();
            $returnValue = parent::run($dispatcher, $action);
            $this->_postAction();
            return $returnValue;
        }
    
        protected function _registerPlugin(Nmc_Controller_Action_Plugin_Interface $plugin)
        {
            if(! $this->_pluginBroker instanceof Nmc_Controller_Action_Plugin_Broker) {
                $this->_pluginBroker = new Nmc_Controller_Action_Plugin_Broker();
            }
            $this->_pluginBroker->registerPlugin($plugin);
        }
    
        protected function _unregisterPlugin(Nmc_Controller_Action_Plugin_Interface $plugin)
        {
            if($this->_pluginBroker instanceof Nmc_Controller_Action_Plugin_Broker) {
                $this->_pluginBroker->unregisterPlugin($plugin);
            }
        }
    
        protected function _preAction()
        {
            if($this->_pluginBroker instanceof Nmc_Controller_Action_Plugin_Broker) {
                $this->_pluginBroker->preAction($this, $this->_action);
            }
        }
    
        protected function _postAction()
        {
            if($this->_pluginBroker instanceof Nmc_Controller_Action_Plugin_Broker) {
                $this->_pluginBroker->postAction($this, $this->_action);
            }
        }
    
    	function noRouteAction()
    	{
            header('HTTP/1.0 404 Not Found');
            $out = new Nmc_View();
            $out->page = '404';
            $out->title = '404 Not Found';
            echo $out->render();
    	}
    
    	function __call($method, $args)
    	{
            if($this->_pluginBroker instanceof Nmc_Controller_Action_Plugin_Broker) {
                if($this->_pluginBroker->pluginMethodExists($method)) {
    	            return $this->_pluginBroker->callPluginMethod($method, $args);
                }
            }
            if(substr($method, -6) == 'Action') {
    	       return $this->noRouteAction();
            }
    	}
    }
    
    ?>