Example #1
0
 /** debug 函数
 	@param mix data 调试的数据
 	@param string method 写文件方法,传'w'则覆盖,传'a'则续写
 	@param string memo 摘要信息
 	@param array aCustomParam 自定义参数 xmp=>是否使用xmp来渲染
 	@author feng
 	@return bool
 	*/
 public static function debug($data, $method = "a", $memo = 'None', $aCustomParam = array('xmp' => 1))
 {
     $sm = \YcheukfReport\Lib\ALYS\ALYSConfig::get('smHandle');
     $aConfig = $sm->get('config');
     if (isset($aConfig['YcheukfReport']['debug']) && $aConfig['YcheukfReport']['debug'] == 1) {
         return \YcheukfCommon\Lib\Functions::debug($data, "[inline]---[report]---" . $memo, $aCustomParam);
     }
     return true;
 }
Example #2
0
 function setType($type = '', $aConfig = array())
 {
     //$type=file/mmc  //配置缓存类型
     $_ALYSconfig = \YcheukfReport\Lib\ALYS\ALYSConfig::get();
     $this->cacheType = empty($type) ? $_ALYSconfig['cache']['type'] : $type;
     $this->cacheHandelKey = $_ALYSconfig['cache']['file_mem_path'];
     $aConfig = empty($aConfig) ? $_ALYSconfig['cache'] : $aConfig;
     switch ($this->cacheType) {
         case 'mmc':
             $this->cac = new \Memcache();
             $this->cac->connect($aConfig['mmc']['host'], $aConfig['mmc']['port']);
             break;
         case 'file':
             $this->cac = new \Cache_Lite($aConfig[$this->cacheHandelKey]);
             break;
         case 'zf2cache':
         default:
             $this->cac = \YcheukfCommon\Lib\Functions::getCacheObject($_ALYSconfig['smHandle'], 'filesystem');
             break;
     }
 }
Example #3
0
 function send($to, $subject, $body, $file = '')
 {
     $_ALYSconfig = \YcheukfReport\Lib\ALYS\ALYSConfig::get();
     \YcheukfCommon\Lib\Functions::sendEmailByMQ($_ALYSconfig['smHandle'], $to, $subject, $body);
     return true;
     //旧的逻辑
     $this->hdrs['From'] = $this->config['mail']['username'];
     //发信地址
     $this->hdrs['To'] = strtr($to, ';', ',');
     //收信地址
     $this->hdrs['Subject'] = $subject;
     //邮件标题
     $this->mime = new Mail_mime();
     $this->mime->_build_params['html_charset'] = "utf-8";
     //设置编码格式
     $this->mime->_build_params['head_charset'] = "utf-8";
     //设置编码格式
     $this->mime->setHTMLBody($body);
     //设置邮件正文
     if ($file != "") {
         $this->mime->addAttachment($file, 'application/octet-stream');
         //设置附件纯文本内容text/html或设置成		application/octet-stream 附件下载
     }
     $new_body = $this->mime->get();
     $headers = $this->mime->headers($this->hdrs);
     $ret = $this->mail_object->send($this->hdrs['To'], $headers, $new_body);
     //发送邮件
     //var_dump($ret);
     if (PEAR::isError($ret)) {
         //检测错误
         $s = $ret->getMessage();
         throw new \YcheukfReport\Lib\ALYS\ALYSException('ALYSEMAIL_ERROR', $s);
         return false;
     } else {
         return true;
     }
 }
Example #4
0
 public function __construct($message = '', $param = '', $code = 0)
 {
     \YcheukfCommon\Lib\Functions::debug($message . ' ' . $param, "[inline]---[exception]---" . __CLASS__);
     parent::__construct($message . ' ' . $param, $code);
 }
