示例#1
0
 public static function create_pie_graph($title)
 {
     self::init();
     $d = array();
     foreach (self::$data_set as $data) {
         $d[] = new pie_value($data['values'], $data['titles']);
     }
     $pie = new pie();
     $pie->start_angle(35)->add_animation(new pie_fade())->add_animation(new pie_bounce(4))->gradient_fill()->tooltip('#val# of #total#<br>#percent# of 100%')->colours(array('#1F8FA1', '#848484', '#CACFBE', '#DEF799'));
     $pie->set_values($d);
     self::$chart->add_element($pie);
     self::show_chart($title);
 }
示例#2
0
文件: chart.php 项目: easthero/kohana
 function disk()
 {
     $disk_used = trim(shell_exec("df -h|grep /usr/data |awk '{print \$3}'"));
     $disk_available = trim(shell_exec("df -h|grep /usr/data |awk '{print \$4}'"));
     $title = new title("磁盘使用情况\n当前已使用 {$disk_used} ,剩余 {$disk_available}");
     $title->set_style("{font-size: 12px; font-family: Times New Roman; font-weight: bold; color: #A2ACBA; text-align: center;}");
     $used_percent = trim(shell_exec("df -h|grep /usr/data |awk '{print \$5}'"));
     $used_percent = substr($used_percent, 0, strlen($used_percent) - 1);
     settype($used_percent, 'float');
     $available_percent = 100 - $used_percent;
     $pie = new pie();
     $pie->set_alpha(0.7);
     $pie->set_start_angle(0);
     $pie->add_animation(new pie_fade());
     $pie->set_tooltip('#val#%');
     $pie->set_colours(array('#FF368D', '#1C9E05'));
     $d = array();
     $d[] = new pie_value($used_percent, $used_percent . "%");
     $d[] = new pie_value($available_percent, $available_percent . "%");
     $pie->set_values($d);
     $chart = new open_flash_chart();
     $chart->set_title($title);
     $chart->add_element($pie);
     $chart->set_bg_colour('#FFFFFF');
     $chart->x_axis = null;
     header("Cache-Control: cache, must-revalidate");
     header("Pragma: public");
     echo $chart->toPrettyString();
 }
示例#3
0
文件: Pie.php 项目: Doluci/tomatocart
 function customizeChartProperties()
 {
     parent::customizeChartProperties();
     $dataSetsToDisplay = $this->getDataSetsToDisplay();
     if ($dataSetsToDisplay === false) {
         return;
     }
     $dataSetToDisplay = current($dataSetsToDisplay);
     // create the Pie
     $pie = new pie();
     $pie->set_alpha("0.6");
     $pie->set_start_angle(35);
     $pie->add_animation(new pie_fade());
     $pie->set_label_colour('#142448');
     $pie->set_colours(array('#3C5A69', '#679BB5', '#695A3C', '#B58E67', '#969696'));
     // create the Pie values
     $yValues = $this->yValues[$dataSetToDisplay];
     $labelName = $this->yLabels[$dataSetToDisplay];
     $unit = $this->yUnit;
     $sum = array_sum($yValues);
     $pieValues = array();
     $i = 0;
     foreach ($this->xLabels as $label) {
         $value = (double) $yValues[$i];
         $i++;
         // we never plot empty pie slices (eg. visits by server time pie chart)
         if ($value <= 0) {
             continue;
         }
         $pieValue = new pie_value($value, $label);
         $percentage = round(100 * $value / $sum);
         $pieValue->set_tooltip("{$label}<br>{$percentage}% ({$value}{$unit} {$labelName})");
         $pieValues[] = $pieValue;
     }
     $pie->set_values($pieValues);
     $this->chart->add_element($pie);
 }
示例#4
0
//echo "<hr>$alertaVerde<hr>";
$ofc_path = "../../include/ofc-2-Kvasir/php-ofc-library";
include "{$ofc_path}/open-flash-chart.php";
$d = array();
$rads = $alertaVerde + $alertaRoja + $alertaAmarilla;
//echo "$alertaVerde + $alertaRoja + $alertaAmarilla <hr>";
$d[] = new pie_value(round($alertaVerde), "<10");
$d[] = new pie_value(round($alertaRoja), "<0");
$slice = new pie_value(round($alertaAmarilla), ">10");
$slice->on_click('http://');
$d[] = $slice;
if (!$rads) {
    $rads = 1;
}
$d[] = new pie_value(1 * 100 / $rads, "");
$pie = new pie();
$title = new title('Estado de Radicados En Bandeja');
$title->set_style("{font-size: 9px; color: #F24062; text-align: center;}");
$pie->set_animate(true);
$pie->set_label_colour('#432BAF');
$pie->set_alpha(1);
$pie->set_start_angle(0);
$pie->add_animation(new pie_fade());
$pie->set_tooltip('#label#<br>Numero de Radicados #val# (#percent#)');
//
// default on-click event
//
$pie->on_click('pie_slice_clicked');
//
//
//
 function get_graph($field, $args)
 {
     $defaults = array('ids' => false, 'colors' => array('#EF8C08', '#21759B', '#1C9E05'), 'grid_color' => '#f7e8bf', 'bg_color' => '#FFFFFF', 'odd' => false, 'truncate' => 40, 'truncate_label' => 15, 'response_count' => 10, 'user_id' => false, 'type' => 'default', 'x_axis' => false, 'data_type' => 'count', 'limit' => '', 'x_start' => '', 'x_end' => '', 'show_key' => false, 'min' => '', 'max' => '', 'include_zero' => false, 'width' => 400, 'height' => 400);
     $args = wp_parse_args($args, $defaults);
     $vals = $this->get_graph_values($field, $args);
     extract($args);
     extract($vals);
     $title = new title(preg_replace("/&#?[a-z0-9]{2,8};/i", "", FrmAppHelper::truncate($field->name, $truncate, 0)));
     $chart = new open_flash_chart();
     $chart->set_title($title);
     $bar = new bar_glass();
     $x = new x_axis();
     $y = new y_axis();
     $x_labels = new x_axis_labels();
     if (in_array($field->type, array('select', 'checkbox', 'radio', '10radio', 'scale')) and (!isset($x_inputs) or !$x_inputs)) {
         $x_labels->rotate(340);
         //$x_labels->set_colour( '#A2ACBA' );
         //$x->set_colour( '#A2ACBA' );
     } else {
         if ($field->type == 'user_id') {
             if (!$pie) {
                 $x_labels->rotate(340);
             }
         } else {
             $x_labels->rotate(340);
         }
     }
     $pie = $type == 'default' ? $pie : ($type == 'pie' ? true : false);
     if ($pie) {
         $bar = new pie();
         $bar->set_alpha(0.6);
         $bar->set_start_angle(35);
         $bar->add_animation(new pie_fade());
         $bar->set_tooltip('#val# (#percent#)');
         $bar->set_colours($colors);
         $pie_values = array();
         foreach ($values as $val_key => $val) {
             if ($val) {
                 $pie_values[] = new pie_value($val, "{$labels[$val_key]} (" . round($val / $total_count * 100) . "%)");
             }
         }
         $bar->set_values($pie_values);
     } else {
         $color = $odd ? current($colors) : next($colors);
         if (!$color) {
             $color = reset($colors);
         }
         if ($type == 'line') {
             $bar = new line();
         } else {
             if ($type == 'hbar') {
                 $bar = new hbar($color);
             } else {
                 if ($type == 'area') {
                     $bar = new area();
                 } else {
                     if ($type == 'bar_flat') {
                         $bar = new bar($color);
                     } else {
                         $bar = new bar_glass($color);
                     }
                 }
             }
         }
         $bar->set_colour($color);
         $bar->set_values($values);
         if ($show_key) {
             $bar->set_key(stripslashes($field->name), $show_key);
         }
         $x_labels->set_labels($labels);
         $x->set_labels($x_labels);
         $x->set_grid_colour($grid_color);
         $y->set_grid_colour($grid_color);
         if ($combine_dates and !strpos($width, '%') and count($labels) * 30 > (int) $width) {
             $x_labels->visible_steps(ceil(count($labels) * 30 / (int) $width));
         }
         $set_max = $max;
         if (!empty($values) and empty($max)) {
             $max = abs(max($values) * 1.2);
             if ($max < 3) {
                 $max = 3;
             }
         }
         foreach ($ids as $f_id) {
             $new_max = abs(max($f_values[$f_id]) * 1.2);
             if ($set_max != $max and $new_max > $max) {
                 $max = $new_max;
             }
             unset($f_id);
             unset($new_max);
         }
         $bars = array();
         foreach ($f_values as $f_id => $f_vals) {
             if ($type == 'line') {
                 $bars[$f_id] = new line();
             } else {
                 if ($type == 'hbar') {
                     $bars[$f_id] = new hbar($color);
                 } else {
                     if ($type == 'area') {
                         $bars[$f_id] = new area();
                     } else {
                         if ($type == 'bar_flat') {
                             $bars[$f_id] = new bar();
                         } else {
                             $bars[$f_id] = new bar_glass();
                         }
                     }
                 }
             }
             $color = next($colors);
             if (!$color) {
                 $color = reset($colors);
             }
             $bars[$f_id]->set_colour($color);
             $bars[$f_id]->set_values($f_vals);
             if ($show_key) {
                 $bars[$f_id]->set_key(stripslashes($fields[$f_id]->name), $show_key);
             }
             unset($f_id);
         }
         if (isset($max) and !empty($max)) {
             $step = ceil($max / 10);
             if (empty($min)) {
                 $min = 0;
             }
             $y->set_range($min, $max, $step);
         }
     }
     $chart->add_element($bar);
     if (isset($bars) and !empty($bars)) {
         foreach ($bars as $f_bar) {
             $chart->add_element($f_bar);
         }
     }
     $chart->set_bg_colour($bg_color);
     if (!$pie) {
         $chart->set_y_axis($y);
         $chart->set_x_axis($x);
     }
     return $chart->toPrettyString();
 }
