Exemple #1
0
 public function downloadExcel()
 {
     include '/Data/ClassLib/Excel.class.php';
     $a = new \Excel();
     $a->set(array('A1' => 'test data'));
     $a->download('test');
 }
Exemple #2
0
 function onlogView($msg = '', $ty = '')
 {
     $action = "index.php?admin_log/logView";
     $hasLogViewPrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "logView");
     $hasLogViewPrivilege['url'] = "?admin_main";
     $hasLogViewPrivilege['return'] = true;
     !$hasLogViewPrivilege['return'] && __msg($hasLogViewPrivilege);
     $LogTypeList = $this->ask_config->getLogType();
     $operator_list = $_ENV['operator']->getList(0, 0);
     $ConditionList['StartDate'] = isset($this->post['StartDate']) ? $this->post['StartDate'] : (isset($this->get[2]) ? $this->get[2] : date("Y-m-d", time()));
     $ConditionList['EndDate'] = isset($this->post['EndDate']) ? $this->post['EndDate'] : (isset($this->get[3]) ? $this->get[3] : date("Y-m-d", time()));
     $ConditionList['EndDate'] = min($ConditionList['EndDate'], date("Y-m-d", time()), date("Y-m-t", strtotime($ConditionList['StartDate'])));
     $ConditionList['operatorId'] = isset($this->post['operatorId']) ? intval(urldecode($this->post['operatorId'])) : (isset($this->get[4]) ? intval(urldecode($this->get[4])) : 0);
     $ConditionList['operator'] = !in_array($ConditionList['operatorId'], array(-2, -1, 0)) ? $operator_list[$ConditionList['operatorId']]['login_name'] : $ConditionList['operatorId'];
     $ConditionList['QuestionId'] = isset($this->post['QuestionId']) ? intval($this->post['QuestionId']) : (isset($this->get[5]) ? intval($this->get[5]) : 0);
     $ConditionList['log_type_id'] = isset($this->post['log_type_id']) ? intval(urldecode($this->post['log_type_id'])) : (isset($this->get[6]) ? intval(urldecode($this->get[6])) : 0);
     $ConditionList['AuthorName'] = isset($this->post['AuthorName']) ? trim(urldecode($this->post['AuthorName'])) : (isset($this->get[7]) ? trim(urldecode($this->get[7])) : '');
     $ConditionList['log_type'] = $ConditionList['log_type_id'] ? $LogTypeList[$ConditionList['log_type_id']] : $ConditionList['log_type_id'];
     @($page = max(1, intval($this->get[8])));
     $export = trim($this->get[9]) == "export" ? 1 : 0;
     $setting = $this->setting;
     if (!$export) {
         $pagesize = $this->setting['list_default'];
         $pagesize = 20;
         $log_list = $_ENV['log']->getLogList($ConditionList, $page, $pagesize);
         $departstr = page($log_list['LogCount'], $pagesize, $page, "admin_log/logView/" . $ConditionList['StartDate'] . "/" . $ConditionList['EndDate'] . "/" . urlencode($ConditionList['operatorId']) . "/" . $ConditionList['QuestionId'] . "/" . $ConditionList['log_type_id'] . "/" . urlencode($ConditionList['AuthorName']));
         $downloadstr = page_url("<下载EXCEL表格>", "admin_log/logView/" . $ConditionList['StartDate'] . "/" . $ConditionList['EndDate'] . "/" . urlencode($ConditionList['operatorId']) . "/" . $ConditionList['QuestionId'] . "/" . $ConditionList['log_type_id'] . "/" . urlencode($ConditionList['AuthorName']) . "/" . $page . "/export");
         $msg && ($message = $msg);
         $ty && ($type = $ty);
     } else {
         set_time_limit(0);
         $page = 1;
         $pagesize = 1000;
         $num = 1;
         require TIPASK_ROOT . '/lib/Excel.php';
         $oExcel = new Excel();
         $FileName = '操作日志表';
         $oExcel->download($FileName)->addSheet('日志表');
         //标题栏
         $title = array("日志ID", "对应问题ID", "用户名", "操作人", "操作时间", "日志内容");
         $oExcel->addRows(array($title));
         while ($num > 0) {
             $log_list = $_ENV['log']->getLogList($ConditionList, $page, $pagesize);
             foreach ($log_list['LogList'] as $key => $value) {
                 $value['message'] = htmlspecialchars_decode($value['message']);
                 $log_list['LogList'][$key]['message'] = preg_replace("/<(.*?)>/", "", $value['message']);
                 $excelArr = array("id" => $log_list['LogList'][$key]['id'], "qid" => $log_list['LogList'][$key]['qid'], "AuthorName" => $log_list['LogList'][$key]['AuthorName'], "user" => $log_list['LogList'][$key]['user'], "time" => date("Y-m-d H:i:s", $log_list['LogList'][$key]['time']), "message" => $log_list['LogList'][$key]['message']);
                 $oExcel->addRows(array($excelArr));
             }
             $page++;
             $num = count($order_list['OrderList']);
         }
         $oExcel->closeSheet()->close();
     }
     include template('logview', 'admin');
 }
