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

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