示例#6
0
$brval[]=620;
$brval[]=350;
$brval[]=470;
$brval[]=134;
$brval[]=267;
$brval[]=534;
*/
$tmp = 0;
$d = array();
for ($i = 0; $i < $ii; $i++) {
    $tmp = new pie_value(intval($brval[$i]), "");
    //
    // this slice would normally be light green
    // but we are overriding the colour here:
    //
    //$tmp->set_colour( '#'.$i.'F'.$i.'3C'.$i );
    $tmp->set_label($br[$i], '#BFFF00', 10);
    $d[] = $tmp;
    //
    // here the colour cycle wraps and this gets the
    // first colour:
    //
}
$pie = new pie();
$pie->start_angle(35)->add_animation(new pie_fade())->add_animation(new pie_bounce(4))->gradient_fill()->tooltip('#val# of #total#<br>#percent# of 100%')->colours(array('#B8001F', '#4400A4', '#CD6600', '#E6FE00', '#007ED5', '#54E300'));
$pie->set_values($d);
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($pie);
$chart->set_bg_colour('#AB4800');
echo $chart->toPrettyString();
    public function GetRenderContent(WebPage $oPage, $aExtraParams = array(), $sId)
    {
        $sHtml = '';
        // Add the extra params into the filter if they make sense for such a filter
        $bDoSearch = utils::ReadParam('dosearch', false);
        if ($this->m_oSet == null) {
            $aQueryParams = array();
            if (isset($aExtraParams['query_params'])) {
                $aQueryParams = $aExtraParams['query_params'];
            }
            if ($this->m_sStyle != 'links') {
                $oAppContext = new ApplicationContext();
                $sClass = $this->m_oFilter->GetClass();
                $aFilterCodes = array_keys(MetaModel::GetClassFilterDefs($sClass));
                $aCallSpec = array($sClass, 'MapContextParam');
                if (is_callable($aCallSpec)) {
                    foreach ($oAppContext->GetNames() as $sContextParam) {
                        $sParamCode = call_user_func($aCallSpec, $sContextParam);
                        //Map context parameter to the value/filter code depending on the class
                        if (!is_null($sParamCode)) {
                            $sParamValue = $oAppContext->GetCurrentValue($sContextParam, null);
                            if (!is_null($sParamValue)) {
                                $aExtraParams[$sParamCode] = $sParamValue;
                            }
                        }
                    }
                }
                foreach ($aFilterCodes as $sFilterCode) {
                    $externalFilterValue = utils::ReadParam($sFilterCode, '', false, 'raw_data');
                    $condition = null;
                    if (isset($aExtraParams[$sFilterCode])) {
                        $condition = $aExtraParams[$sFilterCode];
                    }
                    if ($bDoSearch && $externalFilterValue != "") {
                        // Search takes precedence over context params...
                        unset($aExtraParams[$sFilterCode]);
                        if (!is_array($externalFilterValue)) {
                            $condition = trim($externalFilterValue);
                        } else {
                            if (count($externalFilterValue) == 1) {
                                $condition = trim($externalFilterValue[0]);
                            } else {
                                $condition = $externalFilterValue;
                            }
                        }
                    }
                    if (!is_null($condition)) {
                        $sOpCode = null;
                        // default operator
                        if (is_array($condition)) {
                            // Multiple values, add them as AND X IN (v1, v2, v3...)
                            $sOpCode = 'IN';
                        }
                        $this->AddCondition($sFilterCode, $condition, $sOpCode);
                    }
                }
                if ($bDoSearch) {
                    // Keep the table_id identifying this table if we're performing a search
                    $sTableId = utils::ReadParam('_table_id_', null, false, 'raw_data');
                    if ($sTableId != null) {
                        $aExtraParams['table_id'] = $sTableId;
                    }
                }
            }
            $aOrderBy = array();
            if (isset($aExtraParams['order_by'])) {
                // Convert the string describing the order_by parameter into an array
                // The syntax is +attCode1,-attCode2
                // attCode1 => ascending, attCode2 => descending
                $aTemp = explode(',', $aExtraParams['order_by']);
                foreach ($aTemp as $sTemp) {
                    $aMatches = array();
                    if (preg_match('/^([+-])?(.+)$/', $sTemp, $aMatches)) {
                        $bAscending = true;
                        if ($aMatches[1] == '-') {
                            $bAscending = false;
                        }
                        $aOrderBy[$aMatches[2]] = $bAscending;
                    }
                }
            }
            $this->m_oSet = new CMDBObjectSet($this->m_oFilter, $aOrderBy, $aQueryParams);
        }
        switch ($this->m_sStyle) {
            case 'count':
                if (isset($aExtraParams['group_by'])) {
                    if (isset($aExtraParams['group_by_label'])) {
                        $oGroupByExp = Expression::FromOQL($aExtraParams['group_by']);
                        $sGroupByLabel = $aExtraParams['group_by_label'];
                    } else {
                        // Backward compatibility: group_by is simply a field id
                        $sAlias = $this->m_oFilter->GetClassAlias();
                        $oGroupByExp = new FieldExpression($aExtraParams['group_by'], $sAlias);
                        $sGroupByLabel = MetaModel::GetLabel($this->m_oFilter->GetClass(), $aExtraParams['group_by']);
                    }
                    $aGroupBy = array();
                    $aGroupBy['grouped_by_1'] = $oGroupByExp;
                    $sSql = $this->m_oFilter->MakeGroupByQuery($aQueryParams, $aGroupBy, true);
                    $aRes = CMDBSource::QueryToArray($sSql);
                    $aGroupBy = array();
                    $aLabels = array();
                    $aValues = array();
                    $iTotalCount = 0;
                    foreach ($aRes as $iRow => $aRow) {
                        $sValue = $aRow['grouped_by_1'];
                        $aValues[$iRow] = $sValue;
                        $sHtmlValue = $oGroupByExp->MakeValueLabel($this->m_oFilter, $sValue, $sValue);
                        $aLabels[$iRow] = $sHtmlValue;
                        $aGroupBy[$iRow] = (int) $aRow['_itop_count_'];
                        $iTotalCount += $aRow['_itop_count_'];
                    }
                    $aData = array();
                    $oAppContext = new ApplicationContext();
                    $sParams = $oAppContext->GetForLink();
                    foreach ($aGroupBy as $iRow => $iCount) {
                        // Build the search for this subset
                        $oSubsetSearch = $this->m_oFilter->DeepClone();
                        $oCondition = new BinaryExpression($oGroupByExp, '=', new ScalarExpression($aValues[$iRow]));
                        $oSubsetSearch->AddConditionExpression($oCondition);
                        $sFilter = urlencode($oSubsetSearch->serialize());
                        $aData[] = array('group' => $aLabels[$iRow], 'value' => "<a href=\"" . utils::GetAbsoluteUrlAppRoot() . "pages/UI.php?operation=search&dosearch=1&{$sParams}&filter={$sFilter}\">{$iCount}</a>");
                        // TO DO: add the context information
                    }
                    $aAttribs = array('group' => array('label' => $sGroupByLabel, 'description' => ''), 'value' => array('label' => Dict::S('UI:GroupBy:Count'), 'description' => Dict::S('UI:GroupBy:Count+')));
                    $sFormat = isset($aExtraParams['format']) ? $aExtraParams['format'] : 'UI:Pagination:HeaderNoSelection';
                    $sHtml .= $oPage->GetP(Dict::Format($sFormat, $iTotalCount));
                    $sHtml .= $oPage->GetTable($aAttribs, $aData);
                } else {
                    // Simply count the number of elements in the set
                    $iCount = $this->m_oSet->Count();
                    $sFormat = 'UI:CountOfObjects';
                    if (isset($aExtraParams['format'])) {
                        $sFormat = $aExtraParams['format'];
                    }
                    $sHtml .= $oPage->GetP(Dict::Format($sFormat, $iCount));
                }
                break;
            case 'join':
                $aDisplayAliases = isset($aExtraParams['display_aliases']) ? explode(',', $aExtraParams['display_aliases']) : array();
                if (!isset($aExtraParams['group_by'])) {
                    $sHtml .= $oPage->GetP(Dict::S('UI:Error:MandatoryTemplateParameter_group_by'));
                } else {
                    $aGroupByFields = array();
                    $aGroupBy = explode(',', $aExtraParams['group_by']);
                    foreach ($aGroupBy as $sGroupBy) {
                        $aMatches = array();
                        if (preg_match('/^(.+)\\.(.+)$/', $sGroupBy, $aMatches) > 0) {
                            $aGroupByFields[] = array('alias' => $aMatches[1], 'att_code' => $aMatches[2]);
                        }
                    }
                    if (count($aGroupByFields) == 0) {
                        $sHtml .= $oPage->GetP(Dict::Format('UI:Error:InvalidGroupByFields', $aExtraParams['group_by']));
                    } else {
                        $aResults = array();
                        $aCriteria = array();
                        while ($aObjects = $this->m_oSet->FetchAssoc()) {
                            $aKeys = array();
                            foreach ($aGroupByFields as $aField) {
                                $sAlias = $aField['alias'];
                                if (is_null($aObjects[$sAlias])) {
                                    $aKeys[$sAlias . '.' . $aField['att_code']] = '';
                                } else {
                                    $aKeys[$sAlias . '.' . $aField['att_code']] = $aObjects[$sAlias]->Get($aField['att_code']);
                                }
                            }
                            $sCategory = implode($aKeys, ' ');
                            $aResults[$sCategory][] = $aObjects;
                            $aCriteria[$sCategory] = $aKeys;
                        }
                        $sHtml .= "<table>\n";
                        // Construct a new (parametric) query that will return the content of this block
                        $oBlockFilter = $this->m_oFilter->DeepClone();
                        $aExpressions = array();
                        $index = 0;
                        foreach ($aGroupByFields as $aField) {
                            $aExpressions[] = '`' . $aField['alias'] . '`.`' . $aField['att_code'] . '` = :param' . $index++;
                        }
                        $sExpression = implode(' AND ', $aExpressions);
                        $oExpression = Expression::FromOQL($sExpression);
                        $oBlockFilter->AddConditionExpression($oExpression);
                        $aExtraParams['menu'] = false;
                        foreach ($aResults as $sCategory => $aObjects) {
                            $sHtml .= "<tr><td><h1>{$sCategory}</h1></td></tr>\n";
                            if (count($aDisplayAliases) == 1) {
                                $aSimpleArray = array();
                                foreach ($aObjects as $aRow) {
                                    $oObj = $aRow[$aDisplayAliases[0]];
                                    if (!is_null($oObj)) {
                                        $aSimpleArray[] = $oObj;
                                    }
                                }
                                $oSet = CMDBObjectSet::FromArray($this->m_oFilter->GetClass(), $aSimpleArray);
                                $sHtml .= "<tr><td>" . cmdbAbstractObject::GetDisplaySet($oPage, $oSet, $aExtraParams) . "</td></tr>\n";
                            } else {
                                $index = 0;
                                $aArgs = array();
                                foreach ($aGroupByFields as $aField) {
                                    $aArgs['param' . $index] = $aCriteria[$sCategory][$aField['alias'] . '.' . $aField['att_code']];
                                    $index++;
                                }
                                $oSet = new CMDBObjectSet($oBlockFilter, array(), $aArgs);
                                $sHtml .= "<tr><td>" . cmdbAbstractObject::GetDisplayExtendedSet($oPage, $oSet, $aExtraParams) . "</td></tr>\n";
                            }
                        }
                        $sHtml .= "</table>\n";
                    }
                }
                break;
            case 'list':
                $aClasses = $this->m_oSet->GetSelectedClasses();
                $aAuthorizedClasses = array();
                if (count($aClasses) > 1) {
                    // Check the classes that can be read (i.e authorized) by this user...
                    foreach ($aClasses as $sAlias => $sClassName) {
                        if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $this->m_oSet) && (UR_ALLOWED_YES || UR_ALLOWED_DEPENDS)) {
                            $aAuthorizedClasses[$sAlias] = $sClassName;
                        }
                    }
                    if (count($aAuthorizedClasses) > 0) {
                        if ($this->m_oSet->Count() > 0) {
                            $sHtml .= cmdbAbstractObject::GetDisplayExtendedSet($oPage, $this->m_oSet, $aExtraParams);
                        } else {
                            // Empty set
                            $sHtml .= $oPage->GetP(Dict::S('UI:NoObjectToDisplay'));
                        }
                    } else {
                        // Not authorized
                        $sHtml .= $oPage->GetP(Dict::S('UI:NoObjectToDisplay'));
                    }
                } else {
                    // The list is made of only 1 class of objects, actions on the list are possible
                    if ($this->m_oSet->Count() > 0 && UserRights::IsActionAllowed($this->m_oSet->GetClass(), UR_ACTION_READ, $this->m_oSet) == UR_ALLOWED_YES) {
                        $sHtml .= cmdbAbstractObject::GetDisplaySet($oPage, $this->m_oSet, $aExtraParams);
                    } else {
                        $sHtml .= $oPage->GetP(Dict::S('UI:NoObjectToDisplay'));
                        $sClass = $this->m_oFilter->GetClass();
                        $bDisplayMenu = isset($aExtraParams['menu']) ? $aExtraParams['menu'] == true : true;
                        if ($bDisplayMenu) {
                            if (UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES) {
                                $sLinkTarget = '';
                                $oAppContext = new ApplicationContext();
                                $sParams = $oAppContext->GetForLink();
                                // 1:n links, populate the target object as a default value when creating a new linked object
                                if (isset($aExtraParams['target_attr'])) {
                                    $sLinkTarget = ' target="_blank" ';
                                    $aExtraParams['default'][$aExtraParams['target_attr']] = $aExtraParams['object_id'];
                                }
                                $sDefault = '';
                                if (!empty($aExtraParams['default'])) {
                                    foreach ($aExtraParams['default'] as $sKey => $sValue) {
                                        $sDefault .= "&default[{$sKey}]={$sValue}";
                                    }
                                }
                                $sHtml .= $oPage->GetP("<a{$sLinkTarget} href=\"" . utils::GetAbsoluteUrlAppRoot() . "pages/UI.php?operation=new&class={$sClass}&{$sParams}{$sDefault}\">" . Dict::Format('UI:ClickToCreateNew', Metamodel::GetName($sClass)) . "</a>\n");
                            }
                        }
                    }
                }
                break;
            case 'links':
                //$bDashboardMode = isset($aExtraParams['dashboard']) ? ($aExtraParams['dashboard'] == 'true') : false;
                //$bSelectMode = isset($aExtraParams['select']) ? ($aExtraParams['select'] == 'true') : false;
                if ($this->m_oSet->Count() > 0 && UserRights::IsActionAllowed($this->m_oSet->GetClass(), UR_ACTION_READ, $this->m_oSet) == UR_ALLOWED_YES) {
                    //$sLinkage = isset($aExtraParams['linkage']) ? $aExtraParams['linkage'] : '';
                    $sHtml .= cmdbAbstractObject::GetDisplaySet($oPage, $this->m_oSet, $aExtraParams);
                } else {
                    $sClass = $this->m_oFilter->GetClass();
                    $oAttDef = MetaModel::GetAttributeDef($sClass, $this->m_aParams['target_attr']);
                    $sTargetClass = $oAttDef->GetTargetClass();
                    $sHtml .= $oPage->GetP(Dict::Format('UI:NoObject_Class_ToDisplay', MetaModel::GetName($sTargetClass)));
                    $bDisplayMenu = isset($this->m_aParams['menu']) ? $this->m_aParams['menu'] == true : true;
                    if ($bDisplayMenu) {
                        if (UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES) {
                            $oAppContext = new ApplicationContext();
                            $sParams = $oAppContext->GetForLink();
                            $sDefaults = '';
                            if (isset($this->m_aParams['default'])) {
                                foreach ($this->m_aParams['default'] as $sName => $sValue) {
                                    $sDefaults .= '&' . urlencode($sName) . '=' . urlencode($sValue);
                                }
                            }
                            $sHtml .= $oPage->GetP("<a href=\"" . utils::GetAbsoluteUrlAppRoot() . "pages/UI.php?operation=modify_links&class={$sClass}&sParams&link_attr=" . $aExtraParams['link_attr'] . "&id=" . $aExtraParams['object_id'] . "&target_class={$sTargetClass}&addObjects=true{$sDefaults}\">" . Dict::Format('UI:ClickToCreateNew', Metamodel::GetName($sClass)) . "</a>\n");
                        }
                    }
                }
                break;
            case 'details':
                while ($oObj = $this->m_oSet->Fetch()) {
                    $sHtml .= $oObj->GetDetails($oPage);
                    // Still used ???
                }
                break;
            case 'actions':
                $sClass = $this->m_oFilter->GetClass();
                $oAppContext = new ApplicationContext();
                $bContextFilter = isset($aExtraParams['context_filter']) ? isset($aExtraParams['context_filter']) != 0 : false;
                if ($bContextFilter) {
                    $aFilterCodes = array_keys(MetaModel::GetClassFilterDefs($this->m_oFilter->GetClass()));
                    foreach ($oAppContext->GetNames() as $sFilterCode) {
                        $sContextParamValue = $oAppContext->GetCurrentValue($sFilterCode, null);
                        if (!is_null($sContextParamValue) && !empty($sContextParamValue) && MetaModel::IsValidFilterCode($sClass, $sFilterCode)) {
                            $this->AddCondition($sFilterCode, $sContextParamValue);
                        }
                    }
                    $aQueryParams = array();
                    if (isset($aExtraParams['query_params'])) {
                        $aQueryParams = $aExtraParams['query_params'];
                    }
                    $this->m_oSet = new CMDBObjectSet($this->m_oFilter, array(), $aQueryParams);
                }
                $iCount = $this->m_oSet->Count();
                $sHyperlink = utils::GetAbsoluteUrlAppRoot() . 'pages/UI.php?operation=search&' . $oAppContext->GetForLink() . '&filter=' . urlencode($this->m_oFilter->serialize());
                $sHtml .= '<p><a class="actions" href="' . $sHyperlink . '">';
                // Note: border set to 0 due to various browser interpretations (IE9 adding a 2px border)
                $sHtml .= MetaModel::GetClassIcon($sClass, true, 'float;left;margin-right:10px;border:0;');
                $sHtml .= MetaModel::GetName($sClass) . ': ' . $iCount . '</a></p>';
                $sParams = $oAppContext->GetForLink();
                $sHtml .= '<p>';
                if (UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY)) {
                    $sHtml .= "<a href=\"" . utils::GetAbsoluteUrlAppRoot() . "pages/UI.php?operation=new&class={$sClass}&{$sParams}\">" . Dict::Format('UI:ClickToCreateNew', MetaModel::GetName($sClass)) . "</a><br/>\n";
                }
                $sHtml .= "<a href=\"" . utils::GetAbsoluteUrlAppRoot() . "pages/UI.php?operation=search_form&do_search=0&class={$sClass}&{$sParams}\">" . Dict::Format('UI:SearchFor_Class', MetaModel::GetName($sClass)) . "</a>\n";
                $sHtml .= '</p>';
                break;
            case 'summary':
                $sClass = $this->m_oFilter->GetClass();
                $oAppContext = new ApplicationContext();
                $sTitle = isset($aExtraParams['title[block]']) ? $aExtraParams['title[block]'] : '';
                $sLabel = isset($aExtraParams['label[block]']) ? $aExtraParams['label[block]'] : '';
                $sStateAttrCode = isset($aExtraParams['status[block]']) ? $aExtraParams['status[block]'] : 'status';
                $sStatesList = isset($aExtraParams['status_codes[block]']) ? $aExtraParams['status_codes[block]'] : '';
                $bContextFilter = isset($aExtraParams['context_filter']) ? isset($aExtraParams['context_filter']) != 0 : false;
                if ($bContextFilter) {
                    $aFilterCodes = array_keys(MetaModel::GetClassFilterDefs($this->m_oFilter->GetClass()));
                    foreach ($oAppContext->GetNames() as $sFilterCode) {
                        $sContextParamValue = $oAppContext->GetCurrentValue($sFilterCode, null);
                        if (!is_null($sContextParamValue) && !empty($sContextParamValue) && MetaModel::IsValidFilterCode($sClass, $sFilterCode)) {
                            $this->AddCondition($sFilterCode, $sContextParamValue);
                        }
                    }
                    $aQueryParams = array();
                    if (isset($aExtraParams['query_params'])) {
                        $aQueryParams = $aExtraParams['query_params'];
                    }
                    $this->m_oSet = new CMDBObjectSet($this->m_oFilter, array(), $aQueryParams);
                }
                // Summary details
                $aCounts = array();
                $aStateLabels = array();
                if (!empty($sStateAttrCode) && !empty($sStatesList)) {
                    $aStates = explode(',', $sStatesList);
                    $oAttDef = MetaModel::GetAttributeDef($sClass, $sStateAttrCode);
                    foreach ($aStates as $sStateValue) {
                        $oFilter = $this->m_oFilter->DeepClone();
                        $oFilter->AddCondition($sStateAttrCode, $sStateValue, '=');
                        $oSet = new DBObjectSet($oFilter);
                        $aCounts[$sStateValue] = $oSet->Count();
                        $aStateLabels[$sStateValue] = htmlentities($oAttDef->GetValueLabel($sStateValue), ENT_QUOTES, 'UTF-8');
                        if ($aCounts[$sStateValue] == 0) {
                            $aCounts[$sStateValue] = '-';
                        } else {
                            $sHyperlink = utils::GetAbsoluteUrlAppRoot() . 'pages/UI.php?operation=search&' . $oAppContext->GetForLink() . '&filter=' . urlencode($oFilter->serialize());
                            $aCounts[$sStateValue] = "<a href=\"{$sHyperlink}\">{$aCounts[$sStateValue]}</a>";
                        }
                    }
                }
                $sHtml .= '<div class="summary-details"><table><tr><th>' . implode('</th><th>', $aStateLabels) . '</th></tr>';
                $sHtml .= '<tr><td>' . implode('</td><td>', $aCounts) . '</td></tr></table></div>';
                // Title & summary
                $iCount = $this->m_oSet->Count();
                $sHyperlink = utils::GetAbsoluteUrlAppRoot() . 'pages/UI.php?operation=search&' . $oAppContext->GetForLink() . '&filter=' . urlencode($this->m_oFilter->serialize());
                $sHtml .= '<h1>' . Dict::S(str_replace('_', ':', $sTitle)) . '</h1>';
                $sHtml .= '<a class="summary" href="' . $sHyperlink . '">' . Dict::Format(str_replace('_', ':', $sLabel), $iCount) . '</a>';
                $sHtml .= '<div style="clear:both;"></div>';
                break;
            case 'csv':
                $bAdvancedMode = utils::ReadParam('advanced', false);
                $sCsvFile = strtolower($this->m_oFilter->GetClass()) . '.csv';
                $sDownloadLink = utils::GetAbsoluteUrlAppRoot() . 'webservices/export.php?expression=' . urlencode($this->m_oFilter->ToOQL(true)) . '&format=csv&filename=' . urlencode($sCsvFile);
                $sLinkToToggle = utils::GetAbsoluteUrlAppRoot() . 'pages/UI.php?operation=search&' . $oAppContext->GetForLink() . '&filter=' . urlencode($this->m_oFilter->serialize()) . '&format=csv';
                if ($bAdvancedMode) {
                    $sDownloadLink .= '&fields_advanced=1';
                    $sChecked = 'CHECKED';
                } else {
                    $sLinkToToggle = $sLinkToToggle . '&advanced=1';
                    $sChecked = '';
                }
                $sAjaxLink = $sDownloadLink . '&charset=UTF-8';
                // Includes &fields_advanced=1 if in advanced mode
                /*
                			$sCSVData = cmdbAbstractObject::GetSetAsCSV($this->m_oSet, array('fields_advanced' => $bAdvancedMode));
                			$sCharset = MetaModel::GetConfig()->Get('csv_file_default_charset');
                			if ($sCharset == 'UTF-8')
                			{
                				$bLostChars = false;
                			}
                			else
                			{
                				$sConverted = @iconv('UTF-8', $sCharset, $sCSVData);
                				$sRestored = @iconv($sCharset, 'UTF-8', $sConverted);
                				$bLostChars = ($sRestored != $sCSVData);
                			}
                			if ($bLostChars)
                			{
                				$sCharsetNotice = "&nbsp;&nbsp;<span id=\"csv_charset_issue\">";
                				$sCharsetNotice .= '<img src="../images/error.png"  style="vertical-align:middle"/>';
                				$sCharsetNotice .= "</span>";
                				$sTip = "<p>".htmlentities(Dict::S('UI:CSVExport:LostChars'), ENT_QUOTES, 'UTF-8')."</p>";
                				$sTip .= "<p>".htmlentities(Dict::Format('UI:CSVExport:LostChars+', $sCharset), ENT_QUOTES, 'UTF-8')."</p>";
                				$oPage->add_ready_script("$('#csv_charset_issue').qtip( { content: '$sTip', show: 'mouseover', hide: 'mouseout', style: { name: 'dark', tip: 'leftTop' }, position: { corner: { target: 'rightMiddle', tooltip: 'leftTop' }} } );");
                			}
                			else
                			{
                				$sCharsetNotice = '';
                			}
                */
                $sCharsetNotice = false;
                $sHtml .= "<div>";
                $sHtml .= '<table style="width:100%" class="transparent">';
                $sHtml .= '<tr>';
                $sHtml .= '<td><a href="' . $sDownloadLink . '">' . Dict::Format('UI:Download-CSV', $sCsvFile) . '</a>' . $sCharsetNotice . '</td>';
                $sHtml .= '<td style="text-align:right"><input type="checkbox" ' . $sChecked . ' onClick="window.location.href=\'' . $sLinkToToggle . '\'">&nbsp;' . Dict::S('UI:CSVExport:AdvancedMode') . '</td>';
                $sHtml .= '</tr>';
                $sHtml .= '</table>';
                if ($bAdvancedMode) {
                    $sHtml .= "<p>";
                    $sHtml .= htmlentities(Dict::S('UI:CSVExport:AdvancedMode+'), ENT_QUOTES, 'UTF-8');
                    $sHtml .= "</p>";
                }
                $sHtml .= "</div>";
                $sHtml .= "<div id=\"csv_content_loading\"><div style=\"width: 250px; height: 20px; background: url(../setup/orange-progress.gif); border: 1px #999 solid; margin-left:auto; margin-right: auto; text-align: center;\">" . Dict::S('UI:Loading') . "</div></div><textarea id=\"csv_content\" style=\"display:none;\">\n";
                //$sHtml .= htmlentities($sCSVData, ENT_QUOTES, 'UTF-8');
                $sHtml .= "</textarea>\n";
                $oPage->add_ready_script("\$.post('{$sAjaxLink}', {}, function(data) { \$('#csv_content').html(data); \$('#csv_content_loading').hide(); \$('#csv_content').show();} );");
                break;
            case 'modify':
                if (UserRights::IsActionAllowed($this->m_oSet->GetClass(), UR_ACTION_MODIFY, $this->m_oSet) == UR_ALLOWED_YES) {
                    while ($oObj = $this->m_oSet->Fetch()) {
                        $sHtml .= $oObj->GetModifyForm($oPage);
                    }
                }
                break;
            case 'search':
                $sStyle = isset($aExtraParams['open']) && $aExtraParams['open'] == 'true' ? 'SearchDrawer' : 'SearchDrawer DrawerClosed';
                $sHtml .= "<div id=\"ds_{$sId}\" class=\"{$sStyle}\">\n";
                $oPage->add_ready_script(<<<EOF
\t\$("#dh_{$sId}").click( function() {
\t\t\$("#ds_{$sId}").slideToggle('normal', function() { \$("#ds_{$sId}").parent().resize(); FixSearchFormsDisposition(); } );
\t\t\$("#dh_{$sId}").toggleClass('open');
\t});
EOF
);
                $aExtraParams['currentId'] = $sId;
                $sHtml .= cmdbAbstractObject::GetSearchForm($oPage, $this->m_oSet, $aExtraParams);
                $sHtml .= "</div>\n";
                $sHtml .= "<div class=\"HRDrawer\"></div>\n";
                $sHtml .= "<div id=\"dh_{$sId}\" class=\"DrawerHandle\">" . Dict::S('UI:SearchToggle') . "</div>\n";
                break;
            case 'open_flash_chart':
                static $iChartCounter = 0;
                $oAppContext = new ApplicationContext();
                $sContext = $oAppContext->GetForLink();
                if (!empty($sContext)) {
                    $sContext = '&' . $sContext;
                }
                $sChartType = isset($aExtraParams['chart_type']) ? $aExtraParams['chart_type'] : 'pie';
                $sTitle = isset($aExtraParams['chart_title']) ? $aExtraParams['chart_title'] : '';
                $sGroupBy = isset($aExtraParams['group_by']) ? $aExtraParams['group_by'] : '';
                $sGroupByExpr = isset($aExtraParams['group_by_expr']) ? '&params[group_by_expr]=' . $aExtraParams['group_by_expr'] : '';
                $sFilter = $this->m_oFilter->serialize();
                $sHtml .= "<div id=\"my_chart_{$sId}{$iChartCounter}\">If the chart does not display, <a href=\"http://get.adobe.com/flash/\" target=\"_blank\">install Flash</a></div>\n";
                $oPage->add_script("function ofc_resize(left, width, top, height) { /* do nothing special */ }");
                if (isset($aExtraParams['group_by_label'])) {
                    $sUrl = urlencode(utils::GetAbsoluteUrlAppRoot() . "pages/ajax.render.php?operation=open_flash_chart&params[group_by]={$sGroupBy}{$sGroupByExpr}&params[group_by_label]={$aExtraParams['group_by_label']}&params[chart_type]={$sChartType}&params[chart_title]={$sTitle}&params[currentId]={$sId}&id={$sId}&filter=" . urlencode($sFilter));
                } else {
                    $sUrl = urlencode(utils::GetAbsoluteUrlAppRoot() . "pages/ajax.render.php?operation=open_flash_chart&params[group_by]={$sGroupBy}{$sGroupByExpr}&params[chart_type]={$sChartType}&params[chart_title]={$sTitle}&params[currentId]={$sId}&id={$sId}&filter=" . urlencode($sFilter));
                }
                $oPage->add_ready_script("swfobject.embedSWF(\"../images/open-flash-chart.swf\", \"my_chart_{$sId}{$iChartCounter}\", \"100%\", \"300\",\"9.0.0\", \"expressInstall.swf\",\n\t\t\t\t{\"data-file\":\"" . $sUrl . "\"}, {wmode: 'transparent'} );\n");
                $iChartCounter++;
                if (isset($aExtraParams['group_by'])) {
                    if (isset($aExtraParams['group_by_label'])) {
                        $oGroupByExp = Expression::FromOQL($aExtraParams['group_by']);
                        $sGroupByLabel = $aExtraParams['group_by_label'];
                    } else {
                        // Backward compatibility: group_by is simply a field id
                        $sAlias = $this->m_oFilter->GetClassAlias();
                        $oGroupByExp = new FieldExpression($aExtraParams['group_by'], $sAlias);
                        $sGroupByLabel = MetaModel::GetLabel($this->m_oFilter->GetClass(), $aExtraParams['group_by']);
                    }
                    $aGroupBy = array();
                    $aGroupBy['grouped_by_1'] = $oGroupByExp;
                    $sSql = $this->m_oFilter->MakeGroupByQuery($aQueryParams, $aGroupBy, true);
                    $aRes = CMDBSource::QueryToArray($sSql);
                    $aGroupBy = array();
                    $aLabels = array();
                    $aValues = array();
                    $iTotalCount = 0;
                    foreach ($aRes as $iRow => $aRow) {
                        $sValue = $aRow['grouped_by_1'];
                        $aValues[$iRow] = $sValue;
                        $sHtmlValue = $oGroupByExp->MakeValueLabel($this->m_oFilter, $sValue, $sValue);
                        $aLabels[$iRow] = $sHtmlValue;
                        $aGroupBy[$iRow] = (int) $aRow['_itop_count_'];
                        $iTotalCount += $aRow['_itop_count_'];
                    }
                    $aData = array();
                    $idx = 0;
                    $aURLs = array();
                    foreach ($aGroupBy as $iRow => $iCount) {
                        // Build the search for this subset
                        $oSubsetSearch = $this->m_oFilter->DeepClone();
                        $oCondition = new BinaryExpression($oGroupByExp, '=', new ScalarExpression($aValues[$iRow]));
                        $oSubsetSearch->AddConditionExpression($oCondition);
                        $aURLs[$idx] = $oSubsetSearch->serialize();
                        $idx++;
                    }
                    $sURLList = '';
                    foreach ($aURLs as $index => $sURL) {
                        $sURLList .= "\taURLs[{$index}] = '" . utils::GetAbsoluteUrlAppRoot() . "pages/UI.php?operation=search&format=html{$sContext}&filter=" . urlencode($sURL) . "';\n";
                    }
                    $oPage->add_script(<<<EOF
function ofc_drill_down_{$sId}(index)
{
\tvar aURLs = new Array();
{$sURLList}
\twindow.location.href=aURLs[index];
}
EOF
);
                }
                break;
            case 'open_flash_chart_ajax':
                require_once APPROOT . '/pages/php-ofc-library/open-flash-chart.php';
                $sChartType = isset($aExtraParams['chart_type']) ? $aExtraParams['chart_type'] : 'pie';
                $sId = utils::ReadParam('id', '');
                $oChart = new open_flash_chart();
                switch ($sChartType) {
                    case 'bars':
                        $oChartElement = new bar_glass();
                        if (isset($aExtraParams['group_by'])) {
                            if (isset($aExtraParams['group_by_label'])) {
                                $oGroupByExp = Expression::FromOQL($aExtraParams['group_by']);
                                $sGroupByLabel = $aExtraParams['group_by_label'];
                            } else {
                                // Backward compatibility: group_by is simply a field id
                                $sAlias = $this->m_oFilter->GetClassAlias();
                                $oGroupByExp = new FieldExpression($aExtraParams['group_by'], $sAlias);
                                $sGroupByLabel = MetaModel::GetLabel($this->m_oFilter->GetClass(), $aExtraParams['group_by']);
                            }
                            $aGroupBy = array();
                            $aGroupBy['grouped_by_1'] = $oGroupByExp;
                            $sSql = $this->m_oFilter->MakeGroupByQuery($aQueryParams, $aGroupBy, true);
                            $aRes = CMDBSource::QueryToArray($sSql);
                            $aGroupBy = array();
                            $aLabels = array();
                            $iTotalCount = 0;
                            foreach ($aRes as $iRow => $aRow) {
                                $sValue = $aRow['grouped_by_1'];
                                $sHtmlValue = $oGroupByExp->MakeValueLabel($this->m_oFilter, $sValue, $sValue);
                                $aLabels[$iRow] = strip_tags($sHtmlValue);
                                $aGroupBy[$iRow] = (int) $aRow['_itop_count_'];
                                $iTotalCount += $aRow['_itop_count_'];
                            }
                            $aData = array();
                            $aChartLabels = array();
                            $maxValue = 0;
                            foreach ($aGroupBy as $iRow => $iCount) {
                                $oBarValue = new bar_value($iCount);
                                $oBarValue->on_click("ofc_drill_down_{$sId}");
                                $aData[] = $oBarValue;
                                if ($iCount > $maxValue) {
                                    $maxValue = $iCount;
                                }
                                $aChartLabels[] = html_entity_decode($aLabels[$iRow], ENT_QUOTES, 'UTF-8');
                            }
                            $oYAxis = new y_axis();
                            $aMagicValues = array(1, 2, 5, 10);
                            $iMultiplier = 1;
                            $index = 0;
                            $iTop = $aMagicValues[$index % count($aMagicValues)] * $iMultiplier;
                            while ($maxValue > $iTop) {
                                $index++;
                                $iTop = $aMagicValues[$index % count($aMagicValues)] * $iMultiplier;
                                if ($index % count($aMagicValues) == 0) {
                                    $iMultiplier = $iMultiplier * 10;
                                }
                            }
                            //echo "oYAxis->set_range(0, $iTop, $iMultiplier);\n";
                            $oYAxis->set_range(0, $iTop, $iMultiplier);
                            $oChart->set_y_axis($oYAxis);
                            $oChartElement->set_values($aData);
                            $oXAxis = new x_axis();
                            $oXLabels = new x_axis_labels();
                            // set them vertical
                            $oXLabels->set_vertical();
                            // set the label text
                            $oXLabels->set_labels($aChartLabels);
                            // Add the X Axis Labels to the X Axis
                            $oXAxis->set_labels($oXLabels);
                            $oChart->set_x_axis($oXAxis);
                        }
                        break;
                    case 'pie':
                    default:
                        $oChartElement = new pie();
                        $oChartElement->set_start_angle(35);
                        $oChartElement->set_animate(true);
                        $oChartElement->set_tooltip('#label# - #val# (#percent#)');
                        $oChartElement->set_colours(array('#FF8A00', '#909980', '#2C2B33', '#CCC08D', '#596664'));
                        if (isset($aExtraParams['group_by'])) {
                            if (isset($aExtraParams['group_by_label'])) {
                                $oGroupByExp = Expression::FromOQL($aExtraParams['group_by']);
                                $sGroupByLabel = $aExtraParams['group_by_label'];
                            } else {
                                // Backward compatibility: group_by is simply a field id
                                $sAlias = $this->m_oFilter->GetClassAlias();
                                $oGroupByExp = new FieldExpression($aExtraParams['group_by'], $sAlias);
                                $sGroupByLabel = MetaModel::GetLabel($this->m_oFilter->GetClass(), $aExtraParams['group_by']);
                            }
                            $aGroupBy = array();
                            $aGroupBy['grouped_by_1'] = $oGroupByExp;
                            $sSql = $this->m_oFilter->MakeGroupByQuery($aQueryParams, $aGroupBy, true);
                            $aRes = CMDBSource::QueryToArray($sSql);
                            $aGroupBy = array();
                            $aLabels = array();
                            $iTotalCount = 0;
                            foreach ($aRes as $iRow => $aRow) {
                                $sValue = $aRow['grouped_by_1'];
                                $sHtmlValue = $oGroupByExp->MakeValueLabel($this->m_oFilter, $sValue, $sValue);
                                $aLabels[$iRow] = strip_tags($sHtmlValue);
                                $aGroupBy[$iRow] = (int) $aRow['_itop_count_'];
                                $iTotalCount += $aRow['_itop_count_'];
                            }
                            $aData = array();
                            foreach ($aGroupBy as $iRow => $iCount) {
                                $sFlashLabel = html_entity_decode($aLabels[$iRow], ENT_QUOTES, 'UTF-8');
                                $PieValue = new pie_value($iCount, $sFlashLabel);
                                //@@ BUG: not passed via ajax !!!
                                $PieValue->on_click("ofc_drill_down_{$sId}");
                                $aData[] = $PieValue;
                            }
                            $oChartElement->set_values($aData);
                            $oChart->x_axis = null;
                        }
                }
                if (isset($aExtraParams['chart_title'])) {
                    // The title has been given in an url, and urlencoded...
                    // and urlencode transforms utf-8 into something similar to ISO-8859-1
                    // Example: é (C3A9 becomes %E9)
                    // As a consequence, json_encode (called within open-flash-chart.php)
                    // was returning 'null' and the graph was not displayed at all
                    // To make sure that the graph is displayed AND to get a correct title
                    // (at least for european characters) let's transform back into utf-8 !
                    $sTitle = iconv("ISO-8859-1", "UTF-8//IGNORE", $aExtraParams['chart_title']);
                    // If the title is a dictionnary entry, fetch it
                    $sTitle = Dict::S($sTitle);
                    $oTitle = new title($sTitle);
                    $oChart->set_title($oTitle);
                    $oTitle->set_style("{font-size: 16px; font-family: Tahoma; font-weight: bold; text-align: center;}");
                }
                $oChart->set_bg_colour('#FFFFFF');
                $oChart->add_element($oChartElement);
                $sHtml = $oChart->toPrettyString();
                break;
            default:
                // Unsupported style, do nothing.
                $sHtml .= Dict::format('UI:Error:UnsupportedStyleOfBlock', $this->m_sStyle);
        }
        return $sHtml;
    }
示例#8
0
        $atributos['ancho'] = '30px';
        $atributos['alto'] = '30px';
        $tab++;
        echo $this->miFormulario->enlace($atributos);
        unset($atributos);
        $esteCampo = 'enlacetwitter';
        $atributos['id'] = $esteCampo;
        $atributos['enlace'] = $this->lenguaje->getCadena($esteCampo);
        $atributos['columnas'] = 1;
        // $atributos ['estilo'] = 'jquery';
        $atributos['enlaceImagen'] = $this->miConfigurador->getVariableConfiguracion('rutaUrlBloque') . 'imagen/twitter.png';
        $atributos['ancho'] = '30px';
        $atributos['alto'] = '30px';
        $tab++;
        echo $this->miFormulario->enlace($atributos);
        unset($atributos);
        echo $this->miFormulario->division("fin");
        echo $this->miFormulario->agrupacion('fin');
        $atributos['marco'] = true;
        $atributos['tipoEtiqueta'] = 'fin';
        echo $this->miFormulario->formulario($atributos);
        return true;
    }
}
$miSeleccionador = new pie($this->lenguaje, $this->miFormulario);
$miSeleccionador->miForm();
?>



    protected function RenderChart($oPage, $sId, $aValues, $sDrillDown = '', $aRows = array())
    {
        // 1- Compute Open Flash Chart data
        //
        $aValueKeys = array();
        $index = 0;
        if (count($aValues) > 0 && $sDrillDown != '') {
            $oFilter = DBObjectSearch::FromOQL($sDrillDown);
            $sClass = $oFilter->GetClass();
            $sOQLClause = str_replace('SELECT ' . $sClass, '', $sDrillDown);
            $aSQLColNames = array_keys(current($aRows));
            // Read the list of columns from the current (i.e. first) element of the array
            $oAppContext = new ApplicationContext();
            $sURL = utils::GetAbsoluteUrlAppRoot() . 'pages/UI.php?operation=search_oql&search_form=0&oql_class=' . $sClass . '&format=html&' . $oAppContext->GetForLink() . '&oql_clause=';
        }
        $aURLs = array();
        foreach ($aValues as $key => $value) {
            // Make sure that values are integers (so that max() will work....)
            // and build an array of STRING with the keys (numeric keys are transformed into string by PHP :-(
            $aValues[$key] = (int) $value;
            $aValueKeys[] = (string) $key;
            // Build the custom query for the 'drill down' on each element
            if ($sDrillDown != '') {
                $sFilter = $sOQLClause;
                foreach ($aSQLColNames as $sColName) {
                    $sFilter = str_replace(':' . $sColName, "'" . addslashes($aRows[$key][$sColName]) . "'", $sFilter);
                    $aURLs[$index] = $sURL . urlencode($sFilter);
                }
            }
            $index++;
        }
        $oChart = new open_flash_chart();
        if ($this->m_sType == 'bars') {
            $oChartElement = new bar_glass();
            if (count($aValues) > 0) {
                $maxValue = max($aValues);
            } else {
                $maxValue = 1;
            }
            $oYAxis = new y_axis();
            $aMagicValues = array(1, 2, 5, 10);
            $iMultiplier = 1;
            $index = 0;
            $iTop = $aMagicValues[$index % count($aMagicValues)] * $iMultiplier;
            while ($maxValue > $iTop) {
                $index++;
                $iTop = $aMagicValues[$index % count($aMagicValues)] * $iMultiplier;
                if ($index % count($aMagicValues) == 0) {
                    $iMultiplier = $iMultiplier * 10;
                }
            }
            //echo "oYAxis->set_range(0, $iTop, $iMultiplier);\n";
            $oYAxis->set_range(0, $iTop, $iMultiplier);
            $oChart->set_y_axis($oYAxis);
            $aBarValues = array();
            foreach ($aValues as $iValue) {
                $oBarValue = new bar_value($iValue);
                $oBarValue->on_click("ofc_drilldown_{$sId}");
                $aBarValues[] = $oBarValue;
            }
            $oChartElement->set_values($aBarValues);
            //$oChartElement->set_values(array_values($aValues));
            $oXAxis = new x_axis();
            $oXLabels = new x_axis_labels();
            // set them vertical
            $oXLabels->set_vertical();
            // set the label text
            $oXLabels->set_labels($aValueKeys);
            // Add the X Axis Labels to the X Axis
            $oXAxis->set_labels($oXLabels);
            $oChart->set_x_axis($oXAxis);
        } else {
            $oChartElement = new pie();
            $oChartElement->set_start_angle(35);
            $oChartElement->set_animate(true);
            $oChartElement->set_tooltip('#label# - #val# (#percent#)');
            $oChartElement->set_colours(array('#FF8A00', '#909980', '#2C2B33', '#CCC08D', '#596664'));
            $aData = array();
            foreach ($aValues as $sValue => $iValue) {
                $oPieValue = new pie_value($iValue, $sValue);
                //@@ BUG: not passed via ajax !!!
                $oPieValue->on_click("ofc_drilldown_{$sId}");
                $aData[] = $oPieValue;
            }
            $oChartElement->set_values($aData);
            $oChart->x_axis = null;
        }
        // Title given in HTML
        //$oTitle = new title($this->m_sTitle);
        //$oChart->set_title($oTitle);
        $oChart->set_bg_colour('#FFFFFF');
        $oChart->add_element($oChartElement);
        $sData = $oChart->toPrettyString();
        $sData = json_encode($sData);
        // 2- Declare the Javascript function that will render the chart data\
        //
        $oPage->add_script(<<<EOF
function ofc_get_data_{$sId}()
{
\treturn {$sData};
}
EOF
);
        if (count($aURLs) > 0) {
            $sURLList = '';
            foreach ($aURLs as $index => $sURL) {
                $sURLList .= "\taURLs[{$index}] = '" . addslashes($sURL) . "';\n";
            }
            $oPage->add_script(<<<EOF
function ofc_drilldown_{$sId}(index)
{
\tvar aURLs = new Array();
{$sURLList}
\tvar sURL = aURLs[index];
\t
\twindow.location.href = sURL; // Navigate ! 
}
EOF
);
        }
        // 3- Insert the Open Flash chart
        //
        $oPage->add("<div id=\"{$sId}\"><div>\n");
        $oPage->add_ready_script(<<<EOF
swfobject.embedSWF(\t"../images/open-flash-chart.swf", 
\t"{$sId}", 
\t"100%", "300","9.0.0",
\t"expressInstall.swf",
\t{"get-data":"ofc_get_data_{$sId}", "id":"{$sId}"}, 
\t{'wmode': 'transparent'}
);
EOF
);
    }
示例#10
0
	$pie->radius(80);
	$pie->set_colours( $colors );
	$pie->set_values( $array );
	$chart = new open_flash_chart();
	// $chart->set_title( $title );
	$chart->add_element( $pie );
	echo $chart->toPrettyString();
    break;

    // Default is to generate an Ad-hoc chart
    default:
    $chartType = get_input('chartType');
    $chartType = (!empty($chartType)) ? $chartType : "pie";
    $sql = "SELECT id, host, facility, priority, tag, program, msg, counter, fo, lo, notes, (SELECT value from cache where name='msg_sum') as count FROM ".$_SESSION['TBL_MAIN']." $where GROUP BY $groupby ORDER BY count LIMIT $limit";
    $title = new title( date("D M d Y") );
    $ctype = new pie();
    $result = perform_query($sql, $dbLink, $_SERVER['PHP_SELF']);
    if(num_rows($result) >= 1) {
        while ($line = fetch_array($result)) {
            $hosts[] = $line['host'];
            $pievalues[] = new pie_value(intval($line['count']),  $line['host']);
        }
    }
    // Generate random pie colors
    for($i = 0; $i<=count($pievalues) ; $i++) {
        $colors[] = '#'.random_hex_color(); // 09B826
    }

    $ctype->set_alpha(0.5);
    $ctype->add_animation( new pie_fade() );
    $ctype->add_animation( new pie_bounce(5) );
示例#11
0
function report_chart($data)
{
    $title = new title("Availability Report ");
    $pie = new pie();
    $pie->set_alpha(0.9);
    $pie->radius(90);
    //$pie->start_angle(100);
    $pie->add_animation(new pie_fade());
    $pie->set_tooltip('#label#: #percent#<br>#val# of #total#<br>');
    $status_colors = array(free => '#77CC6D', assigned => '#FF0000', reserved => '#6D86CC', free2 => '#77CC6D', assigned2 => '#FF0000', reserved2 => '#6D86CC');
    $status_name = array(free => 'FREE', assigned => 'ASSIGNED', reserved => 'RESERVED', free2 => 'FREE', assigned2 => 'ASSIGNED', reserved2 => 'RESERVED');
    $col = array();
    $d = array();
    foreach ($data as $name => $value) {
        if ($value > 0) {
            $d[] = new pie_value($value * 1, "{$status_name[$name]}");
            array_push($col, $status_colors[$name]);
        }
    }
    $pie->set_values($d);
    $pie->set_colours($col);
    $chart = new open_flash_chart();
    $chart->set_title($title);
    $chart->add_element($pie);
    $chart->x_axis = null;
    $chart->set_bg_colour('#202020');
    $title->set_style("{font-size: 16px; font-family: Times New Roman; font-weight: bold; color: #000; text-align: center;}");
    $chart->set_bg_colour('#FFFFFF');
    $chart->set_title($title);
    // This is the VIEW section:
    // Should print this first.
    //
    $heading = "\n        <script type='text/javascript'>\n    \n        var data = " . $chart->toPrettyString() . "\n\n        </script>\n\n\n        <script type=\"text/javascript\">\n \n        OFC = {};\n \n        OFC.jquery = {\n        name: 'jQuery',\n        version: function(src) { return \$('#'+ src)[0].get_version() },\n        rasterize: function (src, dst) { \$('#'+ dst).replaceWith(OFC.jquery.image(src)) },\n        image: function(src) { return \"<img src='data:image/png;base64,\" + \$('#'+src)[0].get_img_binary() + \"' />\"},\n        popup: function(src) {\n        var img_win = window.open('', 'Charts: Export as Image')\n        with(img_win.document) {\n            write('<html><head><title>Charts: Export as Image<\\/title><\\/head><body>' + OFC.jquery.image(src) + '<\\/body><\\/html>') }\n                // stop the 'loading...' message\n                img_win.document.close();\n        }\n        }\n \n        // Using_ an object as namespaces is JS Best Practice. I like the Control.XXX style.\n        //if (!Control) {var Control = {}}\n        //if (typeof(Control == \"undefined\")) {var Control = {}}\n        if (typeof(Control == \"undefined\")) {var Control = {OFC: OFC.jquery}}\n \n \n        // By default, right-clicking on OFC and choosing \"save image locally\" calls this function.\n        // You are free to change the code in OFC and call my wrapper (Control.OFC.your_favorite_save_method)\n        // function save_image() { alert(1); Control.OFC.popup('my_chart') }\n        function save_image() { alert(\"Your image will be displayed in a new window\"); OFC.jquery.popup('my_chart') }\n        </script>\n        <div id='my_chart' style='float:left; margin-left:28px;'></div>\n        ";
    return $heading;
}
示例#12
0
    public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array())
    {
        $sTitle = $this->aProperties['title'];
        $aDisplayValues = $this->MakeSimulatedData();
        require_once APPROOT . '/pages/php-ofc-library/open-flash-chart.php';
        $oChart = new open_flash_chart();
        $aGroupBy = array();
        $aLabels = array();
        foreach ($aDisplayValues as $iRow => $aDisplayData) {
            $aLabels[$iRow] = $aDisplayData['label'];
            $aGroupBy[$iRow] = (int) $aDisplayData['count'];
        }
        $oChartElement = new pie();
        $oChartElement->set_start_angle(35);
        $oChartElement->set_animate(true);
        $oChartElement->set_tooltip('#label# - #val# (#percent#)');
        $oChartElement->set_colours(array('#FF8A00', '#909980', '#2C2B33', '#CCC08D', '#596664'));
        $aData = array();
        foreach ($aGroupBy as $iRow => $iCount) {
            $sFlashLabel = html_entity_decode($aLabels[$iRow], ENT_QUOTES, 'UTF-8');
            $PieValue = new pie_value($iCount, $sFlashLabel);
            $aData[] = $PieValue;
        }
        $oChartElement->set_values($aData);
        $oChart->x_axis = null;
        if (!empty($sTitle)) {
            // The title has been given in an url, and urlencoded...
            // and urlencode transforms utf-8 into something similar to ISO-8859-1
            // Example: é (C3A9 becomes %E9)
            // As a consequence, json_encode (called within open-flash-chart.php)
            // was returning 'null' and the graph was not displayed at all
            // To make sure that the graph is displayed AND to get a correct title
            // (at least for european characters) let's transform back into utf-8 !
            $sTitle = iconv("ISO-8859-1", "UTF-8//IGNORE", $sTitle);
            // If the title is a dictionnary entry, fetch it
            $sTitle = $this->oModelReflection->DictString($sTitle);
            $oTitle = new title($sTitle);
            $oChart->set_title($oTitle);
            $oTitle->set_style("{font-size: 16px; font-family: Tahoma; font-weight: bold; text-align: center;}");
        }
        $oChart->set_bg_colour('#FFFFFF');
        $oChart->add_element($oChartElement);
        $sData = $oChart->toPrettyString();
        $sData = json_encode($sData);
        $oPage->add_script(<<<EOF
function ofc_get_data_dashlet_{$this->sId}()
{
\treturn {$sData};
}
EOF
);
        $oPage->add('<div class="dashlet-content">');
        $oPage->add("<div id=\"dashlet_chart_{$this->sId}\">If the chart does not display, <a href=\"http://get.adobe.com/flash/\" target=\"_blank\">install Flash</a></div>\n");
        $oPage->add('</div>');
        //		$oPage->add_script("function ofc_resize(left, width, top, height) { /* do nothing special */ }");
        $oPage->add_ready_script(<<<EOF
swfobject.embedSWF(\t"../images/open-flash-chart.swf", 
\t"dashlet_chart_{$this->sId}", 
\t"100%", "300","9.0.0",
\t"expressInstall.swf",
\t{"get-data":"ofc_get_data_dashlet_{$this->sId}", "id":"dashlet_chart_{$this->sId}"}, 
\t{'wmode': 'transparent'}
);
EOF
);
    }
示例#13
0
# All rights reserved.
#
# Version: 1.0
# Created: 07.04.2009, Bunyamin Demir
#
# Index page
#
# Release Notes:
#
require_once "../lib/DB.class.php";
require_once "../lib/Template.class.php";
require_once "../lib/Report.class.php";
require_once "../lib/Resource.class.php";
require_once "../lib/php-ofc-library/open-flash-chart.php";
$rs = new Resource();
$RS = $rs->enum(array('LIST_SEVERITY'));
$filters['severity'] = array_values($RS['LIST_SEVERITY']);
$title = new title('Category Distribution');
$pie = new pie();
$pie->set_alpha(0.7);
$pie->set_start_angle(35);
$pie->add_animation(new pie_fade());
$pie->set_tooltip('#val# of #total#<br>#percent# of 100%');
$pie->set_colours(array('#E60039', '#00E6AC', '#1C9E05', '#FF368D', '#7547FF'));
$pie->set_values(array(new pie_value(50, "Critical (123)"), new pie_value(10, "Alert (33)"), new pie_value(13, "Error (463)"), new pie_value(17, "Warning (46)"), new pie_value(10, "Notice (89)")));
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($pie);
$chart->set_bg_colour('#FFFFFF');
$chart->x_axis = null;
echo $chart->toPrettyString();
示例#14
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');
 }
$result = mssql_query($sql);
$data = array();
if (mssql_num_rows($result) > 0) {
    while ($val = mssql_fetch_assoc($result)) {
        $jenis[] = $val['Jenis'];
        $jumlah[] = $val['Jumlah'];
        $total = $val['total'];
        $data[] = new pie_value($val['Jumlah'], $val['Jenis'] == null ? 'Tidak KB' : $val['Jenis']);
        //$tempJumlah = $val[ 'Jumlah' ];
        //$maxJumlah = ( $maxJumlah > $tempJumlah ) ? $maxJumlah : $tempJumlah;
    }
}
$max = 0;
$title = new title('Jumlah Pemakaian Alat Kontrasepsi Berdasarkan Jenis, Total : ' . $total . ' ( ' . date("D M d Y") . ' ) ');
$title->set_style('{font-size:20px; color: #bcd6ff; margin:0px; background-color: #5E83BF;}');
$pie = new pie();
$pie->alpha(0.5)->add_animation(new pie_fade())->add_animation(new pie_bounce(5))->start_angle(0)->tooltip('#val# dari #total#<br>#percent# dari 100%')->colours(array('#d01f3c', '#356aa0', '#c79810', '#639bf7', '#ac77dea'));
$pie->set_values($data);
/*$bar = new bar_3d();
	$bar->set_values( $jumlah );	
	$bar->colour = '#9999FF';	
	$bar->set_on_show( new bar_on_show( 'grow-up', 1, 0 ) );

	$labels = new x_axis_labels();
	$labels->set_labels( $jenis );

	$y_base = new y_axis_base();
	$y_base->set_range( 0, $maxJumlah + round( $maxJumlah / 2 ), round( $maxJumlah / 2 ) );

	$x = new x_axis();
	$x->set_labels( $labels );
示例#16
0
 /**
  * public static function to generate two pie charts for the mailing reports
  * It was extracted because there are two graph in mailing for each mailing and general mailing which is the total
  *
  * @param array $results data needed for graph values
  */
 public static function mailingPieChart($results)
 {
     $data = array();
     //First Pie, Pie Chart for HTML/TEXT format
     $valuesFormat = array();
     $pieHtmlValues = new pie_value((int) $results['html_sent'], _JNEWS_GRAPH_LBL_HTML);
     $pieTextValues = new pie_value((int) $results['text_sent'], _JNEWS_GRAPH_LBL_TEXT);
     $valuesFormat[] = $pieHtmlValues;
     $valuesFormat[] = $pieTextValues;
     if (empty($results['html_sent']) && empty($results['text_sent'])) {
         $data['pie1'] = 'empty';
     } else {
         $css = '{font-size:15px;font-weight:bold;color:#0B55C4;}';
         $title = new title(_JNEWS_GRAPH_TITLE_FORMAT);
         //Name of the newsletter
         $title->set_style($css);
         $pieMailing = new pie();
         $pieMailing->set_alpha(0.6);
         $pieMailing->set_start_angle(35);
         $pieMailing->add_animation(new pie_fade());
         $pieMailing->set_tooltip('#val#<br>#percent# of 100%');
         $pieMailing->set_colours(array('#156cbd', '#368d03', '#f7941d', '#ed145a', '#92278f', '#156cbd', '#182972', '#3e5d2b', '#db4b19', '#9d0039', '#440e62'));
         $pieMailing->set_values($valuesFormat);
         $chartPie = new open_flash_chart();
         $chartPie->set_title($title);
         $chartPie->add_element($pieMailing);
         $chartPie->set_bg_colour('#FFFFFF');
         $data['pie1'] = $chartPie->toPrettyString();
     }
     //Second chart, Pie chart for the status of mailing process
     $valuesProcess = array();
     //$pieFailedlValues = new pie_value((int)$results['failed'], _JNEWS_MAILING_FAILED);
     //$pieBounceValues = new pie_value((int)$results['bounces'], _JNEWS_MAILING_BOUNCES);
     $piePendingValues = new pie_value((int) $results['pending'], _JNEWS_MAILING_PENDING);
     $pieSentValues = new pie_value((int) $results['sent'], _JNEWS_MAILING_SENT);
     //$valuesProcess[] = $pieFailedlValues;
     //$valuesProcess[] = $pieBounceValues;
     $valuesProcess[] = $piePendingValues;
     $valuesProcess[] = $pieSentValues;
     //if(!empty($results['failed']) && !empty($results['pending']) && !empty($results['bounces'])){
     if (!empty($results['sent']) || !empty($results['pending'])) {
         $css = '{font-size:15px;font-weight:bold;color:#0B55C4;}';
         $title = new title(_JNEWS_GRAPH_PIE_TITLE_MAIL);
         //Name of the newsletter
         $title->set_style($css);
         $pieMailing = new pie();
         $pieMailing->set_alpha(0.6);
         $pieMailing->set_start_angle(35);
         $pieMailing->add_animation(new pie_fade());
         $pieMailing->set_tooltip('#val#<br>#percent# of 100%');
         $pieMailing->set_colours(array('#156cbd', '#368d03', '#f7941d', '#ed145a', '#92278f', '#156cbd', '#182972', '#3e5d2b', '#db4b19', '#9d0039', '#440e62'));
         $pieMailing->set_values($valuesProcess);
         $chartPie = new open_flash_chart();
         $chartPie->set_title($title);
         $chartPie->add_element($pieMailing);
         $chartPie->set_bg_colour('#FFFFFF');
         $data['pie2'] = $chartPie->toPrettyString();
     } else {
         $data['pie2'] = 'empty';
     }
     return $data;
 }
示例#17
0
 function create()
 {
     if (in_array("b", $this->type) || in_array("l", $this->type)) {
         for ($bar = $i = 0; $i < count($this->type); $i++) {
             if ($this->type[$i] == 'b') {
                 $bar += 1;
             }
         }
         $this->disbar = $this->larg * $bar;
         $this->ld = $this->larg + $this->disbar;
         # variabile di comodo #
         if (in_array("l", $this->type) && $this->disbar == 0) {
             $this->disbar = 2 * $this->larg;
             $this->ld = $this->disbar;
             # variabile di comodo #
         }
         if (!isset($this->mass)) {
             $this->mass = $this->mx;
         }
         if (!isset($this->mnvs)) {
             $this->mnvs = $this->mn;
         }
         if (isset($this->name)) {
             graidle::setLegend($this->name);
         }
         if (!isset($this->dvx)) {
             if ($this->mass <= 1) {
                 $this->dvx = round($this->mass / 5, 1);
             } else {
                 if ($this->mass > 1 && $this->mass < 10) {
                     $this->dvx = 1;
                 } else {
                     $this->dvx = round($this->mass / 10);
                 }
             }
         }
         if (!isset($this->AA)) {
             $this->AA = 2;
         }
         if ($this->mx > 0) {
             if ($this->mass == $this->mx) {
                 $this->scarmax = 1;
             } else {
                 $this->scarmax = $this->mass - $this->mx;
             }
         }
         $this->scarmin = $this->mn;
         if ($this->mn < 0) {
             if ($this->mnvs > 0 || !isset($this->mnvs)) {
                 $this->scarmin = 0;
             } else {
                 if ($this->mnvs > $this->mn || $this->mnvs < $this->mn) {
                     $this->scarmin = $this->mnvs - $this->mn;
                 } else {
                     $this->scarmin = -1;
                 }
             }
         }
         if (strlen($this->mn) > strlen($this->mx)) {
             $this->y_flag = strlen($this->mn);
         } else {
             $this->y_flag = strlen($this->mx);
         }
         $this->s += $this->font_small * graidle::stringLen($this->mass);
         if (!isset($this->w)) {
             $this->w = $this->ld * $this->cnt + $this->s + $this->d;
             if ($this->w < 640) {
                 while ($this->w < 640) {
                     $this->larg += 0.01;
                     $this->disbar = $this->larg * $bar;
                     $this->ld = $this->larg + $this->disbar;
                     $this->w = round($this->ld * $this->cnt) + $this->s + $this->d;
                 }
             } else {
                 while ($this->w > 641) {
                     $this->larg -= 0.01;
                     $this->disbar = $this->larg * $bar;
                     $this->ld = $this->larg + $this->disbar;
                     $this->w = $this->ld * $this->cnt + $this->s + $this->d;
                 }
             }
         } else {
             while ($this->ld * $this->cnt + $this->s + $this->d >= $this->w) {
                 $this->larg -= 0.01;
                 $this->disbar = $this->larg;
                 $this->ld = $this->larg + $this->disbar;
             }
             while ($this->ld * $this->cnt + $this->s + $this->d <= $this->w) {
                 $this->larg += 0.01;
                 $this->disbar = $this->larg;
                 $this->ld = $this->larg + $this->disbar;
             }
         }
         if (!isset($this->h)) {
             $this->h = round(3 / 4 * $this->w);
         }
         $this->b += 2 * $this->font_small;
         if ($this->mnvs > 0 && $this->mass > 0) {
             $this->mul = ($this->h - $this->a - $this->b) / ($this->mass - $this->mnvs);
         } else {
             $this->mul = ($this->h - $this->a - $this->b) / ($this->mass + $this->scarmax + (abs($this->mn) - $this->scarmin));
         }
         $this->div = $this->dvx * $this->mul;
         $this->im = imagecreatetruecolor($this->w, $this->h);
         $rgb = Color::hex2rgb($this->axis_color);
         $this->axis_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
         $rgb = Color::hex2rgb($this->font_color);
         $this->font_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
         $rgb = Color::hex2rgb($this->bg_color);
         $this->bg_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
         imagefilltoborder($this->im, 1, 1, 1, $this->bg_color);
         if (isset($this->legend) || isset($this->name)) {
             graidle::legend();
         }
         graidle::title($this->title, $this->xAxis, $this->yAxis);
         graidle::gradAxis($this->sx, $this->sy);
         if (in_array("b", $this->type)) {
             include "graidle_histo.ext.php";
             histogram::drawHisto();
         }
         graidle::drawAxis();
         if (in_array("l", $this->type)) {
             include "graidle_line.ext.php";
             line::drawLine();
         }
     } else {
         if (in_array("hb", $this->type)) {
             for ($bar = $i = 0; $i < count($this->type); $i++) {
                 if ($this->type[$i] == 'hb') {
                     $bar += 1;
                 }
             }
             $this->disbar = $this->larg * $bar;
             if (isset($this->name)) {
                 graidle::setLegend($this->name);
             }
             if (!isset($this->mass)) {
                 $this->mass = $this->mx;
             }
             if (!isset($this->mnvs)) {
                 $this->mnvs = $this->mn;
             }
             if (!isset($this->dvx)) {
                 if ($this->mass <= 1) {
                     $this->dvx = round($this->mass / 5, 1);
                 } else {
                     if ($this->mass > 1 && $this->mass < 10) {
                         $this->dvx = 1;
                     } else {
                         $this->dvx = round($this->mass / 10);
                     }
                 }
             }
             if (!isset($this->AA)) {
                 $this->AA = 4;
             }
             $this->b += 5 * $this->font_small;
             $this->d += round(graidle::StringLen($this->mass) * ($this->font_small / 4));
             if (isset($this->vlx)) {
                 for ($maxlen = $i = 0; $i <= count($this->vlx); $i++) {
                     if (isset($this->vlx[$i])) {
                         $curlen = graidle::stringlen($this->vlx[$i]) * $this->font_small;
                         if ($maxlen < $curlen) {
                             $maxlen = $curlen;
                         }
                     }
                 }
                 $this->s += $maxlen + 10;
             } else {
                 $this->s += $this->font_small * 4;
             }
             if (isset($this->yAxis)) {
                 $this->s += 2 * $this->fontsmall;
             }
             $this->ld = $this->larg + $this->disbar;
             # variabile di comodo #
             if (!isset($this->h)) {
                 $this->h = $this->ld * $this->cnt + $this->a + $this->b;
                 if ($this->h < 500) {
                     while ($this->h < 500) {
                         $this->larg += 0.01;
                         $this->disbar = $this->larg * $bar;
                         $this->ld = $this->larg + $this->disbar;
                         $this->h = round($this->ld * $this->cnt) + $this->a + $this->b;
                     }
                 } else {
                     while ($this->h > 501) {
                         $this->larg -= 0.01;
                         $this->disbar = $this->larg * $bar;
                         $this->ld = $this->larg + $this->disbar;
                         $this->h = $this->ld * $this->cnt + $this->a + $this->b;
                     }
                 }
             } else {
                 while ($this->ld * $this->cnt + $this->a + $this->b <= $this->h) {
                     $this->larg += 0.01;
                     $this->disbar = $this->larg * $bar;
                     $this->ld = $this->larg + $this->disbar;
                 }
                 while ($this->ld * $this->cnt + $this->a + $this->b >= $this->h) {
                     $this->larg -= 0.01;
                     $this->disbar = $this->larg * $bar;
                     $this->ld = $this->larg + $this->disbar;
                 }
             }
             if (!isset($this->w)) {
                 $this->w = round(4 / 5 * $this->h);
             }
             if ($this->mnvs > 0 && $this->mass > 0) {
                 $this->mul = ($this->w - $this->s - $this->d) / ($this->mass - $this->mnvs);
             } else {
                 $this->mul = ($this->w - $this->s - $this->d) / ($this->mass + abs($this->mnvs));
             }
             $this->im = imagecreatetruecolor($this->w, $this->h);
             $rgb = Color::hex2rgb($this->axis_color);
             $this->axis_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
             $rgb = Color::hex2rgb($this->font_color);
             $this->font_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
             $rgb = Color::hex2rgb($this->bg_color);
             $this->bg_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
             imagefilltoborder($this->im, 1, 1, 1, $this->bg_color);
             if (isset($this->legend) || isset($this->name)) {
                 graidle::legend();
             }
             include "graidle_horizhisto.ext.php";
             HorizHistogram::gradAxis($this->sx, $this->sy);
             HorizHistogram::drawHorizHisto();
             HorizHistogram::drawAxis();
             graidle::title($this->title, $this->xAxis, $this->yAxis);
         } else {
             if (in_array("p", $this->type)) {
                 include "graidle_pie.ext.php";
                 for ($this->pie = $i = 0; $i < count($this->type); $i++) {
                     if ($this->type[$i] == 'p') {
                         $this->pie += 1;
                     }
                 }
                 if (!isset($this->incl)) {
                     $this->incl = 55;
                 }
                 if (!isset($this->AA)) {
                     $this->AA = 4;
                 }
                 if (!isset($this->w)) {
                     $this->w = 500;
                 }
                 if (!isset($this->h)) {
                     $this->h = 500;
                 }
                 $this->tre_d = 0;
                 if ($this->incl < 90) {
                     $this->tre_d = round($this->incl / 5);
                 }
                 $this->radius = $this->w;
                 $e = sin(deg2rad($this->incl));
                 $rapp = pow($e, 2);
                 $a = $this->radius;
                 $b = $a * $rapp;
                 while ($a >= $this->w - $this->s - $this->d) {
                     $a -= 1;
                     $this->radius = $a;
                     $b = $a * $rapp;
                 }
                 while ($b * $this->pie > $this->h - $this->a - $this->pie * $this->b - $this->pie * $this->tre_d) {
                     $b -= 1;
                     $a = $b / $rapp;
                     $this->radius = $a;
                 }
                 $this->im = imagecreatetruecolor($this->w, $this->h);
                 #<----CREO L'IMMAGINE PER IL GRAFICO A TORTA
                 $rgb = Color::hex2rgb($this->bg_color);
                 $this->bg_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
                 imagefilltoborder($this->im, 1, 1, 1, $this->bg_color);
                 #<---- Creo lo sfondo
                 $rgb = Color::hex2rgb($this->font_color);
                 $this->font_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
                 if (isset($this->legend)) {
                     graidle::legend();
                 }
                 graidle::title($this->title);
                 pie::drawPie($a, $b);
             } else {
                 if (in_array("s", $this->type)) {
                     include "graidle_spider.ext.php";
                     if (!isset($this->mass)) {
                         $this->mass = $this->mx;
                     }
                     if (!isset($this->filled)) {
                         $this->filled = 1;
                     }
                     if (!isset($this->AA)) {
                         $this->AA = 4;
                     }
                     if (!isset($this->w)) {
                         if (isset($this->h)) {
                             $this->w = round($this->h * (5 / 4));
                         } else {
                             $this->w = 500;
                         }
                     }
                     if (!isset($this->h)) {
                         $this->h = round($this->w * (4 / 5));
                     }
                     if (isset($this->name)) {
                         graidle::setLegend($this->name);
                     }
                     if (!isset($this->dvx)) {
                         if ($this->mass / 10 < 1) {
                             $this->dvx = round($this->mass / 5, 1);
                         } else {
                             $this->dvx = round($this->mass / 10);
                         }
                     }
                     $this->radius = $this->w - $this->s - $this->d;
                     while ($this->radius >= $this->h - $this->a - $this->b) {
                         $this->radius -= 1;
                     }
                     $this->radius = round($this->radius / 2);
                     $this->im = imagecreatetruecolor($this->w, $this->h);
                     #<----CREO L'IMMAGINE PER IL GRAFICO A TORTA
                     $rgb = Color::hex2rgb($this->bg_color);
                     $this->bg_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
                     imagefilltoborder($this->im, 1, 1, 1, $this->bg_color);
                     #<---- Creo lo sfondo
                     $rgb = Color::hex2rgb($this->font_color);
                     $this->font_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
                     $rgb = Color::hex2rgb($this->axis_color);
                     $this->axis_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
                     if (isset($this->legend)) {
                         graidle::legend();
                     }
                     graidle::title($this->title);
                     spider::drawSpider();
                 }
             }
         }
     }
 }
示例#18
0
    $plist = explode(";", $_GET['graph_filter']);
    for ($i = 0; $i <= count($plist); $i++) {
        list($k, $v) = explode("=", $plist[$i]);
        $param[$k] = $v;
    }
}
list($filter, $fwhere) = Filter::getFilter($param, '');
foreach ($fwhere as $w) {
    $where .= $w;
}
$categories =& Report::getCategoryDistribution($where);
$category = array();
foreach (array_keys($RS['LIST_CATEGORY']) as $s) {
    if ($categories[$s] && $s) {
        $category[] = new pie_value(intval($categories[$s]), $RS['LIST_CATEGORY'][intval($s)] . " ({$categories[$s]})");
    }
}
#$title = new title('Category Distribution');
$pie = new pie();
$pie->set_alpha(0.7);
$pie->set_start_angle(35);
$pie->add_animation(new pie_fade());
$pie->set_tooltip('#val# of #total#<br>#percent# of 100%');
$pie->set_colours(array('#FF6633', '#EB0000', '#2E00B8', '#2EB800', '#7AFFFF', '#7500EB', '#FF0080', '#85FF0A'));
$pie->set_values($category);
$chart = new open_flash_chart();
#$chart->set_title($title);
$chart->add_element($pie);
$chart->set_bg_colour('#FFFFFF');
$chart->x_axis = null;
echo $chart->toPrettyString();
示例#19
0
function report_chart($data)
{
    // Chart
    //
    // This is the MODEL section:
    //
    include 'open-flash-chart/php-ofc-library/open-flash-chart.php';
    $title = new title("Availability Report ");
    $pie = new pie();
    $pie->set_alpha(0.9);
    $pie->radius(90);
    //$pie->start_angle(100);
    $pie->add_animation(new pie_fade());
    $pie->set_tooltip('#label#: #percent#<br>#val# of #total#<br>');
    $status_colors = array(ok => '#77CC6D', critical => '#FF0000', warning => '#FFD40F', unknown => '#6D86CC', no_data => '#848484');
    $status_name = array(ok => 'Ok', critical => 'Critical', warning => 'Warning', unknown => 'Unknown', no_data => 'No Data');
    $col = array();
    $d = array();
    foreach ($data as $name => $value) {
        if ($value > 0) {
            $d[] = new pie_value($value * 1, "{$status_name[$name]}");
            array_push($col, $status_colors[$name]);
        }
    }
    $pie->set_values($d);
    $pie->set_colours($col);
    $chart = new open_flash_chart();
    $chart->set_title($title);
    $chart->add_element($pie);
    $chart->x_axis = null;
    $chart->set_bg_colour('#202020');
    $title->set_style("{font-size: 16px; font-family: Times New Roman; font-weight: bold; color: #000; text-align: center;}");
    $chart->set_bg_colour('#FFFFFF');
    $chart->set_title($title);
    // This is the VIEW section:
    // Should print this first.
    //
    $heading = "\n        <script type='text/javascript' src='open-flash-chart/js/json/json2.js'></script>\n        <script type='text/javascript' src='open-flash-chart/js/swfobject.js'></script>\n        <script type='text/javascript'>\n        swfobject.embedSWF('open-flash-chart/open-flash-chart.swf', 'my_chart', '300', '300', '9.0.0');\n        </script>\n\n        <script type='text/javascript'>\n\n        function open_flash_chart_data() {\n                return JSON.stringify(data);\n        }\n\n        function findSWF(movieName) {\n                if (navigator.appName.indexOf('Microsoft')!= -1) {\n                        return window[movieName];\n                } else {\n                        return document[movieName];\n                }\n        }\n    \n        var data = " . $chart->toPrettyString() . "\n\n        </script>\n\n\n        <script type=\"text/javascript\">\n \n        OFC = {};\n \n        OFC.jquery = {\n        name: 'jQuery',\n        version: function(src) { return \$('#'+ src)[0].get_version() },\n        rasterize: function (src, dst) { \$('#'+ dst).replaceWith(OFC.jquery.image(src)) },\n        image: function(src) { return \"<img src='data:image/png;base64,\" + \$('#'+src)[0].get_img_binary() + \"' />\"},\n        popup: function(src) {\n        var img_win = window.open('', 'Charts: Export as Image')\n        with(img_win.document) {\n            write('<html><head><title>Charts: Export as Image<\\/title><\\/head><body>' + OFC.jquery.image(src) + '<\\/body><\\/html>') }\n                // stop the 'loading...' message\n                img_win.document.close();\n        }\n        }\n \n        // Using_ an object as namespaces is JS Best Practice. I like the Control.XXX style.\n        //if (!Control) {var Control = {}}\n        //if (typeof(Control == \"undefined\")) {var Control = {}}\n        if (typeof(Control == \"undefined\")) {var Control = {OFC: OFC.jquery}}\n \n \n        // By default, right-clicking on OFC and choosing \"save image locally\" calls this function.\n        // You are free to change the code in OFC and call my wrapper (Control.OFC.your_favorite_save_method)\n        // function save_image() { alert(1); Control.OFC.popup('my_chart') }\n        function save_image() { alert(\"Your image will be displayed in a new window\"); OFC.jquery.popup('my_chart') }\n        </script>\n        <div id='my_chart' style='float:left; margin-left:28px;'></div>\n        ";
    return $heading;
}
 /**
  * Build The Pie Gharph.
  *
  * @param  array  $params  assoc array of name/value pairs          
  *
  * @return object $chart   object of open flash chart.
  * @static
  */
 static function &pieChart(&$params)
 {
     $chart = null;
     if (empty($params)) {
         return $chart;
     }
     $allValues = CRM_Utils_Array::value('values', $params);
     if (!is_array($allValues) || empty($allValues)) {
         return $chart;
     }
     // get the required data.
     $values = array();
     foreach ($allValues as $label => $value) {
         $values[] = new pie_value((double) $value, $label);
     }
     $graphTitle = CRM_Utils_Array::value('legend', $params) ? $params['legend'] : ts('Pie Chart');
     //get the currency.
     require_once 'CRM/Utils/Money.php';
     $config = CRM_Core_Config::singleton();
     $symbol = $config->defaultCurrencySymbol;
     $pie = new pie();
     $pie->radius(100);
     // call user define function to handle on click event.
     if ($onClickFunName = CRM_Utils_Array::value('on_click_fun_name', $params)) {
         $pie->on_click($onClickFunName);
     }
     $pie->set_start_angle(35);
     $pie->add_animation(new pie_fade());
     $pie->add_animation(new pie_bounce(2));
     // set the tooltip.
     $tooltip = CRM_Utils_Array::value('tip', $params, "Amount is {$symbol} #val# of {$symbol} #total# <br>#percent#");
     $pie->set_tooltip($tooltip);
     // set colours.
     $pie->set_colours(self::$_colours);
     $pie->set_values($values);
     //create chart.
     $chart = new open_flash_chart();
     // create chart title obj.
     $title = new title($graphTitle);
     $chart->set_title($title);
     $chart->add_element($pie);
     $chart->x_axis = null;
     return $chart;
 }
示例#21
0
$q .= " ORDER BY ish.status ASC";
$r = tep_db_query($q);
$data = array();
$dataraw = array();
while ($row = tep_db_fetch_array($r)) {
    $dataraw[$row['status']] = $row['status_total'];
}
$statuslist = array('1', '2', '7', '3', '4', '5', '6');
foreach ($statuslist as $status) {
    $text = ($status == '1' ? 'New ' : 'Moved to ') . improvement::getImprovementStatus($status);
    if (isset($dataraw[$status])) {
        $data[] = new pie_value(intval($dataraw[$status]), $text . ' (' . $dataraw[$status] . ')');
    } else {
        $data[] = new pie_value(0, $text . " (0)");
    }
}
$title = new title('MIMS Recent Activities (' . array_sum($dataraw) . ')');
$title->set_style("{font-size:13px;font-weight:bold;margin-top:5px;}");
$pie = new pie();
$pie->set_alpha(0.6);
$pie->set_start_angle(-90);
$pie->add_animation(new pie_fade());
$pie->set_tooltip('#val# of #total#<br>#percent# of 100%');
$pie->set_colours(array('#bababa', '#ababab', '#838383', '#900000', '#ffd200', '#0066CC', '#066303'));
$pie->set_values($data);
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($pie);
$chart->x_axis = null;
echo $chart->toString();
require_once 'confy_close.php';
示例#22
0
<?php

$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
$this->output->set_header("Pragma: public");
$title = new title($title);
$pie = new pie();
$pie->set_alpha(0.6);
$pie->set_start_angle(35);
$pie->add_animation(new pie_fade());
$pie->set_tooltip('#val# of #total#<br>#percent# of 100%');
$pie->set_colours(get_random_colors(count($data)));
$pie_values = array();
foreach ($data as $label => $value) {
    $pie_values[] = new pie_value((double) $value, (string) $label);
}
$pie->set_values($pie_values);
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->set_bg_colour("#f3f3f3");
$chart->add_element($pie);
$chart->x_axis = null;
echo $chart->toPrettyString();
示例#23
0
<?php

include 'include.php';
$this_month = ' -w -c -F "%(account)\\t%(total)\\n" -p "this month" bal ^exp | sed -e \'s/\\$//g\' | sed -e \'s/,//g\' ';
exec("{$ledger} {$this_month}", $output);
foreach ($output as $line) {
    //make into key-value pairs
    $tmp = explode("\t", $line);
    if ($tmp[0] != "Expenses" && $tmp[0] != "" && $tmp[0] != "Expenses:Bills" && $tmp[0] != "Expenses:Food") {
        $datalist[] = new pie_value(1 * $tmp[1], $tmp[0]);
    }
}
$title = new title("This month spending breakdown");
$pie = new pie();
$pie->set_alpha(0.6);
$pie->set_start_angle(35);
$pie->add_animation(new pie_fade());
$pie->set_tooltip('#label#<br>$#val# (#percent#)');
$pie->set_no_labels();
$pie->set_colours(array('#1C9E05', '#FF368D', '#FF33C9', '#FF653F'));
$pie->set_values($datalist);
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($pie);
$chart->set_bg_colour('#FFFFFF');
echo $chart->toPrettyString();
?>

示例#24
0
            case "double":
                $theValue = $theValue != "" ? doubleval($theValue) : "NULL";
                break;
            case "date":
                $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL";
                break;
            case "defined":
                $theValue = $theValue != "" ? $theDefinedValue : $theNotDefinedValue;
                break;
        }
        return $theValue;
    }
}
$title = new title();
$title->set_style("font-size:12px; font-weight:bold;");
$pie = new pie();
$pie->set_alpha(0.6);
$pie->set_start_angle(32);
$pie->add_animation(new pie_fade());
$pie->set_tooltip('#val# ' . $multilingual_project_hour);
$pie->set_colours(array('#99C754', '#54C7C5', '#999999', '#996699', '#009900', '#77C600', '#ff7400', '#FF0000', '#4096ee', '#c79810'));
$projectid = $_GET['recordID'];
mysql_select_db($database_tankdb, $tankdb);
$query_Recordset_sumtotal = sprintf("SELECT \n\t\t\t\t\t\t\tsum(csa_tb_manhour) as sum_hour \n\t\t\t\t\t\t\tFROM tk_task_byday \t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tWHERE csa_tb_backup2 = %s", GetSQLValueString($projectid, "text"));
$Recordset_sumtotal = mysql_query($query_Recordset_sumtotal, $tankdb) or die(mysql_error());
$row_Recordset_sumtotal = mysql_fetch_assoc($Recordset_sumtotal);
$t = $row_Recordset_sumtotal['sum_hour'];
$sql = sprintf("SELECT * , sum(csa_tb_manhour) as summ1 FROM tk_task_byday \t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tinner join tk_task_tpye on tk_task_byday.csa_tb_backup4=tk_task_tpye.id\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tWHERE csa_tb_backup2 = %s GROUP BY csa_tb_backup4 ORDER BY summ1 DESC", GetSQLValueString($projectid, "text"));
$query = mysql_query($sql, $tankdb) or die(mysql_error());
while ($row = mysql_fetch_assoc($query)) {
    $total = $row['summ1'];
示例#25
0
 /**
  * 工作耗时饼猪状图
  *@param $id		传入的项目ID
  *@examlpe 
  */
 public function buglevel($id)
 {
     $Public = A('Index', 'Public');
     $App = A('App', 'Public');
     Vendor('OpenFlash.open-flash-chart');
     //main
     $Report = M('Report_table');
     $id = intval($id);
     $color = array('#99C754', '#54C7C5', '#999999', '#996699', '#009900', '#77C600', '#ff7400', '#FF0000', '#4096ee', '#c79810');
     $level = $App->getJson('yanzhongxing', '/Linkage');
     $info = $Report->field('level,COUNT(id) as num')->where('pid=' . $id)->group('level')->order('level')->select();
     //dump($info);
     $title = new title();
     $title->set_style("font-size:13px; font-weight:bold;");
     $pie = new pie();
     $pie->set_alpha(0.8);
     $pie->start_angle(35);
     $pie->add_animation(new pie_fade());
     $pie->add_animation(new pie_bounce(5));
     $pie->gradient_fill();
     $pie->set_tooltip('数量:#val#条,  占:#percent#');
     $pie->set_colours($color);
     foreach ($info as $k => $t) {
         $obj = new pie_value(intval($t['num']), '');
         $name = $Public->searchArr($level, 'id', $t['level']);
         $obj->set_label($name . ':' . $t['num'] . '条', $color[$k], 12);
         $dis_value[] = $obj;
     }
     //dump($dis_value);
     $pie->set_values($dis_value);
     $chart = new open_flash_chart();
     $chart->set_title($title);
     $chart->add_element($pie);
     $chart->x_axis = null;
     $chart->bg_colour = '#FFFFFF';
     echo $chart->toPrettyString();
 }
示例#26
0
            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;
    default:
        $pie->set_tooltip('#label#<br>$#val# (#percent#)');
        break;
}
示例#27
0
 $pie1->radius(100);
 $pie1->add_animation(new pie_fade());
 $pie1->set_tooltip($toolTip);
 $pie1->set_colours(array('#D544A2', '#9408E0', '#E25374', '#269C16', '#9F0946', '#EC7E64', '#8F4F64', '#0AD5A5', '#F957BD', '#F4C377', '#0CEBC5', '#CCDE8B', '#F7FB8C', '#7CBF0C', '#799756', '#D5FFA2'));
 //Pie 2
 $title2 = new title("Top Melodii");
 $pie2 = new pie();
 $pie2->set_alpha(0.6);
 $pie2->add_animation(new pie_bounce(8));
 //$pie2->radius(100);
 $pie2->add_animation(new pie_fade());
 $pie2->set_tooltip($toolTip);
 $pie2->set_colours(array('#D544A2', '#9408E0', '#E25374', '#269C16', '#9F0946', '#EC7E64', '#8F4F64', '#0AD5A5', '#F957BD', '#F4C377', '#0CEBC5', '#CCDE8B', '#F7FB8C', '#7CBF0C', '#799756', '#D5FFA2'));
 //Pie 3
 $title3 = new title("Top Albume");
 $pie3 = new pie();
 $pie3->set_alpha(0.6);
 $pie3->add_animation(new pie_bounce(8));
 //$pie3->radius(100);
 $pie3->add_animation(new pie_fade());
 $pie3->set_tooltip($toolTipLabel);
 $pie3->set_colours(array('#D544A2', '#9408E0', '#E25374', '#269C16', '#9F0946', '#EC7E64', '#8F4F64', '#0AD5A5', '#F957BD', '#F4C377', '#0CEBC5', '#CCDE8B', '#F7FB8C', '#7CBF0C', '#799756', '#D5FFA2'));
 $pie3->set_no_labels();
 //Pie 1
 foreach ($topArtistArr->result() as $row) {
     $pieArr1[] = new pie_value(intval($row->artistCount), $row->artist);
 }
 //Pie 2
 foreach ($topSongsArr->result() as $row) {
     $pieArr2[] = new pie_value(intval($row->trackIdCount), $row->trackName);
 }