[ PHPXref.com ] [ Generated: Sun Jul 20 20:10:38 2008 ] [ RunCms 1.3B ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/runcms13B/manual/test/ -> form.php (source)

   1  <?php
   2  
   3  #####################################################

   4  #  

   5  #  Copyright © 2004, Stefano Balestrini

   6  #  essebe@essebe.ch - http://www.essebe.ch

   7  #  Licence: GPL 

   8  #

   9  #

  10  #  Merci de laisser ce copyright en place...

  11  #####################################################

  12  
  13  include ("../mainfile.php");
  14  include (XOOPS_ROOT_PATH."/header.php");
  15  include (XOOPS_ROOT_PATH."/class/xoopsformloader.php");
  16  
  17  global $xoopsTheme, $xoopsconfig,$HTTP_POST_VARS,$HTTP_GET_VARS;
  18  $xoopsOption['show_rblock'] =0;
  19  
  20  
  21  
  22  opentable($width='100%');
  23  if ($HTTP_POST_VARS){
  24  #####################################################    

  25  //récupération des données

  26  //recovery of the data

  27  #####################################################

  28  
  29  $echo  = !empty($HTTP_POST_VARS['champ']) ? $HTTP_POST_VARS['champ'] : $HTTP_GET_VARS['champ'];
  30  $echo = $myts->makeTareaData4Preview($echo);
  31  $echo2  = $myts->makeTboxData4PreviewInForm($echo);
  32  
  33  $hiddena  = !empty($HTTP_POST_VARS['hidden']) ? $HTTP_POST_VARS['hidden'] : $HTTP_GET_VARS['hidden'];
  34  $hiddena1 = $myts->makeTareaData4Preview($hiddena);
  35  
  36  $yesnoa  = !empty($HTTP_POST_VARS['yesno']) ? $HTTP_POST_VARS['yesno'] : $HTTP_GET_VARS['yesno'];
  37  if ($yesnoa == 1){$yesnoa1 = "J'ai dit oui";    
  38  }elseif ($yesnoa == 0){$yesnoa1 = "J'ai dit non";}
  39  
  40  $radioa  = !empty($HTTP_POST_VARS['radio']) ? $HTTP_POST_VARS['radio'] : $HTTP_GET_VARS['radio'];
  41  if ($radioa == 1){$radioa1 = "Option 2";    
  42  }elseif ($radioa == 0){$radioa1 = "Option1";}
  43  elseif ($radioa == 2){$radioa1 = "Option3";}
  44  
  45  $cochera  = !empty($HTTP_POST_VARS['cocher']) ?$HTTP_POST_VARS['cocher'] : $HTTP_GET_VARS['cocher'];
  46  if ($cochera !=""){
  47  $tableau  =  array_values($cochera);
  48  }
  49  
  50  
  51  $selecta  = !empty($HTTP_POST_VARS['select']) ? $HTTP_POST_VARS['select'] : $HTTP_GET_VARS['select'];
  52  if ($selecta == 1){$selecta1 = "Option 2";    
  53  }elseif ($selecta == 0){$selecta1 = "Option1";}
  54  elseif ($selecta == 2){$selecta1 = "Option3";}
  55  
  56  $filea  = !empty($HTTP_POST_VARS['file']) ? $HTTP_POST_VARS['file'] : $HTTP_GET_VARS['file'];
  57  $filea1 = $myts->makeTareaData4Preview($filea);
  58  
  59  $datea  = !empty($HTTP_POST_VARS['calendar']) ? $HTTP_POST_VARS['calendar'] : $HTTP_GET_VARS['calendar'];
  60  $datea1 = $myts->makeTareaData4Preview($datea);
  61  $datea2  = $myts->makeTboxData4PreviewInForm($datea);
  62  
  63  $datetimeA  = !empty($HTTP_POST_VARS['datetime']) ?$HTTP_POST_VARS['datetime'] : $HTTP_GET_VARS['datetime'];
  64  
  65  if ($datetimeA !=""){
  66  $tableau2  =  array_values($datetimeA);
  67  }
  68  
  69  
  70  function calcul_hours($temps)
  71  {
  72    #####################################################

  73    //combien d'heures ?

  74    // how many hours

  75    #####################################################

  76    $hours = floor($temps / 3600);
  77  
  78    #####################################################

  79    //combien de minutes ?

  80    // how many minutes

  81    #####################################################

  82    $min = floor(($temps - ($hours * 3600)) / 60);
  83    if ($min < 10)
  84      $min = "0".$min;
  85      
  86    #####################################################

  87    //combien de secondes

  88    // how many seconds

  89    #####################################################

  90    
  91    $sec = $temps - ($hours * 3600) - ($min * 60);
  92    if ($sec < 10)
  93      $sec = "0".$sec;
  94          
  95    echo $hours.":".$min;
  96  }
  97  
  98  
  99  $labela  = !empty($HTTP_POST_VARS['label']) ? $HTTP_POST_VARS['label'] : $HTTP_GET_VARS['label'];
 100  $labela1 = $myts->makeTareaData4Preview($labela);
 101  
 102  $groupa  = !empty($HTTP_POST_VARS['groupe']) ? $HTTP_POST_VARS['groupe'] : $HTTP_GET_VARS['groupe'];
 103  
 104  if ($groupa == 1){$groupea = "Groupe 1";    
 105  }elseif ($groupa == 2){$groupea = "Groupe 2";}
 106  elseif ($groupa == 5){$groupea = "Groupe 3";}
 107  
 108  $selusera  = !empty($HTTP_POST_VARS['utilisateur']) ? $HTTP_POST_VARS['utilisateur'] : $HTTP_GET_VARS['utilisateur'];
 109  $selusera1 = $myts->makeTareaData4Preview($selusera);
 110  if ($selusera1 == 0) $selusera1="0";
 111  
 112  $seltheme  = !empty($HTTP_POST_VARS['theme']) ? $HTTP_POST_VARS['theme'] : $HTTP_GET_VARS['theme'];
 113  $seltheme1 = $myts->makeTareaData4Preview($seltheme);
 114  
 115  
 116  $selmodul  = !empty($HTTP_POST_VARS['module']) ? $HTTP_POST_VARS['module'] : $HTTP_GET_VARS['module'];
 117  $selmodul1 = $myts->makeTareaData4Preview($selmodul);
 118  
 119  
 120  $zonetexta  = !empty($HTTP_POST_VARS['zonetext']) ? $HTTP_POST_VARS['zonetext'] : $HTTP_GET_VARS['zonetext'];
 121  $zonetexta1 = $myts->makeTareaData4Preview($zonetexta);
 122  $zonetexta2  = $myts->makeTboxData4PreviewInForm($zonetexta);
 123  
 124  $textform  = !empty($HTTP_POST_VARS['textenforme']) ? $HTTP_POST_VARS['textenforme'] : $HTTP_GET_VARS['textenforme'];
 125  $textform1 = $myts->makeTareaData4Preview($textform,1,1,1,$myts->allowLibrary = "true",$myts->allowImage = "true");
 126  $textform2  = $myts->makeTboxData4PreviewInForm($textform);
 127  
 128  $passw  = !empty($HTTP_POST_VARS['pass']) ? $HTTP_POST_VARS['pass'] : $HTTP_GET_VARS['pass'];
 129  $passw1 = $myts->makeTareaData4Preview($passw);
 130  $passw2  = $myts->makeTboxData4PreviewInForm($passw);
 131  
 132  $timezonea  = !empty($HTTP_POST_VARS['timezon']) ? $HTTP_POST_VARS['timezon'] : $HTTP_GET_VARS['timezon'];
 133  $timezonea = $myts->makeTareaData4Preview($timezonea);
 134  $timezonea2  = $myts->makeTboxData4PreviewInForm($timezonea);
 135  
 136  #####################################################

 137  //affichage des données

 138  //posting the data for preview

 139  #####################################################

 140  
 141  echo "<b><font size ='4'>Preview form</font></b> <br>----------<br><b>CHAMP :</b> $echo
 142         <br>----------<br><b>Hidden :</b> $hiddena1
 143         <br>----------<br><b>Time zone :</b> $timezonea
 144         <br>----------<br><b>Choix Oui/Non :</b> $yesnoa1
 145         <br>----------<br><b>Choix radio :</b> $radioa1
 146         <br>----------<br><b>Choix cases :</b> ";
 147         
 148         for ($i=0; $i<count($tableau); $i++){ 
 149         if ($tableau[$i] == 0 ){
 150             echo  "Option 1 -";
 151             }else if($tableau[$i] == 1 ){
 152             echo  " Option 2 -";
 153             }else{
 154             echo  " Option 3";}
 155      }
 156                 
 157                 
 158  
 159  echo       "<br>----------<br><b>Choix select :</b> $selecta1
 160         <br>----------<br><b>Fichier :</b> $filea1
 161         <br>----------<br><b>Date :</b> $datea1
 162         <br>----------<br><b>Date et Heure :</b> ";
 163         
 164         echo $tableau2[0]." - ";
 165         calcul_hours($tableau2[1]);
 166         
 167  echo      "<br>----------<br><b>Groupe :</b> $groupa - $groupea
 168         <br>----------<br><b>User :</b> $selusera1
 169         <br>----------<br><b>Thème :</b> $seltheme1
 170         <br>----------<br><b>Module :</b> $selmodul1
 171         <br>----------<br> $zonetexta1
 172         <br>----------<br> $textform1
 173         <br>----------<br> $passw1";
 174  }    
 175  
 176      
 177  #####################################################    

 178  //formulaire

 179  //Form

 180  #####################################################

 181  
 182  $action = "form.php";
 183  $title = "Formulaire de test";
 184  $name = "nom";
 185  $my_form = new XoopsThemeForm($title,$name,$action,$method="POST");
 186  
 187  #####################################################

 188  //definition and configuration of the fields from your form

 189  #####################################################

 190  
 191  #####################################################

 192  //hidden field

 193  // XoopsFormHidden($name,$value="");

 194  $hidden = new XoopsFormHidden("hidden","Valeur du champ caché");
 195  
 196  #####################################################

 197  //Label

 198  //The Label field does not turn over any value

 199  // XoopsFormLabel($caption,$value="");

 200  $label = new XoopsFormLabel("Label","<hr>");
 201  
 202  #####################################################

 203  //Text field

 204  //XoopsFormText($caption,$name,$size,$maxlenght,$value="");

 205  $champ = new XoopsFormText("Champ","champ",50,49,"$echo2");
 206  
 207  #####################################################

 208  //Text zone

 209  //XoopsFormTextArea($caption,$name,$value="",$rows,$cols);

 210  $zonetext = new XoopsFormTextArea("Zône texte","zonetext","$zonetexta2",5,50);
 211  
 212  #####################################################

 213  //Text zone with working (icons,url,mail,quote, etc..)

 214  //XoopsFormDhtmlTextArea($caption,$name,$value="",$rows,$cols,$hiddentext="");

 215  $textenforme = new XoopsFormDhtmlTextArea("Zône texte mis en forme","textenforme","$textform2",5,50,$hiddentext="xoopsHiddenText");
 216  
 217  #####################################################

 218  //Password

 219  //XoopsFormPassword($caption,$name,$size,$maxlenght,$value="");

 220  $pass = new XoopsFormPassword("Mot de passe","pass",10,6,"$passw2");
 221  
 222  #####################################################

 223  //Timezone

 224  //XoopsFormSelectTimezone($caption,$name,$value ="(-12 to +12)",$size=a number of posted lines);

 225  $timezon  = new XoopsFormSelectTimezone("Timezone","timezon",$value ="0",$size=1);
 226  
 227  #####################################################

 228  //choix oui ou non

 229  //yes - no field

 230  //XoopsFormRadioYN($caption,$name,$value= "1 for yes 0 for no",$yes,$no);

 231  
 232  $yesno  = new XoopsFormRadioYN("Oui,Non","yesno",$value=null,"J'ai dit oui","j'ai dit non");
 233  
 234  #####################################################

 235  //boutons radio

 236  //radio button

 237  //XoopsFormRadio($caption,$name,$value="preselected value");

 238  
 239  $radio  =  new XoopsFormRadio("Radio","radio","$radioa");
 240  $options = array("Option1","Option2","Option3");
 241  $radio->addOptionArray($options);
 242  //We can add the options one to one

 243  //$radio->addOption("value","name");

 244  
 245  #####################################################

 246  //Case à cocher

 247  //check box

 248  //XoopsFormCheckBox($caption,$name,$value ="preselected value");

 249  $cocher  =  new XoopsFormCheckBox("Cases","cocher",null);
 250  $options = array("Option1","Option2","Option3");
 251  $cocher->addOptionArray($options);
 252  
 253  #####################################################

 254  //Select

 255  //turn over a table if selection multiple

 256  //XoopsFormSelect($caption,$name,$value ="preselected value",$size=a number of posted lines,$multiple=False/true);

 257  $select  = new XoopsFormSelect("Sélection","select",$value = null,1,$multiple=False);
 258  $options = array("Option1","Option2","Option3");
 259  $select->addOptionArray($options);
 260  
 261  #####################################################

 262  //File field

 263  //XoopsFormFile($caption,$name, $maxfilesize);

 264  $file = new XoopsFormFile("Fichier","file", 305678);
 265  
 266  #####################################################

 267  //Date sous la forme yyyy-mm-dd

 268  //Date field with javascript calender  return yyyy-mm-dd

 269  //XoopsFormTextDateSelect($caption,$name,$size,$value = null);

 270  $date  =  new XoopsFormTextDateSelect("Date","calendar",15,$value = null);
 271  
 272  #####################################################

 273  //Date et Heure sous la forme d'un tableau

 274  //Date and Time turn over a table

 275  //XoopsFormDateTime($caption,$name,$size,$value = time());

 276  
 277  $dateHeure  =  new XoopsFormDateTime("Date et Heure","datetime",15,$value = time());
 278  
 279  #####################################################

 280  //Select User Group

 281  //XoopsFormSelectGroup($caption,$name,$include_anon = false, $value="", $size=a number of posted lines,$multiple=false/true);

 282  //turn over a table if selection multiple

 283  $group  = new XoopsFormSelectGroup("Groupe","groupe",$include_anon = false, $value=$groupa, $size=1,$multiple=false);
 284  
 285  #####################################################

 286  //Select User 

 287  // XoopsFormSelectUser($caption,$name,$value="", $size=a number of posted lines,$multiple=false/true);

 288  //turn over a table if selection multiple

 289  $seluser  = new XoopsFormSelectUser("Utilisateur","utilisateur",$include_anon=true, $value=null, $size=1, $multiple=false);
 290  
 291  #####################################################

 292  //Select Language

 293  //XoopsFormSelectLang($caption,$name,$value="", $size=a number of posted lines);

 294  //

 295  $lang = new XoopsFormSelectLang("Langue","lang",null,1);
 296  
 297  #####################################################

 298  //Select a country

 299  //XoopsFormSelectCountry($caption,$name,$value="code of country", $size=a number of posted lines);

 300  //turn over chains containing the code of the country (FR,GB,ZW,...)

 301  $country = new XoopsFormSelectCountry("Pays","pays","FR",1);
 302  
 303  #####################################################

 304  //Select a Match Option for search

 305  //XoopsFormSelectMatchOption($caption,$name,$value=" ", $size=a number of posted lines);

 306  //turn over Xoops_Match Options defined in common.php (1=END,2=EQUAL,3=CONTAIN,0=START)

 307  $match = new XoopsFormSelectMatchOption("Recherche","match","0",1);
 308  
 309  #####################################################

 310  //Select a theme

 311  //XoopsFormSelectTheme($caption,$name,$value=" ", $size=a number of posted lines);

 312  //turn over a chain with the name of the theme

 313  $theme = new XoopsFormSelectTheme("Thème","theme","",1);
 314  
 315  #####################################################

 316  //Select a module

 317  //XoopsFormSelectModule($caption, $name, $include_system=false, $value=0, $size=1, $multiple=false);

 318  //turn over a id of module

 319  $module = new XoopsFormSelectModule("Module","module",$include_system=false,0,1,false);
 320  
 321  #####################################################

 322  //boutton envoyer ou reset

 323  //Button

 324  //XoopsFormButton($caption,$name,$value="",$type (button,submit,reset);

 325  $envoi = new XoopsFormButton("Envoi","send","envoyer",submit);
 326  
 327  #####################################################

 328  // XoopsFormElementTray

 329  
 330  
 331  $element_tray = new XoopsFormElementTray("Name of Element", "<br />");
 332  $element_tray->addElement($champ);
 333  $element_tray->addElement($pass);
 334  
 335  #####################################################

 336  //posting of the form

 337  
 338  $my_form->addElement($element_tray);
 339  
 340  
 341  $my_form->addElement($hidden, true);
 342  $my_form->addElement($label, true);
 343  $my_form->addElement($timezon, true);
 344  $my_form->addElement($yesno, true);
 345  $my_form->addElement($radio, true);
 346  $my_form->addElement($cocher, true);
 347  $my_form->addElement($select, true);
 348  $my_form->addElement($file, true);
 349  $my_form->addElement($date, true);
 350  $my_form->addElement($dateHeure, true);
 351  $my_form->addElement($group, true);
 352  $my_form->addElement($seluser, true);
 353  $my_form->addElement($lang, true);
 354  $my_form->addElement($country, true);
 355  $my_form->addElement($match, true);
 356  $my_form->addElement($theme, true);
 357  $my_form->addElement($module, true);
 358  $my_form->addElement($zonetext);
 359  $my_form->addElement($textenforme, true);
 360  
 361  $my_form->addElement($envoi, true);
 362  $required = array("champ","zonetext","textenforme");
 363  
 364  $my_form->setRequired($required);
 365  $my_form->display();
 366  
 367  
 368  closetable();
 369  
 370  include (XOOPS_ROOT_PATH."/footer.php");
 371  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]