Exemplo n.º 1
0
<?php

Zood_Loader::loadClass('Zood_Controller_Action');
class TestController extends Zood_Controller_Action
{
    public function indexAction()
    {
        require_once ZOODPP_APP . '/models/TestModel.php';
        $list = TestModel::getTests();
        $this->setData('list', $list);
        $this->addResult(self::RESULT_SUCCESS, 'php', 'test/test.php');
        return self::RESULT_SUCCESS;
    }
    public function testAction()
    {
        Zood_Util::print_r('another action:testAction', 'testAction');
    }
}
// End ^ LF ^ UTF-8
Exemplo n.º 2
0
/**
 * iNewS Project
 * 
 * LICENSE
 * 
 * http://www.inews.com.cn/license/inews
 * 
 * @category   iNewS
 * @package    ^ChangeMe^
 * @subpackage ^ChangeMe^
 * @copyright Copyright (c) 2009 Zeed Technologies PRC Inc. (http://www.inews.com.cn)
 * @author     Ahdong ( GTalk: ahdong.com@gmail.com )
 * @since      Mar 24, 2009
 * @version    SVN: $$Id$$
 */
Zood_Loader::loadClass('Zood_Db_Table_Abstract');
class TestTable extends Zood_Db_Table_Abstract
{
    /** Table name */
    protected $_name = 'test';
    protected $_primary = 'testid';
    public function getTests()
    {
        $select = $this->getAdapter()->select()->from('test', '*');
        $rows = $select->query()->fetchAll();
        return $rows;
    }
    /**
     * Insert new row
     *
     * Ensure that a timestamp is set for the created field.
Exemplo n.º 3
0
 /**
  * Set response class/object
  *
  * Set the response object.  The response is a container for action
  * responses and headers. Usage is optional.
  *
  * If a class name is provided, instantiates a response object.
  *
  * @param string|Zood_Controller_Response_Abstract $response
  * @throws Zood_Controller_Exception if invalid response class
  * @return Zood_Controller_Front
  */
 public function setResponse($response)
 {
     if (is_string($response)) {
         Zood_Loader::loadClass($response);
         $response = new $response();
     }
     if (!$response instanceof Zood_Controller_Response_Abstract) {
         throw new Zood_Controller_Exception('Invalid response class');
     }
     $this->_response = $response;
     return $this;
 }
Exemplo n.º 4
0
$bootTime = microtime(true);
error_reporting(E_ALL);
date_default_timezone_set('Asia/Shanghai');
define('ZOODPP_ROOT', realpath(dirname(__FILE__) . '/..'));
//Root dir of project
define('ZOODPP_APP', ZOODPP_ROOT . '/app');
//Dir of applications
/**
 * Add framework dir to php include path
 */
set_include_path(realpath(ZOODPP_ROOT . '/lib') . PATH_SEPARATOR . get_include_path());
require_once 'Zood/Loader.php';
/**
 * Register auto load
 */
Zood_Loader::registerAutoload();
//require_once 'Zend/Registry.php';
//require_once 'Zood/Util.php';
//require_once 'Zood/Controller/Front.php';
/**
 * Set default configuration dir
 */
//Zood_Loader::loadClass('Zood_Config');
//Zood_Config::addConfigDirectory(ZOODPP_ROOT . '/app' . '/config');
//Access authentication
require_once ZOODPP_ROOT . '/app/lib/access/ActionAccessInterceptor.php';
Zood_Controller_Action::addInterceptor(new ActionAccessInterceptor(), 'access');
/**
 * Get front controller instance, set controller dir and dispatch
 */
try {