<?php

/*
 * ©2013 Croce Rossa Italiana
 */
paginaPrivata();
controllaParametri(array('id'), 'gruppi.dash&err');
$id = $_GET['id'];
$v = Volontario::id($id);
$inizio = DT::createFromFormat('d/m/Y', $_POST['datainizio']);
$fine = DT::createFromFormat('d/m/Y', $_POST['datafine']);
$inizio = $inizio->getTimestamp();
$fine = $fine->getTimestamp();
$excel = new Excel();
$excel->intestazione(['Nome', 'Cognome', 'Data nascita', 'Comitato', 'Attività', 'Obiettivo', 'Turno', 'Inizio', 'Fine']);
$partecipazioni = $v->partecipazioni();
foreach ($partecipazioni as $part) {
    $auts = $part->autorizzazioni();
    if (!$auts) {
        continue;
    }
    if ($part->turno()->inizio <= $inizio || $part->turno()->fine >= $fine) {
        continue;
    }
    $excel->aggiungiRiga([$v->nome, $v->cognome, date('d/m/Y', $v->dataNascita), $v->unComitato()->nomeCompleto(), $part->attivita()->nome, $part->attivita()->area()->obiettivo, $part->turno()->nome, date('d/m/Y H:i', $part->turno()->inizio), date('d/m/Y H:i', $part->turno()->fine)]);
}
$excel->genera('Report turni volontario.xls');
$excel->download();
Exemple #4
0
 function onbindLogView($msg = '', $ty = '')
 {
     $action = "index.php?admin_binding/bindLogView";
     $hasOrderLogViewPrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "bindLogView");
     $hasOrderLogViewPrivilege['url'] = "?admin_main";
     !$hasOrderLogViewPrivilege['return'] && __msg($hasOrderLogViewPrivilege);
     $ConditionList['StartDate'] = isset($this->post['StartDate']) ? $this->post['StartDate'] : (isset($this->get[2]) ? $this->get[2] : date("Y-m-d", time()));
     $ConditionList['EndDate'] = isset($this->post['EndDate']) ? $this->post['EndDate'] : (isset($this->get[3]) ? $this->get[3] : date("Y-m-d", time()));
     $ConditionList['author'] = isset($this->post['author']) ? trim(urldecode($this->post['author'])) : (isset($this->get[4]) ? trim(urldecode($this->get[4])) : "");
     $ConditionList['EndDate'] = min($ConditionList['EndDate'], date("Y-m-d", time()), date("Y-m-t", strtotime($ConditionList['StartDate'])));
     $OperatorInfo = $_ENV['operator']->getByColumn("login_name", urldecode($this->ask_login_name));
     $ConditionList['operator_loginId'] = isset($this->post['operator_loginId']) ? trim(urldecode($this->post['operator_loginId'])) : (isset($this->get[5]) ? trim(urldecode($this->get[5])) : "");
     if ($ConditionList['operator_loginId'] != "") {
         $OperatorInfo = $_ENV['operator']->getByColumn("login_name", urldecode($ConditionList['operator_loginId']));
         if ($OperatorInfo['id']) {
             $ConditionList['scopid'] = $OperatorInfo['id'];
         } else {
             $ConditionList['operator_loginId'] = "";
         }
     }
     $ConditionList['bid'] = isset($this->post['bid']) ? trim($this->post['bid']) : (isset($this->get[6]) ? trim($this->get[6]) : 'all');
     $BindTypeList = $this->ask_config->getBindOperateType();
     @($page = max(1, intval($this->get[7])));
     $export = trim($this->get[8]) == "export" ? 1 : 0;
     $setting = $this->setting;
     if (!$export) {
         $pagesize = $this->setting['list_default'];
         $pagesize = 20;
         $bind_log_list = $_ENV['bind_log']->getBindLogList($ConditionList, $page, $pagesize);
         foreach ($bind_log_list['BindLogList'] as $key => $value) {
             if (!isset($OperatorList[$value['scopid']])) {
                 $OperatorList[$value['scid']] = $_ENV['operator']->get($value['scid']);
             }
             $bind_log_list['BindLogList'][$key]['login_name'] = $OperatorList[$value['scid']]['login_name'];
             $bind_log_list['BindLogList'][$key]['bind_type'] = $BindTypeList[$value['bind_type']];
         }
         $departstr = page($bind_log_list['BindLogCount'], $pagesize, $page, "admin_binding/bindLogView/" . $ConditionList['StartDate'] . "/" . $ConditionList['EndDate'] . "/" . urlencode($ConditionList['author']) . "/" . urlencode($ConditionList['operator_loginId']) . "/" . $ConditionList['bid']);
         $downloadstr = page_url("<下载EXCEL表格>", "admin_binding/bindLogView/" . $ConditionList['StartDate'] . "/" . $ConditionList['EndDate'] . "/" . urlencode($ConditionList['author']) . "/" . urlencode($ConditionList['operator_loginId']) . "/" . $ConditionList['bid'] . "/" . $page . "/export");
         $msg && ($message = $msg);
         $ty && ($type = $ty);
     } else {
         set_time_limit(0);
         $page = 1;
         $pagesize = 1000;
         $num = 1;
         require TIPASK_ROOT . '/lib/Excel.php';
         $oExcel = new Excel();
         $FileName = '专属客服绑定记录表';
         $oExcel->download($FileName)->addSheet('绑定记录表');
         //标题栏
         $title = array("客服账号", "被绑定用户帐号", "操作类型", "操作时间");
         $oExcel->addRows(array($title));
         while ($num > 0) {
             $bind_log_list = $_ENV['bind_log']->getBindLogList($ConditionList, $page, $pagesize);
             foreach ($bind_log_list['BindLogList'] as $key => $value) {
                 if (!isset($OperatorList[$value['scopid']])) {
                     $OperatorList[$value['scid']] = $_ENV['operator']->get($value['scid']);
                 }
                 $bind_log_list['BindLogList'][$key]['login_name'] = $OperatorList[$value['scid']]['login_name'];
                 $bind_log_list['BindLogList'][$key]['bind_type'] = $BindTypeList[$value['bind_type']];
                 $excelArr = array("login_name" => $bind_log_list['BindLogList'][$key]['login_name'], "author" => $bind_log_list['BindLogList'][$key]['author'], "bind_type" => $bind_log_list['BindLogList'][$key]['bind_type'], "time" => date("Y-m-d H:i:s", $bind_log_list['BindLogList'][$key]['time']));
                 $oExcel->addRows(array($excelArr));
             }
             $page++;
             $num = count($bind_log_list['BindLogList']);
         }
         $oExcel->closeSheet()->close();
     }
     include template('bindLogview', 'admin');
 }
