dbHandle = new c_mysqlDb ( self::DBHOST, self::DBUSER, self::DBPASS, self::DBNAME); if (is_string ($locale)) $this->dbHandle->setLocale ($locale); } catch (Exception $e) { if ($this->dbHandle !== NULL) unset ($this->dbHandle); print "
\n"; print "Konnte Datenbank nicht initialisieren!\n"; print $e; print "\n"; exit (1); } resetErrExceptionMapping (); $this->_persons = $this->getPersons (); } function __destruct () { if (isset ($this->persons)) unset ($this->persons); if ($this->dbHandle !== NULL) unset ($this->dbHandle); } //private function getPersons () function getPersons () { $result = NULL; setErrExceptionMapping (); try { $resId = $this->dbHandle->query ( 'SELECT * from personsView ORDER BY surname, firstname'); $_result = $this->dbHandle->getObject ( $resId, 'c_person', array (NULL)); $this->dbHandle->freeResult ($resId); } catch (Exception $e) { print "jokus
"; print $e; print ""; } resetErrExceptionMapping (); foreach ($_result as $res) $result[$res->get_personId ()] = $res; unset ($_result); return $result; } function personSearch () { $names = array (); foreach ($this->_persons as $person) $names[$person->get_surname ()][] = array ($person->get_firstname (), $person); $this->assign ('names', $names); return $this->fetch ('personAdmin/personSearch.tpl.php'); } function personForm () { return $this->fetch ('personAdmin/personForm.tpl.php'); } function show () { $this->assign ('personSearch', $this->personSearch ()); $this->assign ('personForm', $this->personForm ()); $this->display ('personAdmin/personAdmin.tpl.php'); } }; ?>