2014-03-29 04:26:44 +01:00
< ? php
2014-11-15 00:57:31 +01:00
//define("NOLOGIN",1); // This means this output page does not require to be logged.
2014-03-29 04:26:44 +01:00
define ( " NOCSRFCHECK " , 1 ); // We accept to go on this page from external web site.
2014-11-16 00:46:27 +01:00
define ( 'REQUIRE_JQUERY_MULTISELECT' , 'select2' );
2014-03-29 04:26:44 +01:00
require '../../main.inc.php' ;
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php' ;
2015-05-07 10:32:20 +02:00
if ( $dolibarr_main_prod ) {
accessforbidden ();
2014-03-29 04:26:44 +01:00
}
2014-11-15 00:57:31 +01:00
llxHeader ();
2014-03-29 04:26:44 +01:00
?>
2014-11-15 00:57:31 +01:00
< h1 >
2014-11-23 13:19:28 +01:00
This page is a sample of page using Dolibarr HTML widget methods . It is designed to make test with < br >
2015-12-15 09:32:09 +01:00
- css ( add parameter & amp ; theme = newtheme to test another theme or edit css of current theme ) < br >
2016-11-08 17:21:26 +01:00
- jmobile ( add parameter < a href = " <?php echo $_SERVER["PHP_SELF"] .'?dol_use_jmobile=4&dol_optimize_smallscreen=1'; ?> " > dol_use_jmobile = 4 & amp ; dol_optimize_smallscreen = 1 </ a > and switch to small screen < 1000 to enable view with jmobile ) < br >
- jmobile ( add parameter < a href = " <?php echo $_SERVER["PHP_SELF"] .'?dol_use_jmobile=1&dol_optimize_smallscreen=1'; ?> " > dol_use_jmobile = 1 & amp ; dol_optimize_smallscreen = 1 </ a > and switch to small screen < 570 to enable with emulated jmobile ) < br >
2015-06-05 14:02:50 +02:00
- no javascript / usage for bind people ( add parameter < a href = " <?php echo $_SERVER["PHP_SELF"] .'?nojs=1'; ?> " > nojs = 1 </ a > to force disable javascript ) < br >
2014-11-15 00:57:31 +01:00
</ h1 >
2014-12-07 23:51:36 +01:00
< br >
2014-03-29 04:26:44 +01:00
<!-- Output to test html . form . class . php -->
2014-11-15 00:57:31 +01:00
< ? php
2014-03-29 04:26:44 +01:00
$form = new Form ( $db );
2016-03-25 15:53:44 +01:00
// Test1: form->select_date using tzuser date
2018-05-12 13:40:53 +02:00
print " Test 1a: We must have here current date and hour for user (must match hour on browser). Note: Check your are logged so user TZ and DST are known. " ;
2014-03-29 04:26:44 +01:00
$offsettz = ( empty ( $_SESSION [ 'dol_tz' ]) ? 0 : $_SESSION [ 'dol_tz' ]) * 60 * 60 ;
$offsetdst = ( empty ( $_SESSION [ 'dol_dst' ]) ? 0 : $_SESSION [ 'dol_dst' ]) * 60 * 60 ;
print " (dol_tz= " . $offsettz . " dol_dst= " . $dol_dst . " )<br> \n " ;
2018-05-12 13:40:53 +02:00
$form -> select_date ( dol_now (), 'test1a' , 1 , 1 , 0 );
print '<br><br>' . " \n " ;
print " Test 1b: We must have here current date with hours to 00:00.<br> " ;
$form -> select_date ( '' , 'test1b' , 1 , 1 , 0 );
2014-03-29 04:26:44 +01:00
print '<br><br>' . " \n " ;
2016-03-25 15:53:44 +01:00
// Test2: form->select_date using tzuser date
2014-03-29 04:26:44 +01:00
print " Test 2: We must have here 1970-01-01 00:00:00 selected (fields can be empty)<br> \n " ;
2016-03-25 15:53:44 +01:00
$form -> select_date ( dol_get_first_day ( 1970 , 1 , false ), 'test2' , 1 , 1 , 1 );
2014-03-29 04:26:44 +01:00
print '<br><br>' . " \n " ;
2016-03-25 15:53:44 +01:00
// Test3: form->select_date for 1970-01-01 00:00:00
2014-03-29 04:26:44 +01:00
print " Test 3: We must have here 1970-01-01 00:00:00 selected (fields are mandatory)<br> \n " ;
2016-03-25 15:53:44 +01:00
$form -> select_date ( dol_get_first_day ( 1970 , 1 , false ), 'test3' , 1 , 1 , 0 );
2014-03-29 04:26:44 +01:00
2014-12-07 23:51:36 +01:00
print '<br><br>' . " \n " ;
2015-09-12 11:33:22 +02:00
// Test4a: a select
2015-05-10 21:21:29 +02:00
print " Test 4a: a select<br> \n " ;
$array = array ( 1 => 'Value 1' , 2 => 'Value 2' , 3 => 'Value 3 ith a very long text. aze eazeae e ae aeae a e a ea ea ea e a e aea e ae aeaeaeaze.' );
$selected = 3 ;
2016-03-25 15:34:37 +01:00
print $form -> selectarray ( 'testselecta' , $array , $selected , 1 , 0 , 0 , 'style="min-width: 250px;"' , 0 , 0 , 0 , '' , '' , 1 );
2015-05-10 21:21:29 +02:00
print '<br><br>' ;
print " Test 4b: a select<br> \n " ;
$array = array ( 1 => 'Value 1' , 2 => 'Value 2' , 3 => 'Value 3' );
$selected = 3 ;
2016-03-25 15:34:37 +01:00
print $form -> selectarray ( 'testselectb' , $array , $selected , 1 , 0 , 0 , 'style="min-width: 250px;"' , 0 , 0 , 0 , '' , '' , 1 );
2015-05-10 21:21:29 +02:00
print '<br><br>' . " \n " ;
print " Test 4c: Select array with no js forced<br> \n " ;
2014-12-07 23:51:36 +01:00
$array = array ( 1 => 'Value 1' , 2 => 'Value 2' , 3 => 'Value 3' );
2016-03-25 15:34:37 +01:00
print $form -> selectarray ( 'selectarray' , $array );
2014-12-07 23:51:36 +01:00
print '<br><br>' . " \n " ;
2015-10-26 11:23:31 +01:00
print " Test 4d: a select with ajax refresh and with onchange call of url<br> \n " ;
2015-09-12 11:33:22 +02:00
$selected =- 1 ;
2016-03-25 15:24:57 +01:00
print $form -> selectArrayAjax ( 'testselectc' , DOL_URL_ROOT . '/core/ajax/selectsearchbox.php' , $selected , 'style="min-width: 250px;"' , '' , 0 , 1 , '' , 1 );
2015-09-12 11:33:22 +02:00
print '<br><br>' . " \n " ;
// Test5a: form->select_thirdparty
print " Test 5a: Select thirdparty<br> \n " ;
2015-06-06 12:26:47 +02:00
print $form -> select_company ( 0 , 'thirdpartytest' );
2015-05-10 21:21:29 +02:00
print '<br><br>' . " \n " ;
2015-09-12 11:33:22 +02:00
// Test5b: form->select_product
print " Test 5b: Select product (using ajax)<br> \n " ;
2015-05-10 21:21:29 +02:00
$form -> select_produits ( 0 , 'producttest' );
print '<br><br>' . " \n " ;
2015-09-12 11:33:22 +02:00
// Test5c: a multiselect
print " Test 5c: a multiselect<br> \n " ;
2014-11-15 00:57:31 +01:00
$array = array ( 1 => 'Value 1' , 2 => 'Value 2' , 3 => 'Value 3' );
$arrayselected = array ( 1 , 3 );
2016-03-25 15:34:43 +01:00
print $form -> multiselectarray ( 'testmulti' , $array , $arrayselected , '' , 0 , '' , 0 , 250 );
2014-11-15 00:57:31 +01:00
2014-03-29 04:26:44 +01:00
2014-11-15 00:57:31 +01:00
llxFooter ();
$db -> close ();