Location: PHPKode > projects > Aukyla Document Management System > doc/html/a00239.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>Aukyla PHP Framework</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="StyleSheet" href="auton.css" type="text/css" media="screen">
  </head>

  <body>
    <div id="mainmenu">
      <a href="http://www.auton.nl/" class="home">Home</a>
    </div>
    <div id="submenu">
      <a class="logo" href="http://www.auton.nl/"></a>

      <div class="head">Ads</div>
      <a href="http://sourceforge.net/"><img src="http://sourceforge.net/sflogo.php?group_id=116358&amp;type=1" alt="SourceForge.net Logo" style="padding: 2px 4px; width: 88px; height: 31px; border: 0px"></a>
      <a href="http://getfirefox.com/" title="Get Firefox - The Browser, Reloaded."><img src="http://www.mozilla.org/products/firefox/buttons/getfirefox_small.png" alt="Get Firefox" style="width: 110px; height: 32px; border: 0px"></a>
    </div>
    <div id="main">
<!-- Generated by Doxygen 1.3.9.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">base</a></div>
<h1>Widgets.php</h1><div class="fragment"><pre class="fragment">00001 &lt;?php
00002 <span class="comment">/*</span>
00003 <span class="comment">     Widgets.php, provides the base set for widgets</span>
00004 <span class="comment">     Copyright (C) 2004 Arend van Beelen, Auton Rijnsburg</span>
00005 <span class="comment"></span>
00006 <span class="comment">     This program is free software; you can redistribute it and/or modify it</span>
00007 <span class="comment">     under the terms of the GNU General Public License as published by the Free</span>
00008 <span class="comment">     Software Foundation; either version 2 of the License, or (at your option)</span>
00009 <span class="comment">     any later version.</span>
00010 <span class="comment"></span>
00011 <span class="comment">     This program is distributed in the hope that it will be useful, but WITHOUT</span>
00012 <span class="comment">     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or</span>
00013 <span class="comment">     FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for</span>
00014 <span class="comment">     more details.</span>
00015 <span class="comment"></span>
00016 <span class="comment">     You should have received a copy of the GNU General Public License along</span>
00017 <span class="comment">     with this program; if not, write to the Free Software Foundation, Inc.,</span>
00018 <span class="comment">     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
00019 <span class="comment"></span>
00020 <span class="comment">     For any questions, comments or whatever, you may mail me at: hide@address.com</span>
00021 <span class="comment">*/</span>
00022 
<a name="l00029"></a><a class="code" href="a00166.html">00029</a> <span class="keyword">abstract</span> <span class="keyword">class </span><a class="code" href="a00166.html">Widget</a>
00030 {
<a name="l00038"></a><a class="code" href="a00166.html#a0">00038</a>         <span class="keyword">public</span> function __construct(<a class="code" href="a00096.html">Container</a> $parent, $<span class="keywordtype">id</span> = '')
00039         {
00040                 $this-&gt;reparent($parent);
00041                 $this-&gt;setID($<span class="keywordtype">id</span>);
00042                 $this-&gt;javaScript = array();
00043                 $this-&gt;cssClass = '';
00044                 $this-&gt;cssStyle = '';
00045         }
00046 
<a name="l00056"></a><a class="code" href="a00166.html#a1">00056</a>         <span class="keyword">public</span> function reparent(<a class="code" href="a00096.html">Container</a> $parent)
00057         {
00058                 $this-&gt;parent = $parent;
00059 
00060                 $parent-&gt;<a class="code" href="a00096.html#a1">addWidget</a>($<span class="keyword">this</span>);
00061                 $this-&gt;form = $parent-&gt;<a class="code" href="a00166.html#a5">form</a>();
00062         }
00063 
<a name="l00071"></a><a class="code" href="a00166.html#a2">00071</a>         <span class="keyword">public</span> function parent()
00072         {
00073                 <span class="keywordflow">return</span> $this-&gt;parent;
00074         }
00075 
<a name="l00081"></a><a class="code" href="a00166.html#a3">00081</a>         <span class="keyword">public</span> function setID($<span class="keywordtype">id</span>)
00082         {
00083                 $this-&gt;<span class="keywordtype">id</span> = $id;
00084         }
00085 
<a name="l00091"></a><a class="code" href="a00166.html#a4">00091</a>         <span class="keyword">public</span> function id()
00092         {
00093                 <span class="keywordflow">return</span> $this-&gt;id;
00094         }
00095 
<a name="l00102"></a><a class="code" href="a00166.html#a5">00102</a>         <span class="keyword">public</span> function form()
00103         {
00104                 <span class="keywordflow">return</span> $this-&gt;form;
00105         }
00106 
<a name="l00115"></a><a class="code" href="a00166.html#a6">00115</a>         <span class="keyword">public</span> function addJavaScript($event, $javaScript)
00116         {
00117                 <span class="keywordflow">if</span>(isset($this-&gt;javaScript[$event]))
00118                 {
00119                         $this-&gt;javaScript[$event] .= <span class="stringliteral">"; $javaScript"</span>;
00120                 }
00121                 <span class="keywordflow">else</span>
00122                 {
00123                         $this-&gt;javaScript[$event] = $javaScript;
00124                 }
00125         }
00126 
<a name="l00134"></a><a class="code" href="a00166.html#a7">00134</a>         <span class="keyword">public</span> function setCssClass($cssClass)
00135         {
00136                 $this-&gt;cssClass = $cssClass;
00137         }
00138 
<a name="l00147"></a><a class="code" href="a00166.html#a8">00147</a>         <span class="keyword">public</span> function setCssStyle($cssStyle)
00148         {
00149                 $this-&gt;cssStyle = $cssStyle;
00150         }
00151 
<a name="l00161"></a><a class="code" href="a00166.html#a9">00161</a>         <span class="keyword">public</span> function addCssStyle($cssStyle)
00162         {
00163                 <span class="keywordflow">if</span>($this-&gt;cssStyle != '')
00164                 {
00165                         $this-&gt;cssStyle .= '; ';
00166                 }
00167 
00168                 $this-&gt;cssStyle .= $cssStyle;
00169         }
00170 
00174         <span class="keyword">abstract</span> <span class="keyword">public</span> function show();
00175 
<a name="l00179"></a><a class="code" href="a00166.html#p0">00179</a>         <span class="keyword">protected</span> $parent;
00180 
<a name="l00184"></a><a class="code" href="a00166.html#p1">00184</a>         <span class="keyword">protected</span> $id;
00185 
<a name="l00189"></a><a class="code" href="a00166.html#p2">00189</a>         <span class="keyword">protected</span> $form;
00190 
<a name="l00194"></a><a class="code" href="a00166.html#p3">00194</a>         <span class="keyword">protected</span> $javaScript;
00195 
<a name="l00199"></a><a class="code" href="a00166.html#p4">00199</a>         <span class="keyword">protected</span> $cssClass;
00200 
<a name="l00204"></a><a class="code" href="a00166.html#p5">00204</a>         <span class="keyword">protected</span> $cssStyle;
00205 
<a name="l00210"></a><a class="code" href="a00166.html#b0">00210</a>         <span class="keyword">protected</span> function parentProperties()
00211         {
00212                 <span class="keywordflow">if</span>($this-&gt;<span class="keywordtype">id</span> != '')
00213                 {
00214                         $parentProperties = <span class="stringliteral">" id=\"{$this-&gt;id}\""</span>;
00215                 }
00216                 <span class="keywordflow">else</span>
00217                 {
00218                         $parentProperties = '';
00219                 }
00220                 <span class="keywordflow">if</span>($this-&gt;cssClass != '')
00221                 {
00222                         $parentProperties .= <span class="stringliteral">" class=\"{$this-&gt;cssClass}\""</span>;
00223                 }
00224                 <span class="keywordflow">if</span>($this-&gt;cssStyle != '')
00225                 {
00226                         $parentProperties .= <span class="stringliteral">" style=\"{$this-&gt;cssStyle}\""</span>;
00227                 }
00228                 foreach($this-&gt;javaScript as $event =&gt; $javaScript)
00229                 {
00230                         $parentProperties .= <span class="stringliteral">" $event=\"$javaScript\""</span>;
00231                 }
00232 
00233                 <span class="keywordflow">return</span> $parentProperties;
00234         }
00235 }
00236 
<a name="l00240"></a><a class="code" href="a00096.html">00240</a> <span class="keyword">class </span><a class="code" href="a00096.html">Container</a> <span class="keyword">extends</span> <a class="code" href="a00166.html">Widget</a>
00241 {
<a name="l00248"></a><a class="code" href="a00096.html#a0">00248</a>         function <a class="code" href="a00096.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $<span class="keywordtype">id</span> = '')
00249         {
00250                 parent::__construct($parent, $<span class="keywordtype">id</span>);
00251 
00252                 $this-&gt;children = array();
00253         }
00254 
<a name="l00263"></a><a class="code" href="a00096.html#a1">00263</a>         <span class="keyword">public</span> function <a class="code" href="a00096.html#a1">addWidget</a>(<a class="code" href="a00166.html">Widget</a> $widget)
00264         {
00265                 $this-&gt;children[] = $widget;
00266         }
00267 
<a name="l00271"></a><a class="code" href="a00096.html#a2">00271</a>         <span class="keyword">public</span> function <a class="code" href="a00096.html#a2">show</a>()
00272         {
00273                 foreach($this-&gt;children as $child)
00274                 {
00275                         $child-&gt;<a class="code" href="a00096.html#a2">show</a>();
00276                 }
00277         }
00278 
<a name="l00286"></a><a class="code" href="a00096.html#b0">00286</a>         <span class="keyword">protected</span> function <a class="code" href="a00096.html#b0">reparentChildrenTo</a>(<a class="code" href="a00096.html">Container</a> $container)
00287         {
00288                 $flag = <span class="keyword">false</span>;
00289                 foreach($this-&gt;children as $child)
00290                 {
00291                         <span class="keywordflow">if</span>($child === $container)
00292                         {
00293                                 $flag = <span class="keyword">true</span>;
00294                         }
00295                         <span class="keywordflow">else</span>
00296                         {
00297                                 $child-&gt;<a class="code" href="a00166.html#a1">reparent</a>($container);
00298                         }
00299                 }
00300 
00301                 $this-&gt;children = array();
00302                 <span class="keywordflow">if</span>($flag == <span class="keyword">true</span>)
00303                 {
00304                         $this-&gt;children[] = $container;
00305                 }
00306         }
00307 
<a name="l00311"></a><a class="code" href="a00096.html#p0">00311</a>         <span class="keyword">protected</span> $children;
00312 }
00313 
<a name="l00319"></a><a class="code" href="a00143.html">00319</a> <span class="keyword">class </span><a class="code" href="a00143.html">RootContainer</a> <span class="keyword">extends</span> <a class="code" href="a00096.html">Container</a>
00320 {
<a name="l00328"></a><a class="code" href="a00143.html#a0">00328</a>         <span class="keyword">public</span> function <a class="code" href="a00143.html#a0">__construct</a>($<span class="keywordtype">id</span> = '')
00329         {
00330                 $this-&gt;children = array();
00331                 $this-&gt;cssClass = '';
00332                 $this-&gt;cssStyle = '';
00333                 $this-&gt;form = null;
00334                 $this-&gt;<span class="keywordtype">id</span> = $id;
00335                 $this-&gt;javaScript = array();
00336                 $this-&gt;parent = null;
00337         }
00338 
<a name="l00339"></a><a class="code" href="a00143.html#p0">00339</a>         <span class="keyword">protected</span> $children;
<a name="l00340"></a><a class="code" href="a00143.html#p1">00340</a>         <span class="keyword">protected</span> $cssClass;
<a name="l00341"></a><a class="code" href="a00143.html#p2">00341</a>         <span class="keyword">protected</span> $cssStyle;
<a name="l00342"></a><a class="code" href="a00143.html#p3">00342</a>         <span class="keyword">protected</span> $id;
<a name="l00343"></a><a class="code" href="a00143.html#p4">00343</a>         <span class="keyword">protected</span> $form;
<a name="l00344"></a><a class="code" href="a00143.html#p5">00344</a>         <span class="keyword">protected</span> $javaScript;
<a name="l00345"></a><a class="code" href="a00143.html#p6">00345</a>         <span class="keyword">protected</span> $parent;
00346 }
00347 
<a name="l00357"></a><a class="code" href="a00142.html">00357</a> <span class="keyword">class </span><a class="code" href="a00142.html">RawWidget</a> <span class="keyword">extends</span> <a class="code" href="a00166.html">Widget</a>
00358 {
<a name="l00365"></a><a class="code" href="a00142.html#a0">00365</a>         <span class="keyword">public</span> function <a class="code" href="a00142.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $text = '')
00366         {
00367                 parent::__construct($parent);
00368 
00369                 self::setText($text);
00370         }
00371 
<a name="l00377"></a><a class="code" href="a00142.html#a1">00377</a>         <span class="keyword">public</span> function <a class="code" href="a00142.html#a1">setText</a>($text)
00378         {
00379                 $this-&gt;text = $text;
00380         }
00381 
<a name="l00385"></a><a class="code" href="a00142.html#a2">00385</a>         <span class="keyword">public</span> function <a class="code" href="a00142.html#a2">show</a>()
00386         {
00387                 <a class="code" href="a00134.html#e5">Output::write</a>($this-&gt;text);
00388         }
00389 
<a name="l00393"></a><a class="code" href="a00142.html#p0">00393</a>         <span class="keyword">protected</span> $text;
00394 }
00395 
<a name="l00404"></a><a class="code" href="a00141.html">00404</a> <span class="keyword">class </span><a class="code" href="a00141.html">RawContainer</a> <span class="keyword">extends</span> <a class="code" href="a00096.html">Container</a>
00405 {
<a name="l00412"></a><a class="code" href="a00141.html#a0">00412</a>         <span class="keyword">public</span> function <a class="code" href="a00141.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $text = '')
00413         {
00414                 parent::__construct($parent);
00415 
00416                 self::setText($text);
00417         }
00418 
<a name="l00424"></a><a class="code" href="a00141.html#a1">00424</a>         <span class="keyword">public</span> function <a class="code" href="a00141.html#a1">setText</a>($text)
00425         {
00426                 $this-&gt;text = $text;
00427         }
00428 
<a name="l00432"></a><a class="code" href="a00141.html#a2">00432</a>         <span class="keyword">public</span> function <a class="code" href="a00141.html#a2">show</a>()
00433         {
00434                 <a class="code" href="a00134.html#e5">Output::write</a>($this-&gt;text);
00435                 parent::show();
00436         }
00437 
<a name="l00441"></a><a class="code" href="a00141.html#p0">00441</a>         <span class="keyword">protected</span> $text;
00442 }
00443 
<a name="l00450"></a><a class="code" href="a00116.html">00450</a> <span class="keyword">class </span><a class="code" href="a00116.html">Label</a> <span class="keyword">extends</span> <a class="code" href="a00096.html">Container</a>
00451 {
<a name="l00458"></a><a class="code" href="a00116.html#a0">00458</a>         <span class="keyword">public</span> function <a class="code" href="a00116.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $text = '')
00459         {
00460                 parent::__construct($parent);
00461 
00462                 self::setText($text);
00463         }
00464 
<a name="l00470"></a><a class="code" href="a00116.html#a1">00470</a>         <span class="keyword">public</span> function <a class="code" href="a00116.html#a1">setText</a>($text)
00471         {
00472                 $this-&gt;text = $text;
00473         }
00474 
<a name="l00478"></a><a class="code" href="a00116.html#a2">00478</a>         <span class="keyword">public</span> function <a class="code" href="a00116.html#a2">show</a>()
00479         {
00480                 <a class="code" href="a00134.html#e5">Output::write</a>(<span class="stringliteral">"&lt;label"</span>.$this-&gt;parentProperties().<span class="stringliteral">"&gt;{$this-&gt;text}"</span>);
00481                 parent::show();
00482                 <a class="code" href="a00134.html#e5">Output::write</a>(<span class="stringliteral">"&lt;/label&gt;"</span>);
00483         }
00484 
<a name="l00488"></a><a class="code" href="a00116.html#p0">00488</a>         <span class="keyword">protected</span> $text;
00489 }
00490 
00491 ?&gt;
</pre></div>    </div>
  </body>
</html>
Return current item: Aukyla Document Management System