40,20 → 40,21 |
'observateur' => 'Observateur', |
); |
|
define('URLPREFIX', 'service:cel:'); |
|
function cel_get_obs() { |
$URL = DOMAIN . '/jrest/InventoryObservationList/' . USER; |
$URL = DOMAIN . '/' . URLPREFIX . 'InventoryObservationList/' . USER; |
// 5000 (memory_limit) |
return json_decode(file_get_contents($URL . '/?limite=5000&numero_page=0')); |
} |
|
function cel_get_images() { |
$URL = DOMAIN . '/jrest/InventoryImageList/' . USER; |
$URL = DOMAIN . '/' . URLPREFIX . 'InventoryImageList/' . USER; |
return json_decode(file_get_contents($URL . '/?limite=100000&numero_page=0')); |
} |
|
function cel_delete_obs($obs) { |
$URL = DOMAIN . '/jrest/InventoryObservationList/' . USER; |
$URL = DOMAIN . '/' . URLPREFIX . 'InventoryObservationList/' . USER; |
$ch = curl_init(); |
|
//set the url, number of POST vars, POST data |
69,7 → 70,7 |
} |
|
function cel_delete_image($img) { |
$URL = DOMAIN . '/jrest/InventoryImageList/' . USER; |
$URL = DOMAIN . '/' . URLPREFIX . 'InventoryImageList/' . USER; |
$ch = curl_init(); |
|
//set the url, number of POST vars, POST data |
102,7 → 103,7 |
|
function cel_upload_image($file) { |
if(! file_exists($file)) return NULL; |
$URL = DOMAIN . '/jrest/InventoryImage'; |
$URL = DOMAIN . '/' . URLPREFIX . 'InventoryImage'; |
|
$ch = curl_init(); |
|
123,7 → 124,7 |
} |
|
function cel_link_images($user, $id_image, $id_obs) { |
$URL = DOMAIN . '/jrest/inventoryImageLink/'; |
$URL = DOMAIN . '/' . URLPREFIX . 'inventoryImageLink/'; |
$ch = curl_init(); |
|
//set the url, number of POST vars, POST data |
146,7 → 147,7 |
// TODO: CURLOPT_NETRC + Cel API support |
if(!defined('EMAIL') || !defined('PASS') || ! EMAIL || ! PASS) return FALSE; |
if(defined('COOKIE') && COOKIE) return TRUE; |
$URL = DOMAIN . '/jrest/User/' . EMAIL . '/' . PASS; |
$URL = DOMAIN . '/' . URLPREFIX . 'User/' . EMAIL . '/' . PASS; |
|
$ch = curl_init(); |
|
191,7 → 192,7 |
} |
|
function import($d) { |
$URL = DOMAIN . '/jrest/ImportXLS'; |
$URL = DOMAIN . '/' . URLPREFIX . 'ImportXLS'; |
if(!is_file($d)) return FALSE; |
$ch = curl_init(); |
|
215,7 → 216,7 |
} |
|
function importXLS($d) { |
$URL = DOMAIN . '/jrest/ImportXLS'; |
$URL = DOMAIN . '/' . URLPREFIX . 'ImportXLS'; |
if(!is_file($d)) return FALSE; |
exec("csvtool -o /tmp/a.csv col 1- $d"); |
exec(__DIR__ . "/bin/csv2xls -v 0 -f -o /tmp/a /tmp/a.csv &>/dev/null"); |
249,7 → 250,7 |
function export($cols = "standard,avance") { |
if(!defined('COOKIE')) return FALSE; |
|
$URL = DOMAIN . '/jrest/CelWidgetExport/export?'; |
$URL = DOMAIN . '/' . URLPREFIX . 'CelWidgetExport/export?'; |
$URL .= http_build_query(array('colonnes' => $cols, |
'id_utilisateur' => USER, |
'format' => 'csv')); |
272,7 → 273,7 |
|
$file = "/tmp/b.xls"; |
|
$URL = DOMAIN . '/jrest/CelWidgetExport/export?'; |
$URL = DOMAIN . '/' . URLPREFIX . 'CelWidgetExport/export?'; |
$URL .= http_build_query(array('colonnes' => $cols, |
'id_utilisateur' => USER, |
'format' => 'xls')); |
328,6 → 329,7 |
|
|
function champsLongToShort($a) { |
if(! $a) return array(); |
$r = array(); |
$x = array_flip($GLOBALS['champs']); |
foreach($a as $k => $v) { |