~sylar-developers/sylar/dev

« back to all changes in this revision

Viewing changes to sylar/classes/presentation/html/components/Form.php

  • Committer: g.giusti at giano-solutions
  • Date: 2008-05-21 19:55:11 UTC
  • Revision ID: g.giusti@giano-solutions.com-20080521195511-t4ga5dfh6d55q5db
New Html Componenents Presentation layer

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/*
 
3
 * This file is part of Sylar.
 
4
 *
 
5
 * Sylar is free software: you can redistribute it and/or modify
 
6
 * it under the terms of the GNU Lesser General Public License as published by
 
7
 * the Free Software Foundation, either version 3 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * Sylar 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
 
13
 * GNU Lesser General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Lesser General Public License
 
16
 * along with Sylar.  If not, see <http://www.gnu.org/licenses/>.
 
17
 * 
 
18
 * @copyright Copyright Sylar Development Team
 
19
 * @license http://www.gnu.org/licenses/ GNU Public License V2.0
 
20
 * @see https://launchpad.net/sylar/
 
21
 * @see http://www.giano-solutions.com
 
22
 */
 
23
 
 
24
 
 
25
 
 
26
import('sylar.presentation.html.Html');
 
27
 
 
28
 
 
29
/**
 
30
 * Html Form Element
 
31
 * 
 
32
 * This object manage an HTML Form.
 
33
 * 
 
34
 * @package Sylar
 
35
 * @version 1.0
 
36
 * @since 14/May/08
 
37
 * @author Gianluca Giusti [brdp] <g.giusti@giano-solutions.com>
 
38
 * @copyright Sylar Development Team
 
39
 */
 
40
 
 
41
class Sylar_Form extends Sylar_Html{
 
42
        // An array of Sylar_HtmlDiv
 
43
        private $aDivArchive;
 
44
        
 
45
        function __construct(){
 
46
                // Inizialize the array
 
47
                $this->aDivArchive = array();
 
48
        }
 
49
        function __destruct(){
 
50
                // nothing to do at the moment
 
51
        }
 
52
 
 
53
        
 
54
        
 
55
        
 
56
        //                                                                                                                        Public Methods
 
57
        //__________________________________________________________________________
 
58
                
 
59
        
 
60
        /**
 
61
         * Add a Div to Body
 
62
         * 
 
63
         * @see Sylar_HtmlDiv
 
64
         * 
 
65
         * @return void
 
66
         * @param Sylar_HtmlDiv $oDiv the object with Div information and content
 
67
         */
 
68
        public function addDiv(Sylar_HtmlDiv $oDiv){
 
69
                if($oDiv != null){
 
70
                        $this->aDivArchive[] =  $oDiv;
 
71
                }
 
72
        }
 
73
        
 
74
        
 
75
        /**
 
76
         * return the Html source
 
77
         * it return html code of entire object
 
78
         * 
 
79
         * @return string
 
80
         */
 
81
        public function getHtmlSource(){
 
82
                return $this->render();
 
83
        }
 
84
        
 
85
        
 
86
        /**
 
87
         * Display the page
 
88
         * it prints the object Html source on screen
 
89
         * 
 
90
         * @return void
 
91
         */
 
92
        public function show(){
 
93
                echo $this->render();
 
94
        }       
 
95
                
 
96
        
 
97
        
 
98
        
 
99
        //                                                                                                                 Protected Methods
 
100
        //__________________________________________________________________________
 
101
        
 
102
        
 
103
        /**
 
104
         * Design Html BODY tag
 
105
         * it push all div in the body and prepare html code
 
106
         * 
 
107
         * @return string
 
108
         */
 
109
        protected function render(){
 
110
                $sTagHtml = "\n<body>\n";
 
111
                
 
112
                        // Floating Style in the page <style> #classname: etc... </style>
 
113
                        foreach ($this->aDivArchive as $val) {
 
114
                                $sTagHtml .= "\n\t".$val->getHtmlSource();
 
115
                        }
 
116
                
 
117
                $sTagHtml .= "\n\n</body>";
 
118
                
 
119
                return $sTagHtml;
 
120
        }       
 
121
}
 
122
 
 
123
 
 
124
 
 
125
?>
 
 
b'\\ No newline at end of file'