break;
        case "callshopcredit":
            $title_val = $locate->Translate("Callshop");
            $pie_value = intval($row['callshopcredit']);
            break;
        case "resellercredit":
            $title_val = $locate->Translate("Reseller Cost");
            $pie_value = intval($row['resellercredit']);
            break;
        case "markup":
            $title_val = $locate->Translate("Markup");
            $pie_value = intval($row['markup']);
            break;
    }
    $tmp = new pie_value($pie_value, $title);
    $tmp->set_colour($col);
    $d[] = $tmp;
    $ii++;
}
$pie = new pie();
$pie->set_start_angle(5);
$pie->set_animate(true);
$pie->set_label_colour('#432BAF');
$pie->set_gradient_fill();
switch ($action_value) {
    case "recordNum":
        $pie->set_tooltip('#label#<br>#val# (#percent#)');
        break;
    case "seconds":
        $pie->set_tooltip('#label#<br>#val# (#percent#)');
        break;
Example #2
0
 function mailing()
 {
     $mailid = JRequest::getInt('mailid');
     if (empty($mailid)) {
         return;
     }
     $db =& JFactory::getDBO();
     $db->setQuery('SELECT * FROM ' . acymailing::table('stats') . ' WHERE mailid = ' . $mailid);
     $mailingstats = $db->loadObject();
     if (empty($mailingstats->mailid)) {
         return;
     }
     $mailClass = acymailing::get('class.mail');
     $mailing = $mailClass->get($mailid);
     $chart = new open_flash_chart();
     $title = new title(JText::_('SEND_PROCESS'));
     $title->set_style('font-size:12px; color: #FF8040');
     $chart->set_title($title);
     $pie = new pie();
     $pie->set_start_angle(35);
     $pie->set_animate(true);
     $pie->set_tooltip('#val# of #total#<br>#percent#');
     $pieHTML = new pie_value((int) $mailingstats->senthtml, JText::_('HTML'));
     $pieHTML->set_colour('#00FF00');
     $pieText = new pie_value((int) $mailingstats->senttext, JText::_('TEXT'));
     $pieText->set_colour('#0000FF');
     $pieFailed = new pie_value((int) $mailingstats->fail, JText::_('FAILED'));
     $pieFailed->set_colour('#FF0000');
     $values = array();
     if (!empty($mailingstats->senthtml)) {
         $values[] = $pieHTML;
     }
     if (!empty($mailingstats->senttext)) {
         $values[] = $pieText;
     }
     if (!empty($mailingstats->fail)) {
         $values[] = $pieFailed;
     }
     $pie->set_values($values);
     $chart->add_element($pie);
     $this->assignRef('chart', $chart);
     $db->setQuery('SELECT COUNT(*) FROM `#__acymailing_queue` WHERE `mailid` = ' . $mailingstats->mailid . ' GROUP BY `mailid`');
     $mailingstats->queue = $db->loadResult();
     $chart3 = new open_flash_chart();
     $title = new title(JText::_('OPEN'));
     $title->set_style('font-size:12px; color: #FF8040');
     $chart3->set_title($title);
     $pie = new pie();
     $pie->set_start_angle(35);
     $pie->set_animate(true);
     $pie->set_tooltip('#val# of #total#<br>#percent#');
     $pieNot = new pie_value((int) $mailingstats->senthtml - (int) $mailingstats->openunique, JText::_('NOT_OPEN'));
     $pieNot->set_colour('#FF0000');
     $pieOpen = new pie_value((int) $mailingstats->openunique, JText::_('OPEN'));
     $pieOpen->set_colour('#00FF00');
     $pie->set_values(array($pieOpen, $pieNot));
     $chart3->add_element($pie);
     $this->assignRef('chart3', $chart3);
     $db->setQuery('SELECT min(opendate) as minval, max(opendate) as maxval FROM ' . acymailing::table('userstats') . ' WHERE opendate > 0 AND mailid = ' . $mailid);
     $datesOpen = $db->loadObject();
     $db->setQuery('SELECT min(`date`) as minval, max(`date`) as maxval FROM ' . acymailing::table('urlclick') . ' WHERE  mailid = ' . $mailid);
     $datesClick = $db->loadObject();
     $spaces = array();
     $intervals = 10;
     $minDate = min($datesOpen->minval, $datesClick->minval);
     if (empty($minDate)) {
         $minDate = max($datesOpen->minval, $datesClick->minval);
     }
     $maxDate = max($datesOpen->maxval, $datesClick->maxval) + 1;
     $delay = ($maxDate - $minDate) / $intervals;
     for ($i = 0; $i < $intervals; $i++) {
         $spaces[$i] = (int) ($minDate + $delay * $i);
     }
     $spaces[$intervals] = $maxDate;
     $clickresults = array();
     $openresults = array();
     $legendX = array();
     for ($i = 0; $i <= $intervals; $i++) {
         $legendX[] = acymailing::getDate($spaces[$i]);
         $db->setQuery('SELECT count(subid) FROM ' . acymailing::table('userstats') . ' WHERE opendate < ' . $spaces[$i] . ' AND opendate > 0 AND mailid = ' . $mailid);
         $openresults[$i] = (int) $db->loadResult();
         $db->setQuery('SELECT count(subid) FROM ' . acymailing::table('urlclick') . ' WHERE date < ' . $spaces[$i] . ' AND mailid = ' . $mailid);
         $clickresults[$i] = (int) $db->loadResult();
     }
     $chart2 = new open_flash_chart();
     $title = new title(JText::_('OPEN') . ' / ' . JText::_('CLICKED_LINK'));
     $title->set_style('font-size:12px; color: #FF8040');
     $chart2->set_title($title);
     $openLine = new line_base();
     $openLine->set_values($openresults);
     $openLine->set_text(JText::_('OPEN'));
     $openLine->set_colour('#94D700');
     $clickLine = new line_base();
     $clickLine->set_values($clickresults);
     $clickLine->set_text(JText::_('CLICKED_LINK'));
     $x_axis = new x_axis();
     $xlabelobject = new x_axis_labels();
     $xlabelobject->rotate(-20);
     $xlabelobject->set_labels($legendX);
     $x_axis->set_labels($xlabelobject);
     $y_axis = new y_axis();
     $maxYValue = max($clickresults[$intervals], $openresults[$intervals]);
     $y_axis->range(0, $maxYValue, intval($maxYValue / 5));
     $chart2->set_x_axis($x_axis);
     $chart2->set_y_axis($y_axis);
     $chart2->add_element($clickLine);
     $chart2->add_element($openLine);
     $this->assignRef('chart2', $chart2);
     $this->assignRef('mailing', $mailing);
     $this->assignRef('mailingstats', $mailingstats);
     $this->setLayout('mailing');
 }