function indexAction() { // $this->_helper->layout->disableLayout(); // $login = "******"; // $password = "******"; // include_once 'sina.php'; // $resultarray = get_sinacontacts($login, $password); // Zend_Debug::dump($resultarray); // include_once '163.php'; // $login = '******'; // $password = '******'; // $resultarray = get_163contacts($login, $password); // Zend_Debug::dump($resultarray); // include_once 'yahoo.php'; // $obj = new GrabYahoo(); // $contacts = $obj->getAddressbook('*****@*****.**','19990402'); // Zend_Debug::dump($contacts); // include_once "contacts_fn.php"; // $ret_array = get_msncontacts('*****@*****.**', '1999040211'); // Zend_Debug::dump($ret_array); // $this->_helper->layout->setLayout("layout_admin"); $this->_helper->layout->disableLayout(); // get date from db $db = Zend_Registry::get('db'); $select = $db->select(); $select->from('report', array('left(create_date,10) as date', 'accesscode'))->where('report.campaign_id = 3')->where("report.state = 'APPROVED'")->order('date'); $results = $db->fetchAll($select); $accesscodeDbMatchArray = array(); foreach ($results as $result) { $accesscodeDbMatchArray[$result['accesscode']] = $result['date']; } $accesscodeArray = array_keys($accesscodeDbMatchArray); // Zend_Debug::Dump($accesscodematchArray); // get value from ws $indicate2Connect = new Indicate2_Connect(); $response = $indicate2Connect->getAnswerSetForSurvey(385, null, array(array('ContextIndex' => 1, 'QuestionIndex' => 1), array('ContextIndex' => 1, 'QuestionIndex' => 4)), 0); // Zend_Debug::Dump($response); $talkingdurationArray = array(); $accesscodeResponseMathArray = array(); if (isset($response->AnswerSetType)) { foreach ($response->AnswerSetType as $answerSet) { if (isset($answerSet->AnswerType) && is_array($answerSet->AnswerType) && !empty($answerSet->AnswerType)) { foreach ($answerSet->AnswerType as $answer) { if ($answer->QuestionId == 573) { $accesscodeResponseMathArray[$answerSet->AccessCode] = (int) iconv("UTF-8", "gb18030", preg_replace('/[\\n\\r\\t]/', ' ', base64_decode($answer->AnswerText))); } if ($answer->QuestionId == 576) { $talkingdurationArray[$answerSet->AccessCode] = (int) iconv("UTF-8", "gb18030", preg_replace('/[\\n\\r\\t]/', ' ', base64_decode($answer->AnswerText))); } } } else { //get min value, like '11-15' = 11 $accesscodeResponseMathArray[$answerSet->AccessCode] = (int) iconv("UTF-8", "gb18030", preg_replace('/[\\n\\r\\t]/', ' ', base64_decode($answerSet->AnswerType->AnswerText))); } } } // Zend_Debug::Dump($accesscodeResponseMathArray); // Zend_Debug::Dump($talkingdurationArray); $resultmatchArray = array(); foreach ($accesscodeArray as $accesscode) { $resultmatchArray[$accesscodeDbMatchArray[$accesscode]] = 0; } foreach ($accesscodeArray as $accesscode) { if (array_key_exists($accesscode, $accesscodeResponseMathArray)) { $resultmatchArray[$accesscodeDbMatchArray[$accesscode]] += $accesscodeResponseMathArray[$accesscode]; } } // Zend_Debug::Dump($resultmatchArray); $dateArray = array_keys($resultmatchArray); foreach ($dateArray as $date) { $resultmatchArray[$date] = floor($resultmatchArray[$date] * 1.65); } // Zend_Debug::Dump($resultmatchArray); include 'open-flash-chart.php'; $data_1 = array(); $base = floor(1472 * 1.65); $temp = 0; $resultmatchArray[0] = 0; foreach ($dateArray as $date) { $resultmatchArray[$date] += $resultmatchArray[$temp]; $data_1[] = $resultmatchArray[$date] + $base; $temp = $date; } // Zend_Debug::Dump($data_1); $title = new title("Impressions of BugsLock by day"); $y = new y_axis(); $y->set_range(0, 40000, 10000); $x = new x_axis(); $x_labels = new x_axis_labels(); $x_labels->set_labels($dateArray); $x_labels->set_steps(2); $x_labels->rotate(40); $x->set_labels($x_labels); $line_1_default_dot = new dot(); $line_1_default_dot->colour('#f00000')->tooltip('#x_label#: #val#'); $line_1 = new line(); $line_1->set_default_dot_style($line_1_default_dot); $line_1->set_values($data_1); $line_1->set_width(1); $line_1->set_key('Impression', 10); $this->view->chart = new open_flash_chart(); $this->view->chart->set_title($title); $this->view->chart->add_element($line_1); $this->view->chart->set_y_axis($y); $this->view->chart->set_x_axis($x); $this->view->chart->set_bg_colour('#FFFFFF'); // include 'ofc_sugar.php'; $this->view->chart2 = new open_flash_chart(); $this->view->chart2->set_title(new title('Generation Chart')); $line_1 = new line(); $array_1 = array(); $f = 1.5; for ($i = 0; $i <= 50; $i++) { array_push($array_1, $f); } $line_1->set_values($array_1); // $line_1->set_default_dot_style( new s_hollow_dot('#FBB829', 4) ); $line_1->set_width(1); $line_1->set_colour('#FF0000'); $line_1->set_tooltip("Gen0"); $line_1->set_key('Gen0', 10); $line_1->loop(); $area = new area(); // set the circle line width: $area->set_width(1); // $area->set_default_dot_style( new s_hollow_dot('#45909F', 5) ); $area->set_colour('#FF0000'); // $area->set_fill_colour( '#FF0000' ); // $area->set_fill_alpha( 0.4 ); $area->set_loop(); $area->set_values($array_1); $line_2 = new line(); $array_2 = array(); $f = 2.8; for ($i = 0; $i <= 50; $i++) { array_push($array_2, $f); } $line_2->set_values($array_2); // $line_2->set_default_dot_style( new s_hollow_dot('#FBB829', 4) ); $line_2->set_width(1); $line_2->set_colour('#FBB829'); $line_2->set_tooltip("Gold<br>#val#"); $line_2->set_key('Gen1', 10); $line_2->loop(); $line_4 = new line(); $array_4 = array(); $f = 5; for ($i = 0; $i <= 50; $i++) { array_push($array_4, $f); } $line_4->set_values($array_4); // $line_2->set_default_dot_style( new s_star('#8000FF', 4) ); $line_4->set_width(1); $line_4->set_colour('#3030D0'); $line_4->set_tooltip("Purple<br>#val#"); $line_4->set_key('Gen2', 10); $line_4->loop(); // add the area object to the chart: $this->view->chart2->add_element($line_1); $this->view->chart2->add_element($line_2); $this->view->chart2->add_element($line_4); $r = new radar_axis(5); $r->set_colour('#FFFFFF'); $r->set_grid_colour('#FFFFFF'); $labels = new radar_axis_labels(array('G0', '', 'G1', '', 'G2')); $labels->set_colour('#9F819F'); $r->set_labels($labels); $this->view->chart2->set_radar_axis($r); $tooltip = new tooltip(); $tooltip->set_proximity(); $this->view->chart2->set_tooltip($tooltip); $this->view->chart2->set_bg_colour('#ffffff'); // echo $this->view->chart2->toPrettyString(); }