openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 28c59f3f0dc540a9e17c8eb28b01c31246bc3db5
parent 6049ec52369672aec2672f4e7cb6cea4ee163679
Author: dankert <devnull@localhost>
Date:   Sun, 19 Dec 2004 16:23:56 +0100

Anpassung Session-Funktionen

Diffstat:
objectClasses/Language.class.php | 7+++++--
objectClasses/Object.class.php | 21+++++++++++++++------
objectClasses/Project.class.php | 42++++++++++++++++++++++++++++++++++--------
objectClasses/Template.class.php | 36++++++++++++++++++++++--------------
4 files changed, 76 insertions(+), 30 deletions(-)

diff --git a/objectClasses/Language.class.php b/objectClasses/Language.class.php @@ -20,7 +20,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ -// Revision 1.4 2004-12-15 23:18:36 dankert +// Revision 1.5 2004-12-19 15:23:56 dankert +// Anpassung Session-Funktionen +// +// Revision 1.4 2004/12/15 23:18:36 dankert // Anpassung an Session-Funktionen // // Revision 1.3 2004/11/10 22:46:18 dankert @@ -179,7 +182,7 @@ class Language $sql = new Sql( 'UPDATE {t_language} '. ' SET is_default = 0 '. ' WHERE projectid={projectid}' ); - $sql->setInt('projectid',$SESS['projectid'] ); + $sql->setInt('projectid',$this->projectid ); $db->query( $sql->query ); // Jetzt die gew?nschte Sprachvariante auf Standard setzen diff --git a/objectClasses/Object.class.php b/objectClasses/Object.class.php @@ -20,7 +20,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ -// Revision 1.12 2004-12-15 23:18:09 dankert +// Revision 1.13 2004-12-19 15:23:56 dankert +// Anpassung Session-Funktionen +// +// Revision 1.12 2004/12/15 23:18:09 dankert // Anpassung an Session-Funktionen // // Revision 1.11 2004/11/29 23:54:36 dankert @@ -234,9 +237,15 @@ class Object global $SESS; $db = db_connection(); - if ( !isset($this->projectid) ) - $projectid = $SESS['projectid']; - else $projectid = $this->projectid; + if ( ! isset($this->projectid) ) + { + $project = Session::getProject(); + $projectid = $project->projectid; + } + else + { + $projectid = $this->projectid; + } $sql = new Sql('SELECT id from {t_object} '. ' WHERE projectid={projectid}'); @@ -592,8 +601,8 @@ class Object $db = db_connection(); $sql = new Sql('SELECT COUNT(*) FROM {t_name} '.' WHERE objectid ={objectid}'.' AND languageid={languageid}'); - $sql->setInt('objectid' , $this->objectid ); - $sql->setInt('languageid', $SESS['languageid']); + $sql->setInt( 'objectid' , $this->objectid ); + $sql->setInt( 'languageid', $this->languageid ); $count = $db->getOne($sql->query); if ($count > 0) diff --git a/objectClasses/Project.class.php b/objectClasses/Project.class.php @@ -20,7 +20,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ -// Revision 1.6 2004-12-15 23:16:58 dankert +// Revision 1.7 2004-12-19 15:23:56 dankert +// Anpassung Session-Funktionen +// +// Revision 1.6 2004/12/15 23:16:58 dankert // Anpassung an Session-Funktionen // // Revision 1.5 2004/11/10 22:47:57 dankert @@ -97,7 +100,8 @@ class Project $db = db_connection(); $sql = new Sql( 'SELECT id FROM {t_language}'. - ' WHERE projectid={projectid} ' ); + ' WHERE projectid={projectid} '. + ' ORDER BY name' ); $sql->setInt ('projectid',$this->projectid); return $db->getCol( $sql->query ); @@ -109,7 +113,8 @@ class Project $db = db_connection(); $sql = new Sql( 'SELECT id FROM {t_projectmodel}'. - ' WHERE projectid= {projectid} ' ); + ' WHERE projectid= {projectid} '. + ' ORDER BY name' ); $sql->setInt ('projectid',$this->projectid); return $db->getCol( $sql->query ); @@ -225,6 +230,12 @@ class Project $sql->setInt ('projectid',$this->projectid ); $db->query( $sql->query ); + + // Modell anlegen + $model = new Model(); + $model->projectid = $this->projectid; + $model->name = 'html'; + $model->add(); // Sprache anlegen $language = new Language(); @@ -243,11 +254,26 @@ class Project $folder->isRoot = true; $folder->add(); - // Modell anlegen - $model = new Model(); - $model->projectid = $this->projectid; - $model->name = 'html'; - $model->add(); + // Template anlegen + $template = new Template(); + $template->projectid = $this->projectid; + $template->name = ''; + $template->modelid = $model->modelid; + $template->languageid = $language->languageid; + $template->extension = 'html'; + $template->src = '<html><body>...</body></html>'; + $template->add(); + $template->save(); + + // Beispiel-Seite anlegen + $page = new Page(); + $page->parentid = $folder->objectid; + $page->projectid = $this->projectid; + $page->languageid = $language->languageid; + $page->templateid = $template->templateid; + $page->filename = ''; + $page->name = 'OpenRat'; + $page->add(); } diff --git a/objectClasses/Template.class.php b/objectClasses/Template.class.php @@ -20,7 +20,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ -// Revision 1.6 2004-12-18 00:37:50 dankert +// Revision 1.7 2004-12-19 15:23:56 dankert +// Anpassung Session-Funktionen +// +// Revision 1.6 2004/12/18 00:37:50 dankert // Projekt aus Session lesen // // Revision 1.5 2004/12/15 23:16:26 dankert @@ -78,13 +81,13 @@ class Template * Dateierweiterung dieses Templates (abh?ngig von der Projektvariante) * @type String */ - var $extension; + var $extension=''; /** * Inhalt des Templates (abh?ngig von der Projektvariante) * @type String */ - var $src; + var $src=''; // Konstruktor function Template( $templateid='' ) @@ -146,8 +149,12 @@ class Template $sql->setInt( 'modelid' ,$this->modelid ); $row = $db->getRow( $sql->query ); - $this->extension = $row['extension']; - $this->src = $row['text']; + if ( isset($row['extension']) ) + { + $this->extension = $row['extension']; + $this->src = $row['text']; + } + } @@ -157,7 +164,7 @@ class Template function save() { if ( $this->name == "" ) - $this->name = lang('TEMPLATE').' #'.$this->templateid; + $this->name = lang('GLOBAL_TEMPLATE').' #'.$this->templateid; $db = db_connection(); @@ -166,7 +173,7 @@ class Template ' WHERE id={templateid}' ); $sql->setString( 'name' ,$this->name ); $sql->setInt ( 'templateid',$this->templateid ); - $row = $db->getRow( $sql->query ); + $db->query( $sql->query ); $sql = new Sql( 'SELECT COUNT(*) FROM {t_templatemodel}'. ' WHERE templateid={templateid}'. @@ -195,7 +202,7 @@ class Template $sql->setString( 'extension' ,$this->extension ); $sql->setString( 'src' ,$this->src ); $sql->setInt ( 'templateid' ,$this->templateid ); - $sql->setInt ( 'modelid' ,$this->modelid ); + $sql->setInt ( 'modelid' ,$this->modelid ); $db->query( $sql->query ); } @@ -234,7 +241,6 @@ class Template ' WHERE templateid={templateid}'. ' ORDER BY name ASC' ); $sql->setInt( 'templateid',$this->templateid ); - return $db->getCol( $sql->query ); } @@ -275,12 +281,14 @@ class Template /** - * Hinzuf?gen eines Templates - * @param String Name des Templates + * Hinzufuegen eines Templates + * @param String Name des Templates (optional) */ - function add( $name ) + function add( $name='' ) { - global $SESS; + if ( !empty($name) ) + $this->name = $name; + $db = db_connection(); $sql = new Sql('SELECT MAX(id) FROM {t_template}'); @@ -291,7 +299,7 @@ class Template ' VALUES({templateid},{name},{projectid})' ); $sql->setInt ('templateid',$this->templateid ); $sql->setString('name' ,$name ); - $sql->setInt ('projectid' ,$SESS['projectid']); + $sql->setInt ('projectid' ,$this->projectid ); $db->query( $sql->query ); }