/** * Process the default options to make sure checkbox non-set values are there. * @param array $get * @param array $options */ protected function getDefaultOptions($get, $options = array()) { if (array_key_exists('layers', $get) && is_array($get['layers'])) { foreach ($get['layers'] as $layer => &$data) { if (!array_key_exists('enable', $data)) { $data['enable'] = 'off'; } if (!array_key_exists('style', $data)) { $data['style'] = 'off'; } } } return parent::getDefaultOptions($get, $options); }
/** * returns an array of the default display options. Default options are read and overriddenb * in the following order: * /modules/CustomReports/displays/$display/display_options * /modules/CustomReports/relationships/display_options/$display * /modules/CustomReports/reports/display_options/$display * /modules/CustomReports/reportViews/$view/display_options/$display * Finally any options that have a key in $get are replaced by that value * @param array $get * @param array $options. Default to the empty array. The options that we want to be already set before we start goinng through * @returns array */ protected function getDefaultOptions($get, $options = array()) { //make sure we get these values from the get variables $make_exist = array('flash_width' => 590, 'flash_height' => 350, 'flash_bgcolor' => '#e0e0e0', 'reverseOrder' => false, 'style' => null, 'styles' => array(), 'displayFieldsType' => null, 'displayFieldsTypes' => array(), 'displayFields' => array()); foreach ($make_exist as $key => $val) { if (!array_key_exists($key, $options)) { $options[$key] = $val; } } $defaultOptions = parent::getDefaultOptions($get, $options); $this->defaultOptions = $defaultOptions; $this->findNumericFields(); $this->makeChartStylesSane($defaultOptions); if (count($defaultOptions['styles']) == 0) { //no valid styles. I2CE::raiseError("No Valid Styles For Pie/Chart"); return false; } if (array_key_exists('flash_data', $get)) { if (!$this->ensureValidStyleAndType($defaultOptions)) { I2CE::raiseError("No Valid Style and Type can be chosen For Pie/Chart"); return false; } if (!$this->setupFlashChart($defaultOptions)) { I2CE::raiseError("Could not set up flash chart options"); return false; } } //get rid of limit stuff foreach (array('limit_page', 'limit_per_page', 'limit_offset', 'limit_amount') as $key) { $defaultOptions[$key] = false; } return $defaultOptions; }
/** * returns an array of the default display options. Default options are read and overriddenb * in the following order: * /modules/CustomReports/displays/$display/display_options * /modules/CustomReports/relationships/display_options/$display * /modules/CustomReports/reports/display_options/$display * /modules/CustomReports/reportViews/$view/display_options/$display * Finally any options that have a key in $get are replaced by that value * @param array $get * @param array $options. Default to the empty array. The options that we want to be already set before we start goinng through * @returns array */ protected function getDefaultOptions($get, $options = array()) { //make sure we get these values from the get variables $make_exist = array('reverseOrder' => false, 'displayFieldsType' => null, 'displayFieldsTypes' => array(), 'displayFields' => array(), 'limit_page' => 1, 'limit_per_page' => false, 'limit_offset' => 0, 'limit_amount' => false, 'limit_paginated' => false); foreach ($make_exist as $key => $val) { if (!array_key_exists($key, $options)) { $options[$key] = $val; } } $t_options = array(); if (I2CE::getConfig()->setIfIsSet($t_options, "/modules/CustomReports/displays/Visualization/display_options", true)) { I2CE_Util::merge_recursive($options, $t_options); } $t_options = array(); if ($this->config->setIfIsSet($t_options, "display_options/Visualization", true)) { I2CE_Util::merge_recursive($options, $t_options); } $defaultOptions = parent::getDefaultOptions($get, $options); $this->defaultOptions = $defaultOptions; $this->findNumericFields(); $this->makeVisualizationStylesSane($defaultOptions); if (count($defaultOptions['styles']) == 0) { I2CE::raiseError("No valid styles for Visualization!"); return false; } if (!$this->ensureValidStyleAndType($defaultOptions)) { I2CE::raiseError("No valid style and type can be chosen for Visualization"); return false; } if (!$this->setupVisualization($defaultOptions)) { I2CE::raiseError("Could not set up visualization options!"); return false; } // Currently don't allow saving datasource as default view since Visualization passes this through unset($defaultOptions['save_options_as_default_view']); return $defaultOptions; }
/** * returns an array of the default display options. Default options are read and overriddenb * in the following order: * /modules/CustomReports/displays/$display/display_options * /modules/CustomReports/relationships/display_options/$display * /modules/CustomReports/reports/display_options/$display * /modules/CustomReports/reportViews/$view/display_options/$display * Finally any options that have a key in $get are replaced by that value * @param array $get * @param array $options. Default to the empty array. The options that we want to be already set before we start goinng through * @returns array */ protected function getDefaultOptions($get, $options = array()) { //make sure we get these values from the get variables $make_exist = array('width' => 590, 'height' => 350, 'bgcolor' => '#ffffff', 'reverseOrder' => false, 'style' => null, 'styles' => array(), 'displayFieldsType' => null, 'displayFieldsTypes' => array(), 'displayFields' => array(), 'style' => 'Pie'); foreach ($make_exist as $key => $val) { if (!array_key_exists($key, $options)) { $options[$key] = $val; } } $defaultOptions = parent::getDefaultOptions($get, $options); $this->defaultOptions = $defaultOptions; $this->findNumericFields(); $this->makeVisualizationStylesSane($defaultOptions); if (count($defaultOptions['styles']) == 0) { //no valid styles. I2CE::raiseError("No Valid Styles For Visualization"); return false; } //get rid of limit stuff foreach (array('limit_page', 'limit_per_page', 'limit_offset', 'limit_amount') as $key) { $defaultOptions[$key] = false; } return $defaultOptions; }