Example #5
0
 /**
  * 不同的部分
  */
 public function go_diff()
 {
     $geoType = $this->dateType;
     $showLabels = 0;
     $type = 'flash';
     $aInput = $this->aInput['input'][$type];
     $_ALYSconfig = \YcheukfReport\Lib\ALYS\ALYSConfig::get();
     $noDataShowLabel = empty($_ALYSconfig['fusion']['geography']['noDataShowLabel']) ? 0 : 1;
     $geographyRange = empty($aInput['geoRangeStyle']) ? 'common' : $aInput['geoRangeStyle'];
     unset($this->aChartStyles['range']);
     $field = $aInput['mainTable']['showField'][0];
     $oId2Label = \YcheukfReport\Lib\ALYS\ALYSFunction::loadDictionary('Id2label');
     $aTmp = $oId2Label->ALYSchgId2Label($this->dimenkey2selected);
     $aryLabelSet4Geo = $aTmp[key($this->dimenkey2selected)];
     $Data = $this->aDatas[0][$field];
     $DataN = $this->aFlashDatas[0][$field];
     //$Data = $DataN = array(58=>900);
     //		var_dump($aTmp);
     //翻译citykey
     $sCitykey = 'num2citykey';
     $aIDs = array();
     if (is_array($DataN)) {
         foreach ($DataN as $k => $v) {
             $aIDs[$sCitykey][] = $k;
         }
     }
     $aLabel = $oId2Label->ALYSchgId2Label(array($sCitykey => $sCitykey), $aIDs);
     $aCityMap = $aLabel[$sCitykey];
     //var_dump($aCityMap,$Data);exit;
     $fieldLabel = \YcheukfReport\Lib\ALYS\ALYSLang::_($field);
     if ($geoType == 'country') {
         $aCountrySN2Id = $this->_getCountryShortName2Id();
         $aryLabelSet4Geo = $this->_getCompatibleCode($aryLabelSet4Geo);
         foreach ($aryLabelSet4Geo as $shortName => $geoLabel) {
             $fusionCountryId = $this->_chgLocationCode2FusionCode($shortName);
             if (empty($aCountrySN2Id[$fusionCountryId])) {
                 continue;
             }
             $iniId = $aCountrySN2Id[$fusionCountryId];
             if ($Data[$fusionCountryId]) {
                 if (!empty($_ALYSconfig['fusion']['geography']['linkble'])) {
                     $event = $shortName == 'CN' ? "link=\\\"JavaScript:changeGeoMap('country', '" . $shortName . "');\\\"" : "";
                 }
                 $value = $DataN[$fusionCountryId];
                 $entitys .= "<entity id='" . $iniId . "' value='" . $value . "' showLabel='1' displayValue='" . $geoLabel . "' toolText='" . $fieldLabel . ',' . $geoLabel . ',' . $Data[$fusionCountryId] . "' " . $event . "/>";
             } else {
                 $entitys .= "<entity id='" . $iniId . "' value='0' displayValue='" . $geoLabel . "' toolText='" . $geoLabel . "' showLabel='" . $noDataShowLabel . "' />";
             }
         }
     } elseif ($geoType == 'province') {
         unset($Data['CN00']);
         foreach ($aryLabelSet4Geo as $shortName => $geoLabel) {
             list($t, $geoLabel) = explode('-', $geoLabel);
             $countryCode = substr($shortName, 0, 2);
             if ($countryCode == 'CN') {
                 $provinceCode = substr($shortName, 2, 2);
                 $fusionProvinceId = 'CN.' . $provinceCode;
                 $fusionProvinceId = $this->_chgLocationCode2FusionCode($fusionProvinceId);
                 if (!empty($_ALYSconfig['fusion']['geography']['linkble'])) {
                     $event = " link=\\\"JavaScript:changeGeoMap('province', '" . $countryCode . '.' . $provinceCode . "');\\\"";
                 }
                 if (!empty($aCityMap[$shortName])) {
                     $shortName = $aCityMap[$shortName];
                 }
                 if ($Data[$shortName]) {
                     //$selectedProvince = ($geoType == 'city' && strtoupper($provinceCode)==strtoupper($aryData['geoTypeProvinceCode']))? "fontBold='1' fontSize='16' fontColor='0' color='FF9933'":"";
                     $value = $DataN[$shortName];
                     $entitys .= "<entity id='" . $fusionProvinceId . "' value='" . $value . "' showLabel='1' displayValue='" . $geoLabel . "' toolText='" . $fieldLabel . ',' . $geoLabel . ',' . $Data[$shortName] . "' {$event} {$selectedProvince}/>";
                 } else {
                     $entitys .= "<entity id='" . $fusionProvinceId . "' value='0' displayValue='" . $geoLabel . "' toolText='" . $geoLabel . "' showLabel='" . $noDataShowLabel . "'  {$event}/>";
                 }
             } else {
                 unset($Data[$shortName]);
             }
         }
         $showLabels = 1;
     }
     //echo "aryLabelSet4Geo=";print_r($aryLabelSet4Geo);
     //$colorRange = $this->_getFusionColorRange($field, @max($DataN));
     if ('percent' == $geographyRange) {
         $colorRange = $this->_rangeColor1to10percent(@max($DataN));
     } elseif ('5hundred' == $geographyRange) {
         $colorRange = $this->_rangeColor1to5hun(@max($DataN));
     } else {
         $colorRange = $this->_getFusionColorRange($field, @max($DataN));
     }
     $s1 = "";
     $sUrlBase = \YcheukfCommon\Lib\Functions::getBaseUrl($_ALYSconfig['smHandle']);
     if (count($this->aChartStyles)) {
         foreach ($this->aChartStyles as $k => $v) {
             $s1 .= " {$k}='{$v}'";
         }
         if (isset($_ALYSconfig['fusion']['exportHandler'])) {
             $s1 .= " exportHandler='" . $sUrlBase . '/' . $_ALYSconfig['fusion']['exportHandler'] . "'";
         }
     }
     $this->xmlData = "<map showLabels ='" . $showLabels . "' legendCaption='" . $fieldLabel . "' {$s1}>" . $colorRange . "<data>" . $entitys . '</data></map>';
 }