Exemple #5
0
 function ontransformedComplainView($msg = '', $ty = '')
 {
     $action = "index.php?admin_complain/transformedComplainView";
     $hasIntoComplainViewPrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "intoTransformedComplainView");
     $hasIntoComplainViewPrivilege['url'] = "?admin_main";
     !$hasIntoComplainViewPrivilege['return'] && __msg($hasIntoComplainViewPrivilege);
     $ConditionList['ComplainStartDate'] = isset($this->post['ComplainStartDate']) ? $this->post['ComplainStartDate'] : (isset($this->get[2]) ? $this->get[2] : date("Y-m-d", time() - 7 * 86400));
     $ConditionList['ComplainEndDate'] = isset($this->post['ComplainEndDate']) ? $this->post['ComplainEndDate'] : (isset($this->get[3]) ? $this->get[3] : date("Y-m-d", time()));
     // $ConditionList['AnswerStartDate'] = isset($this->post['AnswerStartDate'])?$this->post['AnswerStartDate']:(isset($this->get[4])?$this->get[4]:date("Y-m-d",time()-7*86400)); ;
     // $ConditionList['AnswerEndDate'] = isset($this->post['AnswerEndDate'])?$this->post['AnswerEndDate']:(isset($this->get[5])?$this->get[5]:date("Y-m-d",time()));
     $ConditionList['AnswerStartDate'] = 0;
     $ConditionList['AnswerEndDate'] = 0;
     $ConditionList['author'] = isset($this->post['author']) ? urldecode(trim($this->post['author'])) : (isset($this->get[6]) ? urldecode(trim($this->get[6])) : "");
     $ConditionList['author_id'] = isset($this->post['author_id']) ? trim($this->post['author_id']) : (isset($this->get[7]) ? trim($this->get[7]) : "");
     $ConditionList['operator_loginId'] = isset($this->post['operator_loginId']) ? trim($this->post['operator_loginId']) : (isset($this->get[8]) ? trim($this->get[8]) : "");
     $ConditionList['jid'] = isset($this->post['jid']) ? intval($this->post['jid']) : (isset($this->get[10]) ? intval($this->get[10]) : 0);
     $ConditionList['complainId'] = isset($this->post['complainId']) ? intval($this->post['complainId']) : (isset($this->get[9]) ? intval($this->get[9]) : 0);
     $statusList = $this->ask_config->getComStatus();
     $ConditionList['status'] = isset($this->post['status']) ? intval($this->post['status']) : (isset($this->get[11]) ? intval($this->get[11]) : -2);
     $assessStatusList = $this->ask_config->getComAssessStatus();
     $ConditionList['Assess'] = isset($this->post['Assess']) ? intval($this->post['Assess']) : (isset($this->get[12]) ? intval($this->get[12]) : -1);
     $SellerTypeList = $this->ask_config->getSellerType();
     $ConditionList['sid'] = isset($this->post['sid']) ? intval($this->post['sid']) : (isset($this->get[13]) ? intval($this->get[13]) : -1);
     $J = $this->cache->get("Jlist_" . $ConditionList['sid']);
     if (false != $J) {
         $Jlist = json_decode($J, true);
     } else {
         $Jlist = $_ENV['complain']->getJList($ConditionList['sid']);
         $this->cache->set("Jlist_" . $ConditionList['sid'], json_encode($Jlist), 1800);
     }
     $ConditionList['transformed'] = isset($this->post['transformed']) ? intval($this->post['transformed']) : (isset($this->get[14]) ? intval($this->get[14]) : 2);
     $PublicStatusList = $this->ask_config->getPublicStatus();
     @($page = max(1, intval($this->get[15])));
     $export = trim($this->get[16]) == "export" ? 1 : 0;
     $setting = $this->setting;
     $question_type_list = $this->ask_config->getQuestionType();
     if (!$export) {
         $pagesize = $this->setting['list_default'];
         $pagesize = 20;
         $complain_list = $_ENV['complain']->getComplainList($ConditionList, $page, $pagesize);
         foreach ($complain_list['ComplainList'] as $key => $value) {
             $complain_list['ComplainList'][$key]['description'] = cutstr($value['description'], 15);
             $S = $SellerTypeList;
             $complain_list['ComplainList'][$key]['sName'] = isset($S[$value['sid']]) ? $S[$value['sid']] : "尚未处理";
             $J = $this->cache->get("Jlist_0");
             if (false != $J) {
                 $J = json_decode($J, true);
             } else {
                 $J = $_ENV['complain']->getJList(0);
                 $this->cache->set("Jlist_0", json_encode($J), 1800);
             }
             $complain_list['ComplainList'][$key]['jName'] = isset($J[$value['jid']]) ? $J[$value['jid']] : "其他分类";
             $complain_list['ComplainList'][$key]['publicStatus'] = $PublicStatusList[$value['public']];
             $complain_list['ComplainList'][$key]['asnum'] = $assessStatusList[$value['assess']] . ($value['asnum'] > 0 ? "/" . $value['asnum'] . "次" : "");
             if ($value['sync'] == 0) {
                 $complain_list['ComplainList'][$key]['syncStatus'] = "未同步";
             } elseif ($value['sync'] == 1) {
                 $complain_list['ComplainList'][$key]['syncStatus'] = "已同步";
             } elseif ($value['sync'] < 0) {
                 $complain_list['ComplainList'][$key]['syncStatus'] = "失败" . -1 * $value['sync'] . "次/最大" . $setting['ts_warn_maxNum'] . "次";
             }
             if (in_array($value['status'], array(1, 3))) {
                 $answer = $_ENV['complain']->get_ComplainAnInfo($complain_list['ComplainList'][$key]['id']);
                 $complain_list['ComplainList'][$key]['answer_loginId'] = $answer['contact'];
             }
             $Comment = unserialize($value['comment']);
             $complain_list['ComplainList'][$key]['reason'] = $Comment['convert']['reason'];
             if (isset($Comment['convert']['from_type'])) {
                 $complain_list['ComplainList'][$key]['convertion'] = "<a href = '" . $_ENV['question']->getQuestionLink($Comment['convert']['from_id'], "question") . "' target='_BLANK'><来自 " . $question_type_list[$Comment['convert']['from_type']] . "><a> ";
                 $complain_list['ComplainList'][$key]['transformTime'] = $Comment['convert']['transformTime'];
                 $complain_list['ComplainList'][$key]['transformloginId'] = $Comment['convert']['loginId'];
             } else {
                 $complain_list['ComplainList'][$key]['convertion'] = "<a href = '" . $_ENV['question']->getQuestionLink($Comment['convert']['to_id'], "question") . "' target='_BLANK'><转成 " . $question_type_list[$Comment['convert']['to_type']] . " ><a> ";
                 $complain_list['ComplainList'][$key]['transformTime'] = $Comment['convert']['transformTime'];
                 $complain_list['ComplainList'][$key]['transformloginId'] = $Comment['convert']['loginId'];
             }
             if (in_array($value['status'], array(0, 2, 4))) {
                 if ($value['status'] == 2) {
                     $complain_list['ComplainList'][$key]['title'] = '撤销理由:"' . ($Comment['revoke']['revokeReason'] ? urldecode($Comment['revoke']['revokeReason']) : '无') . '",客户端IP:' . ($Comment['revoke']['ip'] ? $Comment['revoke']['ip'] : '无');
                     $complain_list['ComplainList'][$key]['AnswerTimeLag'] = "用户于" . date("Y-m-d H:i:s", $value['rtime']) . "撤销";
                 } else {
                     $complain_list['ComplainList'][$key]['AnswerTimeLag'] = $statusList[$value['status']];
                 }
             } else {
                 if ($answer['time'] > 0) {
                     $complain_list['ComplainList'][$key]['AnswerTimeLag'] = $this->timeLagToText($value['time'], $answer['time']);
                 } else {
                     $complain_list['ComplainList'][$key]['AnswerTimeLag'] = "尚未回复";
                 }
             }
             $complain_list['ComplainList'][$key]['reason'] = $Comment['convert']['reason'];
             $complain_list['ComplainList'][$key]['url'] = $value['public'] == 1 ? "已隐藏" : "<a href = '" . $_ENV['question']->getQuestionLink($value['id'], "complain") . "' target='_BLANK'><查看></a>";
             $complain_list['ComplainList'][$key]['SyncInfo'] = $_ENV['complain']->get_ComplainSyncInfo($value['id']);
             $complain_list['ComplainList'][$key]['SyncInfo']['cpid'] = $complain_list['ComplainList'][$key]['SyncInfo']['cpid'] ? "SC000" . $complain_list['ComplainList'][$key]['SyncInfo']['cpid'] : "无";
         }
         $departstr = page($complain_list['ComplainCount'], $pagesize, $page, "admin_complain/transformedComplainView/" . $ConditionList['ComplainStartDate'] . "/" . $ConditionList['ComplainEndDate'] . "/" . $ConditionList['AnswerStartDate'] . "/" . $ConditionList['AnswerEndDate'] . "/" . urlencode($ConditionList['author']) . "/" . $ConditionList['author_id'] . "/" . $ConditionList['operator_loginId'] . "/" . $ConditionList['complainId'] . "/" . $ConditionList['jid'] . "/" . $ConditionList['status'] . "/" . $ConditionList['Assess'] . "/" . $ConditionList['sid'] . "/" . $ConditionList['transformed']);
         $downloadstr = page_url("<下载EXCEL表格>", "admin_complain/transformedComplainView/" . $ConditionList['ComplainStartDate'] . "/" . $ConditionList['ComplainEndDate'] . "/" . $ConditionList['AnswerStartDate'] . "/" . $ConditionList['AnswerEndDate'] . "/" . urlencode($ConditionList['author']) . "/" . $ConditionList['author_id'] . "/" . $ConditionList['operator_loginId'] . "/" . $ConditionList['complainId'] . "/" . $ConditionList['jid'] . "/" . $ConditionList['status'] . "/" . $ConditionList['Assess'] . "/" . $ConditionList['sid'] . "/" . $ConditionList['transformed'] . "/" . $page . "/export");
         $msg && ($message = $msg);
         $ty && ($type = $ty);
     } else {
         set_time_limit(0);
         $page = 1;
         $pagesize = 1000;
         $num = 1;
         require TIPASK_ROOT . '/lib/Excel.php';
         $oExcel = new Excel();
         $FileName = 'SC与酷宝后台类别转换查询下载';
         $oExcel->download($FileName)->addSheet('投诉详情列表');
         //标题栏
         $title = array("SC投诉单号", "交易/物品订单号", "关联投诉单号", "问题描述", "用户名", "身份类型", "交易类型", "投诉时间", "回复时间", "转单客服", "转单时间", "转单说明", "转单理由", "浏览量", "是否隐藏", "接手客服账号", "评价", "同步状态", "回复客服", "回复内容", "撤销时间", "撤销理由", "撤销客户端IP", "浏览器", "操作系统");
         $oExcel->addRows(array($title));
         while ($num > 0) {
             $complain_list = $_ENV['complain']->getComplainList($ConditionList, $page, $pagesize);
             foreach ($complain_list['ComplainList'] as $key => $value) {
                 $value['description'] = preg_replace('/[\\s"]/', '', $value['description']);
                 $complain_list['ComplainList'][$key]['author'] = str_replace('<x>', '<?>', $value['author']);
                 $value['description'] = preg_replace('/[&amp;&nbsp;&quot;]/', '', $value['description']);
                 $complain_list['ComplainList'][$key]['description'] = strip_tags($value['description']);
                 $complain_list['ComplainList'][$key]['qtypeName'] = isset($qtypeList[$value['qtype']]) ? $qtypeList[$value['qtype']]['name'] : "其他分类";
                 $complain_list['ComplainList'][$key]['publicStatus'] = $PublicStatusList[$value['public']];
                 $complain_list['ComplainList'][$key]['asnum'] = $assessStatusList[$value['assess']] . ($value['asnum'] > 0 ? "/" . $value['asnum'] . "次" : "");
                 if ($value['sync'] == 0) {
                     $complain_list['ComplainList'][$key]['syncStatus'] = "未同步";
                 } elseif ($value['sync'] == 1) {
                     $complain_list['ComplainList'][$key]['syncStatus'] = "已同步";
                 } elseif ($value['sync'] < 0) {
                     $complain_list['ComplainList'][$key]['syncStatus'] = "失败" . -1 * $value['sync'] . "次/最大" . $setting['ts_warn_maxNum'] . "次";
                 }
                 if (in_array($value['status'], array(1, 3))) {
                     $answer = $_ENV['complain']->get_ComplainAnInfo($complain_list['ComplainList'][$key]['id']);
                     $answer['content'] = preg_replace('/[\\s"]/', '', $answer['content']);
                     $answer['content'] = preg_replace('/[&amp;&nbsp;&quot;]/', '', $answer['content']);
                     $answer['content'] = strip_tags($answer['content']);
                 }
                 $Comment = unserialize($value['comment']);
                 if (isset($Comment['convert']['from_type'])) {
                     $complain_list['ComplainList'][$key]['convertion'] = "来自 " . $question_type_list[$Comment['convert']['from_type']] . ",问题ID:" . $Comment['convert']['from_id'];
                     $complain_list['ComplainList'][$key]['transformTime'] = $Comment['convert']['transformTime'];
                     $complain_list['ComplainList'][$key]['transformloginId'] = $Comment['convert']['loginId'];
                 } else {
                     $complain_list['ComplainList'][$key]['convertion'] = "转为 " . $question_type_list[$Comment['convert']['to_type']] . ",问题ID:" . $Comment['convert']['to_id'];
                     $complain_list['ComplainList'][$key]['transformTime'] = $Comment['convert']['transformTime'];
                     $complain_list['ComplainList'][$key]['transformloginId'] = $Comment['convert']['loginId'];
                 }
                 $complain_list['ComplainList'][$key]['reason'] = $Comment['convert']['reason'];
                 if (in_array($value['status'], array(0, 2, 4))) {
                     if ($value['status'] == 2) {
                         $complain_list['ComplainList'][$key]['AnswerTimeLag'] = "用户已撤销";
                         //"用户于".date("Y-m-d H:i:s",$value['rtime'])."撤销";
                         $complain_list['ComplainList'][$key]['RevokeTime'] = $value['rtime'] ? date("Y-m-d H:i:s", $value['rtime']) : "无";
                         $complain_list['ComplainList'][$key]['RevokeReason'] = $Comment['revoke']['revokeReason'] ? urldecode($Comment['revoke']['revokeReason']) : "无";
                         $complain_list['ComplainList'][$key]['RevokeIP'] = $Comment['revoke']['ip'] ? $Comment['revoke']['ip'] : "无";
                         $answer['content'] = "无";
                     } else {
                         $complain_list['ComplainList'][$key]['AnswerTimeLag'] = $statusList[$value['status']];
                     }
                 } else {
                     if ($answer['time'] > 0) {
                         $complain_list['ComplainList'][$key]['AnswerTimeLag'] = $this->timeLagToText($value['time'], $answer['time']);
                     } else {
                         $complain_list['ComplainList'][$key]['AnswerTimeLag'] = "尚未回复";
                     }
                 }
                 $J = $this->cache->get("Jlist_0");
                 if (false != $J) {
                     $J = json_decode($J, true);
                 } else {
                     $J = $_ENV['complain']->getJList(0);
                     $this->cache->set("Jlist_0", json_encode($J), 1800);
                 }
                 $complain_list['ComplainList'][$key]['SyncInfo'] = $_ENV['complain']->get_ComplainSyncInfo($value['id']);
                 $excelArr = array();
                 $S = $SellerTypeList;
                 $S['0'] = "尚未处理";
                 $excelArr = array("id" => $complain_list['ComplainList'][$key]['id'], "order_id" => $complain_list['ComplainList'][$key]['order_id'] ? $complain_list['ComplainList'][$key]['order_id'] : $complain_list['ComplainList'][$key]['goods_id'], "ComplainId" => $complain_list['ComplainList'][$key]['SyncInfo']['scid'] ? "CS000" . $complain_list['ComplainList'][$key]['SyncInfo']['cpid'] : "", "description" => $complain_list['ComplainList'][$key]['description'], "author" => $complain_list['ComplainList'][$key]['author'], "sName" => isset($S[$value['sid']]) ? $S[$value['sid']] : "尚未处理", "jName" => isset($J[$value['jid']]) ? $J[$value['jid']] : "其他分类", "time" => date("Y-m-d H:i:s", $complain_list['ComplainList'][$key]['time']), "AnswerTimeLag" => $complain_list['ComplainList'][$key]['AnswerTimeLag'], "transformloginId" => $complain_list['ComplainList'][$key]['transformloginId'], "transformTime" => date("Y-m-d H:i:s", $complain_list['ComplainList'][$key]['transformTime']), "convertion" => $complain_list['ComplainList'][$key]['convertion'], "reason" => strip_tags($complain_list['ComplainList'][$key]['reason']), "view" => $complain_list['ComplainList'][$key]['view'], "publicStatus" => $complain_list['ComplainList'][$key]['publicStatus'], "loginId" => $complain_list['ComplainList'][$key]['loginId'], "asnum" => $complain_list['ComplainList'][$key]['asnum'], "syncStatus" => $complain_list['ComplainList'][$key]['syncStatus'], "answer_loginId" => trim($answer['contact']), "answer" => trim($answer['content']) == "" ? "无回复内容" : $answer['content'], "RevokeTime" => $complain_list['ComplainList'][$key]['RevokeTime'], "RevokeReason" => strip_tags($complain_list['ComplainList'][$key]['RevokeReason']), "RevokeIP" => $complain_list['ComplainList'][$key]['RevokeIP'], "Browser" => $Comment['Browser'], "OS" => $Comment['OS']);
                 $oExcel->addRows(array($excelArr));
             }
             $page++;
             $num = count($complain_list['ComplainList']);
         }
         $oExcel->closeSheet()->close();
     }
     include template('transformedComplainview', 'admin');
 }
 function ondatamonth()
 {
     set_time_limit(0);
     $year = trim($this->get[2]);
     $data_arr = $_ENV['question']->getDataMonth($year);
     require TIPASK_ROOT . '/lib/Excel.php';
     $oExcel = new Excel();
     $FileName = $year . "年每月数据";
     $oExcel->download($FileName);
     $sheetArr = array('total_count' => '总咨询量', 'handle_count' => '已处理', 'yes' => '满意', 'no' => '不满意', 'none' => '未评价');
     foreach ($sheetArr as $key => $value) {
         $oExcel->addSheet($value);
         $title = array('-1' => $value);
         for ($i = 1; $i <= 12; $i++) {
             $title[$i] = "第" . $i . "月";
         }
         $oExcel->addRows(array($title));
         ksort($data_arr);
         foreach ($data_arr as $cid => $cid_info) {
             $d = array('-1' => $cid_info['name']);
             for ($i = 1; $i <= 12; $i++) {
                 $d[$i] = $cid_info[$key][$i];
             }
             $oExcel->addRows(array($d));
             ksort($cid_info['sub']);
             foreach ($cid_info['sub'] as $cid1 => $cid1_info) {
                 $d = array('-1' => $cid1_info['name']);
                 for ($i = 1; $i <= 12; $i++) {
                     $d[$i] = $cid1_info[$key][$i];
                 }
                 $oExcel->addRows(array($d));
                 ksort($cid1_info['sub']);
                 foreach ($cid1_info['sub'] as $cid2 => $cid2_info) {
                     $d = array('-1' => $cid2_info['name']);
                     for ($i = 1; $i <= 12; $i++) {
                         $d[$i] = $cid2_info[$key][$i];
                     }
                     $oExcel->addRows(array($d));
                     ksort($cid2_info['sub']);
                     foreach ($cid2_info['sub'] as $cid3 => $cid3_info) {
                         $d = array('-1' => $cid3_info['name']);
                         for ($i = 1; $i <= 12; $i++) {
                             $d[$i] = $cid3_info[$key][$i];
                         }
                         $oExcel->addRows(array($d));
                         ksort($cid3_info['sub']);
                         foreach ($cid3_info['sub'] as $cid4 => $cid4_info) {
                             $d = array('-1' => $cid4_info['name']);
                             for ($i = 1; $i <= 12; $i++) {
                                 $d[$i] = $cid4_info[$key][$i];
                             }
                             $oExcel->addRows(array($d));
                         }
                     }
                 }
             }
         }
         $oExcel->closeSheet();
     }
     $oExcel->close();
 }
