Location: PHPKode > projects > Aukyla Platform > aukyla/doc/html/a00208.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>ConfigEditor.php</h1><div class="fragment"><pre class="fragment">00001 &lt;?php
00002 <span class="comment">/*</span>
00003 <span class="comment">     ConfigEditor.php, functions for editing configuration options</span>
00004 <span class="comment">     Copyright (C) 2003-2005 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="a00099.html">Decoration</a>.php');
00025 require_once('Forms.php');
00026 require_once('GUI.php');
00027 require_once('<a class="code" href="a00119.html">Locale</a>.php');
00028 require_once('<a class="code" href="a00122.html">Login</a>.php');
00029 require_once('<a class="code" href="a00129.html">Messages</a>.php');
00030 require_once('<a class="code" href="a00131.html">Navigation</a>.php');
00031 require_once('Widgets.php');
00032 
<a name="l00041"></a><a class="code" href="a00093.html">00041</a> <span class="keyword">class </span><a class="code" href="a00093.html">ConfigEditor</a> <span class="keyword">extends</span> <a class="code" href="a00106.html">Form</a>
00042 {
<a name="l00050"></a><a class="code" href="a00093.html#a0">00050</a>         <span class="keyword">public</span> function <a class="code" href="a00093.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $viewContainer = 'view', $cancelView = '<span class="keywordflow">default</span>')
00051         {
00052                 parent::__construct($parent, Config::globals('baseURL').<span class="stringliteral">"?view=ConfigEditor&amp;amp;action=ConfigEditor&amp;amp;{$viewContainer}_cancel={$cancelView}"</span>);
00053 
00054                 <span class="keyword">new</span> <a class="code" href="a00135.html">PageIcon</a>($<span class="keyword">this</span>, 'base/icons/settings');
00055                 $this-&gt;tabWidget = <span class="keyword">new</span> <a class="code" href="a00158.html">TabWidget</a>($<span class="keyword">this</span>, '<a class="code" href="a00093.html">ConfigEditor</a>');
00056                 $this-&gt;tabWidget-&gt;setParameters('view=<a class="code" href="a00093.html">ConfigEditor</a>');
00057         }
00058 
<a name="l00059"></a><a class="code" href="a00093.html#a1">00059</a>         <span class="keyword">public</span> function <a class="code" href="a00093.html#a1">addWidget</a>(<a class="code" href="a00166.html">Widget</a> $widget)
00060         {
00061                 <span class="keywordflow">if</span>(is_a($widget, '<a class="code" href="a00095.html">ConfigTab</a>'))
00062                 {
00063                         $this-&gt;tabWidget-&gt;addTab($widget-&gt;config(), $widget-&gt;label());
00064                         $this-&gt;tabWidget-&gt;setTabContainer($widget-&gt;config(), $widget);
00065                 }
00066                 <span class="keywordflow">else</span>
00067                 {
00068                         parent::addWidget($widget);
00069                 }
00070         }
00071 
00079         <span class="keyword">public</span> <span class="keyword">static</span> function checkAction()
00080         {
00081                 <span class="comment">// save settings</span>
00082                 <span class="keywordflow">if</span>(<a class="code" href="a00092.html#e2">Config::request</a>('action') == '<a class="code" href="a00093.html">ConfigEditor</a>')
00083                 {
00084                         <span class="keywordflow">if</span>(<a class="code" href="a00092.html#e2">Config::request</a>('button') == i18n('Apply changes'))
00085                         {
00086                                 $config = <span class="keyword">new</span> <a class="code" href="a00092.html">Config</a>(Config::request('ConfigEditor__config'), Login::username());
00087                                 foreach(Config::requests() as $var =&gt; $val)
00088                                 {
00089                                         <span class="keywordflow">if</span>(<a class="code" href="a00153.html#e2">String::startsWith</a>($var, 'ConfigEditor_') == <span class="keyword">false</span> ||
00090                                            $var == 'ConfigEditor__config' ||
00091                                            <a class="code" href="a00092.html#e2">Config::request</a>(<span class="stringliteral">"{$var}__checkbox"</span>) == '<span class="keyword">true</span>')
00092                                         {
00093                                                 <span class="keywordflow">continue</span>;
00094                                         }
00095 
00096                                         $var = <a class="code" href="a00153.html#e1">String::substringAfter</a>($var, 'ConfigEditor_');
00097 
00098                                         <span class="comment">// special case for checkboxes</span>
00099                                         <span class="keywordflow">if</span>(<a class="code" href="a00153.html#e3">String::endsWith</a>($var, '__checkbox'))
00100                                         {
00101                                                 $var = <a class="code" href="a00153.html#e0">String::substringBefore</a>($var, '__checkbox');
00102                                                 $val = (<a class="code" href="a00092.html#e2">Config::request</a>(<span class="stringliteral">"ConfigEditor_$var"</span>) == '<span class="keyword">true</span>' ? '<span class="keyword">true</span>' : '<span class="keyword">false</span>');
00103                                         }
00104 
00105                                         $config-&gt;setVariable($var, $val);
00106                                 }
00107                                 $config-&gt;saveConfiguration();
00108                                 <a class="code" href="a00119.html#e0">Locale::init</a>('base', $config-&gt;variable('language', 'en'));
00109                                 <a class="code" href="a00129.html#e1">Messages::confirm</a>(i18n('Preferences saved.'));
00110                         }
00111                 }
00112         }
00113 
<a name="l00114"></a><a class="code" href="a00093.html#a2">00114</a>         <span class="keyword">public</span> function <a class="code" href="a00093.html#a2">show</a>()
00115         {
00116                 $box = <span class="keyword">new</span> <a class="code" href="a00088.html">Box</a>($<span class="keyword">this</span>);
00117                 $box-&gt;setOrientation('horizontal');
00118                 $applyButton = <span class="keyword">new</span> <a class="code" href="a00089.html">Button</a>($box, 'button');
00119                 $applyButton-&gt;setValue(i18n('Apply changes'));
00120                 $applyButton-&gt;setConfirm(<span class="keyword">true</span>);
00121                 $cancelButton = <span class="keyword">new</span> <a class="code" href="a00089.html">Button</a>($box, 'button');
00122                 $cancelButton-&gt;setValue(i18n('Cancel'));
00123 
00124                 parent::show();
00125         }
00126 
<a name="l00127"></a><a class="code" href="a00093.html#p0">00127</a>         <span class="keyword">protected</span> $id;
00128 
00129         <span class="keyword">private</span> $tabWidget;
00130 }
00131 
00132 <span class="comment">// immediately check actions from a previous page</span>
00133 ConfigEditor::checkAction();
00134 
<a name="l00140"></a><a class="code" href="a00095.html">00140</a> <span class="keyword">class </span><a class="code" href="a00095.html">ConfigTab</a> <span class="keyword">extends</span> <a class="code" href="a00096.html">Container</a>
00141 {
<a name="l00150"></a><a class="code" href="a00095.html#a0">00150</a>         <span class="keyword">public</span> function <a class="code" href="a00095.html#a0">__construct</a>(<a class="code" href="a00093.html">ConfigEditor</a> $parent, $label, $config)
00151         {
00152                 $this-&gt;<a class="code" href="a00095.html#a1">label</a> = $label;
00153                 $this-&gt;<a class="code" href="a00095.html#a2">config</a> = $config;
00154 
00155                 parent::__construct($parent);
00156 
00157                 $hiddenInput = <span class="keyword">new</span> <a class="code" href="a00111.html">HiddenInput</a>($<span class="keyword">this</span>, 'ConfigEditor__config');
00158                 $hiddenInput-&gt;setValue($<a class="code" href="a00095.html#a2">config</a>);
00159         }
00160 
<a name="l00164"></a><a class="code" href="a00095.html#a1">00164</a>         <span class="keyword">public</span> function <a class="code" href="a00095.html#a1">label</a>()
00165         {
00166                 <span class="keywordflow">return</span> $this-&gt;label;
00167         }
00168 
<a name="l00173"></a><a class="code" href="a00095.html#a2">00173</a>         <span class="keyword">public</span> function <a class="code" href="a00095.html#a2">config</a>()
00174         {
00175                 <span class="keywordflow">return</span> $this-&gt;config;
00176         }
00177 
00178         <span class="keyword">private</span> $label;
00179         <span class="keyword">private</span> $config;
00180 }
00181 
<a name="l00185"></a><a class="code" href="a00160.html">00185</a> <span class="keyword">class </span><a class="code" href="a00160.html">TextConfigOption</a> <span class="keyword">extends</span> <a class="code" href="a00161.html">TextInput</a>
00186 {
<a name="l00197"></a><a class="code" href="a00160.html#a0">00197</a>         <span class="keyword">public</span> function <a class="code" href="a00160.html#a0">__construct</a>(<a class="code" href="a00095.html">ConfigTab</a> $parent, $variable, $value,
00198                                     $description, $tooltip = '')
00199         {
00200                 parent::__construct($parent, <span class="stringliteral">"ConfigEditor_$variable"</span>);
00201 
00202                 $this-&gt;<a class="code" href="a00114.html#a2">setValue</a>($value);
00203                 $this-&gt;<a class="code" href="a00114.html#a1">setText</a>($description);
00204 
00205                 <span class="keywordflow">if</span>($tooltip != '')
00206                 {
00207                         <span class="keyword">new</span> <a class="code" href="a00113.html">Image</a>($<span class="keyword">this</span>, 'resources/base/icons/buttons/help.png');
00208                         <span class="keyword">new</span> <a class="code" href="a00162.html">Tooltip</a>($<span class="keyword">this</span>, $tooltip);
00209                 }
00210         }
00211 }
00212 
<a name="l00216"></a><a class="code" href="a00137.html">00216</a> <span class="keyword">class </span><a class="code" href="a00137.html">PasswordConfigOption</a> <span class="keyword">extends</span> <a class="code" href="a00138.html">PasswordInput</a>
00217 {
<a name="l00227"></a><a class="code" href="a00137.html#a0">00227</a>         <span class="keyword">public</span> function <a class="code" href="a00137.html#a0">__construct</a>(<a class="code" href="a00095.html">ConfigTab</a> $parent, $variable,
00228                                     $description, $tooltip = '')
00229         {
00230                 parent::__construct($parent, <span class="stringliteral">"ConfigEditor_$variable"</span>);
00231 
00232                 $this-&gt;<a class="code" href="a00114.html#a1">setText</a>($description);
00233 
00234                 <span class="keywordflow">if</span>($tooltip != '')
00235                 {
00236                         <span class="keyword">new</span> <a class="code" href="a00113.html">Image</a>($<span class="keyword">this</span>, 'resources/base/icons/buttons/help.png');
00237                         <span class="keyword">new</span> <a class="code" href="a00162.html">Tooltip</a>($<span class="keyword">this</span>, $tooltip);
00238                 }
00239         }
00240 }
00241 
<a name="l00245"></a><a class="code" href="a00090.html">00245</a> <span class="keyword">class </span><a class="code" href="a00090.html">CheckboxConfigOption</a> <span class="keyword">extends</span> <a class="code" href="a00091.html">CheckboxInput</a>
00246 {
<a name="l00258"></a><a class="code" href="a00090.html#a0">00258</a>         <span class="keyword">public</span> function <a class="code" href="a00090.html#a0">__construct</a>(<a class="code" href="a00095.html">ConfigTab</a> $parent, $variable, $value,
00259                                     $description, $tooltip = '')
00260         {
00261                 parent::__construct($parent, <span class="stringliteral">"ConfigEditor_$variable"</span>);
00262 
00263                 $this-&gt;<a class="code" href="a00091.html#a1">setChecked</a>($value == '<span class="keyword">true</span>');
00264                 $this-&gt;<a class="code" href="a00114.html#a1">setText</a>($description);
00265 
00266                 $hiddenInput = <span class="keyword">new</span> <a class="code" href="a00111.html">HiddenInput</a>($<span class="keyword">this</span>, $this-&gt;id().'__checkbox');
00267                 $hiddenInput-&gt;setValue('<span class="keyword">true</span>');
00268 
00269                 <span class="keywordflow">if</span>($tooltip != '')
00270                 {
00271                         <span class="keyword">new</span> <a class="code" href="a00113.html">Image</a>($<span class="keyword">this</span>, 'resources/base/icons/buttons/help.png');
00272                         <span class="keyword">new</span> <a class="code" href="a00162.html">Tooltip</a>($<span class="keyword">this</span>, $tooltip);
00273                 }
00274         }
00275 }
00276 
<a name="l00283"></a><a class="code" href="a00150.html">00283</a> <span class="keyword">class </span><a class="code" href="a00150.html">SelectConfigOption</a> <span class="keyword">extends</span> <a class="code" href="a00151.html">SelectInput</a>
00284 {
<a name="l00297"></a><a class="code" href="a00150.html#a0">00297</a>         <span class="keyword">public</span> function <a class="code" href="a00150.html#a0">__construct</a>(<a class="code" href="a00095.html">ConfigTab</a> $parent, $variable, $value, $options,
00298                                     $description, $tooltip = '')
00299         {
00300                 parent::__construct($parent, <span class="stringliteral">"ConfigEditor_$variable"</span>);
00301 
00302                 $this-&gt;<a class="code" href="a00151.html#a1">setOptions</a>($options);
00303                 $this-&gt;<a class="code" href="a00114.html#a2">setValue</a>($value);
00304                 $this-&gt;<a class="code" href="a00114.html#a1">setText</a>($description);
00305 
00306                 <span class="keywordflow">if</span>($tooltip != '')
00307                 {
00308                         <span class="keyword">new</span> <a class="code" href="a00113.html">Image</a>($<span class="keyword">this</span>, 'resources/base/icons/buttons/help.png');
00309                         <span class="keyword">new</span> <a class="code" href="a00162.html">Tooltip</a>($<span class="keyword">this</span>, $tooltip);
00310                 }
00311         }
00312 }
00313 
<a name="l00320"></a><a class="code" href="a00094.html">00320</a> <span class="keyword">class </span><a class="code" href="a00094.html">ConfigEditorRadioOption</a> <span class="keyword">extends</span> <a class="code" href="a00096.html">Container</a>
00321 {
<a name="l00334"></a><a class="code" href="a00094.html#a0">00334</a>         <span class="keyword">public</span> function <a class="code" href="a00094.html#a0">__construct</a>(<a class="code" href="a00095.html">ConfigTab</a> $parent, $variable, $value, $options,
00335                                     $description, $tooltip = '')
00336         {
00337                 parent::__construct($parent);
00338 
00339                 <span class="keyword">new</span> <a class="code" href="a00136.html">Paragraph</a>($<span class="keyword">this</span>, $description);
00340                 $radioGroup = <span class="keyword">new</span> <a class="code" href="a00140.html">RadioGroup</a>($<span class="keyword">this</span>, <span class="stringliteral">"ConfigEditor_{$variable}"</span>);
00341                 foreach($options as $key =&gt; $text)
00342                 {
00343                         $radioButton = <span class="keyword">new</span> <a class="code" href="a00139.html">RadioButton</a>($radioGroup, $key);
00344                         $radioButton-&gt;setText($text);
00345                         $radioButton-&gt;setChecked($key == $this-&gt;value);
00346                 }
00347 
00348                 <span class="keywordflow">if</span>($tooltip != '')
00349                 {
00350                         <span class="keyword">new</span> <a class="code" href="a00113.html">Image</a>($<span class="keyword">this</span>, 'resources/base/icons/buttons/help.png');
00351                         <span class="keyword">new</span> <a class="code" href="a00162.html">Tooltip</a>($<span class="keyword">this</span>, $tooltip);
00352                 }
00353         }
00354 }
00355 
00356 ?&gt;
</pre></div>    </div>
  </body>
</html>
Return current item: Aukyla Platform