Location: PHPKode > projects > Aukyla Platform > aukyla/doc/html/a00226.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>Navigation.php</h1><div class="fragment"><pre class="fragment">00001 &lt;?php
00002 <span class="comment">/*</span>
00003 <span class="comment">     Navigation.php, provides widgets used for navigation</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 
00023 require_once('<a class="code" href="a00092.html">Config</a>.php');
00024 require_once('<a class="code" href="a00122.html">Login</a>.php');
00025 require_once('<a class="code" href="a00134.html">Output</a>.php');
00026 require_once('Widgets.php');
00027 require_once('Windows.php');
00028 
00032 <span class="keyword">class </span>Tab
00033 {
00034         <span class="keyword">public</span> function __construct($<span class="keywordtype">id</span>, $label)
00035         {
00036                 $this-&gt;<span class="keywordtype">id</span> = $id;
00037                 $this-&gt;label = $label;
00038                 $this-&gt;container = <span class="keyword">new</span> <a class="code" href="a00143.html">RootContainer</a>();
00039         }
00040 
00041         <span class="keyword">public</span> $id;
00042         <span class="keyword">public</span> $label;
00043         <span class="keyword">public</span> $container;
00044 }
00045 
<a name="l00057"></a><a class="code" href="a00158.html">00057</a> <span class="keyword">class </span><a class="code" href="a00158.html">TabWidget</a> <span class="keyword">extends</span> <a class="code" href="a00166.html">Widget</a>
00058 {
<a name="l00067"></a><a class="code" href="a00158.html#a0">00067</a>         <span class="keyword">public</span> function <a class="code" href="a00158.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $<span class="keywordtype">id</span>)
00068         {
00069                 parent::__construct($parent, $<span class="keywordtype">id</span>);
00070 
00071                 <span class="keywordflow">if</span>(<a class="code" href="a00092.html#e2">Config::request</a>(<span class="stringliteral">"{$id}_currentTab"</span>) != '')
00072                 {
00073                         $this-&gt;<a class="code" href="a00158.html#a5">currentTab</a> = <a class="code" href="a00092.html#e2">Config::request</a>(<span class="stringliteral">"{$id}_currentTab"</span>);
00074                         <a class="code" href="a00122.html#e7">Login::setSessionVariable</a>(<span class="stringliteral">"{$id}_currentTab"</span>, $this-&gt;currentTab);
00075                 }
00076                 <span class="keywordflow">else</span>
00077                 {
00078                         $this-&gt;<a class="code" href="a00158.html#a5">currentTab</a> = <a class="code" href="a00122.html#e8">Login::sessionVariable</a>(<span class="stringliteral">"{$id}_currentTab"</span>);
00079                 }
00080 
00081                 $this-&gt;panels = array();
00082                 $this-&gt;parameters = '';
00083         }
00084 
<a name="l00094"></a><a class="code" href="a00158.html#a1">00094</a>         <span class="keyword">public</span> function <a class="code" href="a00158.html#a1">addTab</a>($<span class="keywordtype">id</span>, $label)
00095         {
00096                 $this-&gt;tabs[] = $tab = <span class="keyword">new</span> Tab($<span class="keywordtype">id</span>, $label);
00097 
00098                 <span class="keywordflow">return</span> $tab-&gt;container;
00099         }
00100 
<a name="l00110"></a><a class="code" href="a00158.html#a2">00110</a>         <span class="keyword">public</span> function <a class="code" href="a00158.html#a2">tab</a>($<span class="keywordtype">id</span>)
00111         {
00112                 foreach($this-&gt;tabs as $<a class="code" href="a00158.html#a2">tab</a>)
00113                 {
00114                         <span class="keywordflow">if</span>($tab-&gt;id == $id)
00115                         {
00116                                 <span class="keywordflow">return</span> $tab-&gt;container;
00117                         }
00118                 }
00119 
00120                 <span class="keywordflow">return</span> null;
00121         }
00122 
<a name="l00128"></a><a class="code" href="a00158.html#a3">00128</a>         <span class="keyword">public</span> function <a class="code" href="a00158.html#a3">setTabContainer</a>($<span class="keywordtype">id</span>, <a class="code" href="a00096.html">Container</a> $container)
00129         {
00130                 foreach($this-&gt;tabs as $<a class="code" href="a00158.html#a2">tab</a>)
00131                 {
00132                         <span class="keywordflow">if</span>($tab-&gt;id == $id)
00133                         {
00134                                 $tab-&gt;container = $container;
00135                                 <span class="keywordflow">return</span>;
00136                         }
00137                 }
00138         }
00139 
<a name="l00146"></a><a class="code" href="a00158.html#a4">00146</a>         <span class="keyword">public</span> function <a class="code" href="a00158.html#a4">setCurrentTab</a>($<span class="keywordtype">id</span>)
00147         {
00148                 $this-&gt;<a class="code" href="a00158.html#a5">currentTab</a> = $id;
00149         }
00150 
<a name="l00158"></a><a class="code" href="a00158.html#a5">00158</a>         <span class="keyword">public</span> function <a class="code" href="a00158.html#a5">currentTab</a>()
00159         {
00160                 <span class="keywordflow">return</span> $this-&gt;currentTab;
00161         }
00162 
<a name="l00168"></a><a class="code" href="a00158.html#a6">00168</a>         <span class="keyword">public</span> function <a class="code" href="a00158.html#a6">setParameters</a>($parameters)
00169         {
00170                 $this-&gt;parameters = $parameters;
00171         }
00172 
<a name="l00173"></a><a class="code" href="a00158.html#a7">00173</a>         <span class="keyword">public</span> function <a class="code" href="a00158.html#a7">show</a>()
00174         {
00175                 <span class="keywordflow">if</span>(<span class="keyword">sizeof</span>($this-&gt;tabs) == 0)
00176                 {
00177                         <span class="keywordflow">return</span>;
00178                 }
00179 
00180                 <span class="keywordflow">if</span>($this-&gt;<a class="code" href="a00158.html#a5">currentTab</a> == '')
00181                 {
00182                         $this-&gt;<a class="code" href="a00158.html#a5">currentTab</a> = $this-&gt;tabs[0]-&gt;id;
00183                 }
00184 
00185                 <a class="code" href="a00134.html#e5">Output::write</a>('&lt;tabwidget&gt;'.
00186                               '&lt;tabs&gt;');
00187 
00188                 $firstTab = <span class="keyword">true</span>;
00189                 foreach($this-&gt;tabs as $<a class="code" href="a00158.html#a2">tab</a>)
00190                 {
00191                         $selectedProperty = ($this-&gt;<a class="code" href="a00158.html#a5">currentTab</a> == $tab-&gt;id ? ' selected=<span class="stringliteral">"true"</span>' : '');
00192                         $parameters = ($this-&gt;parameters == '' ? '' : <span class="stringliteral">"&amp;amp;{$this-&gt;parameters}"</span>);
00193 
00194                         <span class="keywordflow">if</span>($firstTab == <span class="keyword">true</span>)
00195                         {
00196                                 $firstTab = <span class="keyword">false</span>;
00197                         }
00198                         <span class="keywordflow">else</span>
00199                         {
00200                                 <a class="code" href="a00134.html#e5">Output::write</a>(<span class="stringliteral">"&lt;tabseperator/&gt;"</span>);
00201                         }
00202 
00203                         <a class="code" href="a00134.html#e5">Output::write</a>(<span class="stringliteral">"&lt;tab id=\"{$tab-&gt;id}\" label=\"{$tab-&gt;label}\" "</span>.
00204                                       <span class="stringliteral">"href=\""</span>.Config::globals('baseURL').<span class="stringliteral">"?{$this-&gt;id}_currentTab={$tab-&gt;id}$parameters\"$selectedProperty /&gt;"</span>);
00205                 }
00206 
00207                 <a class="code" href="a00134.html#e5">Output::write</a>('&lt;/tabs&gt;'.
00208                               '&lt;tabpanels&gt;');
00209 
00210                 foreach($this-&gt;tabs as $tab)
00211                 {
00212                         <span class="keywordflow">if</span>($this-&gt;<a class="code" href="a00158.html#a5">currentTab</a> == $tab-&gt;id)
00213                         {
00214                                 <a class="code" href="a00134.html#e5">Output::write</a>('&lt;tabpanel&gt;');
00215                                 $tab-&gt;container-&gt;show();
00216                                 <a class="code" href="a00134.html#e5">Output::write</a>('&lt;/tabpanel&gt;');
00217                         }
00218                 }
00219 
00220                 <a class="code" href="a00134.html#e5">Output::write</a>('&lt;/tabpanels&gt;'.
00221                               '&lt;/tabwidget&gt;');
00222         }
00223 
00224         <span class="keyword">private</span> $currentTab;
00225         <span class="keyword">private</span> $parameters;
00226         <span class="keyword">private</span> $tabs;
00227 }
00228 
<a name="l00236"></a><a class="code" href="a00131.html">00236</a> <span class="keyword">class </span><a class="code" href="a00131.html">Navigation</a>
00237 {
<a name="l00247"></a><a class="code" href="a00131.html#e0">00247</a>         <span class="keyword">public</span> <span class="keyword">static</span> function windowLink($window, $secure = <span class="keyword">false</span>)
00248         {
00249                 $baseUrl = ($secure ? <a class="code" href="a00092.html#e0">Config::globals</a>('secureBaseURL') : <a class="code" href="a00092.html#e0">Config::globals</a>('baseURL'));
00250 
00251                 <span class="keywordflow">return</span> <span class="stringliteral">"$baseUrl?window=$window"</span>;
00252         }
00253 
<a name="l00264"></a><a class="code" href="a00131.html#e1">00264</a>         <span class="keyword">public</span> <span class="keyword">static</span> function viewLink($viewContainer, $view, $secure = <span class="keyword">false</span>)
00265         {
00266                 $baseUrl = ($secure ? <a class="code" href="a00092.html#e0">Config::globals</a>('secureBaseURL') : <a class="code" href="a00092.html#e0">Config::globals</a>('baseURL'));
00267 
00268                 $windowManager = <a class="code" href="a00168.html#e0">WindowManager::instance</a>();
00269 
00270                 <span class="keywordflow">return</span> <span class="stringliteral">"$baseUrl?window="</span>.$windowManager-&gt;window().<span class="stringliteral">"&amp;amp;$viewContainer=$view"</span>;
00271         }
00272 }
00273 
00274 ?&gt;
</pre></div>    </div>
  </body>
</html>
Return current item: Aukyla Platform