<!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&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 Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">base</a></div>
<h1>JavaScript.php</h1><div class="fragment"><pre class="fragment">00001 <?php
00002 <span class="comment">/*</span>
00003 <span class="comment"> JavaScript.php, this module provides functions to generate handy</span>
00004 <span class="comment"> JavaScripts</span>
00005 <span class="comment"> Copyright (C) 2004 Arend van Beelen, Auton Rijnsburg</span>
00006 <span class="comment"></span>
00007 <span class="comment"> This program is free software; you can redistribute it and/or modify it</span>
00008 <span class="comment"> under the terms of the GNU General Public License as published by the Free</span>
00009 <span class="comment"> Software Foundation; either version 2 of the License, or (at your option)</span>
00010 <span class="comment"> any later version.</span>
00011 <span class="comment"></span>
00012 <span class="comment"> This program is distributed in the hope that it will be useful, but WITHOUT</span>
00013 <span class="comment"> ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or</span>
00014 <span class="comment"> FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for</span>
00015 <span class="comment"> more details.</span>
00016 <span class="comment"></span>
00017 <span class="comment"> You should have received a copy of the GNU General Public License along</span>
00018 <span class="comment"> with this program; if not, write to the Free Software Foundation, Inc.,</span>
00019 <span class="comment"> 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
00020 <span class="comment"></span>
00021 <span class="comment"> For any questions, comments or whatever, you may mail me at: hide@address.com</span>
00022 <span class="comment">*/</span>
00023
00024 require_once('<a class="code" href="a00119.html">Locale</a>.php');
00025 require_once('<a class="code" href="a00134.html">Output</a>.php');
00026 require_once('Widgets.php');
00027
<a name="l00036"></a><a class="code" href="a00115.html">00036</a> <span class="keyword">class </span><a class="code" href="a00115.html">JavaScript</a> <span class="keyword">extends</span> <a class="code" href="a00166.html">Widget</a>
00037 {
<a name="l00044"></a><a class="code" href="a00115.html#a0">00044</a> <span class="keyword">public</span> function <a class="code" href="a00115.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $expression)
00045 {
00046 parent::__construct($parent);
00047 $this->expression = $expression;
00048 }
00049
<a name="l00050"></a><a class="code" href="a00115.html#a1">00050</a> <span class="keyword">public</span> function <a class="code" href="a00115.html#a1">show</a>()
00051 {
00052 <a class="code" href="a00134.html#e5">Output::write</a>(<span class="stringliteral">"<script type=\"application/x-javascript\""</span>.$this->parentProperties().<span class="charliteral">'>'</span>.
00053 <span class="stringliteral">"<![CDATA[{$this->expression}]]>"</span>.
00054 '</script>');
00055 }
00056
<a name="l00066"></a><a class="code" href="a00115.html#e0">00066</a> <span class="keyword">public</span> <span class="keyword">static</span> function <a class="code" href="a00115.html#e0">checkVariables</a>($variables)
00067 {
00068 <span class="keywordflow">if</span>(is_array($variables))
00069 {
00070 $checkVariables = '';
00071 foreach($variables as $variable)
00072 {
00073 <span class="keywordflow">if</span>($checkVariables != '')
00074 {
00075 $checkVariables .= ' || ';
00076 }
00077 $checkVariables .= <span class="stringliteral">"document.getElementById('$variable').value == ''"</span>;
00078 }
00079 <span class="keywordflow">return</span> $checkVariables;
00080 }
00081 <span class="keywordflow">else</span>
00082 {
00083 <span class="keywordflow">return</span> <span class="stringliteral">"document.getElementById('$variables').value == ''"</span>;
00084 }
00085 }
00086
<a name="l00103"></a><a class="code" href="a00115.html#e1">00103</a> <span class="keyword">public</span> <span class="keyword">static</span> function <a class="code" href="a00115.html#e1">checkFormFunction</a>($expressions, $form = '')
00104 {
00105 $function = <span class="stringliteral">"function checkForm$form()"</span>.
00106 <span class="stringliteral">"{"</span>;
00107 foreach($expressions as $expression => $error)
00108 {
00109 <span class="keywordflow">if</span>($error == '')
00110 {
00111 $error = i18n('Please fill in all required fields.');
00112 }
00113 $function .= <span class="stringliteral">"if($expression)"</span>.
00114 <span class="stringliteral">"{"</span>.
00115 <span class="stringliteral">"alert('$error');"</span>.
00116 <span class="stringliteral">"return false;"</span>.
00117 <span class="stringliteral">"}"</span>;
00118 }
00119 $function .= <span class="stringliteral">"return true;"</span>.
00120 <span class="stringliteral">"}"</span>;
00121
00122 <span class="keywordflow">return</span> $function;
00123 }
00124
00125 <span class="keyword">private</span> $expression;
00126 }
00127
<a name="l00134"></a><a class="code" href="a00104.html">00134</a> <span class="keyword">class </span><a class="code" href="a00104.html">ExternalJavaScript</a> <span class="keyword">extends</span> <a class="code" href="a00166.html">Widget</a>
00135 {
<a name="l00142"></a><a class="code" href="a00104.html#a0">00142</a> <span class="keyword">public</span> function <a class="code" href="a00104.html#a0">__construct</a>(<a class="code" href="a00096.html">Container</a> $parent, $url)
00143 {
00144 parent::__construct($parent);
00145 $this->url = $url;
00146 }
00147
<a name="l00148"></a><a class="code" href="a00104.html#a1">00148</a> <span class="keyword">public</span> function <a class="code" href="a00104.html#a1">show</a>()
00149 {
00150 <a class="code" href="a00134.html#e5">Output::write</a>(<span class="stringliteral">"<script type=\"application/x-javascript\" src=\"{$this->url}\""</span>.$this->parentProperties().' />');
00151 }
00152
00153 <span class="keyword">private</span> $url;
00154 }
00155
00156 ?>
</pre></div> </div>
</body>
</html>