/[cvs]/nfo/php/libs/org.netfrag.glib/Application/AbstractBase.php
ViewVC logotype

Contents of /nfo/php/libs/org.netfrag.glib/Application/AbstractBase.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations)
Tue Mar 11 01:09:59 2003 UTC (21 years, 6 months ago) by joko
Branch: MAIN
Changes since 1.6: +5 -1 lines
+ fixed metadata for phpDocumentor

1 <?
2 /**
3 * This file contains the Application::AbstractBase class.
4 *
5 * @author Andreas Motl <andreas.motl@ilo.de>
6 * @package org.netfrag.glib
7 * @name Application::AbstractBase
8 *
9 */
10
11
12 // ---------------------------------------------------------------------------
13 // $Id: AbstractBase.php,v 1.6 2003/03/11 00:12:45 joko Exp $
14 // ---------------------------------------------------------------------------
15 // $Log: AbstractBase.php,v $
16 // Revision 1.6 2003/03/11 00:12:45 joko
17 // + fixed metadata for phpDocumentor
18 //
19 // Revision 1.5 2003/03/10 23:45:29 joko
20 // + fixed metadata for phpDocumentor
21 //
22 // Revision 1.4 2003/03/10 22:58:48 joko
23 // + fixed metadata for phpDocumentor
24 //
25 // Revision 1.3 2003/03/05 23:16:47 joko
26 // updated docu - phpDocumentor is very strict about its 'blocks'...
27 //
28 // Revision 1.2 2003/03/03 21:11:01 joko
29 // mungled the namespaces
30 //
31 // Revision 1.1 2003/02/09 17:05:57 joko
32 // + initial commit
33 //
34 // ---------------------------------------------------------------------------
35
36
37 require_once('php_extensions.php');
38 php::export_symbols( 'is_hash', 'array_join_merge', 'session_register_safe', 'array_init' );
39
40 loadModule('Class::Inner');
41
42 /**
43 * --- Application::AbstractBase
44 *
45 * @author Andreas Motl <andreas.motl@ilo.de>
46 *
47 * @package org.netfrag.glib
48 * @subpackage Application
49 * @name Application::AbstractBase
50 *
51 */
52 class Application_AbstractBase extends Class_Inner {
53
54 var $children = array();
55
56 function constructor() {
57 parent::constructor();
58 $this->log( get_class($this) . "->new", PEAR_LOG_DEBUG );
59
60 //print "BASE<br>";
61
62 $build = array();
63 $defaults = array(
64 parent_name => get_class($this),
65 run => 'start',
66 );
67
68 foreach ($this->children as $dummykey => $block) {
69
70 $class_names = array();
71 $ref_names = array();
72
73 // build declaration (classnames, objectnames)
74 if (is_hash($block)) {
75 foreach ($block as $key => $val) {
76 //array_push($class_names, $key);
77 $args_t = array_join_merge($defaults, array( class_names => array($key) ) );
78 $args = array_join_merge($args_t, $val);
79 //print Dumper($args);
80 array_push($build, $args);
81 }
82
83 } else {
84 foreach ($block as $idx => $entry) {
85 array_push($class_names, $entry);
86 }
87 $args = array( class_names => $class_names );
88 array_push($build, array_join_merge($defaults, $args ));
89
90 }
91
92
93 }
94
95 //print Dumper($build);
96 //exit;
97
98 // create child objects
99 //$args = array( parent_name => get_class($this), run => 'start', class_names => $class_names, ref_names => $ref_names );
100 foreach ($build as $declaration) {
101 //$args = array_join_merge($defaults, $declaration);
102 //print Dumper($declaration);
103 $this->perform( $declaration );
104 }
105
106 }
107
108 function _init_database() {
109 // Database
110 //print "database<br>";
111 $this->log( get_class($this) . "->_init_database: connecting...", PEAR_LOG_DEBUG);
112 //print "dsn: " . $site->config[dbinfo][dsn] . "<br>";
113 $this->db = DB::connect($this->config[dbinfo][dsn], true);
114 if (DB::isError($this->db)) {
115 // TODO
116 // (notifyBox!!! (will we get there?)) else:
117 // do a redirect to a completely static "out-of-order-page" ("maintenance.html")
118 // or do a die here?
119 $error_log = $this->db->getMessage();
120 $this->log( "init_site: database ERROR (dsn=" . $this->config[dbinfo][dsn] . "): \"$error_log\"", PEAR_LOG_EMERG);
121 // TODO: include email-address, too (from config, if available there)
122 gen_badDbError();
123 exit;
124 } else {
125 $this->db->setFetchMode(DB_FETCHMODE_ASSOC);
126 $this->log( get_class($this) . "->_init_database: ok", PEAR_LOG_DEBUG);
127 }
128 }
129
130 }
131
132 ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed