PageRenderTime 38ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/docs/api/_image_selector_8php_source.html

http://openbiz-cubi.googlecode.com/
HTML | 129 lines | 128 code | 0 blank | 1 comment | 0 complexity | c4beb1958fc0ee90ae151b57746f2758 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-3.0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <title>openbiz: E:/E/GEAMP/www/openbiz/openbiz/bin/easy/element/ImageSelector.php Source File</title>
  6. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  7. <link href="doxygen.css" rel="stylesheet" type="text/css"/>
  8. </head>
  9. <body>
  10. <!-- Generated by Doxygen 1.7.2 -->
  11. <div class="navigation" id="top">
  12. <div class="tabs">
  13. <ul class="tablist">
  14. <li><a href="main.html"><span>Main&#160;Page</span></a></li>
  15. <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
  16. <li><a href="namespaces.html"><span>Namespaces</span></a></li>
  17. <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
  18. <li class="current"><a href="files.html"><span>Files</span></a></li>
  19. </ul>
  20. </div>
  21. <div class="tabs2">
  22. <ul class="tablist">
  23. <li><a href="files.html"><span>File&#160;List</span></a></li>
  24. </ul>
  25. </div>
  26. <div class="header">
  27. <div class="headertitle">
  28. <h1>E:/E/GEAMP/www/openbiz/openbiz/bin/easy/element/ImageSelector.php</h1> </div>
  29. </div>
  30. <div class="contents">
  31. <div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 &lt;?<a class="code" href="category_p_h_p.html">PHP</a>
  32. <a name="l00002"></a>00002 include_once(<span class="stringliteral">&quot;OptionElement.php&quot;</span>);
  33. <a name="l00003"></a>00003
  34. <a name="l00004"></a><a class="code" href="class_image_selector.html">00004</a> <span class="keyword">class </span><a class="code" href="class_image_selector.html">ImageSelector</a> <span class="keyword">extends</span> <a class="code" href="class_option_element.html">OptionElement</a>
  35. <a name="l00005"></a>00005 {
  36. <a name="l00006"></a>00006 <span class="keyword">public</span> $m_BlankOption;
  37. <a name="l00007"></a>00007
  38. <a name="l00008"></a>00008
  39. <a name="l00009"></a><a class="code" href="class_image_selector.html#a5888f7e5883c7c2d486f7ddc1bd64760">00009</a> <span class="keyword">protected</span> function <a class="code" href="class_image_selector.html#a5888f7e5883c7c2d486f7ddc1bd64760">readMetaData</a>(&amp;$xmlArr)
  40. <a name="l00010"></a>00010 {
  41. <a name="l00011"></a>00011 <a class="code" href="class_image_selector.html#a5888f7e5883c7c2d486f7ddc1bd64760">parent::readMetaData</a>($xmlArr);
  42. <a name="l00012"></a>00012 $this-&gt;m_BlankOption = isset($xmlArr[<span class="stringliteral">&quot;ATTRIBUTES&quot;</span>][<span class="stringliteral">&quot;BLANKOPTION&quot;</span>]) ? $xmlArr[<span class="stringliteral">&quot;ATTRIBUTES&quot;</span>][<span class="stringliteral">&quot;BLANKOPTION&quot;</span>] : null;
  43. <a name="l00013"></a>00013 $this-&gt;m_cssClass = isset($xmlArr[<span class="stringliteral">&quot;ATTRIBUTES&quot;</span>][<span class="stringliteral">&quot;CSSCLASS&quot;</span>]) ? $xmlArr[<span class="stringliteral">&quot;ATTRIBUTES&quot;</span>][<span class="stringliteral">&quot;CSSCLASS&quot;</span>] : <span class="stringliteral">&#39;image_selector&#39;</span>;
  44. <a name="l00014"></a>00014 $this-&gt;m_cssErrorClass = isset($xmlArr[<span class="stringliteral">&quot;ATTRIBUTES&quot;</span>][<span class="stringliteral">&quot;CSSERRORCLASS&quot;</span>]) ? $xmlArr[<span class="stringliteral">&quot;ATTRIBUTES&quot;</span>][<span class="stringliteral">&quot;CSSERRORCLASS&quot;</span>] : $this-&gt;m_cssClass . <span class="stringliteral">&quot;_error&quot;</span>;
  45. <a name="l00015"></a>00015 $this-&gt;m_cssFocusClass = isset($xmlArr[<span class="stringliteral">&quot;ATTRIBUTES&quot;</span>][<span class="stringliteral">&quot;CSSFOCUSCLASS&quot;</span>]) ? $xmlArr[<span class="stringliteral">&quot;ATTRIBUTES&quot;</span>][<span class="stringliteral">&quot;CSSFOCUSCLASS&quot;</span>] : $this-&gt;m_cssClass . <span class="stringliteral">&quot;_focus&quot;</span>;
  46. <a name="l00016"></a>00016 }
  47. <a name="l00017"></a>00017
  48. <a name="l00018"></a>00018
  49. <a name="l00019"></a><a class="code" href="class_image_selector.html#afde88292c44dc59faf017738dae6dffb">00019</a> <span class="keyword">public</span> function <a class="code" href="class_image_selector.html#afde88292c44dc59faf017738dae6dffb">render</a>()
  50. <a name="l00020"></a>00020 {
  51. <a name="l00021"></a>00021 $fromList = array();
  52. <a name="l00022"></a>00022 $this-&gt;<a class="code" href="class_option_element.html#af9b9251ea754aa65bc036e5bd9eb2e1d">getFromList</a>($fromList);
  53. <a name="l00023"></a>00023 $valueArray = explode(<span class="charliteral">&#39;,&#39;</span>, $this-&gt;m_Value);
  54. <a name="l00024"></a>00024 $disabledStr = ($this-&gt;<a class="code" href="class_input_element.html#ab442a42d8265e71787a82ef3a1b4549c">getEnabled</a>() == <span class="stringliteral">&quot;N&quot;</span>) ? <span class="stringliteral">&quot;DISABLED=\&quot;true\&quot;&quot;</span> : <span class="stringliteral">&quot;&quot;</span>;
  55. <a name="l00025"></a>00025 $style = $this-&gt;<a class="code" href="class_element.html#a1a9c641ae8a39113009425cbccaee5d5">getStyle</a>();
  56. <a name="l00026"></a>00026 $func = $this-&gt;<a class="code" href="class_element.html#a3cb728ca27acfebd282caecdb8a1f5fc">getFunction</a>();
  57. <a name="l00027"></a>00027
  58. <a name="l00028"></a>00028 $formobj = $this-&gt;GetFormObj();
  59. <a name="l00029"></a>00029 <span class="keywordflow">if</span>($formobj-&gt;m_Errors[$this-&gt;m_Name]){
  60. <a name="l00030"></a>00030 $func .= <span class="stringliteral">&quot;onclick=\&quot;this.className=&#39;$this-&gt;m_cssClass&#39;\&quot;&quot;</span>;
  61. <a name="l00031"></a>00031 }<span class="keywordflow">else</span>{
  62. <a name="l00032"></a>00032 $func .= <span class="stringliteral">&quot;onmouseover=\&quot;this.className=&#39;$this-&gt;m_cssFocusClass&#39;\&quot; onmouseout=\&quot;this.className=&#39;$this-&gt;m_cssClass&#39;\&quot;&quot;</span>;
  63. <a name="l00033"></a>00033 }
  64. <a name="l00034"></a>00034
  65. <a name="l00035"></a>00035 $sHTML = <span class="stringliteral">&quot;&lt;input type=\&quot;hidden\&quot; NAME=\&quot;&quot;</span> . $this-&gt;m_Name . <span class="stringliteral">&quot;\&quot; ID=\&quot;&quot;</span> . $this-&gt;m_Name .<span class="stringliteral">&quot;\&quot; value=\&quot;&quot;</span>.$this-&gt;m_Value.<span class="stringliteral">&quot;\&quot; $disabledStr $this-&gt;m_HTMLAttr /&gt;&quot;</span>;
  66. <a name="l00036"></a>00036 $sHTML .= <span class="stringliteral">&quot;&lt;ul id=\&quot;image_list_&quot;</span> . $this-&gt;m_Name .<span class="stringliteral">&quot;\&quot; $style $func &gt;&quot;</span>;
  67. <a name="l00037"></a>00037 <span class="keywordflow">if</span> ($this-&gt;m_BlankOption) <span class="comment">// ADD a blank option</span>
  68. <a name="l00038"></a>00038 {
  69. <a name="l00039"></a>00039 $entry = explode(<span class="stringliteral">&quot;,&quot;</span>,$this-&gt;m_BlankOption);
  70. <a name="l00040"></a>00040 $text = $entry[0];
  71. <a name="l00041"></a>00041 $value = ($entry[1]!= <span class="stringliteral">&quot;&quot;</span>) ? $entry[1] : null;
  72. <a name="l00042"></a>00042 $entryList = array(array(<span class="stringliteral">&quot;val&quot;</span> =&gt; $value, <span class="stringliteral">&quot;txt&quot;</span> =&gt; $text ));
  73. <a name="l00043"></a>00043 $fromList = array_merge($entryList, $fromList);
  74. <a name="l00044"></a>00044 }
  75. <a name="l00045"></a>00045
  76. <a name="l00046"></a>00046 <span class="keywordflow">foreach</span> ($fromList as $option)
  77. <a name="l00047"></a>00047 {
  78. <a name="l00048"></a>00048 $test = array_search($option[<span class="stringliteral">&#39;val&#39;</span>], $valueArray);
  79. <a name="l00049"></a>00049 <span class="keywordflow">if</span> ($test === <span class="keyword">false</span>)
  80. <a name="l00050"></a>00050 {
  81. <a name="l00051"></a>00051 $selectedStr = <span class="stringliteral">&#39;normal&#39;</span>;
  82. <a name="l00052"></a>00052 }
  83. <a name="l00053"></a>00053 <span class="keywordflow">else</span>
  84. <a name="l00054"></a>00054 {
  85. <a name="l00055"></a>00055 $selectedStr = <span class="stringliteral">&quot;current&quot;</span>;
  86. <a name="l00056"></a>00056 }
  87. <a name="l00057"></a>00057 <span class="keywordflow">if</span>($this-&gt;m_Width){
  88. <a name="l00058"></a>00058 $width_str = <span class="stringliteral">&quot; width=\&quot;&quot;</span>.$this-&gt;m_Width.<span class="stringliteral">&quot;\&quot; &quot;</span>;
  89. <a name="l00059"></a>00059 }
  90. <a name="l00060"></a>00060 <span class="keywordflow">if</span>($this-&gt;m_Height){
  91. <a name="l00061"></a>00061 $height_str = <span class="stringliteral">&quot; height=\&quot;&quot;</span>.$this-&gt;m_Height.<span class="stringliteral">&quot;\&quot; &quot;</span>;
  92. <a name="l00062"></a>00062 }
  93. <a name="l00063"></a>00063 $image_url = $option[<span class="stringliteral">&#39;pic&#39;</span>];
  94. <a name="l00064"></a>00064 <span class="keywordflow">if</span>(preg_match(<span class="stringliteral">&quot;/\{.*\}/si&quot;</span>,$image_url))
  95. <a name="l00065"></a>00065 {
  96. <a name="l00066"></a>00066 $formobj = $this-&gt;<a class="code" href="class_element.html#abf87088a2cd6b615e8e8add31567ba5a">getFormObj</a>();
  97. <a name="l00067"></a>00067 $image_url = <a class="code" href="class_expression.html#a85d5504074029bc1ebe18dd8de91571c">Expression::evaluateExpression</a>($image_url, $formobj);
  98. <a name="l00068"></a>00068 }<span class="keywordflow">else</span>{
  99. <a name="l00069"></a>00069 $image_url = <a class="code" href="class_resource.html#a7b561ddf50dd090a4e4d4e4f0cf54d78">Resource::getImageUrl</a>().<span class="stringliteral">&quot;/&quot;</span>.$image_url;
  100. <a name="l00070"></a>00070 }
  101. <a name="l00071"></a>00071 $sHTML .= <span class="stringliteral">&quot;&lt;a title=\&quot;&quot;</span> . $option[<span class="stringliteral">&#39;txt&#39;</span>] . <span class="stringliteral">&quot;\&quot; </span>
  102. <a name="l00072"></a>00072 <span class="stringliteral"> href=\&quot;javascript:;\&quot;</span>
  103. <a name="l00073"></a>00073 <span class="stringliteral"> class=\&quot;$selectedStr\&quot;</span>
  104. <a name="l00074"></a>00074 <span class="stringliteral"> onclick =\&quot;$(&#39;&quot;</span>.$this-&gt;m_Name.<span class="stringliteral">&quot;&#39;).value=&#39;&quot;</span>. $option[<span class="stringliteral">&#39;val&#39;</span>].<span class="stringliteral">&quot;&#39;; </span>
  105. <a name="l00075"></a>00075 <span class="stringliteral"> Openbiz.ImageSelector.reset(&#39;image_list_&quot;</span>.$this-&gt;m_Name.<span class="stringliteral">&quot;&#39;);</span>
  106. <a name="l00076"></a>00076 <span class="stringliteral"> this.className=&#39;current&#39;;</span>
  107. <a name="l00077"></a>00077 <span class="stringliteral"> \&quot; </span>
  108. <a name="l00078"></a>00078 <span class="stringliteral"> &gt;</span>
  109. <a name="l00079"></a>00079 <span class="stringliteral"> &lt;img</span>
  110. <a name="l00080"></a>00080 <span class="stringliteral"> $width_str $height_str</span>
  111. <a name="l00081"></a>00081 <span class="stringliteral"> src=\&quot;&quot;</span>.$image_url.<span class="stringliteral">&quot;\&quot; </span>
  112. <a name="l00082"></a>00082 <span class="stringliteral"> title=\&quot;&quot;</span> . $option[<span class="stringliteral">&#39;txt&#39;</span>] . <span class="stringliteral">&quot;\&quot; </span>
  113. <a name="l00083"></a>00083 <span class="stringliteral"> /&gt;&lt;/a&gt;&quot;</span>;
  114. <a name="l00084"></a>00084
  115. <a name="l00085"></a>00085 }
  116. <a name="l00086"></a>00086 $sHTML .= <span class="stringliteral">&quot;&lt;/ul&gt;&quot;</span>;
  117. <a name="l00087"></a>00087
  118. <a name="l00088"></a>00088 <span class="keywordflow">return</span> $sHTML;
  119. <a name="l00089"></a>00089 }
  120. <a name="l00090"></a>00090 }
  121. <a name="l00091"></a>00091
  122. <a name="l00092"></a>00092 ?&gt;
  123. </pre></div></div>
  124. </div>
  125. <hr class="footer"/><address class="footer"><small>Generated on Thu Apr 19 2012 17:09:13 for openbiz by&#160;
  126. <a href="http://www.doxygen.org/index.html">
  127. <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address>
  128. </body>
  129. </html>