/[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.1 - (show annotations)
Sun Feb 9 17:05:57 2003 UTC (21 years, 7 months ago) by joko
Branch: MAIN
+ initial commit

1 <?
2 // ---------------------------------------------------------------------------
3 // $Id: Object.php,v 1.2 2003/02/03 05:01:48 joko Exp $
4 // ---------------------------------------------------------------------------
5 // $Log: Object.php,v $
6 // ---------------------------------------------------------------------------
7
8
9 class Application_AbstractBase extends DesignPattern_Bridge {
10
11 var $children = array();
12
13 function constructor() {
14 parent::constructor();
15 $this->log( get_class($this) . "->new", PEAR_LOG_DEBUG );
16
17 //print "BASE<br>";
18
19 $build = array();
20 $defaults = array(
21 parent_name => get_class($this),
22 run => 'start',
23 );
24
25 foreach ($this->children as $dummykey => $block) {
26
27 $class_names = array();
28 $ref_names = array();
29
30 // build declaration (classnames, objectnames)
31 if (is_hash($block)) {
32 foreach ($block as $key => $val) {
33 //array_push($class_names, $key);
34 $args_t = array_join_merge($defaults, array( class_names => array($key) ) );
35 $args = array_join_merge($args_t, $val);
36 //print Dumper($args);
37 array_push($build, $args);
38 }
39
40 } else {
41 foreach ($block as $idx => $entry) {
42 array_push($class_names, $entry);
43 }
44 $args = array( class_names => $class_names );
45 array_push($build, array_join_merge($defaults, $args ));
46
47 }
48
49
50 }
51
52 //print Dumper($build);
53 //exit;
54
55 // create child objects
56 //$args = array( parent_name => get_class($this), run => 'start', class_names => $class_names, ref_names => $ref_names );
57 foreach ($build as $declaration) {
58 //$args = array_join_merge($defaults, $declaration);
59 //print Dumper($declaration);
60 $this->_mkEmbeddedObjects( $declaration );
61 }
62
63 }
64
65 function _init_database() {
66 // Database
67 //print "database<br>";
68 $this->log( get_class($this) . "->_init_database: connecting...", PEAR_LOG_DEBUG);
69 //print "dsn: " . $site->config[dbinfo][dsn] . "<br>";
70 $this->db = DB::connect($this->config[dbinfo][dsn], true);
71 if (DB::isError($this->db)) {
72 // TODO
73 // (notifyBox!!! (will we get there?)) else:
74 // do a redirect to a completely static "out-of-order-page" ("maintenance.html")
75 // or do a die here?
76 $error_log = $this->db->getMessage();
77 $this->log( "init_site: database ERROR (dsn=" . $this->config[dbinfo][dsn] . "): \"$error_log\"", PEAR_LOG_EMERG);
78 // TODO: include email-address, too (from config, if available there)
79 gen_badDbError();
80 exit;
81 } else {
82 $this->db->setFetchMode(DB_FETCHMODE_ASSOC);
83 $this->log( get_class($this) . "->_init_database: ok", PEAR_LOG_DEBUG);
84 }
85 }
86
87 }
88
89 ?>

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