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

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