Пример #1
0
 public function export_subscriber()
 {
     $subscribers = D("Subscribers")->select();
     $rows = array();
     foreach ($subscribers as $index => $subscriber) {
         $row = array();
         $row[] = $subscriber['name'];
         $row[] = $subscriber['company'];
         $row[] = $subscriber['contact'];
         $row[] = $subscriber['business'];
         $row[] = $subscriber['message'];
         $row[] = date('m/d/Y', $subscriber['create_time']);
         $rows[] = $row;
     }
     $titles = array("姓名", "公司", "联系方式", "业务方向", "留言", '时间');
     foreach ($intrests_title as $key => $display) {
         $titles[] = $display;
     }
     Excel::createExcel($rows, "Export", "SubscribersExport", $titles);
 }
Пример #2
0
 public function export_projects()
 {
     $ids = strval($this->_param('ids'));
     $status = intval($this->_param('status'));
     if ($ids) {
         $filter['id'] = array('in', explode(',', $ids));
     }
     if ($status) {
         $filter['status'] = $status;
     }
     $projects = D("Projects")->getProjects($filter);
     $columns = D("CustomColumns")->getProjectModuleColumns();
     $no_needs = array('status', 'manager_id');
     foreach ($columns as $k => $v) {
         if (in_array($k, $no_needs)) {
             continue;
         }
         $keynames[$k] = $v['display_name'];
     }
     $column_data = array();
     foreach ($projects as $one) {
         $single_data = array();
         foreach ($keynames as $key => $name) {
             if (!$one[$key]) {
                 $one[$key] = '';
             }
             $single_data[] = str_replace(' ', '', $one[$key]);
         }
         $column_data[] = $single_data;
     }
     D('AdminLogs')->saveLog('project', Utility::GetColumn($projects, 'title'), 'project_export');
     Excel::createExcel($column_data, "项目", "项目导出-" . date('Y-m-d'), array_values($keynames));
 }