OSDN Git Service

Merge branch 'skinnable-master' of sakamocchi@git.sourceforge.jp:/gitroot/nucleus...
[nucleus-jp/nucleus-next.git] / build / testcases / NP_ItemOptionTestCase3.php
1 <?php
2 /**
3  * +-------------------------------------------------------
4  * |            Nucleus ItemOption TestCase              
5  * +-------------------------------------------------------
6  * |
7  * +-INFO--------------------------------------------------
8  * |  Author:   Jeroen Budts (TeRanEX)
9  * |  URL:      http://budts.be/weblog/
10  * |  JabberID: teranex@jabber.org
11  * |
12  * +-TODO--------------------------------------------------
13  * | 
14  * +-HISTORY-----------------------------------------------
15  * |  
16  * |
17  * +-CVS---------------------------------------------------
18  * | $Id: NP_ItemOptionTestCase3.php 1417 2009-10-30 06:13:29Z ehui $
19  * |
20  * +-------------------------------------------------------
21  */
22
23 class NP_ItemOptionTestCase3 extends NucleusPlugin {
24
25 // --------- Plug-in Info ---------------------------------
26   // name of plugin
27   function getName() {
28     return 'ItemOptionTestCase3';
29   }
30   
31   // author of plugin
32   function getAuthor() {
33     return 'TeRanEX';
34   }
35   // an URL to the plugin website
36   function getURL() {
37     return 'http://budts.be/weblog/';
38   }
39   
40   // version of the plugin
41   function getVersion() {
42     return '0.1';
43   }
44   
45   // a description to be shown on the installed plugins listing
46   function getDescription() {
47     return 'A plugin to test the itemoptions';
48   }
49
50   function getEventList() {
51     return array('PrePluginOptionsEdit', 'PostPluginOptionsUpdate');
52   }
53   
54   //supported features
55   function supportsFeature($what) {
56     switch($what) {
57       case 'SqlTablePrefix':
58         return 1;
59       default:
60         return 0;
61     }
62   }
63   
64   function getMinNucleusVersion() {
65     return 250;
66   }
67 // --------- Install and Uninstall functions --------------
68   function install() {
69     $this->createItemOption('TestCase3', 'TestCaseOption:TextArea', 'textarea', 'This is the default value for my textareatest');
70   }
71   
72   function event_PrePluginOptionsEdit($data){
73           echo 'event: PrePluginOptionsEdit<br/>';
74           echo '$data: '.$data.'<br/>';
75           echo 'context: '.$data['context'].'<br/>';
76           echo 'contextid: '.$data['contextid'].'<br/>';
77           for ($i = 0; $i < count($data['options']); $i++) {
78                   echo 'option-name: '.$data['options'][$i]['name'].' value: '.$data['options'][$i]['value'].'<br/>';
79           }
80   }
81
82   function event_PostPluginOptionsUpdate($data){
83           echo 'event: PostPluginOptionsEdit';
84           echo '$data: '.$data.' | context: '.$data['context'].'<br/>';
85           echo 'itemid: '.$data['itemid'].'<br/>';
86           echo 'item title: '.$data['item']['title'].'<br/>';
87   }
88
89 // --------- do...-Functions ------------------------------
90   function doTemplateVar(&$item) {
91       //currently we do nothing :-)
92           echo $this->getItemOption($item->itemid, 'TestCase3');
93   }
94   
95   function doSkinVar($skinType) {
96       global $blog;
97           $mostTest = $this->getItemOptionTop('TestCase3', 15, 'asc');
98         for($i=0; $i < count($mostTest); $i++) {
99                 echo '<br/>item: '.$mostTest[$i]['id'].': '.$mostTest[$i]['value'];
100         }
101   }
102   
103 }
104 ?>