| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 require_once('limb/wact/src/components/WactClassPath.class.php'); 10 require_once('limb/wact/src/components/iterator/WactBaseIteratorComponent.class.php'); 11 12 /** 13 * class WactFetchComponent. 14 * 15 * @package wact 16 * @version $Id$ 17 */ 18 class WactFetchComponent extends WactBaseIteratorComponent 19 { 20 protected $fetcher_name; 21 protected $include_path; 22 protected $params = array(); 23 protected $dataset = null; 24 protected $cache_dataset = true; 25 protected $reserved_params = array('limit', 'offset', 'order'); 26 27 function setFetcherName($fetcher_name) 28 { 29 $this->fetcher_name = $fetcher_name; 30 } 31 32 function setIncludePath($include_path) 33 { 34 $this->include_path = $include_path; 35 } 36 37 function setAdditionalParam($param, $value) 38 { 39 $this->params[$param] = $value; 40 } 41 42 function setCacheDataset($flag) 43 { 44 $this->cache_dataset = $flag; 45 } 46 47 function getDataset() 48 { 49 if($this->dataset !== null && (boolean)$this->cache_dataset) 50 return $this->dataset; 51 52 $fetcher = $this->_createFetcher(); 53 54 $this->dataset = $fetcher->fetch(); 55 56 return $this->dataset; 57 } 58 59 protected function _createFetcher() 60 { 61 $class_path = new WactClassPath($this->fetcher_name, $this->include_path); 62 $fetcher = $class_path->createObject(); 63 64 foreach($this->params as $param => $value) 65 { 66 $method = WactTemplate :: toStudlyCaps('set_' . $param, false); 67 if(in_array($param, $this->reserved_params)) 68 $this->$method($value); 69 elseif(method_exists($fetcher, $method)) 70 $fetcher->$method($value); 71 else 72 throw new WactException('Fetcher "' .$this->fetcher_name. '" does not support method: '. $method); 73 } 74 75 return $fetcher; 76 } 77 } 78 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Oct 15 04:31:08 2008 | Cross-referenced by PHPXref 0.7 |