Exemplo n.º 1
0
 function ExportToExcel()
 {
     $id = intval($this->Get['id']);
     if ($id < 1 || MEMBER_ID < 1 || 'admin' !== MEMBER_ROLE_TYPE) {
         $this->Messager('您不能导出该内容');
     }
     $list = array();
     load::logic('event');
     $EventLogic = new EventLogic();
     $param = array('where' => " a.id = '{$id}' ");
     $return = $EventLogic->getEventInfo($param);
     $event = $return['event_list'][$id];
     if (empty($event)) {
         $this->Messager('您要导出的内容已经不存在了');
     }
     $list[0][0] = '标题:';
     $list[0][1] = $event['title'];
     $list[1][0] = '时间:';
     $list[1][1] = $event['fromt'] . "-" . $event['tot'];
     $list[2][0] = '地点:';
     $list[2][1] = $event['province'] . $event['city'] . $event['area'] . $event['address'];
     $list[3][0] = '发起人:';
     $list[3][1] = $event['nickname'];
     $list[4][0] = '参与人数:';
     $list[4][1] = $event['play_num'] . "人";
     $list[5] = array();
     $list[6][0] = '申请者';
     $j = 1;
     foreach (unserialize($event['need_app_info']) as $value) {
         $list[6][$j] = $value['name'];
         $j++;
     }
     $list[6][$j] = '留言';
     $i = 7;
     $param = array('where' => " id = '{$id}' and play = 1 ", 'order' => " order by a.play_time ");
     $member = $EventLogic->getAllUser($param);
     $member_list = (array) $member['member'];
     foreach ($member_list as $member) {
         $app_info = (array) unserialize($member['app_info']);
         $list[$i][0] = $member['nickname'];
         $k = 1;
         foreach ($app_info as $value) {
             $list[$i][$k] = $value;
             $k++;
         }
         $i++;
     }
     jext('php-excel');
     $xls = new Excel_XML($this->Config['charset']);
     $xls->addArray($list);
     $xls->generateXML('event-' . date("YmdHis"));
     exit;
 }
Exemplo n.º 2
0
 function json_decode($json_value, $bool = false)
 {
     if (!class_exists('servicesJSON')) {
         jext('servicesJSON');
     }
     $assoc = $bool ? 16 : 32;
     $json = new servicesJSON($assoc);
     return $json->decode($json_value);
 }
 function http_socket($url, $method, $postfields = NULL, $multi = false)
 {
     jext('http_client');
     $http = new Http_Client($this->debug);
     $http->setHeader('user-agent', $this->useragent);
     if ($this->access_token) {
         $http->setHeader('authorization', 'OAuth2 ' . $this->access_token);
     }
     $http->setHeader('API-RemoteIP', $GLOBALS['_J']['client_ip']);
     if ('POST' == $method) {
         if ($postfields && is_array($postfields)) {
             if ($multi && isset($postfields['pic'])) {
                 if (is_array($postfields['pic'])) {
                     $http->addPostFile('pic', $postfields['pic']['name'], $postfields['pic']['data']);
                 } else {
                     $http->addPostFile('pic', $postfields['pic']);
                 }
                 unset($postfields['pic']);
             }
             foreach ($postfields as $k => $v) {
                 $http->addPostField($k, $v);
             }
         }
         return $http->Post($url, false);
     } else {
         if ($postfields) {
             $url = $this->_get_url($url, $postfields);
         }
         return $http->Get($url, false);
     }
 }
Exemplo n.º 4
0
 function _excel($list, $filename = '')
 {
     if (!$filename) {
         $filename = date('YmdHis');
     }
     jext('php-excel');
     $XLS = new Excel_XML($this->Config['charset']);
     $XLS->addArray($list);
     $XLS->generateXML($filename);
 }