/** * 获得数据入口 */ public function getData() { $type = 'total'; if (\YcheukfReport\Lib\ALYS\Report\Advance::isAdvanced($type)) { $aData = $this->getAdvancedData($type); } else { $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $aConf = $this->getConf($type); $aDatesNew = $this->getDateNew($type); $aDates = $this->getDate($type); $aConfs = array(); foreach ($aDates as $k => $Date) { foreach ($aConf as $table => $Conf) { $aConfs[$k][$table] = $Conf; $aCondition = $Conf['condition']; if (isset($aInput['nodateFlag']) && !$aInput['nodateFlag']) { //have date $aCondition = array_merge(array($aDatesNew[$k][$table]), $aCondition); } // $aCondition=array_merge(array($aDatesNew[$k][$table]),$aCondition); $aConfs[$k][$table]['condition'] = $aCondition; } } //\YcheukfReport\Lib\ALYS\ALYSFunction::debug($aConfs, 'a', 'aConfs'); foreach ($aConfs as $k => $aConf) { foreach ($aConf as $table => $Conf) { list($aData[$k][$table], $nTmpTotal) = $this->{$type}->getAlldata($Conf); } } } $aData = $this->_executeSqlData($type, $aData); return $aData; }
function go() { $aOutput = \YcheukfReport\Lib\ALYS\Report\Start::getOutput(); $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $oDict = \YcheukfReport\Lib\ALYS\ALYSFunction::loadDictionary('Metric'); $separator = $this->_getCsvSeparator(); $trendType = $aInput['input']['flash']['type'] = isset($aInput['input']['flash']['type']) ? $aInput['input']['flash']['type'] : "trend"; $aOffsetData = $aOutput['total']; foreach ($aOutput['total'] as $i => $aTmp) { $compareFlag = $i != 0 ? 1 : 0; foreach ($aTmp as $metric => $v) { if ($compareFlag) { if (empty($v)) { $offerPercent = 0; } else { $offerPercent = $aOutput['total'][0][0][$metric] ? ($aOutput['total'][0][0][$metric] - $v) * 100 / $v : 0; } $aOffsetData[$i][$metric] = $offerPercent; } } } $sHTML = ""; // \YcheukfReport\Lib\ALYS\ALYSFunction::debug($aOutput,'a', 'aOutputaOutput'); switch (strtolower($trendType)) { default: case "trend": case "multdate": $index = 0; foreach ($aOutput['total'][0] as $metric => $vvv) { foreach ($vvv as $metric2 => $vvv2) { if ($metric != $metric2) { continue; } $sHTML .= "\r\n"; $keyLabel = \YcheukfReport\Lib\ALYS\ALYSLang::_($metric2); $keyLabelTip = \YcheukfReport\Lib\ALYS\ALYSLang::_($metric2 . '-tip'); $sHTML .= '"' . $keyLabel . '"' . $separator; $offerPercentHTML = ""; if ($ii != 0) { if ($aOffsetData[$ii][$metric] == 0) { $offerPercentCls = "zero"; } else { $offerPercentCls = $aOffsetData[$ii][$metric] > 0 ? "plus2" : 'negative'; } $offerPercentLabel = abs(round($aOffsetData[$ii][$metric], 2)) . "%"; $offsetPercentHTML = '(' . $offerPercentLabel . ')'; $sHTML .= '"' . $vvv2 . '' . $offsetPercentHTML . '"' . $separator; } else { $sHTML .= '"' . $oDict->ALYSmetricFormat($metric2, $vvv2) . '"' . $separator; } } $index++; } break; } $sHTML .= "\r\n"; // var_export($sHTML); $aOutput['total.output'] = $sHTML; \YcheukfReport\Lib\ALYS\Report\Start::setOutput($aOutput); }
/** * 负责csv的字符串的组织与输出 @return string 处理过后的csv 字符串 */ function ALYSfmtOutputCsv() { $aOutput = \YcheukfReport\Lib\ALYS\Report\Start::getOutput(); $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $sCsv = ""; if ($aInput['nodateFlag'] == false) { foreach ($aInput['date'] as $aTmp) { $sCsv .= "#" . $aTmp['s'] . "~" . $aTmp['e'] . "\r\n"; } $sCsv .= "\r\n\r\n"; } if (isset($aOutput['flash.output'])) { $sCsv .= $aOutput['flash.output']; $sCsv .= "\r\n\r\n"; } if (isset($aOutput['total.output'])) { $sCsv .= $aOutput['total.output']; $sCsv .= "\r\n\r\n"; } if (isset($aOutput['detail.output'])) { $sCsv .= $aOutput['detail.output']; $sCsv .= "\r\n\r\n"; } return $sCsv; }
function go() { $aOutput = \YcheukfReport\Lib\ALYS\Report\Start::getOutput(); $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $trendType = $aInput['input']['flash']['type'] = isset($aInput['input']['flash']['type']) ? $aInput['input']['flash']['type'] : "trend"; $xmlDataEntity = ""; if ('bubble' == $trendType) { $xmlDataEntity .= "\n\r<bubble>"; foreach ($aOutput['flash'] as $i => $aTmp) { $xmlDataEntity .= "\n\r<entity>\n"; $xmlDataEntity .= "<column>" . $i . "</column>\n"; foreach ($aTmp as $date => $aTmp2) { $xmlDataEntity .= "<column>" . $aTmp2 . "</column>"; } $xmlDataEntity .= "\n</entity>"; } $xmlDataEntity .= "\n\r</bubble>"; } else { foreach ($aOutput['flash'] as $i => $aTmp) { $xmlDataEntity .= "\n\r<trend>"; foreach ($aTmp as $date => $aTmp2) { $xmlDataEntity .= "\n\r<entity>\n"; $xmlDataEntity .= "<column>" . $date . "</column>\n"; $xmlDataEntity .= "<column>" . current(array_values($aTmp2)) . "</column>"; $xmlDataEntity .= "\n</entity>"; } $xmlDataEntity .= "\n\r</trend>"; } } $aOutput['flash.output'] = "<flash>\n\n" . $xmlDataEntity . "</flash>\n\n"; \YcheukfReport\Lib\ALYS\Report\Start::setInput($aInput); \YcheukfReport\Lib\ALYS\Report\Start::setOutput($aOutput); }
function go() { $type = 'total'; $aOutput = \YcheukfReport\Lib\ALYS\Report\Start::getOutput(); $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $aOffsetData = $aOutput['total']; foreach ($aOutput['total'] as $date_i => $aData) { foreach ($aData as $i => $aTmp) { $compareFlag = $date_i != 0 ? 1 : 0; foreach ($aTmp as $metric => $v) { if ($compareFlag) { if (empty($v)) { $offerPercent = 0; } else { $offerPercent = $aOutput['total'][0][0][$metric] ? ($aOutput['total'][0][0][$metric] - $v) * 100 / $v : 0; } $aOffsetData[$date_i][$metric] = $offerPercent; } } } } $this->_formatMetric($type); //格式化 $oPlugin = \YcheukfReport\Lib\ALYS\ALYSFunction::loadPlugin("total"); $aOutput['total.output'] = $oPlugin->ALYSfmtOutputHtml($aOffsetData); \YcheukfReport\Lib\ALYS\Report\Start::setOutput($aOutput); }
/** * 负责Email发送 @param string staticKey 静态html链接的key @return array 处理过后的email数组 @description 处理 */ public function ALYSbefore_email($staticKey) { $_ALYSconfig = \YcheukfReport\Lib\ALYS\ALYSConfig::get(); $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); //配置静态页面时间 $time = $_ALYSconfig['cache']['report_static_html']['lifeTime']; $nDate = intval($time / (3600 * 24)); //配置静态页面链接 $url = $_ALYSconfig['rooturl'] . "demo/advance_get_statichtml.php"; //配置email信息 $aEmail = array(); $mailBody = isset($aInput['custom']['email']['mailBody']) ? $aInput['custom']['email']['mailBody'] : "hello world"; $aEmail['subject'] = 'report engine'; $aEmail['fromEmail'] = '*****@*****.**'; $aEmail['toEmail'] = isset($aInput['custom']['email']['toEmail']) ? join(',', $aInput['custom']['email']['toEmail']) : "'ycheukf@gmail.com,ruzhuo_feng@allyes.com'"; //逗号分割 $aEmail['body'] = <<<OUTPUT \t\t\t<p>您好: \t\t\t{$mailBody} \t\t\t<p>\t请点击链接查看报表 \t\t\t<p>\t{$url}?id={$staticKey} \t\t\t<p>\t本条链接在{$nDate}天内有效 OUTPUT; //var_export($aEmail); return $aEmail; }
function go() { $headertop = ""; //设置头标题上部份 $headerfoot = ""; //设置头标题下部份 $aOutput = \YcheukfReport\Lib\ALYS\Report\Start::getOutput(); $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $aOutput['total.output'] = self::_forma_pdf_total($aOutput['total.output']); $aOutput['detail.output'] = self::_format_pdf_list($aOutput['detail.output']); if (isset($aInput["custom"]["image"]) && !empty($aInput["custom"]["image"])) { $image = $aInput["custom"]["image"]; $_ALYSconfig = \YcheukfReport\Lib\ALYS\ALYSConfig::get(); \YcheukfReport\Lib\ALYS\ALYSFunction::removeLifeFile($_ALYSconfig['pdf']['path'], $_ALYSconfig['pdf']['lifetime'], $_ALYSconfig['pdf']['remove']); if (isset($aInput["custom"]["headertop"]) || isset($aInput["custom"]["headerfoot"])) { $headertop = $aInput["custom"]["headertop"]; $headerfoot = $aInput["custom"]["headerfoot"]; $pagefooter = @$aInput["custom"]["pagefooter"]; } else { $aHeader = \YcheukfReport\Lib\ALYS\ALYSFunction::loadPlugin("Css"); $aHeader = $aHeader->ALYSfmtOuputPdfTitle(); $headertop = $aHeader["titletop"]; $headerfoot = $aHeader["titlefoot"]; $pagefooter = @$aHeader["pagefooter"]; } $aOutput['output'] = self::_createPdf($image, $aOutput['total.output'], $aOutput['detail.output'], "f", $headertop, $headerfoot, $pagefooter); \YcheukfReport\Lib\ALYS\Report\Start::setOutput($aOutput); } }
public function _fmtOutput() { $type = 'detail'; $this->_fmtDimen_Metric($type); $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $o = \YcheukfReport\Lib\ALYS\ALYSFunction::loadClass("report.output." . $type . ".format." . $this->aInput['output']['format']); $o->go(); }
function go() { $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $sXmlTh = ""; foreach ($aInput['groups'] as $k => $aTmp) { foreach ($aTmp as $key => $aGroup) { /** * aGroup 数据结构 $aGroup = array( 'type'=>xxx 'key'=>xxx 'pieFieldSelected'=>true|false 是否为在饼图中被选中的指标 'pieFieldAble'=>true|false 是否出现在饼图的选择项中 'sortAble'=>true|false 'orderbyClass'=>''|orderby_asc|orderby 'thclass'=>array() 'tipclass'=>array() ) */ $key = $aGroup['key']; $label = \YcheukfReport\Lib\ALYS\ALYSLang::_($aGroup['key']); $sXmlTh .= "\n\t\t<th>" . $label . "</th>"; } } $sXmlTh = "\t<thead>\n" . $sXmlTh . "\n\t</thead>\n"; $aryListData = $this->aOutput['detail']; $xmlDataEntity = ""; for ($i = 0; $i < count($aryListData); $i++) { if (isset($aryListData[$i]) && is_array($aryListData[$i])) { $xmlDataEntity .= "\n\t\t<entity>"; foreach ($aryListData[$i] as $key => $aTmp) { foreach ($aTmp as $ii => $item) { if ($ii == 0 && $key == 'dimens') { continue; } $label = isset($item['label']) ? $item['label'] : ''; //$label = strip_tags(preg_replace('/'.$separator.'/', " ", $label)); $label = strip_tags(str_replace("\t", " ", $label)); $label = strip_tags(str_replace("\r\n", " ", $label)); $label = strip_tags(str_replace("\n", " ", $label)); $xmlDataEntity .= "\n\t\t\t<column>" . $label . "</column>"; } } $xmlDataEntity .= "\n\t\t</entity>"; } } $xmlDataEntity = "\t<data>\n" . $xmlDataEntity . "\n\t</data>\n"; $xmlPage = ""; if (isset($aInput['input']['detail']['page'])) { foreach ($aInput['input']['detail']['page'] as $key => $v) { $xmlPage .= "\n\t\t<{$key}>" . $v . "</{$key}>"; } } $xmlPage = "\t<pagenation>\n" . $xmlPage . "\n\t</pagenation>\n"; // var_export($aRe); $this->aOutput['detail.output'] = "<list>\n" . $sXmlTh . $xmlDataEntity . $xmlPage . "\n</list>\n"; \YcheukfReport\Lib\ALYS\Report\Start::setOutput($this->aOutput); }
public function __construct() { $this->aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $this->aOutput = \YcheukfReport\Lib\ALYS\Report\Start::getOutput(); $this->aFlashDatas = $this->aInput['internal']['flash']['datas']; $this->aDimen = array_keys($this->aInput['input']['flash']['tables'][$this->aInput['input']['flash']['mainTable']['table']]['dimen']['dimenkey2field']); $this->dimenkey2selected = $this->aInput['input']['flash']['tables'][$this->aInput['input']['flash']['mainTable']['table']]['dimen']['dimenkey2selected']; //维度 }
/** * 将输入的参数格式化为跨纬度指标的形式 */ public function _fmtGroup($type) { $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $mainTable = $this->aInput['input'][$type]['mainTable']['table']; $aGroup = array(); $orderByKey = null; $orderbyAsc = 'asc'; if (isset($aInput['input'][$type]['orderby']) && !preg_match("/\\(/i", $aInput['input'][$type]['orderby'])) { list($orderByKey, $orderbyAsc) = @explode(' ', $aInput['input'][$type]['orderby']); $orderbyAsc = empty($orderbyAsc) ? 'asc' : $orderbyAsc; } // var_export($orderByKey); // var_export($orderbyAsc); foreach ($aInput['input'][$type]['table'] as $table => $aTmp) { if (isset($aTmp['dimen']) and $table == $mainTable) { foreach ($aTmp['dimen'] as $i => $aTmp2) { if (!isset($aTmp2['group']) || !empty($aTmp2['group'])) { $aTmp3 = $aTmp2; // $aTmp3 = array(); // foreach($aTmp2 as $k=>$v){ // if($k == 'key'){ // }else{ // $aTmp3[$k] = $v; // } // } $aTmp2['selected'] = empty($aTmp2['selected']) ? $aTmp2['key'] : $aTmp2['selected']; $aTmp3['key'] = $aTmp2['selected']; $aTmp3['sortAble'] = isset($aTmp2['sortAble']) ? $aTmp2['sortAble'] : true; $aTmp3['orderbyClass'] = $orderByKey == $aTmp2['key'] ? "orderby_" . $orderbyAsc : ""; $aTmp3['thclass'] = isset($aTmp2['thclass']) ? $aTmp2['thclass'] : array("td150"); $aTmp3['tipclass'] = array(); $aGroup['dimen'][$aTmp2['selected']] = $aTmp3; } } } if (isset($aTmp['metric'])) { foreach ($aTmp['metric'] as $i => $aTmp2) { if ($aTmp2['show']) { $aTmp3 = $aTmp2; $aTmp3['pieFieldSelected'] = true; $aTmp3['pieFieldAble'] = true; $aTmp3['sortAble'] = isset($aTmp2['sortAble']) ? $aTmp2['sortAble'] : true; $aTmp3['orderbyClass'] = $orderByKey == $aTmp2['key'] ? "orderby_" . $orderbyAsc : ""; $aTmp3['thclass'] = isset($aTmp2['thclass']) ? $aTmp2['thclass'] : array("td150"); $aTmp3['tipclass'] = array(); $aGroup['metric'][$aTmp2['key']] = $aTmp3; } } } } //print_r($aGroup); $aInput['groups'] = $aGroup; \YcheukfReport\Lib\ALYS\Report\Start::setInput($aInput); }
/** * 负责csv输出时的表头的处理 @param string s 将要输出的html @return string 处理过后的html @description 传进来的html中已经埋了一些可替换的字符串, 用于不同系统的不同需求的替换 */ public function ALYSxml_title() { $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $s = ""; foreach ($aInput['date'] as $aTmp) { $s .= "<date>" . $aTmp['s'] . "~" . $aTmp['e'] . "</date>\r\n"; } $s = "<header>\n" . $s . "</header>\n\n"; // $s .= "#some title \r\n"; $s .= "\r\n\r\n\r\n"; return $s; }
public static function getAdvanceSQL($type) { $aInputData = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $aInput = $aInputData['input'][$type]; $sqls = array(); if (!empty($aInput['advanced']['statement'])) { $sqls = $aInput['advanced']['statement']; //$sql = str_replace("\n",'',$sql); //这里可对sql进行查检 } return $sqls; }
public static function getDateFeildByTable($type = '', $table = '') { if (empty($type) || empty($table)) { return \YcheukfReport\Lib\ALYS\ALYSConfig::get('dateField'); } $Input = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $aInput = $Input['input'][$type]; $dateFeild = @$aInput['table'][$table]['dateFeild']; if (empty($dateFeild)) { $dateFeild = \YcheukfReport\Lib\ALYS\ALYSConfig::get('dateField'); } return $dateFeild; }
function go() { $aOutput = \YcheukfReport\Lib\ALYS\Report\Start::getOutput(); $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $aJson = array(); $aReturn = ""; foreach ($aOutput['flash'] as $i => $aTmp) { foreach ($aTmp as $x => $aTmp2) { foreach ($aTmp2 as $metric => $v) { $aReturn[$i][$x]['x'] = $x; $aReturn[$i][$x]['y'] = \YcheukfReport\Lib\ALYS\ALYSLang::_("metric_" . $metric); $aReturn[$i][$x]['v'] = $v; } } } $aOutput['flash.output'] = $aReturn; \YcheukfReport\Lib\ALYS\Report\Start::setOutput($aOutput); }
function go() { $aOutput = \YcheukfReport\Lib\ALYS\Report\Start::getOutput(); // \YcheukfReport\Lib\ALYS\ALYSFunction::debug($aOutput,'a', 'aOutputaOutput'); $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $trendType = $aInput['input']['flash']['type'] = isset($aInput['input']['flash']['type']) ? $aInput['input']['flash']['type'] : "trend"; $aTmp2 = array(); foreach ($aOutput['total'] as $i => $aTmp) { $ii = 0; foreach ($aTmp as $metric => $v) { $aTmp2[$i][$ii]['label'] = \YcheukfReport\Lib\ALYS\ALYSLang::_("metric_" . $metric); $aTmp2[$i][$ii]['value'] = $v; $ii++; } } $aOutput['total.output'] = $aTmp2; \YcheukfReport\Lib\ALYS\Report\Start::setOutput($aOutput); }
/** * 格式化flash输出的样式的样式 * @return array 两维数组, 第一位为chart级别, 第二位为data级别 */ public function ALYSoutput_flash_trend_html_style() { //////////chart 级别样式///// $aChartStyle = array("MSCombi2D" => array("chartLeftMargin" => 0, "chartRightMargin" => 0, "formatNumberScale" => 0, "showAlternateHGridColor" => 1, "labelDisplay" => "STAGGER", "isSliced" => 1, "slicingDistance" => 20, "decimalPrecision" => 0, "baseFontSize" => 12, "showShadow" => 0, "aboutMenuItemLabel" => \YcheukfReport\Lib\ALYS\ALYSLang::_('ALYSFLASH_ABOUT_ABLEL'), "aboutMenuItemLink" => \YcheukfReport\Lib\ALYS\ALYSLang::_('ALYSFLASH_ABOUT_LINK'), "aboutIdiggerURL" => 1, "exportShowMenuItem" => 0, "exportEnabled" => 1, "exportfilename" => 'ALYSimage_', "exportAction" => 'save', "exportCallback" => 'myexportCallBack', "exportDialogColor" => 'e1f5ff', "exportDialogBorderColor" => '0372ab', "exportDialogFontColor" => '0372ab', "exportDialogPBColor" => '0372ab', "exportDialogMessage" => \YcheukfReport\Lib\ALYS\ALYSLang::_('ALYSFLASH_EXPORT_MSG')), "Bubble" => array("divLineColor" => "c3c3c3", "catVerticalLineColor" => "ff0000", "bgColor" => "ffffff", "canvasBorderColor" => '666666', "alternateHGridColor" => 'f0fff0', "showBorder" => '0', "numberSuffix" => '%', "bubbleScale" => "1", "baseFontColor" => '000000', "palette" => '3', "is3D" => 1, "animation" => 1, 'clipBubbles' => 1, 'showPlotBorder' => '1', 'exportEnabled' => '1', 'exportfilename' => 'ALYSimage_', 'exportAction' => 'save', 'exportCallback' => 'myexportCallBack'), "Bar2d" => array('numberSuffix' => '%', 'bgSWF' => '', 'exportEnabled' => '1', 'exportfilename' => 'ALYSimage_', 'exportAction' => 'save', 'exportCallback' => 'myexportCallBack'), "geography" => array("formatNumberScale" => '0', "animation" => '1', "showShadow" => '1', "baseFontSize" => '12', "showMarkerLabels" => '0', "fillColor" => 'F1f1f1', "borderColor" => '000000', "markerBorderColor" => '000000', "markerBgColor" => 'FF5904', "markerRadius" => '6', "legendPosition" => 'RIGHT', "useHoverColor" => '1', "showMarkerToolTip" => '1', "showBevel" => '1', "bgColor" => 'e4f4fc', "aboutMenuItemLabel" => \YcheukfReport\Lib\ALYS\ALYSLang::_('ALYSFLASH_ABOUT_ABLEL'), "aboutMenuItemLink" => \YcheukfReport\Lib\ALYS\ALYSLang::_('ALYSFLASH_ABOUT_LINK'), "aboutIdiggerURL" => 1, "exportShowMenuItem" => 0, "exportEnabled" => 1, "exportfilename" => 'ALYSimage_', "exportAction" => 'save', "exportCallback" => 'myexportCallBack', "exportDialogColor" => 'e1f5ff', "exportDialogBorderColor" => '0372ab', "exportDialogFontColor" => '0372ab', "exportDialogPBColor" => '0372ab', "exportDialogMessage" => \YcheukfReport\Lib\ALYS\ALYSLang::_('ALYSFLASH_EXPORT_MSG')), "pie3D" => array("palette" => '4', "decimals" => '0', "enableSmartLabels" => '0', "enableRotation" => '0', "bgColor" => 'FFFFFF', "bgAlpha" => '40,100', "bgRatio" => '0,100', "bgAngle" => '360', "showBorder" => '0', "startingAngle" => '70', "baseFontSize" => '12', "showValues" => '0', "showLabels" => '0', "formatNumberScale" => '0', "aboutMenuItemLabel" => \YcheukfReport\Lib\ALYS\ALYSLang::_('ALYSFLASH_ABOUT_ABLEL'), "aboutMenuItemLink" => \YcheukfReport\Lib\ALYS\ALYSLang::_('ALYSFLASH_ABOUT_LINK'), "aboutIdiggerURL" => 1)); $aChartStyle['MultiAxisLine'] = $aChartStyle["MSCombi2D"]; $aChartStyle['MSCombiDY2D'] = $aChartStyle["MSCombi2D"]; // $aChartStyle['MSCombiDY2D']['leftYAxis'] = 'M,K,L'; $aChartStyle['MSCombiDY2D']['useRoundEdges'] = '1'; $aChartStyle['MSCombiDY2D']['sNumberSuffix'] = ''; // //自定义样式 $aChartStyleCustom = array("MSCombi2D" => array("showLegend" => 1, "useRoundEdges" => "1", "showBorder" => "0", "divLineColor" => "#cccccc", "numDivLines" => 5, "numVDivLines" => 5, "showAlternateHGridColor" => "0", "canvasPadding" => 10, "canvasLeftMargin" => 90, "canvasBorderThickness" => "0", "canvasBgAlpha" => 0, "chartRightMargin" => 40, "bgSWFAlpha" => 100), "Bubble" => array("chartRightMargin" => "10", "divLineColor" => "c3c3c3", "catVerticalLineColor" => "ff0000", "bgColor" => "ffffff", "canvasBorderColor" => '666666', "alternateHGridColor" => 'f0fff0', "alternateHGridAlpha" => "100", "showBorder" => '0', "numberSuffix" => '%', "bubbleScale" => "1", "baseFontColor" => '000000', "palette" => '3', "is3D" => 1, "animation" => 1, 'clipBubbles' => 1, 'yAxisMinValue' => '0', 'yAxisMaxValue' => '6', 'xAxisMinValue' => '10', 'xAxisMaxValue' => '100', 'showPlotBorder' => '1', 'xAxisName' => 'Stickiness', 'yAxisName' => 'Cost Per Service'), "MultiAxisLine" => array("canvasBorderColor" => "#cccccc", "canvasBorderThickness" => "2", "showAlternateVGridColor" => "1", "alternateVGridColor" => "#FF3333", "useRoundEdges" => "1", "showBorder" => "0", "bgColor" => "#ffffff", "canvasBgColor" => "#ffffff"), "geography" => array("bgColor" => "ffffff", "showBorder" => "0", "canvasBorderColor" => "#ffffff")); //自定义flash属性 可传入 $aInput['custom']['flashstyle'] $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); if (isset($aInput['custom']) && !empty($aInput['custom']['flashstyle']) && is_array($aInput['custom']['flashstyle'])) { foreach ($aInput['custom']['flashstyle'] as $key => $val) { if (is_array($val)) { foreach ($val as $k => $v) { $aChartStyleCustom[$key][$k] = $v; } } } } if (isset($aChartStyleCustom["Bubble"]) && isset($aChartStyle["Bubble"])) { $aChartStyle["Bubble"] = array_merge($aChartStyle["Bubble"], $aChartStyleCustom["Bubble"]); } if (isset($aChartStyleCustom["MSCombi2D"]) && isset($aChartStyle["MSCombi2D"])) { $aChartStyle["MSCombi2D"] = array_merge($aChartStyle["MSCombi2D"], $aChartStyleCustom["MSCombi2D"]); } if (isset($aChartStyleCustom["MultiAxisLine"]) && isset($aChartStyle["MultiAxisLine"])) { $aChartStyle["MultiAxisLine"] = array_merge($aChartStyle["MultiAxisLine"], $aChartStyleCustom["MultiAxisLine"]); } if (isset($aChartStyleCustom["geography"]) && isset($aChartStyle["geography"])) { $aChartStyle["geography"] = array_merge($aChartStyle["geography"], $aChartStyleCustom["geography"]); } if (isset($aChartStyleCustom["MSCombiDY2D"]) && isset($aChartStyle["MSCombiDY2D"])) { $aChartStyle["MSCombiDY2D"] = array_merge($aChartStyle["MSCombiDY2D"], $aChartStyleCustom["MSCombiDY2D"]); } //////////data 级别样式///// $aDataStyle = array(array('color' => '1874cd', 'alpha' => "70", 'anchorRadius' => 5, 'lineThickness' => 3, 'anchorBgColor' => 'ffffff', 'anchorBorderColor' => '1874cd'), array('color' => '008b00', 'alpha' => '70', 'anchorRadius' => 4, 'lineThickness' => 2, 'anchorBgColor' => '008b00', 'anchorBorderColor' => 'ffffff'), array('color' => 'ff7f24', 'alpha' => '70', 'anchorRadius' => 4, 'lineThickness' => 1, 'anchorBgColor' => 'ffffff', 'anchorBorderColor' => 'ff7f24'), array('color' => '87ceeb', 'anchorBgColor' => '87ceeb', 'anchorBorderColor' => 'ffffff'), array('color' => '40e0d0', 'anchorBgColor' => 'ffffff', 'anchorBorderColor' => '40e0d0')); return array($aChartStyle, $aDataStyle); }
public function __construct() { $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); }
/** * 获得数据入口 */ public function getData() { $type = 'detail'; if (\YcheukfReport\Lib\ALYS\Report\Advance::isAdvanced($type)) { $aData = $this->getAdvancedData($type); // var_dump($aData); } else { $this->_init(); //初始化 $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $aConf = $this->getConf($type); $aDatesNew = $this->getDateNew($type); $aDates = $this->getDate($type); // print_r($aConf); $aConfs = array(); $oDict = \YcheukfReport\Lib\ALYS\ALYSFunction::loadDictionary('Metric'); // var_dump($aInput['nodateFlag']); foreach ($aDates as $k => $Date) { foreach ($aConf as $table => $Conf) { $aConfs[$k][$table] = $Conf; $aCondition = $Conf['condition']; if (isset($aInput['nodateFlag']) && !$aInput['nodateFlag']) { //have date $aCondition = array_merge(array($aDatesNew[$k][$table]), $aCondition); } // $aCondition=array_merge(array($aDatesNew[$k][$table]),$aCondition); $aConfs[$k][$table]['condition'] = $aCondition; } } // var_dump($aCondition); foreach ($aConfs as $k => $aConf) { foreach ($aConf as $table => $Conf) { list($aData[$k][$table], $nTotal) = $this->{$type}->getAlldata($Conf); //主表数据 $this->_setTotal($type, $nTotal); break; } } // \YcheukfReport\Lib\ALYS\ALYSFunction::debug($aData, 'a', 'aData'); $aInput = $this->aInput['input'][$type]; $mainTable = $aInput['mainTable']['table']; $table2Field = $aInput['mainTable']['table2Field']; //echo "dimens=";print_r($dimens); //$aGroup=$aInput['tables'][$mainTable]['dimen']['key']; //$aGroup=$aInput['tables'][$mainTable]['dimen']['dimenkey2field']; $aConcatKey = array(); //次表条件 foreach ($aConfs as $k => $aConfTmp) { if (!empty($aData[$k][$mainTable])) { foreach ($aData[$k][$mainTable] as $j => $Data) { foreach ($aInput['tables'] as $table => $aTable) { if ($table != $mainTable) { $dimens = $aInput['tables'][$table]['dimen']; foreach ($dimens['dimenkey2field'] as $keyTmp => $fieldTmp) { $aConcatKey[$k][$fieldTmp][$j] = $Data[$keyTmp]; } } } } } else { //若主表无数据, 则将此表条件制空 foreach ($aInput['tables'] as $table => $aTable) { if ($table != $mainTable) { $dimens = $aInput['tables'][$table]['dimen']; foreach ($dimens['dimenkey2field'] as $keyTmp => $fieldTmp) { $aConcatKey[$k][$fieldTmp][$j] = ''; } } } } } // echo "aConcatKey=";print_r($aConcatKey); $aConfSecond = array(); foreach ($aInput['tables'] as $table => $aTable) { //次表 if ($table != $mainTable) { $aConftion = array(); $aConftion = $this->getCondition($type, $table); $aConftionAry = $this->getCondition($type, $table, 'array'); $aConfSecond[$table] = array('noRecord' => 0, 'limit' => 0, 'field_array' => $this->getField($type, $table, 'array'), 'dimen_array' => $this->getDimenFieldArray($type, $table), 'metric_array' => $this->getMetricFieldArray($type, $table), 'groupby' => $aInput['tables'][$table]['dimen']['key'], 'table' => $oDict->ALYStableDefine($table), 'condition' => $aConftion, 'condition_array' => $aConftionAry); } } $aConfSeconds = array(); foreach ($aDates as $k => $Date) { foreach ($aConfSecond as $table => $Conf) { $aConfSeconds[$k][$table] = $Conf; $aCondition = $Conf['condition']; $aCondition = array_merge(array($aDatesNew[$k][$table]), $aCondition); if (is_array($aConcatKey[$k])) { foreach ($aConcatKey[$k] as $group => $val) { $aTmp = array(); $val = array_unique($val); $quotes = $oDict->ALYSgetDimenTypeOf($group); // var_export($group); // var_export($quotes); // var_export($val); //echo "<hr>"; foreach ($val as $v) { $aTmp[] = $quotes . $v . $quotes; } $aCondition[] = $group . ' in (' . implode(',', $aTmp) . ')'; } } $aConfSeconds[$k][$table]['condition'] = $aCondition; } } foreach ($aConfSeconds as $k => $aConf) { foreach ($aConf as $table => $Conf) { list($aData[$k][$table], $nTmpTotal) = $this->{$type}->getAlldata($Conf); //次表数据 } } } // echo "<xmp>"; // echo "aConfSeconds=";print_r($aConfSeconds); $aData = $this->_executeSqlData($type, $aData); // echo "<xmp>"; return $aData; }
public function getConditionByInput() { $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $aCondition = array(); //日期 $dateField = \YcheukfReport\Lib\ALYS\Report::getDateFeildByTable(); foreach ($aInput['date'] as $aDate) { $aCondition[] = "(" . $dateField . " >= '" . $aDate['s'] . "' and " . $dateField . " <= '" . $aDate['e'] . "')"; } //filter if (is_array($aInput['filters'])) { foreach ($aInput['filters'] as $condition) { $aCondition[] = $condition['key'] . ' ' . $condition['op'] . ' ' . $condition['value']; } } $sCondition = 1; if (is_array($aCondition) && !empty($aCondition)) { $sCondition = implode(' and ', $aCondition); } return $sCondition; }
public function __construct() { $this->aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $this->aOutput = \YcheukfReport\Lib\ALYS\Report\Start::getOutput(); }
private function _isPerspective() { $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $sListType = $aInput['input']['detail']['type']; return 'perspective' == $sListType; }
function go() { $aOutput = \YcheukfReport\Lib\ALYS\Report\Start::getOutput(); $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $trendType = $aInput['input']['flash']['type'] = isset($aInput['input']['flash']['type']) ? $aInput['input']['flash']['type'] : "trend"; $separator = isset($this->aInput['output']['csvSeparator']) ? $this->aInput['output']['csvSeparator'] : "\t"; $sCsv = $sCsvTitle = ""; $nIndex = 0; //维度标题的标签转换 $aInputFlash = $aInput['input']['flash']; $aDimen = @array_keys($aInputFlash['tables'][$aInputFlash['mainTable']['table']]['dimen']['dimenkey2field']); $sDimen = @current($aDimen); switch (strtolower($trendType)) { default: case "trend": $aId2Label = $this->_getId2Label($sDimen, $aOutput['flash'][0]); if (is_array($aOutput['flash'][0])) { foreach ($aOutput['flash'][0] as $date => $aTmp) { if ($nIndex == 0) { $sCsvTitle .= '"' . \YcheukfReport\Lib\ALYS\ALYSLang::_($sDimen) . '"' . $separator . '"' . \YcheukfReport\Lib\ALYS\ALYSLang::_(current(array_keys($aTmp))) . "\"\r\n"; $nIndex = 1; } $sCsv .= '"' . (empty($aId2Label[$date]) ? $date : $aId2Label[$date]) . '"' . $separator . '"' . current(array_values($aTmp)) . "\"\r\n"; } } break; case "geography": $aId2Label = $this->_getId2Label($sDimen, $aOutput['flash'][0]); if (is_array($aOutput['flash'][0])) { foreach ($aOutput['flash'][0] as $date => $aTmp) { $sCsvTitle .= '"' . \YcheukfReport\Lib\ALYS\ALYSLang::_($sDimen) . '"' . $separator . '"' . \YcheukfReport\Lib\ALYS\ALYSLang::_($date) . "\"\r\n"; if (is_array($aTmp)) { foreach ($aTmp as $k => $v) { $sCsv .= '"' . (empty($aId2Label[$k]) ? $k : $aId2Label[$k]) . '"' . $separator . '"' . $v . "\"\r\n"; } } } } break; case "bubble": $aId2Label = $this->_getId2Label($sDimen, $aOutput['flash']); $oDict = \YcheukfReport\Lib\ALYS\ALYSFunction::loadDictionary('Metric'); if (is_array($aOutput['flash']) && !empty($aOutput['flash'])) { $aInputFlash = $aInput['input']['flash']; $aDimen = array_keys($aInputFlash['tables'][$aInputFlash['mainTable']['table']]['dimen']['dimenkey2field']); $sDimen = $aDimen[0]; $sCsvTitle .= \YcheukfReport\Lib\ALYS\ALYSLang::_($sDimen); if (is_array($aInput['input']['flash']['mainTable']['showField'])) { foreach ($aInput['input']['flash']['mainTable']['showField'] as $v) { $sCsvTitle .= $separator . '"' . \YcheukfReport\Lib\ALYS\ALYSLang::_($v) . '"'; } } $sCsvTitle .= "\r\n"; if (is_array($aOutput['flash'])) { foreach ($aOutput['flash'] as $key => $values) { $tmp = array(); if (is_array($aInput['input']['flash']['mainTable']['showField'])) { foreach ($aInput['input']['flash']['mainTable']['showField'] as $v) { if (isset($values[$v])) { $tmp[] = $oDict->ALYSmetricFormat($v, $values[$v]); } else { $tmp[] = ''; } } } $sCsv .= '"' . (empty($aId2Label[$key]) ? $key : $aId2Label[$key]) . '"' . $separator . '"' . implode('"' . $separator . '"', $tmp) . "\"\r\n"; } } } break; case "multdate": $sCsvTitle .= '"' . \YcheukfReport\Lib\ALYS\ALYSLang::_("ALYSDATE"); if (is_array($aOutput['flash'])) { foreach ($aOutput['flash'] as $i => $aTmp) { $sDate = $aInput['date'][$i]['s']; $eDate = $aInput['date'][$i]['e']; $sTmp = $sDate . "~" . $eDate; foreach ($aTmp as $date => $aTmp) { if ($nIndex == 0) { $sCsvTitle .= '"' . $separator . '"' . \YcheukfReport\Lib\ALYS\ALYSLang::_($sDimen) . $separator . '"' . \YcheukfReport\Lib\ALYS\ALYSLang::_(current(array_keys($aTmp))) . "\"\r\n"; $nIndex = 1; } $sCsv .= '"' . $date . '"' . $separator . '"' . $sTmp . '"' . $separator . '"' . current(array_values($aTmp)) . "\"\r\n"; } } } break; case "multmetric": $aId2Label = $this->_getId2Label($sDimen, $aOutput['flash'][0]); $sCsvTitle .= '"' . \YcheukfReport\Lib\ALYS\ALYSLang::_($sDimen) . '"'; if (is_array($aOutput['flash'])) { foreach ($aOutput['flash'] as $i => $aTmp) { foreach ($aTmp as $date => $aTmp2) { foreach ($aTmp2 as $guiline => $v) { $sCsvTitle .= $separator . '"' . \YcheukfReport\Lib\ALYS\ALYSLang::_($guiline) . '"'; break; } break; } } } $sCsvTitle .= "\r\n"; if (is_array($aOutput['flash'][0])) { foreach ($aOutput['flash'][0] as $date => $aTmp) { $sCsv .= '"' . (empty($aId2Label[$date]) ? $date : $aId2Label[$date]) . '"'; for ($i = 0; $i < count($aOutput['flash']); $i++) { $sCsv .= $separator . '"' . current(array_values($aOutput['flash'][$i][$date])) . '"'; } $sCsv .= "\r\n"; } } break; } $aOutput['flash.output'] = $sCsvTitle . $sCsv; \YcheukfReport\Lib\ALYS\Report\Start::setOutput($aOutput); }
public function go() { $aInput = \YcheukfReport\Lib\ALYS\Report\Start::getInput(); $o = \YcheukfReport\Lib\ALYS\ALYSFunction::loadClass("report.output.format." . $aInput['output']['format']); $o->go(); }