"Fossies" - the Fresh Open Source Software Archive

Member "Open-Web-Analytics-1.7.0/modules/base/report.php" (16 Sep 2020, 9163 Bytes) of package /linux/www/Open-Web-Analytics-1.7.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "report.php" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.6.9_vs_1.7.0.

    1 <?php
    2 
    3 //
    4 // Open Web Analytics - An Open Source Web Analytics Framework
    5 //
    6 // Copyright 2006 Peter Adams. All rights reserved.
    7 //
    8 // Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html
    9 //
   10 // Unless required by applicable law or agreed to in writing, software
   11 // distributed under the License is distributed on an "AS IS" BASIS,
   12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13 // See the License for the specific language governing permissions and
   14 // limitations under the License.
   15 //
   16 // $Id$
   17 //
   18 
   19 require_once(OWA_BASE_DIR.'/owa_lib.php');
   20 require_once(OWA_BASE_DIR.'/owa_view.php');
   21 
   22 /**
   23  * View
   24  * 
   25  * @author      Peter Adams <peter@openwebanalytics.com>
   26  * @copyright   Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>
   27  * @license     http://www.gnu.org/copyleft/gpl.html GPL v2.0
   28  * @category    owa
   29  * @package     owa
   30  * @version        $Revision$
   31  * @since        owa 1.0.0
   32  */
   33 
   34 class owa_reportView extends owa_view {
   35 
   36     function render($data) {
   37 
   38         // Set Page title
   39         $this->t->set('page_title', $this->get('title'));
   40 
   41         // Set Page headline
   42         $this->body->set('title', $this->get('title'));
   43         $this->body->set('titleSuffix', $this->get('titleSuffix'));
   44 
   45         // Set reporting period
   46         $this->setPeriod($this->data['period']);
   47         $this->subview->body->set('is_default_period', $this->get('is_default_period'));
   48 
   49         //create the report control params array
   50         // TODO: this is evil as it may contain xss. Kill it's use downstream with fire, then nuke it here.
   51         $this->report_params = $this->data['params'];
   52 
   53         unset($this->report_params['guid']);
   54         unset($this->report_params['caller']);
   55         $this->t->set('params', $this->report_params);
   56         $this->body->set('params', $this->report_params);
   57         $this->subview->body->set('params', $this->report_params);
   58 
   59 
   60         // set site filter list
   61         $this->body->set('sites', $this->get('sites') );
   62 
   63         $this->body->set('dom_id', $this->get( 'dom_id' ) );
   64         // add if here
   65         $this->subview->body->set('dom_id', $this->get( 'dom_id' ) );
   66         $this->body->set('do', $this->data['do']);
   67 
   68         // Set navigation
   69         $this->body->set('hideReportingNavigation', $this->get('hideReportingNavigation') );
   70         $this->body->set('top_level_report_nav', $this->get('top_level_report_nav'));
   71 
   72         $this->body->set('hideSitesFilter', $this->get('hideSitesFilter') );
   73 
   74         $this->body->set('currentSiteId', $this->get('currentSiteId'));
   75 
   76 
   77         // load body template
   78         $this->body->set_template('report.tpl');
   79 
   80         // set link state used by report navigation
   81         $period = $this->get('period');
   82 
   83         $link_state = array(
   84             'siteId' => $this->get('currentSiteId')
   85         );
   86 
   87         if ( $period->get() === 'date_range' ) {
   88 
   89             $link_state[ 'startDate' ] = $period->getStartDate()->getYyyymmdd();
   90             $link_state[ 'endDate' ] = $period->getEndDate()->getYyyymmdd();
   91 
   92         } else {
   93 
   94             $link_state[ 'period' ] = $period->get();
   95         }
   96 
   97         $this->_setLinkState( $link_state );
   98 
   99         // set Js libs to be loaded
  100         $this->setJs('owa.reporting', 'base/js/owa.reporting-combined-min.js');
  101         
  102         // css libs to be loaded
  103         
  104         /*
  105         $this->setCss('base/css/smoothness-1.8.12/jquery-ui.css');
  106         $this->setCss('base/css/jquery.ui.selectmenu.css');
  107         $this->setCss('base/css/ui.jqgrid.css');
  108         $this->setCss('base/css/chosen/chosen.css');
  109         $this->setCss("base/css/owa.admin.css");
  110         $this->setCss("base/css/owa.report.css");
  111         */
  112         $this->setCss("base/css/font-awesome/css/all.min.css");
  113         $this->setCss("base/css/owa.reporting-css-combined.css");
  114         $additionalCss = $this->c->get('base','additionalCss');
  115         if (is_array($additionalCss)) {
  116             foreach ($additionalCss as $css) {
  117                 $this->setCss($css);
  118             }
  119         }
  120     }
  121 
  122     /**
  123      * Set report period
  124      *
  125      * @access public
  126      * @param string $period
  127      */
  128     function setPeriod( $period ) {
  129 
  130         // set in various templates and params
  131         $this->data['params']['period'] = $period->get();
  132         $this->body->set( 'period_obj', $period);
  133         $this->subview->body->set( 'period_obj', $period);
  134         $this->body->set( 'period', $period->get() );
  135         $this->subview->body->set( 'period', $period->get() );
  136         // set period label
  137         $period_label = $period->getLabel();
  138         $this->body->set('period_label', $period_label);
  139         $this->subview->body->set('period_label', $period_label);
  140         $start_date = $period->get('startDate');
  141         $this->body->set( 'startDate', $start_date );
  142         $this->subview->body->set('startDate', $start_date );
  143         $end_date =  $period->get('endDate');
  144         $this->body->set('endDate', $end_date );
  145         $this->subview->body->set('endDate', $end_date );
  146     }
  147 
  148     /**
  149      * Applies calling params
  150      *
  151      * @access     private
  152      * @param     array $properties
  153      */
  154     function _setParams($params = null) {
  155 
  156         if(!empty($params)) {
  157             foreach ($params as $key => $value) {
  158                 if(!empty($value)) {
  159                     $this->params[$key] = $value;
  160                 }
  161             }
  162         }
  163     }
  164 }
  165 
  166 /**
  167  *  Dimension Report View
  168  * 
  169  * @author      Peter Adams <peter@openwebanalytics.com>
  170  * @copyright   Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>
  171  * @license     http://www.gnu.org/copyleft/gpl.html GPL v2.0
  172  * @category    owa
  173  * @package     owa
  174  * @version        $Revision$
  175  * @since        owa 1.0.0
  176  */
  177 
  178 class owa_reportDimensionView extends owa_view {
  179 
  180     function render($data) {
  181 
  182         // Assign Data to templates
  183         $this->body->set('tabs', $this->get('tabs') );
  184         $this->body->set('metrics', $this->get('metrics'));
  185         $this->body->set('dimensions', $this->get('dimensions'));
  186         $this->body->set('sort', $this->get('sort'));
  187         $this->body->set('resultsPerPage', $this->get('resultsPerPage'));
  188         $this->body->set('dimensionLink', $this->get('dimensionLink'));
  189         $this->body->set('trendChartMetric', $this->get('trendChartMetric'));
  190         $this->body->set('trendTitle', $this->get('trendTitle'));
  191         $this->body->set('constraints', $this->get('constraints'));
  192         $this->body->set('gridTitle', $this->get('gridTitle'));
  193         $this->body->set('gridFormatters', $this->get('gridFormatters'));
  194         $this->body->set('excludeColumns', $this->get('excludeColumns'));
  195         $this->body->set_template('report_dimensionalTrend.php');
  196     }
  197 }
  198 
  199 /**
  200  *  Dimension Detail Report View
  201  * 
  202  * @author      Peter Adams <peter@openwebanalytics.com>
  203  * @copyright   Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>
  204  * @license     http://www.gnu.org/copyleft/gpl.html GPL v2.0
  205  * @category    owa
  206  * @package     owa
  207  * @version        $Revision$
  208  * @since        owa 1.0.0
  209  */
  210 
  211 class owa_reportDimensionDetailView extends owa_view {
  212 
  213     function render($data) {
  214 
  215         // Assign Data to templates
  216         $this->body->set('tabs', $this->get('tabs') );
  217         $this->body->set('metrics', $this->get('metrics'));
  218         $this->body->set('dimension', $this->get('dimension'));
  219         $this->body->set('trendChartMetric', $this->get('trendChartMetric'));
  220         $this->body->set('trendTitle', $this->get('trendTitle'));
  221         $this->body->set('constraints', $this->get('constraints'));
  222         $this->body->set('dimension_properties', $this->get('dimension_properties'));
  223         $this->body->set('dimension_template', $this->get('dimension_template'));
  224         $this->body->set('excludeColumns', $this->get('excludeColumns'));
  225         $this->body->set_template('report_dimensionDetail.php');
  226     }
  227 }
  228 
  229 /**
  230  * Simple Dimensional Report View
  231  * 
  232  * @author      Peter Adams <peter@openwebanalytics.com>
  233  * @copyright   Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>
  234  * @license     http://www.gnu.org/copyleft/gpl.html GPL v2.0
  235  * @category    owa
  236  * @package     owa
  237  * @version        $Revision$
  238  * @since        owa 1.4.0
  239  */
  240 
  241 class owa_reportSimpleDimensionalView extends owa_view {
  242 
  243     function render() {
  244 
  245         // Assign Data to templates
  246         $this->body->set('metrics', $this->get('metrics'));
  247         $this->body->set('dimensions', $this->get('dimensions'));
  248         $this->body->set('sort', $this->get('sort'));
  249         $this->body->set('resultsPerPage', $this->get('resultsPerPage'));
  250         $this->body->set('dimensionLink', $this->get('dimensionLink'));
  251         $this->body->set('trendChartMetric', $this->get('trendChartMetric'));
  252         $this->body->set('trendTitle', $this->get('trendTitle'));
  253         $this->body->set('gridFormatters', $this->get('gridFormatters'));
  254         $this->body->set('constraints', $this->get('constraints'));
  255         $this->body->set('gridTitle', $this->get('gridTitle'));
  256         $this->body->set('excludeColumns', $this->get('excludeColumns'));
  257         $this->body->set_template('report_dimensionDetailNoTabs.php');
  258     }
  259 }
  260 
  261 ?>