/** * 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; }
<?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
/** * 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.