File: PhpTestModule.php

package info (click to toggle)
mysql-query-browser 1.1.6-1sarge0
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 36,320 kB
  • ctags: 24,680
  • sloc: pascal: 203,479; xml: 136,561; ansic: 47,502; cpp: 28,926; sh: 12,433; objc: 4,823; java: 1,849; php: 1,485; python: 1,225; sql: 1,128; makefile: 872
file content (85 lines) | stat: -rw-r--r-- 2,132 bytes parent folder | download
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
<?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);
	}

}
?>