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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations)
Tue Mar 11 00:12:45 2003 UTC (21 years, 6 months ago) by joko
Branch: MAIN
Changes since 1.5: +6 -2 lines
+ fixed metadata for phpDocumentor

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

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