示例#1
0
 public function tldSummaryPerMonth()
 {
     $NS = new Zend_Session_Namespace('Default');
     $registry = Shineisp_Registry::getInstance();
     $translation = $registry->Zend_Translate;
     $domains = array();
     if (!empty($NS->customer)) {
         $this->view->uri = "";
         $data = $NS->customer;
         // Get the data information
         $all_domains = Domains::getSummaryPerMonth($data['customer_id']);
         $autorenew_domains = Domains::getAutorenewSummaryPerMonth($data['customer_id']);
         for ($i = 1; $i <= 12; $i++) {
             $domains['months'][$i] = date('M', strtotime(date('Y/m/01/', strtotime("2012/12/1")) . " {$i} month"));
             $domains['autorenew'][$i] = 0;
             $domains['norenew'][$i] = 0;
             foreach ($autorenew_domains as $domain) {
                 if ($domain['monthid'] == $i) {
                     $domains['autorenew'][$i] = $domain['total'];
                 }
             }
             foreach ($all_domains as $domain) {
                 if ($domain['month_number'] == $i) {
                     $domains['norenew'][$i] = $domain['total'] - $domains['autorenew'][$i];
                 }
             }
         }
         $norenew = implode(",", $domains['norenew']);
         $autorenew = implode(",", $domains['autorenew']);
         $months = implode("|", $domains['months']);
         $max = max($domains['autorenew']);
         $this->view->uri = "http://chart.apis.google.com/chart?cht=bvg\n\t\t\t&chdlp=t\n\t\t\t&chtt=" . $translation->translate('Domain Summary per Month') . "\n\t\t\t&chdl=" . $translation->translate('Automatic Renewal') . "|" . $translation->translate('No Auto Renew') . "\n\t\t\t&chts=4d89f9,18\n\t\t\t&chs=550x300\n\t\t\t&chd=t:" . $autorenew . "|" . $norenew . "\n\t\t\t&chxt=x\n\t\t\t&chxl=0:|" . $months . "\n\t\t\t&chco=4d89f9,FF1F1F\n\t\t\t&chds=0," . $max . "\n\t\t\t&chm=N,000000,-1,,11|N,000000,0,,11\n\t\t\t&chbh=a";
     }
     return $this->view->render('partials/graph.phtml');
 }