Exemple #7
0
 function onpageViewDetail($msg = '', $ty = '')
 {
     //只查询转为投诉的问题
     $action = "index.php?admin_data/PageViewDetail";
     $hasIntoViewDetailPrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "intoPageViewDetail");
     $hasIntoResponseDayDataPrivilege['url'] = "?admin_main";
     !$hasIntoViewDetailPrivilege['return'] && __msg($hasIntoViewDetailPrivilege);
     $ConditionList['StartDate'] = isset($this->post['StartDate']) ? $this->post['StartDate'] : (isset($this->get[2]) ? $this->get[2] : date("Y-m-d", time()));
     $ConditionList['EndDate'] = isset($this->post['EndDate']) ? $this->post['EndDate'] : (isset($this->get[3]) ? $this->get[3] : date("Y-m-d", time()));
     $ConditionList['PageId'] = isset($this->post['PageId']) ? intval($this->post['PageId']) : (isset($this->get[4]) ? intval($this->get[4]) : 0);
     $ConditionList['EndDate'] = min($ConditionList['EndDate'], date("Y-m-t", strtotime($ConditionList['StartDate'])), date("Y-m-d", time()));
     $PageList = $_ENV['view']->GetAllPage();
     $export = trim($this->get[6]) == "export" ? 1 : 0;
     @($page = max(1, intval($this->get[5])));
     if (!$export) {
         $pagesize = $this->setting['list_default'];
         $pagesize = 10;
         $PageViewDetail = $_ENV['view']->getPageViewDetail($ConditionList, $page, $pagesize);
         foreach ($PageViewDetail['PageViewList'] as $key => $value) {
             $PageViewDetail['PageViewList'][$key]['PageName'] = isset($PageList[$value['PageId']]) ? $PageList[$value['PageId']]['PageName'] : '未知页面';
         }
         $downloadstr = page_url("<下载EXCEL表格>", "admin_data/PageViewDetail/" . $ConditionList['StartDate'] . "/" . $ConditionList['EndDate'] . "/" . $ConditionList['PageId'] . "/" . $page . "/export");
         $departstr = page($PageViewDetail['PageViewCount'], $pagesize, $page, "admin_data/PageViewDetail/" . $ConditionList['StartDate'] . "/" . $ConditionList['EndDate'] . "/" . $ConditionList['PageId']);
         $msg && ($message = $msg);
         $ty && ($type = $ty);
     } else {
         set_time_limit(0);
         $page = 1;
         $pagesize = 1000;
         $num = 1;
         require TIPASK_ROOT . '/lib/Excel.php';
         $oExcel = new Excel();
         $FileName = '页面浏览记录';
         $oExcel->download($FileName)->addSheet('页面浏览记录');
         //标题栏
         $title = array("页面", "浏览IP", "浏览时间");
         $oExcel->addRows(array($title));
         while ($num > 0) {
             $PageViewDetail = $_ENV['view']->getPageViewDetail($ConditionList, $page, $pagesize);
             foreach ($PageViewDetail['PageViewList'] as $key => $value) {
                 $excelArr = array("PageName" => isset($PageList[$value['PageId']]) ? $PageList[$value['PageId']]['PageName'] : '未知页面', "ViewIP" => long2ip($value['ViewIP']), "ViewTime" => date('Y-m-d H:i:s', $value['Time']));
                 $oExcel->addRows(array($excelArr));
             }
             $page++;
             $num = count($PageViewDetail['PageViewList']);
         }
         $oExcel->closeSheet()->close();
     }
     include template('PageViewDetail', 'admin');
 }
<?php

/*
 * ©2013 Croce Rossa Italiana
 */
paginaPrivata();
richiediComitato();
$x = new Excel();
$x->intestazione(['Attività', 'Turno', 'Data inizio', 'Ora inizio', 'Data fine', 'Ora fine']);
foreach ($me->partecipazioni(AUT_OK) as $p) {
    $t = $p->turno();
    $x->aggiungiRiga([$t->attivita()->nome, $t->nome, $t->inizio()->format('d-m-Y'), $t->inizio()->format('H:i'), $t->fine()->format('d-m-Y'), $t->fine()->format('H:i')]);
}
$x->genera('Foglio di servizio.xls');
$x->download();