[ Index ] |
PHP Cross Reference of Web Application Component Toolkit |
[Summary view] [Print] [Text view]
1 <?php 2 //-------------------------------------------------------------------------------- 3 // Copyright 2003 Procata, Inc. 4 // Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html) 5 //-------------------------------------------------------------------------------- 6 /** 7 * @package WACT_TAG 8 * @version $Id: dataspace.tag.php,v 1.4 2004/11/18 04:22:48 jeffmoore Exp $ 9 */ 10 11 /** 12 * Register the tag 13 */ 14 $taginfo =& new TagInfo('dev:DATASPACE', 'DevDataSpaceTag'); 15 $taginfo->setEndTag(ENDTAG_FORBIDDEN); 16 TagDictionary::registerTag($taginfo, __FILE__); 17 18 /** 19 * Dumps a runtime dataspace for display using print_r or var_dump 20 * @see http://wact.sourceforge.net/index.php/DevDataSpaceTag 21 * @access protected 22 * @package WACT_TAG 23 */ 24 class DevDataSpaceTag extends CompilerDirectiveTag { 25 /** 26 * @param CodeWriter 27 * @return void 28 * @access protected 29 */ 30 function generateContents(&$code) { 31 parent::preGenerate($code); 32 if ( NULL !== ( $context = $this->getAttribute('context') ) ) { 33 $contexts = array('root','parent','current'); 34 if ( !in_array($context,$contexts) ) { 35 $context = 'current'; 36 } 37 } else { 38 $context = 'current'; 39 } 40 if ( NULL !== ( $output = $this->getAttribute('output') ) ) { 41 $outputs = array('print_r','var_dump'); 42 if ( !in_array($output,$outputs) ) { 43 $output = 'print_r'; 44 } 45 } else { 46 $output = 'print_r'; 47 } 48 $code->writeHTML('<div aligh="left"><hr /><h3>Begin '.ucfirst($context).' DataSpace</h3><hr /></div>'); 49 switch ( $context ) { 50 case 'root': 51 $Context =& $this->getRootDataSource(); 52 break; 53 case 'parent': 54 $Context =& $this->getParentDataSource(); 55 break; 56 default: 57 $Context =& $this->getDataSource(); 58 break; 59 } 60 $code->writeHTML('<pre>'); 61 $code->writePHP('if ( is_object('.$Context->getDataSourceRefCode(). 62 ') && method_exists ('.$Context->getDataSourceRefCode().',"export") ) {'); 63 $code->writePHP($output.'('.$Context->getDataSourceRefCode().'->export());'); 64 $code->writePHP('} else {'); 65 $code->writeHTML('Dataspace unavailable'); 66 $code->writePHP('}'); 67 $code->writeHTML('</pre>'); 68 $code->writeHTML('<div aligh="left"><hr /><h3>End '.ucfirst($context).' DataSpace</h3><hr /></div>'); 69 } 70 71 } 72 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 28 19:36:09 2004 | Cross-referenced by PHPXref 0.5 |