/[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.3 - (hide annotations)
Wed Mar 5 23:16:47 2003 UTC (21 years, 6 months ago) by joko
Branch: MAIN
Changes since 1.2: +24 -1 lines
updated docu - phpDocumentor is very strict about its 'blocks'...

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

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