Przeglądaj źródła

download csv first skeleton workded

master
patrick 6 lat temu
rodzic
commit
575ac97818
4 zmienionych plików z 35 dodań i 9 usunięć
  1. +2
    -1
      css/xeroc.css
  2. +1
    -1
      js/bts_office.js
  3. +18
    -0
      js/xeroc.js
  4. +14
    -7
      ts.php

+ 2
- 1
css/xeroc.css Wyświetl plik

@@ -15,7 +15,8 @@
}

#cstart, #cfinish, #paydate,
#invoice_start, #invoice_finish{
#invoice_start, #invoice_finish,
#ndis_start, #ndis_finish{
width:100%;
border:none;
text-align: center;

+ 1
- 1
js/bts_office.js Wyświetl plik

@@ -1934,7 +1934,7 @@
//console.log(kms);
for (var staff in kms ){
bts().staff_people[staff].set_km(kms[staff]);
console.log(bts().staff_map[staff]);
//console.log(bts().staff_map[staff]);
ensure_visible(bts().staff_people[staff].selector);
}
}

+ 18
- 0
js/xeroc.js Wyświetl plik

@@ -1,3 +1,4 @@
function on_download_ndis_csv (){}
(function ($) {
$(function () {
/*_____________________________________________*/
@@ -315,6 +316,23 @@
datebox();
setup_invoice_start_finish();

on_download_ndis_csv = do_download_ndis;
function do_download_ndis(){
var form = $('#ndis');
$('input[name="start"]').attr('value', "start中");
$('input[name="finish"]').attr('value', "finish文");
var clients = ["client1", "client2", "client3", "client4"];
clients.forEach(function(e,i){
if ( $('#e' + i).length == 0 ){
var input = $('<input id="e'+ i +'" type="hidden" name="clients[]" value="' + e +'">');
form.append(input);
}else{
$('#e' + i).attr('value', e);
}
});
form.submit();
}
/*_____________________________________________*/
});
})(jQuery);

+ 14
- 7
ts.php Wyświetl plik

@@ -33,7 +33,7 @@ class AcareOffice{
$this->setup_db_name();
$this->class_loader();
$this->apiv1 = new Apiv1($this, $this->job_table);
//$this->check_csv_download();
add_option( "acare_ts_db_version", "1.0" );
register_activation_hook( __FILE__, array($this, 'db_install') );
@@ -145,13 +145,18 @@ class AcareOffice{
public function check_csv_download()
{
$method = $_SERVER['REQUEST_METHOD'];
if ( $method != "POST")
return;
global $wpdb;
$url = $_SERVER['REQUEST_URI'];
$matches=[];
preg_match("/\/ndiscsv\/start-([^\/]+)\/finish-([^\/]+)\/?$/", $url, $matches);
if ( $matches !=3 || $_SERVER['REQUEST_URI'] != $matches[0] )
if ($url != "/ndiscsv/"){
return;
$start = $matches[1];
$finish = $matches[2];
}
$clients= $_POST['clients'];
$start = $_POST['start'];;
$finish = $_POST['finish'];;
$filename="{$start}___{$finish}.csv";
header("Expires: 0");
@@ -162,7 +167,8 @@ class AcareOffice{
header("Content-Disposition:attachment; filename=$filename");
header("Content-Type: application/force-download");
//readfile(dirname(__FILE__) . "/img/circle.png");
echo "content of this file";
echo "content of this file " . print_r($clients, true) . print_r($_POST, true);
exit();
}
@@ -802,6 +808,7 @@ ZOT;
'email'=> $s->user_email,
'account'=> get_user_meta($s->ID, 'account', true),
'address' => get_user_meta($s->ID, 'address', true),
'paymemt'=>get_user_meta($s->ID, 'payment', true),
'rating'=> 0,
'unconfirmedjob'=> 0,
);

Ładowanie…
Anuluj
Zapisz