Documentation is available at RSDEngineDBApplicationIndexFile.php
1 <?php
2 // RSDEngine: The Rapid and Secure Development Engine
3 // Copyright (C) 2003 Lukas Feiler
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 /**Contains just the class RSDEngineDBApplicationIndexFile.
20 *
21 * @package RSDEngine
22 * @author Lukas Feiler <lukas.feiler@chello.at>
23 * @copyright Lukas Feiler 2003
24 * @filesource
25 */
26
27 /**RSDEngineDBApplicationIndexFile extends RSDEngineFile.
28 */
29 require_once('RSDEngine/RSDEngineFile.php');
30
31
32 /**Generates a file called index.php to be put in the code directory.
33 *
34 * It is primary for demonstration purpose.
35 * It should only be generated for database backended applications.
36 *
37 * @author Lukas Feiler <lukas.feiler@chello.at>
38 * @version 0.1.9
39 * @copyright Lukas Feiler 2003
40 * @package RSDEngine
41 */
42 class RSDEngineDBApplicationIndexFile extends RSDEngineFile{
43
44 /**Returns the filename of this index file.
45 * @return String The string "index.php" will be returned.
46 */
47 function getFilename()
48 {
49 return "index.php";
50 }
51
52 /**Returns the code for the file index.php.
53 *
54 * Note that this method requires $this->config to be correctly
55 * filled with all configuration options of the RSDEngine.
56 * @see config
57 *
58 * @return String The code for index.php.
59 */
60 function getCode()
61 {
62 extract($this->config);
63 $authors = RSArrayUtil::toString(split("\n",$authors),"\n",'* @author %val');
64
65 $write = $this->config['writeIndexFile'];
66 $this->setWrite($write);
67
68 $data = '';
69 $data .="<?php\n" .
70 '/' . '**This file is the controller for the home page.' . "\n" .
71 '*' . "\n" .
72 $authors . "\n" .
73 '* @copyright ' . $copyright . "\n" .
74 '* @package ' . $projectName . "\n" .
75 '* @filesource' . "\n" .
76 '*/' . "\n" .
77 "\n" .
78 '/' . '**This controller requires authentication..' . "\n" .
79 "*/\n";
80 if ($webApplication) {
81 $data .= "require_once('model/" . $this->relatedFiles['dbApplicationPrivateInitFile']->getFilename() . "');\n";
82 } else {
83 $data .= "require_once('" . $this->relatedFiles['dbApplicationPrivateInitFile']->getFilename() . "');\n";
84 }
85
86 $links = '';
87 $rsdEngineDB =& $this->config['rsdEngineDB'];
88 reset($rsdEngineDB->tables);
89 while (list($key, $table) = each($rsdEngineDB->tables)) {
90 $name = ucfirst($table->getTableNameWithoutPrefix());
91 $get = 'get' . ucfirst($table->getTableNameWithoutPrefix()) . '.php';
92 $search = 'search' . ucfirst($table->getTableNameWithoutPrefix()) . '.php';
93 $links .= "<a href=\"$get\">get</a>/<a href=\"$search\">search</a> $name | ";
94 }
95
96 $data .="?>\n";
97 $data .= <<<END
98 <b>$projectName - $projectDescription</b><br>
99 <a href="logout.php">logout</a> $links<br>
100 -------------------------------------------------<br>
101 <br>
102 END;;; return $data;
103 }
104 }
105 ?>
Documentation generated on Mon, 8 Dec 2003 13:11:04 +0100 by phpDocumentor 1.2.3