<?php/********************************************************************************************
* BlueShoes Framework; This file is part of the php application framework.
* NOTE: This code is stripped (obfuscated). To get the clean documented code goto 
*       www.blueshoes.org and register for the free open source *DEVELOPER* version or 
*       buy the commercial version.
*       
*       In case you've already got the developer version, then this is one of the few 
*       packages/classes that is only available to *PAYING* customers.
*       To get it go to www.blueshoes.org and buy a commercial version.
* 
* @copyright www.blueshoes.org
* @author    Samuel Blume <sam at blueshoes dot org>
* @author    Andrej Arn <andrej at blueshoes dot org>
*/?><?php
define('BS_CHART_VERSION',         '4.5.$Revision: 1.3 $');if (!@$APP) require_once($_SERVER['DOCUMENT_ROOT'] . $GLOBALS['APP']['path']['diffFromDocRootToGlobalConf'] . 'global.conf.php');require_once($APP['path']['core'] . 'html/form/Bs_Form.class.php');require_once($APP['path']['core'] . 'html/form/Bs_FormFieldSelectImage.class.php');require_once($APP['path']['core'] . 'html/form/domapi/Bs_DaFormPageControl.class.php');require_once($APP['path']['core'] . 'html/Bs_HtmlUtil.class.php');require_once($APP['path']['core'] . 'util/Bs_CsvUtil.class.php');if (isSet($APP['path']['jpgraph'])) {$jpGraphPath = $APP['path']['jpgraph'];} else {$jpGraphPath = $APP['path']['lib'] . 'JpGraph/';}
include($jpGraphPath . 'jpgraph.php');include($jpGraphPath . 'jpgraph_line.php');include($jpGraphPath . 'jpgraph_bar.php');include($jpGraphPath . 'jpgraph_scatter.php');include($jpGraphPath . 'jpgraph_pie.php');include($jpGraphPath . 'jpgraph_pie3d.php');class Bs_Chart extends Bs_Object {var $Bs_HtmlUtil;var $_jpGraph;var $_form;var $ID             = '';var $chartName = '';var $chartType = 'bar';var $chartSubtype = 'grouped';var $chartWidth  = 300;var $chartHeight = 200;var $chartTitle = '';var $chartCaptionX = '';var $chartCaptionY = '';var $dataRowIn = 'row';var $firstRowTitle;var $legendInDataWhere = '';var $useManualLegendInstead = FALSE;var $manualLegend = '';var $legendShow;var $legendLocationX;var $legendLocationY;var $legendAlign;var $gridMainX = TRUE;var $gridHelperX = FALSE;var $gridMainY = FALSE;var $gridHelperY = FALSE;var $_data;var $dataCsv;var $_titleData;var $_legendData;function getLegendData() {}
function Bs_Chart() {parent::Bs_Object(); $this->Bs_HtmlUtil =& $GLOBALS['Bs_HtmlUtil'];}
function setData($data) {$this->_data = $data;}
function draw() {if (!isSet($this->_data) && isSet($this->dataCsv)) {$this->prepareData();}
if ($this->chartType == 'pie') {$graph =& new PieGraph($this->chartWidth, $this->chartHeight);} else {$graph =& new Graph($this->chartWidth, $this->chartHeight);}
$graph->SetScale('textlin'); $graph->SetShadow();$graph->img->SetMargin(40,20,20,40);if (!empty($this->chartTitle)) {$graph->title->Set($this->chartTitle);}
if (!empty($this->chartCaptionX)) $graph->xaxis->title->Set($this->chartCaptionX);if (!empty($this->chartCaptionY)) $graph->yaxis->title->Set($this->chartCaptionY);if (is_array($this->_titleData)) {$graph->xaxis->SetTickLabels($this->_titleData);}
$dataLineContainer = array();$i = 0;switch ($this->chartType) {case 'bar':
while (list($k) = each($this->_data)) {$dataLineElement =& new BarPlot($this->_data[$k]);$dataLineContainer[] = &$dataLineElement;$dataLineElement->SetFillColor($this->_getNextColor());unset($dataLineElement);$i++;}
if (isSet($this->chartSubtype) && (substr($this->chartSubtype, 0, 7) == 'stapled')) {$container =& new AccBarPlot($dataLineContainer);} else {$container =& new GroupBarPlot($dataLineContainer);}
$graph->Add($container);unset($container);break;case 'line':
while (list($k) = each($this->_data)) {$dataLineElement =& new LinePlot($this->_data[$k]);$dataLineContainer[] = &$dataLineElement;$dataLineElement->SetColor($this->_getNextColor());$graph->Add($dataLineElement);unset($dataLineElement);$i++;}
break;case 'pie':
$tmpDataArr = array();while (list($k) = each($this->_data)) {$tmpDataArr[] = $this->_data[$k][0];}
if (substr($this->chartSubtype, 0, 2) == '3d') {$dataLineElement =& new PiePlot3d($tmpDataArr);} else {$dataLineElement =& new PiePlot($tmpDataArr);}
if (substr($this->chartSubtype, -8) === 'exploded') {$dataLineElement->ExplodeAll();}
if ($this->legendShow) {$dataLineElement->SetLegends($this->getLegendCaption()); }
$dataLineElement->SetCenter(0.26);$dataLineContainer[] = &$dataLineElement;$graph->Add($dataLineElement);unset($dataLineElement);break;case 'surface':
while (list($k) = each($this->_data)) {$dataLineElement =& new LinePlot($this->_data[$k]);$dataLineContainer[] = &$dataLineElement;$dataLineElement->SetFillColor($this->_getNextColor());unset($dataLineElement);$i++;}
$ap =& new AccLinePlot($dataLineContainer);$graph->Add($ap);break;case 'scatter':
while (list($k) = each($this->_data)) {$dataLineElement =& new ScatterPlot($this->_data[$k]);$dataLineContainer[] = &$dataLineElement;$graph->Add($dataLineElement);unset($dataLineElement);$i++;}
break;}
if ($this->legendShow) {if (isSet($this->legendAlign)) {if ($this->legendAlign == 'hor') {$graph->legend->SetLayout(LEGEND_HOR);} else { $graph->legend->SetLayout(LEGEND_VERT);}
}
if ($this->chartType == 'pie') {} else {$numLines = sizeOf($this->_data);for ($i=0; $i<$numLines; $i++) {$dataLineContainer[$i]->SetLegend($this->getLegendCaption($i +1));}
}
$graph->legend->Pos(0.05, 0.15, $this->legendLocationX, $this->legendLocationY);}
$graph->ygrid->Show($this->gridMainY, $this->gridHelperY);$graph->xgrid->Show($this->gridMainX, $this->gridHelperX);$graph->Stroke();}
function treatForm() {$this->_loadForm();$status = $this->_form->doItYourself();if ($status === TRUE) {$this->_workOnSubmittedData();return TRUE;}
return $status;}
function _workOnSubmittedData() {$data = $this->_form->getValuesArray(FALSE, 'valueInternal');$this->chartName       = $_POST['chartName'];$this->chartType       = $_POST['chartType'];switch ($this->chartType) {case 'bar':
$this->chartSubtype    = $_POST['chartSubtypeBar'];break;case 'line':
$this->chartSubtype    = $_POST['chartSubtypeLine'];break;case 'pie':
$this->chartSubtype    = $_POST['chartSubtypePie'];break;case 'surface':
$this->chartSubtype    = $_POST['chartSubtypeSurface'];break;case 'scatter':
$this->chartSubtype    = $_POST['chartSubtypeScatter'];break;}
$this->chartWidth             = $_POST['chartWidth'];$this->chartHeight            = $_POST['chartHeight'];$this->chartTitle             = $_POST['chartTitle'];$this->chartCaptionX          = $_POST['chartCaptionX'];$this->chartCaptionY          = $_POST['chartCaptionY'];$this->dataRowIn              = $_POST['dataRowIn'];$this->firstRowTitle          = $_POST['firstRowTitle'];$this->legendInDataWhere      = $_POST['legendInDataWhere'];$this->manualLegend           = $_POST['manualLegend'];$this->useManualLegendInstead = @$_POST['useManualLegendInstead'];$this->legendShow             = @$_POST['legendShow'];$this->legendLocationX        = $_POST['legendLocationX'];$this->legendLocationY        = $_POST['legendLocationY'];$this->legendAlign            = $_POST['legendAlign'];$this->gridMainX              = @$_POST['gridMainX'];$this->gridHelperX            = @$_POST['gridHelperX'];$this->gridMainY              = @$_POST['gridMainY'];$this->gridHelperY            = @$_POST['gridHelperY'];$this->dataCsv                = $_POST['dataDirect']; $this->prepareData();}
function prepareData() {$Bs_CsvUtil =& new Bs_CsvUtil();$this->_data = $Bs_CsvUtil->csvStringToArray($this->dataCsv, $separator=';', $trim='both', $removeHeader=FALSE);while (list($k) = each($this->_data)) {if ( (empty($this->_data[$k])) || ((sizeOf($this->_data[$k]) == 1) && empty($this->_data[$k][0])) ) {unset($this->_data[$k]);}
}
reset($this->_data);if ($this->isFirstRowTitle()) {$this->_titleData = array_shift($this->_data);}
if (!empty($this->legendInDataWhere)) {if ($this->firstRowTitle) {array_shift($this->_titleData);}
if (substr($this->legendInDataWhere, 0, 3) === 'col') {while (list($k) = each($this->_data)) {if ($this->legendInDataWhere === 'collast') {$this->_legendData[] = array_pop($this->_data[$k]);} else { $this->_legendData[] = array_shift($this->_data[$k]);}
}
reset($this->_data); } elseif ($this->legendInDataWhere == 'rowfirst') {$this->_legendData = array_shift($this->_data);} elseif ($this->legendInDataWhere == 'rowlast') {$this->_legendData = array_pop($this->_data);}
}
return TRUE;}
function isFirstRowTitle() {if (isSet($this->firstRowTitle)) {return (bool)$this->firstRowTitle;} else {return FALSE;}
}
function isFirstColLegend() {if (isSet($this->firstColLegend)) {return (bool)$this->firstColLegend;} else {return FALSE;}
}
function getLegendCaption($row=null) {$legendData = ($this->useManualLegendInstead) ? explode(';', $this->manualLegend) : $this->_legendData;if (is_null($row)) {if (is_array($legendData)) {return $legendData;} else {return array();}
}
if (is_array($legendData)) {if (isSet($legendData[$row -1])) {return $legendData[$row -1];}
}
return 'Plot ' . $row;}
function _getNextColor() {static $rgb_table;if (!is_array($rgb_table)) {$dummy = 'dummy';$dummy2 =& new RGB($dummy);$rgb_table = $dummy2->rgb_table;}
next($rgb_table);return key($rgb_table);}
function _loadForm() {$form =& new Bs_Form();$form->serializeType        = 'php';$form->internalName         = "chartWizard";$form->name                 = "chartWizard";$form->mustFieldsVisualMode = 'starRight';$form->useAccessKeys        = TRUE;$form->useJsFile            = TRUE;$form->jumpToFirstError     = TRUE;$form->buttons              = array('add' => array('next' => array('en'=>'Next',     'de'=>'Weiter')));$form->onEnter              = 'tab';$form->language             = 'en';$form->mode                 = 'add';$form->level                = 1; $form->advancedStyles       = array(
'captionMust'      => '', 
'captionMustOkay'  => '', 
'captionMustWrong' => 'formError', 
'captionMay'       => '', 
'captionMayOkay'   => '', 
'captionMayWrong'  => 'formError', 
'fieldMust'        => '', 
'fieldMustOkay'    => '', 
'fieldMustWrong'   => '', 
'fieldMay'         => '', 
'fieldMayOkay'     => '', 
'fieldMayWrong'    => ''
);$containerLevelOne =& new Bs_FormContainer();$containerLevelOne->name            = "levelOne";$containerLevelOne->level           = 1;$containerLevelOne->pseudoContainer = TRUE;$form->elementContainer->addElement($containerLevelOne);$containerStart                  =& new Bs_FormContainer();$containerStart->name            = "start";$containerStart->pseudoContainer = TRUE;$pControlOne =& new Bs_DaFormPageControl();$pControlOne->name             = "start";$pControlOne->domApiDoRollover = FALSE;$pControlOne->domApiWidth      = 600;$pControlOne->domApiHeight     = 500;$containerLevelOne->addElement($pControlOne); $containerChartType                  =& new Bs_FormContainer();$containerChartType->name            = "chartTypeContainer";$containerChartType->pseudoContainer = TRUE;$containerChartType->useTemplate     = TRUE;$containerChartType->templatePath    = $GLOBALS['APP']['path']['bsRoot'] . 'applications/ChartWizard/'; $pControlOne->setTab('type',     'Type', $containerChartType);$form->addOnLoadCode("
var chartType = '" . @$this->chartType . "';if (chartType == '') chartType = 'bar';var elm = document.getElementById('chartSubtype_' + chartType + 'Div');if (elm != null) elm.style.display = 'block';");$element =& new Bs_FormFieldSelect();$element->name             = 'chartType';$element->caption          = array('en'=>'Chart Type', 'de'=>'Diagrammtyp');$element->editability      = 'always';$element->minLength        = 1;$element->maxLength        = 10;$element->bsDataType       = 'string';$element->valueDefault     = @$this->chartType;$element->optionsType      = 'hard';$element->optionsHard        = array(
'en'=>array('bar'=>'Bar',   'line'=>'Line',  'pie'=>'Pie'),     'de'=>array('bar'=>'Säule', 'line'=>'Linie', 'pie'=>'Kuchen'),  );$element->size               = 10;$element->must               = TRUE;$element->events['onChange'] = "chartTypeOnChange();";$containerChartType->addElement($element);unset($element);$element =& new Bs_FormFieldSelectImage();$element->name             = 'chartSubtypeBar';$element->caption          = array('en'=>'Chart Subype', 'de'=>'Diagramm-Untertyp');$element->editability      = 'always';$element->minLength        = 1;$element->maxLength        = 20;$element->bsDataType       = 'string';$element->valueDefault     = @$this->chartSubtype; $element->optionsType      = 'hard';$element->optionsHard        = array('grouped'=>'bar_grouped.gif', 'stapled'=>'bar_stapled.gif');$element->size               = 10;$element->must               = FALSE;$element->imagePath          = '/_bsImages/applications/chartwizard/';$element->imageWidth         = 60;$element->imageHeight        = 50;$element->width              = 180;$element->height             = 150;$element->bgColor            = 'white';$containerChartType->addElement($element);unset($element);$element =& new Bs_FormFieldSelectImage();$element->name             = 'chartSubtypeLine';$element->caption          = array('en'=>'Chart Subype', 'de'=>'Diagramm-Untertyp');$element->editability      = 'always';$element->minLength        = 1;$element->maxLength        = 20;$element->bsDataType       = 'string';$element->valueDefault     = @$this->chartSubtype; $element->optionsType      = 'hard';$element->optionsHard        = array('grouped'=>'line_grouped.gif', 'stapled'=>'line_stapled.gif');$element->size               = 10;$element->must               = FALSE;$element->imagePath          = '/_bsImages/applications/chartwizard/';$element->imageWidth         = 60;$element->imageHeight        = 50;$element->width              = 180;$element->height             = 150;$element->bgColor            = 'white';$containerChartType->addElement($element);unset($element);$element =& new Bs_FormFieldSelectImage();$element->name             = 'chartSubtypePie';$element->caption          = array('en'=>'Chart Subype', 'de'=>'Diagramm-Untertyp');$element->editability      = 'always';$element->minLength        = 1;$element->maxLength        = 20;$element->bsDataType       = 'string';$element->valueDefault     = @$this->chartSubtype; $element->optionsType      = 'hard';$element->optionsHard        = array('2d_together'=>'pie2d_together.gif', '2d_exploded'=>'pie2d_exploded.gif', '3d_together'=>'pie3d_together.gif', '3d_exploded'=>'pie3d_exploded.gif');$element->size               = 10;$element->must               = FALSE;$element->imagePath          = '/_bsImages/applications/chartwizard/';$element->imageWidth         = 60;$element->imageHeight        = 50;$element->width              = 180;$element->height             = 150;$element->bgColor            = 'white';$containerChartType->addElement($element);unset($element);$element =& new Bs_FormFieldSelectImage();$element->name             = 'chartSubtypeSurface';$element->caption          = array('en'=>'Chart Subype', 'de'=>'Diagramm-Untertyp');$element->editability      = 'always';$element->minLength        = 1;$element->maxLength        = 20;$element->bsDataType       = 'string';$element->valueDefault     = @$this->chartSubtype; $element->optionsType      = 'hard';$element->optionsHard        = array('grouped'=>'surface_grouped.gif', 'stapled'=>'surface_stapled.gif');$element->size               = 10;$element->must               = FALSE;$element->imagePath          = '/_bsImages/applications/chartwizard/';$element->imageWidth         = 60;$element->imageHeight        = 50;$element->width              = 180;$element->height             = 150;$element->bgColor            = 'white';$containerChartType->addElement($element);unset($element);$element =& new Bs_FormFieldSelectImage();$element->name             = 'chartSubtypeScatter';$element->caption          = array('en'=>'Chart Subype', 'de'=>'Diagramm-Untertyp');$element->editability      = 'always';$element->minLength        = 1;$element->maxLength        = 20;$element->bsDataType       = 'string';$element->optionsType      = 'hard';$element->size               = 10;$element->must               = FALSE;$element->imagePath          = '/_bsImages/applications/chartwizard/';$element->imageWidth         = 60;$element->imageHeight        = 50;$element->width              = 180;$element->height             = 150;$element->bgColor            = 'white';$containerChartType->addElement($element);unset($element);$containerChartSize                  =& new Bs_FormContainer();$containerChartSize->name            = "chartSizeContainer";$containerChartSize->pseudoContainer = TRUE;$pControlOne->setTab('size',  array('en'=>'Size', 'de'=>'Grösse'), $containerChartSize);$element =& new Bs_FormFieldText();$element->name             = 'chartWidth';$element->caption          = array(
'en'=>'Width', 
'de'=>'Breite', 
);$element->editability      = 'always';$element->size             = 5;$element->minLength        = 2;$element->maxLength        = 4;$element->bsDataType       = 'number';$element->bsDataInfo       = '20|2000';$element->valueDefault     = @$this->chartWidth;$element->must             = TRUE;$element->trim             = 'both';$element->elementStringFormat = "%s Pixel";$containerChartSize->addElement($element);unset($element);$element =& new Bs_FormFieldText();$element->name             = 'chartHeight';$element->caption          = array(
'en'=>'Height', 
'de'=>'Höhe', 
);$element->editability      = 'always';$element->size             = 5;$element->minLength        = 2;$element->maxLength        = 4;$element->bsDataType       = 'number';$element->bsDataInfo       = '20|2000';$element->valueDefault     = @$this->chartHeight;$element->must             = TRUE;$element->trim             = 'both';$element->elementStringFormat = "%s Pixel";$containerChartSize->addElement($element);unset($element);$containerLevelTwo =& new Bs_FormContainer();$containerLevelTwo->name            = "levelTwo";$containerLevelTwo->level           = 2;$containerLevelTwo->pseudoContainer = TRUE;$containerLevelTwo->mayToggle       = FALSE;$containerLevelTwo->useTemplate     = FALSE;$form->elementContainer->addElement($containerLevelTwo);$containerDataSpreadSheet =& new Bs_FormContainer();$containerDataSpreadSheet->name            = "containerDataSpreadSheet";$containerDataSpreadSheet->pseudoContainer = TRUE;$containerDataSpreadSheet->useTemplate     = TRUE;$containerDataSpreadSheet->templatePath    = $GLOBALS['APP']['path']['bsRoot'] . 'applications/ChartWizard/'; $containerDataCsv                  =& new Bs_FormContainer();$containerDataCsv->name            = "containerDataCsv";$containerDataCsv->pseudoContainer = TRUE;$containerDataCsv->useTemplate     = TRUE;$containerDataCsv->templatePath    = $GLOBALS['APP']['path']['bsRoot'] . 'applications/ChartWizard/'; $containerDataDb                  =& new Bs_FormContainer();$containerDataDb->name            = "containerDataDb";$containerDataDb->pseudoContainer = TRUE;$containerDataDb->useTemplate     = TRUE;$containerDataDb->templatePath    = $GLOBALS['APP']['path']['bsRoot'] . 'applications/ChartWizard/'; $pControlTwo =& new Bs_DaFormPageControl();$pControlTwo->name             = "data";$pControlTwo->domApiDoRollover = FALSE;$pControlTwo->domApiWidth      = 600;$pControlTwo->domApiHeight     = 500;$containerLevelTwo->addElement($pControlTwo);$pControlTwo->setTab('spreadSheet', 'SpreadSheet',         $containerDataSpreadSheet);$pControlTwo->setTab('csv',         'CSV',                 $containerDataCsv);$pControlTwo->setTab('db',          'Database',            $containerDataDb);$Bs_CsvUtil =& new Bs_CsvUtil();$dataCsv = $Bs_CsvUtil->csvStringToArray($this->dataCsv, $separator=';', $trim='both', $removeHeader=FALSE);$element =& new Bs_FormFieldSpreadsheet();$element->name          = 'dataDirect'; $element->caption       = array(
'en'=>'', 
);$element->editability   = 'always';$element->bsDataType    = 'text';$element->bsDataInfo    = 0;$element->valueDefault  = $dataCsv;$element->valueDefaultType  = 'array';$element->mayUseFormat  = FALSE;$element->mayUseAlign   = FALSE;$element->mayUseWysiwyg = FALSE;$element->returnType    = "csv";$containerDataSpreadSheet->addElement($element);unset($element);$element =& new Bs_FormFieldRadio();$element->name             = 'dataFrom';$element->caption          = array('en'=>'Data from', 'de'=>'Daten von');$element->editability      = 'always';$element->minLength        = 3;$element->maxLength        = 3;$element->bsDataType       = 'string';$element->valueDefault     = 'ss';$element->valueDefaultType = 'text';$element->optionsHard      = array(
'en'=>array('ss'=>'SpreadSheet',   'csv'=>'CSV',  'db'=>'Database'), 
'de'=>array('ss'=>'SpreadSheet',   'csv'=>'CSV',  'db'=>'Datenbank'), 
);$element->must             = TRUE;$containerDataCsv->addElement($element);unset($element);$element =& new Bs_FormFieldTextarea();$element->name             = 'dataCsv';$element->caption          = array('en'=>'Data CSV');$element->editability      = 'always';$element->minLength        = 0;$element->maxLength        = 65535;$element->rows             = 14;$element->bsDataType       = 'blob';$element->valueDefault     = $this->dataCsv;$containerDataCsv->addElement($element);unset($element);$element =& new Bs_FormFieldText();$element->name             = 'dataDbSqlQuery';$element->caption          = array(
'en'=>'SQL Query', 
'de'=>'SQL Abfrage', 
);$element->editability      = 'always';$element->size             = 40;$element->minLength        = 5;$element->maxLength        = 500;$element->bsDataType       = 'text';$element->bsDataInfo       = 1;$element->valueDefault     = 'SELECT * FROM TABLE'; $element->must             = FALSE;$element->trim             = 'both';$containerDataDb->addElement($element);unset($element);$containerLevelThree =& new Bs_FormContainer();$containerLevelThree->name            = "levelThree";$containerLevelThree->level           = 3;$containerLevelThree->pseudoContainer = TRUE;$containerLevelThree->mayToggle       = FALSE;$containerLevelThree->useTemplate     = FALSE;$form->elementContainer->addElement($containerLevelThree);$containerDataRegion                 =& new Bs_FormContainer();$containerDataRegion->name            = "dataRegion";$containerDataRegion->pseudoContainer = TRUE;$pControlThree =& new Bs_DaFormPageControl();$pControlThree->name             = "region";$pControlThree->domApiDoRollover = FALSE;$pControlThree->domApiWidth      = 600;$pControlThree->domApiHeight     = 500;$containerLevelThree->addElement($pControlThree);$pControlThree->setTab('dataStructure',    array('en'=>'data structure', 'de'=>'Datenstruktur'), $containerDataRegion);$containerWhereData =& new Bs_FormContainer();$containerWhereData->name            = "whereData";$containerWhereData->caption         = array('en'=>"How is the data arranged?", 'de'>'Wie sind die Daten angeordnet?');$containerDataRegion->addElement($containerWhereData);$element =& new Bs_FormText;$element->name             = 'dataRowInText';$element->text             = array(
'en'=>'This can be used to virtually flip the data.', 
'de'=>'Dies kann benutzt werden, um die Daten virtuell zu flippen.', 
);$element->editability      = 'always';$element->minLength        = 3;$element->maxLength        = 3;$element->bsDataType       = 'string';$element->valueDefault     = ($this->dataRowIn === 'col') ? 'col' : 'row';$element->valueDefaultType = 'text';$element->optionsHard      = array(
'en'=>array('row'=>'rows (horizontal)',    'col'=>'columns (vertical)'), 
'de'=>array('row'=>'Zeilen (horizontal)',  'col'=>'Spalten (vertikal)'), 
);$element->must             = TRUE;$containerWhereData->addElement($element);unset($element);$element =& new Bs_FormFieldRadio();$element->name             = 'dataRowIn';$element->caption          = array('en'=>'Rows are in', 'de'=>'Reihen sind in');$element->editability      = 'always';$element->minLength        = 3;$element->maxLength        = 3;$element->bsDataType       = 'string';$element->valueDefault     = ($this->dataRowIn === 'col') ? 'col' : 'row';$element->valueDefaultType = 'text';$element->optionsHard      = array(
'en'=>array('row'=>'rows (horizontal)',    'col'=>'columns (vertical)'), 
'de'=>array('row'=>'Zeilen (horizontal)',  'col'=>'Spalten (vertikal)'), 
);$element->must             = TRUE;$containerWhereData->addElement($element);unset($element);$containerTitleInData =& new Bs_FormContainer();$containerTitleInData->name            = "titleInData";$containerTitleInData->caption         = array('en'=>"Are there titles in the data?", 'de'>'Beinhalten die Daten Titel');$containerDataRegion->addElement($containerTitleInData);$element =& new Bs_FormFieldCheckbox();$element->name             = 'firstRowTitle';$element->caption          = array('en'=>'First row', 'de'=>'Erste Zeile');$element->text             = array('en'=>'the first row is a title row', 'de'=>'die erste Zeile ist eine Titelzeile');$element->editability      = 'always';$element->bsDataType       = 'boolean';$element->valueDefault     = $this->firstRowTitle;$containerTitleInData->addElement($element);unset($element);$containerLegendInData =& new Bs_FormContainer();$containerLegendInData->name            = "legendInData";$containerLegendInData->caption         = array('en'=>"Is there legend data in the data?", 'de'>'Beinhalten die Daten Legenden-Daten?');$containerDataRegion->addElement($containerLegendInData);$element =& new Bs_FormFieldSelect();$element->name             = 'legendInDataWhere'; $element->caption          = array('en'=>'Legend in data', 'de'=>'Legende in den Daten');$element->optionsType      = 'array';$element->optionsHard      = array(
'en' => array(''=>'no', 'colfirst'=>'a legend is in the first column', 'collast'=>'a legend is in the last column', 'rowfirst'=>'a legend is in the first row', 'rowlast'=>'a legend is in the last row'), 
'de' => array(''=>'no', 'colfirst'=>'a legend is in the first column', 'collast'=>'a legend is in the last column', 'rowfirst'=>'a legend is in the first row', 'rowlast'=>'a legend is in the last row'), 
);$element->text             = array('en'=>'the first col is a legend column', 'de'=>'die erste Spalte ist für die Legende');$element->editability      = 'always';$element->bsDataType       = 'boolean';$element->valueDefault     = $this->legendInDataWhere;$containerLegendInData->addElement($element);unset($element);$containerLevelFour =& new Bs_FormContainer();$containerLevelFour->name            = "levelFour";$containerLevelFour->level           = 4;$containerLevelFour->pseudoContainer = TRUE;$form->elementContainer->addElement($containerLevelFour);$containerTitle                 =& new Bs_FormContainer();$containerTitle->name            = "chartTitleContainer";$containerTitle->pseudoContainer = TRUE;$pControlFour =& new Bs_DaFormPageControl();$pControlFour->name             = "pageControlTitle";$pControlFour->domApiDoRollover = FALSE;$pControlFour->domApiWidth      = 600;$pControlFour->domApiHeight     = 500;$containerLevelFour->addElement($pControlFour);$pControlFour->setTab('title',     array('en'=>'Title', 'de'=>'Titel'), $containerTitle);$element =& new Bs_FormFieldText();$element->name             = 'chartTitle';$element->caption          = array(
'en'=>'Chart title', 
'de'=>'Diagrammtitel', 
);$element->editability      = 'always';$element->size             = 40;$element->minLength        = 0;$element->maxLength        = 80;$element->bsDataType       = 'text';$element->bsDataInfo       = 1;$element->valueDefault     = $this->chartTitle;$element->must             = FALSE;$element->trim             = 'both';$containerTitle->addElement($element);unset($element);$element =& new Bs_FormFieldText();$element->name             = 'chartCaptionX';$element->caption          = array(
'en'=>'Caption X', 
'de'=>'Rubrikenachse X', 
);$element->editability      = 'always';$element->size             = 40;$element->minLength        = 0;$element->maxLength        = 80;$element->bsDataType       = 'text';$element->bsDataInfo       = 1;$element->valueDefault     = $this->chartCaptionX;$element->must             = FALSE;$element->trim             = 'both';$containerTitle->addElement($element);unset($element);$element =& new Bs_FormFieldText();$element->name             = 'chartCaptionY';$element->caption          = array(
'en'=>'Caption Y', 
'de'=>'Rubrikenachse Y', 
);$element->editability      = 'always';$element->size             = 40;$element->minLength        = 0;$element->maxLength        = 80;$element->bsDataType       = 'text';$element->bsDataInfo       = 1;$element->valueDefault     = $this->chartCaptionY;$element->must             = FALSE;$element->trim             = 'both';$containerTitle->addElement($element);unset($element);$containerLegend                 =& new Bs_FormContainer();$containerLegend->name            = "containerLegend";$containerLegend->pseudoContainer = TRUE;$pControlFour->setTab('legend',     array('en'=>'Legend', 'de'=>'Legende'), $containerLegend);$containerLegend2 =& new Bs_FormContainer();$containerLegend2->name                 = "containerLegend2";$containerLegend2->level                = 5;$containerLegend2->pseudoContainer      = FALSE;$containerLegend2->useCheckboxAsCaption = 'legendShow';$containerLegend->addElement($containerLegend2);$element =& new Bs_FormFieldCheckbox();$element->name             = 'legendShow';$element->caption          = array('en'=>'Show Legend', 'de'=>'Legende anzeigen');$element->editability      = 'always';$element->minLength        = 0;$element->maxLength        = 1;$element->bsDataType       = 'boolean';$element->must             = FALSE;$element->valueDefault     = $this->legendShow;$containerLegend2->addElement($element);unset($element);$element =& new Bs_FormFieldCheckbox();$element->name             = 'useManualLegendInstead';$element->caption          = array('en'=>'Use manual legend', 'de'=>'Benutze manuelle Legende');$element->text             = array('en'=>'even if there is a legend in the data, use this one instead:', 'de'=>'selbst wenn die Daten eine Legende enthalten, benutze dies:');$element->editability      = 'always';$element->bsDataType       = 'boolean';$element->valueDefault     = $this->useManualLegendInstead;$containerLegend2->addElement($element);unset($element);$element =& new Bs_FormFieldText();$element->name                = 'manualLegend';$element->caption             = array('en'=>'Manual legend', 'de'=>'Manuelle Legende');$element->size                = 60;$element->maxLength           = 1000;$element->editability         = 'always';$element->bsDataType          = 'text';$element->valueDefault        = $this->manualLegend;$element->elementStringFormat = array(
'en'=>"%s<br>separate fields by semicolon ;", 
'de'=>"%s<br>Felder mit Strichkomma ; trennen", 
);$element->mustIf = array(
array('operator'=>'|', 'field'=>'legendInDataWhere', 'compare'=>'=', 'value'=>''), 
array('operator'=>'|', 'field'=>'useManualLegendInstead'), 
);$containerLegend2->addElement($element);unset($element);$containerLegendLocation =& new Bs_FormContainer();$containerLegendLocation->name            = "containerLegendLocation";$containerLegendLocation->caption         = array('en'=>'Alignment', 'de'=>'Ausrichtung');$containerLegendLocation->useTemplate     = TRUE;$containerLegendLocation->templatePath    = $GLOBALS['APP']['path']['bsRoot'] . 'applications/ChartWizard/';$containerLegend2->addElement($containerLegendLocation);$containerLegendLocationInner =& new Bs_FormContainer();$containerLegendLocationInner->name            = "containerLegendLocationInner";$containerLegendLocationInner->pseudoContainer = TRUE;$containerLegendLocation->addElement($containerLegendLocationInner);$element =& new Bs_FormFieldRadio();$element->name             = 'legendLocationX';$element->caption          = array(
'en'=>'Location X', 
'de'=>'Plazierung X', 
);$element->optionsHard      = array('en'=>array('left'=>'left',      'center'=>'center',    'right'=>'right'), 
'de'=>array('left'=>'links',     'center'=>'mitte',     'right'=>'rechts'), 
);$element->valueDefault     = $this->legendLocationX; $element->valueDefaultType = 'text';$element->editability      = 'always';$element->minLength        = 1;$element->maxLength        = 10;$element->bsDataType       = 'text';$element->bsDataInfo       = 1;$element->must             = FALSE;$element->mustIf           = array(array('field'=>'legendShow'));$element->trim             = 'none';$element->events['onClick'] = "setLegendLocationX(this);";$containerLegendLocationInner->addElement($element);unset($element);$element =& new Bs_FormFieldRadio();$element->name             = 'legendLocationY';$element->caption          = array(
'en'=>'Location Y', 
'de'=>'Plazierung Y', 
);$element->optionsHard      = array('en'=>array('top'=>'top',      'center'=>'center', 'bottom'=>'bottom'), 
'de'=>array('top'=>'oben',     'center'=>'mitte',  'bottom'=>'unten'), 
);$element->valueDefault     = $this->legendLocationY; $element->valueDefaultType = 'text';$element->editability      = 'always';$element->minLength        = 1;$element->maxLength        = 10;$element->bsDataType       = 'text';$element->bsDataInfo       = 1;$element->must             = FALSE;$element->mustIf           = array(array('field'=>'legendShow'));$element->trim             = 'none';$element->events['onClick'] = "setLegendLocationY(this);";$containerLegendLocationInner->addElement($element);unset($element);$element =& new Bs_FormFieldRadio();$element->name             = 'legendAlign';$element->caption          = array(
'en'=>'Alignment', 
'de'=>'Ausrichtung', 
);$element->optionsHard      = array('en'=>array('hor'=>'horizontal',     'vert'=>'vertical'), 
'de'=>array('hor'=>'horizontal',     'vert'=>'vertikal'), 
);$element->valueDefault     = $this->legendAlign; $element->valueDefaultType = 'text';$element->editability      = 'always';$element->minLength        = 1;$element->maxLength        = 10;$element->bsDataType       = 'text';$element->bsDataInfo       = 1;$element->must             = FALSE;$element->mustIf           = array(array('field'=>'legendShow'));$element->trim             = 'none';$element->events['onClick'] = "setLegendAlignment(this);";$containerLegendLocationInner->addElement($element);unset($element);$form->addOnLoadCode("
legendAlignment = '{$this->legendAlign}';legendLocationX  = '{$this->legendLocationX}';legendLocationY  = '{$this->legendLocationY}';try { updateLegendOnLoad(); } catch (e) {};");$containerGrid                 =& new Bs_FormContainer();$containerGrid->name            = "containerGrid";$containerGrid->pseudoContainer = TRUE;$pControlFour->setTab('grid',     array('en'=>'Grid lines', 'de'=>'Gitternetzlinien'), $containerGrid);$containerGridOuter                 =& new Bs_FormContainer();$containerGridOuter->name            = "containerGridOuter";$containerGridOuter->caption         = array('en'=>'Grid lines', 'de'=>'Gitternetzlinien');$containerGridOuter->pseudoContainer = FALSE;$containerGridOuter->useTemplate     = TRUE;$containerGridOuter->templatePath    = $GLOBALS['APP']['path']['bsRoot'] . 'applications/ChartWizard/';$containerGrid->addElement($containerGridOuter);$containerGridInner                 =& new Bs_FormContainer();$containerGridInner->name            = "containerGridInner";$containerGridInner->pseudoContainer = TRUE;$containerGridOuter->addElement($containerGridInner);$element =& new Bs_FormText();$element->name             = 'containerGridInnerText';$element->text             = array(
'en'=>'Not all chart types use grids. Bar and line charts do, pie charts don\'t.', 
'de'=>'Nicht alle Diagramm-Typen verwenden Gitternetzlinien. Balken- und Liniendiagramme tun es, Kreisdiagramme nicht.'
);$containerGridInner->addElement($element);unset($element);$element =& new Bs_FormFieldCheckbox();$element->name             = 'gridMainX';$element->caption          = array('en'=>'X-Axis', 'de'=>'Rubrikenachse (X)');$element->text             = array('en'=>'Main Grid', 'de'=>'Hauptgitternetz');$element->editability      = 'always';$element->minLength        = 0;$element->maxLength        = 1;$element->bsDataType       = 'boolean';$element->must             = FALSE;$element->valueDefault     = $this->gridMainX;$element->events['onClick']  = "chartWizard_setGrid('x', 'main', this.checked);";$containerGridInner->addElement($element);unset($element);$element =& new Bs_FormFieldCheckbox();$element->name             = 'gridHelperX';$element->text             = array('en'=>'Helper Grid', 'de'=>'Hilfsgitternetz');$element->editability      = 'always';$element->minLength        = 0;$element->maxLength        = 1;$element->bsDataType       = 'boolean';$element->must             = FALSE;$element->valueDefault     = $this->gridHelperX;$element->events['onClick'] = "chartWizard_setGrid('x', 'helper', this.checked);";$containerGridInner->addElement($element);unset($element);$element =& new Bs_FormFieldCheckbox();$element->name             = 'gridMainY';$element->caption          = array('en'=>'Y-Axis', 'de'=>'Grössenachse (Y)');$element->text             = array('en'=>'Main Grid', 'de'=>'Hauptgitternetz');$element->editability      = 'always';$element->minLength        = 0;$element->maxLength        = 1;$element->bsDataType       = 'boolean';$element->valueDefault     = $this->gridMainY; $element->must             = FALSE;$element->events['onClick'] = "chartWizard_setGrid('y', 'main', this.checked);";$containerGridInner->addElement($element);unset($element);$element =& new Bs_FormFieldCheckbox();$element->name             = 'gridHelperY';$element->text             = array('en'=>'Helper Grid', 'de'=>'Hilfsgitternetz');$element->editability      = 'always';$element->minLength        = 0;$element->maxLength        = 1;$element->bsDataType       = 'boolean';$element->valueDefault     = $this->gridHelperY;$element->must             = FALSE;$element->events['onClick'] = "chartWizard_setGrid('y', 'helper', this.checked);";$containerGridInner->addElement($element);unset($element);$form->addOnLoadCode("
gridMainX   = " . boolToString($this->gridMainX)   . ";gridHelperX = " . boolToString($this->gridHelperX) . ";gridMainY   = " . boolToString($this->gridMainY)   . ";gridHelperY = " . boolToString($this->gridHelperY) . ";try { chartWizard_updateGridOnLoad(); } catch (e) {};");$this->_form = &$form;}
function bs_sop_getHints($sopAgent) {static $perisit_hints = array(
'table'   => array('name'=>'bschart', 'create'=>TRUE),
'debug'   => array('checkHintSyntax'=>TRUE, 'checkClassVars'=>FALSE),
'primary' => array('ID' => array('name'=>'ID', 'type'=>'auto_increment')),
'fields'  => array(
'chartName'              => array('metaType'=>'text',    'size'=>100),
'chartType'              => array('metaType'=>'text',    'size'=>10),
'chartSubtype'           => array('metaType'=>'string',  'size'=>20),
'chartWidth'             => array('metaType'=>'integer'),
'chartHeight'            => array('metaType'=>'integer'),
'chartTitle'             => array('metaType'=>'string',  'size'=>255),
'chartCaptionX'          => array('metaType'=>'string',  'size'=>255),
'chartCaptionY'          => array('metaType'=>'string',  'size'=>255),
'dataRowIn'              => array('metaType'=>'string',  'size'=>10),
'firstRowTitle'          => array('metaType'=>'boolean'),
'legendInDataWhere'      => array('metaType'=>'string',  'size'=>10),
'manualLegend'           => array('metaType'=>'blob',    'size'=>1000),
'useManualLegendInstead' => array('metaType'=>'boolean'),
'legendShow'             => array('metaType'=>'boolean'),
'legendLocationX'        => array('metaType'=>'string',  'size'=>20),
'legendLocationY'        => array('metaType'=>'string',  'size'=>20),
'legendAlign'            => array('metaType'=>'string',  'size'=>20),
'gridMainX'              => array('metaType'=>'boolean'),
'gridHelperX'            => array('metaType'=>'boolean'),
'gridMainY'              => array('metaType'=>'boolean'),
'gridHelperY'            => array('metaType'=>'boolean'),
'dataCsv'                => array('metaType'=>'blob',    'size'=>10000),
),
);return $perisit_hints;}
}
?>