Changeset 802
- Timestamp:
- 08/10/07 16:18:26 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/websites/memphis/stubMemphisPageElement.php
r267 r802 1 1 <?php 2 2 /** 3 * Interfacefor a memphis page element.3 * Basic implementation for a memphis page element. 4 4 * 5 5 * @author Frank Kleine <mikey@stubbles.net> … … 7 7 * @subpackage websites_memphis 8 8 */ 9 stubClassLoader::load('net.stubbles.websites.stub PageElement');9 stubClassLoader::load('net.stubbles.websites.stubAbstractPageElement'); 10 10 /** 11 * Interfacefor a memphis page element.11 * Basic implementation for a memphis page element. 12 12 * 13 13 * @package stubbles 14 14 * @subpackage websites_memphis 15 15 */ 16 interface stubMemphisPageElement extends stubPageElement16 abstract class stubMemphisPageElement extends stubAbstractPageElement 17 17 { 18 18 /** 19 * set the source of the element19 * for which part the page element applies 20 20 * 21 * @ param string $source21 * @var array<string> 22 22 */ 23 p ublic function setSource($source);23 protected $parts = array(); 24 24 25 25 /** 26 * returns the source of the element 26 * checks whether the page element is available or not 27 * 28 * A memphis page element is available if the context contains a member with 29 * key part and if the value of this member is inside of the configured parts. 27 30 * 28 * @return string 31 * @param stubRequest $request the request data 32 * @param stubSession $session current session 33 * @param stubResponse $response contains response data 34 * @param array $context optional additional context data 35 * @return bool 29 36 */ 30 public function getSource(); 37 public function isAvailable(stubRequest $request, stubSession $session, stubResponse $response, array $context = array()) 38 { 39 if (isset($context['part']) == false) { 40 return false; 41 } 42 43 return in_array($context['part'], $this->parts); 44 } 45 46 /** 47 * set the parts for which the element should be applied 48 * 49 * @param string $parts 50 */ 51 public function setParts($parts) 52 { 53 $this->parts = array_map('trim', explode(',', $parts)); 54 } 31 55 } 32 56 ?>
