File: PhpTestModule.php

package info (click to toggle)
mysql-admin 1.2.5rc-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 80,944 kB
  • ctags: 43,103
  • sloc: sql: 295,916; pascal: 256,535; cpp: 74,487; ansic: 68,881; objc: 26,417; sh: 16,867; yacc: 10,755; java: 9,917; xml: 8,453; php: 2,806; python: 2,068; makefile: 1,252; perl: 3
file content (93 lines) | stat: -rw-r--r-- 2,442 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php

class PhpTestModule {
	public static function getModuleInfo() {
		return Grt::getModuleInfoXml('PhpTestModule', '');
	}

	public static function helloWorld() {
		Grt::getInstance()->addMsg("Hello world!");
		
		return 'Hello world!';
	}
	
	public static function upperCase($str) {
		return strtoupper($str);
	}
	
	public static function getListSize(GrtList $list) {
		return $list->size();
	}

	public static function concatStrings($s1, $s2) {
		return $s1 . $s2;
	}

	public static function throwException() {
		throw new Exception("Exception Test");
	}
	
	public static function getMessages() {
		$msgList = new GrtList("GrtMessage", "");
		$msgs = Grt::getInstance()->getMessages();

		for ($i = 0; $i < count($msgs); $i++) {
			$msgList->addObject($msgs[$i]);
		}

		Grt::getInstance()->clearMessages();

		return $msgList;
	}

	public static function getGlobalString($objectPath) {
		Grt::getInstance()->addMsg("Calling getGrtGlobalAsString.");
		Grt::getInstance()->addMsgDetailToLastMsg(
				"applicationPath = " . Grt::getInstance()->getApplicationPath());
		Grt::getInstance()->addMsgDetailToLastMsg(
				"callback.class = "
						. get_class(Grt::getInstance()->getCallback()));

		return Grt::getInstance()->getGrtGlobalAsString($objectPath);
	}
	
	public static function testCallbacks() {
		$root = Grt::getInstance()->getGrtGlobalAsObject("/");
		
		$list = new GrtStringList("", "");
		$list->add("Item1");
		$list->add("Item2");		
		$root->addObject("stringList", $list);
		
		$obj = new com_mysql_grt_GrtObject(null);
		$obj->setName("testObject");		
		$root->addObject("object", $obj);
		
		$map = new GrtStringHashMap("", "");
		$map->add("mike", "mzinner@mysql.com");
		$map->add("alfredo", "alfredo@mysql.com");
		$root->addObject("emails", $map);
		
		$catalog = new com_mysql_grt_db_Catalog(null);
		$catalog->setName("sourceCatalog");
		
		$schemata = new GrtObjectList("com_mysql_grt_db_Schema", "");
		$catalog->setSchemata($schemata);
		
		$schema = new com_mysql_grt_db_Schema($catalog);
		$schema->setName("scott");
		$schemata->add($schema);
		
		$root->addObject("sourceCatalog", $catalog);
	}
	
	public static function printPhpInfo() {
		phpinfo();
	}
	
	public static function debugTest() {
		echo xdebug_call_file() . ", func: " . xdebug_call_function() . ", Ln" . xdebug_call_line();
		xdebug_break();
	}
}
?>