Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 require_once('function_javascript.php');
00028 require_once('class_html_input.php');
00029
00030 class IPopup extends HtmlInput
00031 {
00032 var $name;
00033 function __construct($p_name)
00034 {
00035 $this->name=$p_name;
00036 $this->parameter='';
00037 $this->attribute=array();
00038 $this->drag=false;
00039 $this->blocking=true;
00040 }
00041 function set_width($p_val)
00042 {
00043 $js=sprintf('$("%s'.'_border").style.width="%s";',
00044 $this->name,$p_val);
00045 $this->parameter.=$js;
00046
00047 }
00048 function set_height($p_val)
00049 {
00050 $js=sprintf('$("%s'.'_border").style.height="%s";',
00051 $this->name,$p_val);
00052 $this->parameter.=$js;
00053
00054 }
00055
00056
00057
00058
00059
00060 function set_block($p_block)
00061 {
00062 $this->blocking=$p_block;
00063 }
00064
00065 function set_zindex($p_val)
00066 {
00067 $js=sprintf('$("%s'.'_border").style.zIndex=%d;',
00068 $this->name,$p_val);
00069 $js=sprintf('$("%s'.'_content").style.zIndex=%d;',
00070 $this->name,$p_val);
00071 $this->parameter.=$js;
00072 }
00073 function set_dragguable($p_value)
00074 {
00075 $this->drag=$p_value;
00076 }
00077
00078
00079
00080
00081
00082 function set_attribute($p_name,$p_val)
00083 {
00084 $this->attribute[]=array($p_name,$p_val);
00085 }
00086
00087
00088
00089
00090 function set_title($p_title)
00091 {
00092 $this->title=$p_title;
00093 $s=sprintf('$("%s_"+"title")="%s"',
00094 $this->name,$this->title);
00095 return create_script($s);
00096 }
00097 function input()
00098 {
00099 $r="";
00100 if ($this->blocking)
00101 {
00102 $r.=sprintf('<div id="%s_fond" name="fond" class="popup_back">',$this->name);
00103 $r.="</div>";
00104 }
00105 $javascript=sprintf("javascript:hideIPopup('%s')",
00106 $this->name);
00107
00108
00109 if ( isset($this->title) && trim($this->title) != "" )
00110 {
00111 $r.=sprintf('<div name ="%s_border" id="%s_border" class="popup_border_title">',
00112 $this->name,
00113 $this->name);
00114 $r.=sprintf('<span id="%s_">%s</span>',$this->name,$this->title);
00115 }
00116 else
00117 {
00118 $r.=sprintf('<div name ="%s_border" id="%s_border" class="popup_border_notitle">',
00119 $this->name,
00120 $this->name);
00121 }
00122 $r.='<div style="position:absolute;top:0px;right:10px;font-weight:normal;font-size:9px;color:black;text-align:right">';
00123 $r.=sprintf('<a style="background-color:blue;color:white;text-decoration:none" href="%s">'._('Fermer').'</a></div>',
00124 $javascript);
00125
00126 $r.=sprintf('<div name ="%s_content" id="%s_content" class="popup_content"> %s </div></div>',
00127 $this->name,
00128 $this->name,
00129 $this->value);
00130
00131
00132
00133 $attr=$this->parameter;
00134 for ($i=0;$i< count($this->attribute);$i++)
00135 {
00136 list($name,$value)=$this->attribute[$i];
00137 $tmp1=sprintf("$('%s').%s='%s';",
00138 $this->name,
00139 $name,
00140 $value);
00141 $attr.=$tmp1;
00142 }
00143 $draggable='';
00144 if ($this->drag==true)
00145 {
00146
00147 $draggable=sprintf(" new Draggable('%s_border',{starteffect:function(){
00148 new Effect.Highlight('%s_border',{scroll:window,queue:'end'}); } });"
00149 ,$this->name
00150 ,$this->name);
00151
00152 }
00153 $attr=create_script($attr.$draggable);
00154 $r.=$attr;
00155 return $r;
00156 }
00157
00158 static function test_me()
00159 {
00160 echo js_include('js/scripts.js');
00161 require_once('class_iselect.php');
00162 $select=new ISelect('a');
00163 $select->value=array(array ('value'=>0,'label'=>'Première valeur'),
00164 array ('value'=>0,'label'=>'Première valeur'),
00165 array ('value'=>0,'label'=>'Première valeur'));
00166 for ($e=0;$e<50;$e++)
00167 {
00168 echo $select->input();
00169 if ($e%10 == 0 ) echo '<hr>';
00170 }
00171 $a=new IPopup('pop1');
00172 $a->value="";
00173 for ($e=0;$e<500;$e++)
00174 {
00175 $a->value.="<p>Il etait une fois dans un pays vraiment lointain où même plus loin que ça</p>";
00176 }
00177 echo $a->input();
00178 echo '
00179 <input type="button" onclick="hide(\'pop1\');hide(\'pop1_border\')" value="cacher">
00180 <input type="button" onclick="showIPopup(\'pop1\')" value="montrer">
00181 ',
00182 $a=new IPopup('pop2');
00183 $a->value='';
00184 $a->title="Retrouvez une saucisse";
00185 echo $a->input();
00186 echo '
00187 <input type="button" onclick="hide(\'pop2\');hide(\'pop2_border\')" value="cacher">
00188 <input type="button" onclick="showIPopup(\'pop2\')" value="montrer">
00189 ';
00190
00191 }
00192 }