<commit_before><?php
/*
 * Xibo - Digital Signage - http://www.xibo.org.uk
 * Copyright (C) 2009-2014 <NAME>
 *
 * This file is part of Xibo.
 *
 * Xibo is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version. 
 *
 * Xibo is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Xibo.  If not, see <http://www.gnu.org/licenses/>.
 */
defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");

class statsDAO extends baseDAO
{	
    /**
     * Stats page
     */
	function displayPage() 
	{
        // Render a Bandwidth Widget
        $id = uniqid();
        Theme::Set('id', $id);
        Theme::Set('form_meta', '<input type="hidden" name="p" value="stats"><input type="hidden" name="q" value="BandwidthGrid">');
        
        $formFields = array();
        $formFields[] = FormManager::AddText('fromdt', __('From Date'), date("Y-m-d", time() - (86400 * 35)), NULL, 'f');
        $formFields[] = FormManager::AddText('todt', __('To Date'), date("Y-m-d"), NULL, 't');

        // List of Displays this user has permission for
        $displays = $this->user->DisplayGroupList(1);
        array_unshift($displays, array('displayid' => 0, 'displaygroup' => 'All'));
        $formFields[] = FormManager::AddCombo(
            'displayid', 
            __('Display'), 
            NULL,
            $displays,
            'displayid',
            'displaygroup',
            NULL, 
            'd');

        Theme::Set('header_text', __('Bandwidth'));
        Theme::Set('form_fields', $formFields);
        Theme::Render('grid_render');

        // Render an Availability Widget
        $id = uniqid();
        Theme::Set('id', $id);
        Theme::Set('form_meta', '<input type="hidden" name="p" value="stats"><input type="hidden" name="q" value="AvailabilityGrid">');
        
        $formFields = array();
        $formFields[] = FormManager::AddText('fromdt', __('From Date'), date("Y-m-d", time() - (86400 * 35)), NULL, 'f');
        $formFields[] = FormManager::AddText('todt', __('To Date'), date("Y-m-d"), NULL, 't');

        // List of Displays this user has permission for
        $displays = $this->user->DisplayGroupList(1);
        array_unshift($displays, array('displayid' => 0, 'displaygroup' => 'All'));
        $formFields[] = FormManager::AddCombo(
            'displayid', 
            __('Display'), 
            NULL,
            $displays,
            'displayid',
            'displaygroup',
            NULL, 
            'd');

        Theme::Set('header_text', __('Availability'));
        Theme::Set('form_fields', $formFields);
        Theme::Render('grid_render');


		// Proof of Play stats widget
        $id = uniqid();
        Theme::Set('id', $id);
        Theme::Set('form_meta', '<input type="hidden" name="p" value="stats"><input type="hidden" name="q" value="StatsGrid">');
        
        $formFields = array();
        $formFields[] = FormManager::AddText('fromdt', __('From Date'), date("Y-m-d", time() - 86400), NULL, 'f');
        $formFields[] = FormManager::AddText('todt', __('To Date'), date("Y-m-d"), NULL, 't');

        // List of Displays this user has permission for
        $displays = $this->user->DisplayGroupList(1);
        array_unshift($displays, array('displayid' => 0, 'displaygroup' => 'All'));
        $formFields[] = FormManager::AddCombo(
            'displayid', 
            __('Display'), 
            NULL,
            $displays,
            'displayid',
            'displaygroup',
            NULL, 
            'd');

        // List of Media this user has permission for
        $media = $this->user->MediaList();
        array_unshift($media, array('mediaid' => 0, 'media' => 'All'));
        $formFields[] = FormManager::AddCombo(
            'mediaid', 
            __('Media'), 
            NULL,
            $media,
            'mediaid',<commit_msg>Generate better uniqueIds for the stats page (3 grids, one page). Fixes xibosignage/xibo#88.<commit_after><?php
/*
 * Xibo - Digital Signage - http://www.xibo.org.uk
 * Copyright (C) 2009-2014 <NAME>
 *
 * This file is part of Xibo.
 *
 * Xibo is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version. 
 *
 * Xibo is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Xibo.  If not, see <http://www.gnu.org/licenses/>.
 */
defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");

class statsDAO extends baseDAO
{	
    /**
     * Stats page
     */
	function displayPage() 
	{
        // Render a Bandwidth Widget
        $id = Kit::uniqueId();
        Theme::Set('id', $id);
        Theme::Set('form_meta', '<input type="hidden" name="p" value="stats"><input type="hidden" name="q" value="BandwidthGrid">');
        
        $formFields = array();
        $formFields[] = FormManager::AddText('fromdt', __('From Date'), date("Y-m-d", time() - (86400 * 35)), NULL, 'f');
        $formFields[] = FormManager::AddText('todt', __('To Date'), date("Y-m-d"), NULL, 't');

        // List of Displays this user has permission for
        $displays = $this->user->DisplayGroupList(1);
        array_unshift($displays, array('displayid' => 0, 'displaygroup' => 'All'));
        $formFields[] = FormManager::AddCombo(
            'displayid', 
            __('Display'), 
            NULL,
            $displays,
            'displayid',
            'displaygroup',
            NULL, 
            'd');

        Theme::Set('header_text', __('Bandwidth'));
        Theme::Set('form_fields', $formFields);
        Theme::Render('grid_render');

        // Render an Availability Widget
        $id = Kit::uniqueId();
        Theme::Set('id', $id);
        Theme::Set('form_meta', '<input type="hidden" name="p" value="stats"><input type="hidden" name="q" value="AvailabilityGrid">');
        
        $formFields = array();
        $formFields[] = FormManager::AddText('fromdt', __('From Date'), date("Y-m-d", time() - (86400 * 35)), NULL, 'f');
        $formFields[] = FormManager::AddText('todt', __('To Date'), date("Y-m-d"), NULL, 't');

        // List of Displays this user has permission for
        $displays = $this->user->DisplayGroupList(1);
        array_unshift($displays, array('displayid' => 0, 'displaygroup' => 'All'));
        $formFields[] = FormManager::AddCombo(
            'displayid', 
            __('Display'), 
            NULL,
            $displays,
            'displayid',
            'displaygroup',
            NULL, 
            'd');

        Theme::Set('header_text', __('Availability'));
        Theme::Set('form_fields', $formFields);
        Theme::Render('grid_render');


		// Proof of Play stats widget
        $id = Kit::uniqueId();
        Theme::Set('id', $id);
        Theme::Set('form_meta', '<input type="hidden" name="p" value="stats"><input type="hidden" name="q" value="StatsGrid">');
        
        $formFields = array();
        $formFields[] = FormManager::AddText('fromdt', __('From Date'), date("Y-m-d", time() - 86400), NULL, 'f');
        $formFields[] = FormManager::AddText('todt', __('To Date'), date("Y-m-d"), NULL, 't');

        // List of Displays this user has permission for
        $displays = $this->user->DisplayGroupList(1);
        array_unshift($displays, array('displayid' => 0, 'displaygroup' => 'All'));
        $formFields[] = FormManager::AddCombo(
            'displayid', 
            __('Display'), 
            NULL,
            $displays,
            'displayid',
            'displaygroup',
            NULL, 
            'd');

        // List of Media this user has permission for
        $media = $this->user->MediaList();
        array_unshift($media, array('mediaid' => 0, 'media' => 'All'));
        $formFields[] = FormManager::AddCombo(
            'mediaid', 
            __('Media'), 
            NULL,
            $media,
            'mediaid',
{'fraction_non_alphanumeric': 0.1625028389734272, 'fraction_numerical': 0.008289802407449465, 'mean_word_length': 2.486539984164687, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1971901', 'n_tokens_mistral': 2647, 'n_tokens_neox': 2533, 'n_words': 713}