Commit a1416318 by Phạm Văn Đoan

Update lại tên file khi export

parent 66df9354
......@@ -135,6 +135,8 @@ class CmsRanking extends CI_Controller
*/
public function exportReport($type, $time)
{
ini_set('max_execution_time', -1);
// Ghi log
$this->actionlog_model->add('EXPORTED', 'Export BXH: ' . $type, null, null, null);
......@@ -149,7 +151,8 @@ class CmsRanking extends CI_Controller
case 'daily':
if ($time) {
$daily_at = date('Y-m-d', strtotime($time));
$filename = 'Daily-report-' . $daily_at;
$filename = 'Daily_report_' . date('Y_m_d', strtotime($time));
$sheet_name = 'Daily-report-' . $daily_at;
$reports = $this->track_model->getReportDaily($daily_at);
}
break;
......@@ -159,19 +162,21 @@ class CmsRanking extends CI_Controller
$date_range = MyHelper::getWeekDateRange($week, $year, 'd-m-Y');
if (isset($date_range['start_week']) && isset($date_range['end_week'])) {
$name = date('d-m', strtotime($date_range['start_week'])) . '_' . date('d-m', strtotime($date_range['end_week']));
$sheet_name = 'Weekly-tuan' . (($week < 10) ? '0'.$time : $time) . '_' . $name;
$name = date('d_m', strtotime($date_range['start_week'])) . '__' . date('d_m', strtotime($date_range['end_week']));
$filename = 'Weekly_report_' . (($week < 10) ? '0'.$week : $week) . '_' . $year . ' (' . $name . ')';
} else {
$sheet_name = 'Weekly-tuan' . (($week < 10) ? '0'.$time : $time);
$filename = 'Weekly_report_' . (($week < 10) ? '0'.$week : $week) . '_' . $year;
}
$filename = 'Weekly-tuan' . (($week < 10) ? '0'.$time : $time);
$sheet_name = 'Weekly-report-' . $time;
$reports = $this->track_model->getReportWeekly($week, $year);
break;
case 'monthly':
$month = trim($array_time[0]);
$year = trim($array_time[1]);
$filename = 'Monthly-' . (($month < 10) ? '0'.$time : $time);
$filename = 'Monthly_report_' . (($month < 10) ? '0'.$time : $time);
$sheet_name = 'Monthly-report-' . $time;
$reports = $this->track_model->getReportMonthly($month, $year);
break;
......@@ -232,7 +237,7 @@ class CmsRanking extends CI_Controller
// writer already created the first sheet for us, let's get it
$objSheet = $objPHPExcel->getActiveSheet();
// rename the sheet
$objSheet->setTitle(($type == 'weekly') ? $sheet_name : $filename);
$objSheet->setTitle($sheet_name);
$objSheet->getCell('A1')->setValue("Rank");
$objSheet->getCell('B1')->setValue("Song Title");
......
......@@ -19,6 +19,9 @@ class CmsTrack extends CI_Controller
$this->load->model('actionlog_model');
}
/**
* Hiển thị ds bài hát
*/
public function listTrack()
{
$this->_data['functionName'] = 'Track';
......@@ -28,6 +31,9 @@ class CmsTrack extends CI_Controller
$this->load->view('backend/admin_template_view', $this->_data);
}
/**
* Ajax xử lý lấy ds bài hát
*/
public function listTrackAjax()
{
$data = array();
......@@ -49,6 +55,13 @@ class CmsTrack extends CI_Controller
$this->load->view('backend/ajax/cms_track/list_track_view', $data);
}
/**
* Hàm xử lý cập nhật bài hát
*
* @param $track_id
* @param string $id_user
* @param string $id_artist
*/
public function editTrack($track_id, $id_user = '', $id_artist = '')
{
$this->_data['contest'] = $track = $this->track_model->getById($track_id);
......@@ -120,10 +133,8 @@ class CmsTrack extends CI_Controller
$config['max_height'] = 768;
$this->load->library('upload', $config);
// if()
if ($this->upload->do_upload('avatar')) {
$upload_data = $this->upload->data();
// MyHelper::echoPreDie('ac: '.$$upload_data);
$db_art_path = $upload_path . '/' . $upload_data['file_name'];
}
$this->track_model->update($track_id, $title, $db_art_path);
......@@ -242,11 +253,9 @@ class CmsTrack extends CI_Controller
$this->track_model->add_singer($singer,$insert_id);
$this->track_model->add_artist($artist, $insert_id);
}
// Ghi log
// $this->mactionlog->add('UPDATED', 'Cập nhật Cuộc đua thành công!', 'Mactionlog', 'tracks', $contest_id);
//
$this->session->set_flashdata('success', 'Tạo Bài hát thành công');
}else{
} else {
$this->session->set_flashdata('error', 'Tạo Bài hát không thành công');
}
......
......@@ -22,7 +22,6 @@
<?php endif; ?>
<div class="row">
<?php //echo form_open(base_url().'backend/cmsRanking/listByDailyAjax'); ?>
<div class="col-lg-3">
<div class="input-group text-center">
<input class="form-control date-picker" id="input-date-picker" type="text" data-date-format="dd/mm/yyyy"
......@@ -40,7 +39,6 @@
<button class="btn btn-sm btn-warning"><i class="fa fa-download"></i> Export ra Excel</button>
</a>
</div>
<?php //echo form_close(); ?>
</div>
<!-- /.row -->
<div class="space-6"></div>
......@@ -97,6 +95,10 @@
changePagination('0');
updateExportLink();
$('#input-date-picker').change(function () {
updateExportLink();
});
});
//Ham chung cho cac input
function loadDataByAjaxFromInput(url){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment