Index: trunk/extensions/Wikidata/OmegaWiki/Record.php |
— | — | @@ -1,6 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | require_once('Attribute.php'); |
| 5 | +require_once('RecordHelper.php'); |
5 | 6 | |
6 | 7 | interface Record { |
7 | 8 | public function getStructure(); |
— | — | @@ -12,9 +13,11 @@ |
13 | 14 | protected $structure; |
14 | 15 | protected $values = array(); |
15 | 16 | protected $type = null; |
| 17 | + protected $helper=null; |
16 | 18 | |
17 | 19 | public function __construct($structure) { |
18 | 20 | $this->structure = $structure; |
| 21 | + $this->helper=new RecordHelper($this); |
19 | 22 | } |
20 | 23 | |
21 | 24 | public function getStructure() { |
Index: trunk/extensions/Wikidata/OmegaWiki/RecordHelper.php |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class RecordHelperFactory { |
| 5 | + function __construct() { |
| 6 | + # --- |
| 7 | + } |
| 8 | + |
| 9 | + function getRecordHelper($record) { |
| 10 | + $type=$record->type(); |
| 11 | + if (empty($type)) |
| 12 | + return null; |
| 13 | + switch($type) { |
| 14 | + case "expression": |
| 15 | + echo "express!"; |
| 16 | + break; |
| 17 | + case "synonyms-translations": |
| 18 | + echo "sinner!"; |
| 19 | + break; |
| 20 | + } |
| 21 | + |
| 22 | + } |
| 23 | +} |
| 24 | +?> |