1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-12-13 01:08:49 +01:00
DataTables/media/unit_testing/data_sources/arrays.php

51 lines
751 B
PHP
Raw Normal View History

<?php
if ( isset($_REQUEST['sEcho']) ) {
$a = dataSrc();
$a['sEcho'] = intval( $_REQUEST['sEcho'] );
$a['iTotalRecords'] = 1;
$a['iTotalDisplayRecords'] = 1;
echo json_encode( $a );
}
else {
echo json_encode( dataSrc() );
}
function dataSrc()
{
if ( !isset( $_REQUEST['dataSrc'] ) ) {
return array(
'aaData' => array(
array(1, 2, 3, 4, 5)
)
);
}
else if ( $_REQUEST['dataSrc'] === 'data' ) {
return array(
'data' => array(
array(1, 2, 3, 4, 5)
)
);
}
else if ( $_REQUEST['dataSrc'] === 'nested' ) {
return array(
'data' => array(
'inner' => array(
array(1, 2, 3, 4, 5)
)
)
);
}
else if ( $_REQUEST['dataSrc'] === 'plain' ) {
return array(
array(1, 2, 3, 4, 5)
);
}
}