Öffentliche Methoden | |
| Model ($modelid='') | |
| available ($id) | |
| getAll () | |
| load () | |
| save () | |
| getProperties () | |
| add ($name= '') | |
| getDefaultId () | |
| setDefault () | |
| delete () | |
Öffentliche Attribute | |
| $modelid = 0 | |
| $error = '' | |
| $projectid | |
| $name = '' | |
| $isDefault = false | |
Definiert in Zeile 47 der Datei Model.class.php.
| Model::add | ( | $ | name = '' |
) |
Modell hinzufuegen
| String | Name des Modells (optional) |
Definiert in Zeile 165 der Datei Model.class.php.
Benutzt $db, $name und db_connection().
00166 { 00167 if ( $name != '' ) 00168 $this->name = $name; 00169 00170 $db = db_connection(); 00171 00172 $sql = new Sql('SELECT MAX(id) FROM {t_model}'); 00173 $this->modelid = intval($db->getOne($sql->query))+1; 00174 00175 // Modell hinzuf?gen 00176 $sql = new Sql( 'INSERT INTO {t_model} '. 00177 "(id,projectid,name,extension,is_default) VALUES( {modelid},{projectid},{name},'',0 )"); 00178 00179 $sql->setInt ('modelid' ,$this->modelid ); 00180 $sql->setInt ('projectid',$this->projectid ); 00181 $sql->setString('name' ,$this->name ); 00182 00183 // Datenbankbefehl ausfuehren 00184 $db->query( $sql->query ); 00185 }
| Model::available | ( | $ | id | ) |
Stellt fest, ob die angegebene Id existiert.
Definiert in Zeile 70 der Datei Model.class.php.
Benutzt $db und db_connection().
Wird benutzt von IndexAction::evaluateRequestVars() und IndexAction::login().
00071 { 00072 $db = db_connection(); 00073 00074 $sql = new Sql('SELECT 1 FROM {t_model} '. 00075 ' WHERE id={id}'); 00076 $sql->setInt('id' ,$id ); 00077 00078 return intval($db->getOne($sql->query)) == 1; 00079 }
| Model::delete | ( | ) |
Entfernen des Projektmodells aus der Datenbank Es wird dabei nicht geprueft, ob noch ein anders Projektmodell vorhanden ist.
Definiert in Zeile 236 der Datei Model.class.php.
Benutzt $db und db_connection().
00237 { 00238 $db = db_connection(); 00239 00240 // Modell l?schen 00241 $sql = new Sql( 'DELETE FROM {t_model} WHERE id={modelid}' ); 00242 $sql->setInt( 'modelid',$this->modelid ); 00243 $db->query( $sql->query ); 00244 00245 // Anderes Modell auf "Default" setzen (sofern vorhanden) 00246 $sql = new Sql( 'SELECT id FROM {t_model} WHERE projectid={projectid}' ); 00247 $sql->setInt( 'projectid',$this->projectid ); 00248 $new_default_modelid = $db->getOne( $sql->query ); 00249 00250 $sql = new Sql( 'UPDATE {t_model} SET is_default=1 WHERE id={modelid}' ); 00251 $sql->setInt( 'modelid',$new_default_modelid ); 00252 $db->query( $sql->query ); 00253 }
| Model::getAll | ( | ) |
Lesen aller Projektmodelle aus der Datenbank
Definiert in Zeile 87 der Datei Model.class.php.
Benutzt $db, $SESS und db_connection().
Wird benutzt von Page::publish().
00088 { 00089 global $SESS; 00090 $db = db_connection(); 00091 00092 $sql = new Sql( "SELECT id,name FROM {t_model} ". 00093 " WHERE projectid = {projectid} ". 00094 " ORDER BY name" ); 00095 00096 if ( isset($this) ) 00097 $sql->setInt('projectid',$this->projectid ); 00098 else $sql->setInt('projectid',$SESS['projectid'] ); 00099 00100 return $db->getAssoc( $sql->query ); 00101 }
| Model::getDefaultId | ( | ) |
Definiert in Zeile 188 der Datei Model.class.php.
Benutzt $db, $SESS, db_connection() und Session::getProject().
Wird benutzt von TreeAction::load().
00189 { 00190 global $SESS; 00191 $db = db_connection(); 00192 00193 $sql = new Sql( 'SELECT id FROM {t_model} '. 00194 ' WHERE projectid={projectid}'. 00195 ' ORDER BY is_default DESC' ); 00196 if ( isset($this->projectid) ) 00197 $sql->setInt('projectid',$this->projectid ); 00198 else 00199 { 00200 $project = Session::getProject(); 00201 $sql->setInt('projectid',$project->projectid); 00202 } 00203 00204 return $db->getOne( $sql->query ); 00205 }
| Model::getProperties | ( | ) |
Alle notwendigen Eigenschaften dieses Projektmodells werden als Array zurueckgegeben
Definiert in Zeile 152 der Datei Model.class.php.
00153 { 00154 return Array( 'modelid' =>$this->modelid, 00155 'projectid'=>$this->projectid, 00156 'isDefault'=>$this->isDefault, 00157 'name' =>$this->name ); 00158 }
| Model::load | ( | ) |
Lesen aus der Datenbank
Definiert in Zeile 107 der Datei Model.class.php.
Benutzt $db und db_connection().
00108 { 00109 $db = db_connection(); 00110 00111 $sql = new Sql( 'SELECT * FROM {t_model}'. 00112 ' WHERE id={modelid}' ); 00113 $sql->setInt( 'modelid',$this->modelid ); 00114 00115 $row = $db->getRow( $sql->query ); 00116 00117 $this->name = $row['name' ]; 00118 $this->projectid = $row['projectid']; 00119 00120 if ( $row['is_default'] == '1' ) 00121 $this->isDefault = true; 00122 else $this->isDefault = false; 00123 }
| Model::Model | ( | $ | modelid = '' |
) |
| Model::save | ( | ) |
Speichern des Projektmodells
Definiert in Zeile 129 der Datei Model.class.php.
Benutzt $db und db_connection().
00130 { 00131 $db = db_connection(); 00132 00133 // Gruppe speichern 00134 $sql = new Sql( 'UPDATE {t_model} '. 00135 ' SET name = {name} '. 00136 ' WHERE id={modelid}' ); 00137 $sql->setString( 'name' ,$this->name ); 00138 00139 $sql->setInt( 'modelid',$this->modelid ); 00140 00141 // Datenbankabfrage ausfuehren 00142 $db->query( $sql->query ); 00143 }
| Model::setDefault | ( | ) |
Definiert in Zeile 210 der Datei Model.class.php.
Benutzt $db, $SESS und db_connection().
00211 { 00212 global $SESS; 00213 $db = db_connection(); 00214 00215 // Zuerst alle auf nicht-Standard setzen 00216 $sql = new Sql( 'UPDATE {t_model} '. 00217 ' SET is_default = 0 '. 00218 ' WHERE projectid={projectid}' ); 00219 $sql->setInt('projectid',$this->projectid ); 00220 $db->query( $sql->query ); 00221 00222 // Jetzt die gew?nschte Sprachvariante auf Standard setzen 00223 $sql = new Sql( 'UPDATE {t_model} '. 00224 ' SET is_default = 1 '. 00225 ' WHERE id={modelid}' ); 00226 $sql->setInt('modelid',$this->modelid ); 00227 $db->query( $sql->query ); 00228 }
| Model::$error = '' |
Definiert in Zeile 50 der Datei Model.class.php.
| Model::$isDefault = false |
Definiert in Zeile 54 der Datei Model.class.php.
| Model::$modelid = 0 |
| Model::$name = '' |
| Model::$projectid |
Definiert in Zeile 51 der Datei Model.class.php.
1.5.8