[Phphtmllib-devel] SF.net SVN: phphtmllib:[3366] trunk/phphtmllib
Status: Beta
Brought to you by:
hemna
From: <he...@us...> - 2010-02-26 03:56:49
|
Revision: 3366 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3366&view=rev Author: hemna Date: 2010-02-26 03:56:43 +0000 (Fri, 26 Feb 2010) Log Message: ----------- Added JSONWidget Modified Paths: -------------- trunk/phphtmllib/CHANGELOG trunk/phphtmllib/src/generator/AutoloadGenerator.inc Added Paths: ----------- trunk/phphtmllib/src/widgets/JSONWidget.inc Modified: trunk/phphtmllib/CHANGELOG =================================================================== --- trunk/phphtmllib/CHANGELOG 2010-02-25 15:34:48 UTC (rev 3365) +++ trunk/phphtmllib/CHANGELOG 2010-02-26 03:56:43 UTC (rev 3366) @@ -17,6 +17,7 @@ + added support to disable controller request debug output 2 on objects that provide the controller_debug_allowed() method. + added hostname port support in RequestBuilder + + Added new JSONWidget and AutoloadGenerator support. version 3.0.2 - 03/18/08 - fixed a bug with RequestBuilder::get_url() when a RequestBuilder::set_file() was called. Modified: trunk/phphtmllib/src/generator/AutoloadGenerator.inc =================================================================== --- trunk/phphtmllib/src/generator/AutoloadGenerator.inc 2010-02-25 15:34:48 UTC (rev 3365) +++ trunk/phphtmllib/src/generator/AutoloadGenerator.inc 2010-02-26 03:56:43 UTC (rev 3366) @@ -177,7 +177,8 @@ * * @var array */ - protected $renderable_parents = array('Container','HTMLPage', 'HTMLWidget', 'HTMLDataList'); + protected $renderable_parents = array('Container','HTMLPage', 'HTMLWidget', 'HTMLDataList', + 'JSONWidget'); /** * list of class names that if extended will Added: trunk/phphtmllib/src/widgets/JSONWidget.inc =================================================================== --- trunk/phphtmllib/src/widgets/JSONWidget.inc (rev 0) +++ trunk/phphtmllib/src/widgets/JSONWidget.inc 2010-02-26 03:56:43 UTC (rev 3366) @@ -0,0 +1,46 @@ +<?php + +/** + * This class is used to render a JSON array output that gets + * put back to the browser. + */ + + +/** + * JSONWidget is used when you want the controller + * to be able to call a "renderable" object that + * simply returns JSON. + * + * @author waboring + * + */ +abstract class JSONWidget { + + protected $data = null; + + public function __construct() { + $this->init(); + } + + + public function render() { + $data = $this->build_object(); + return json_encode($data); + } + + /** + * called at constructor time to do something. + * @return none + */ + abstract public function init(); + + /** + * This method is used to build the object + * that will be converted to json and + * returned to the request + * @return mixed + */ + abstract public function build_object(); + +} +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |