<commit_before><?php
/**
 * ------------------------------------------------------------------------------------
 * Created by SAN Business Consultants for RAPTOR phase 2
 * Open Source VA Innovation Project 2011-2015
 * VA Innovator: Dr. <NAME>
 * SAN Implementation: <NAME>, <NAME>, et al
 * Contacts: <EMAIL>, <EMAIL>
 * ------------------------------------------------------------------------------------
 *  
 */

namespace raptor;

use \DateTime;

require_once 'AReport.php';

/**
 * This class returns the Admin Information input content
 *
 * CLIN2 1.7
 * 
 * @author <NAME> of SAN Business Consultants
 */
class ViewReport2Page extends AReport
{

    public function getName() 
    {
        return 'User Activity Analysis';
    }

    public function getDescription() 
    {
        return 'Shows analysis of user activity in the system';
    }

    public function getRequiredPrivileges() 
    {
        $aRequire['VREP2'] = 1;
        return $aRequire;
    }
    
    public function getMenuKey() 
    {
        return 'raptor/viewrepusract1';
    }
    
    /**
     * Get the values to populate the form.
     * @return type result of the queries as an array
     */
    function getFieldValues()
    {
        $myvalues = array();
        //$myvalues['formmode'] = 'V';
        
		$result = db_query("Call raptor_user_dept_analysis('user')")
				->execute();
		
		$result = db_select('temp4', 't')
				->fields('t')
				->orderBy('modality_abbr', 'DESC')
				->orderBy('_year', 'DESC')
				->orderBy('quarter', 'DESC')
				->orderBy('week', 'DESC')
				->orderBy('day', 'DESC')
				->orderBy('username', 'DESC')
				->execute();
		
		while($res = $result->fetchAssoc())
		{
			$myvalues[] = $res;
		}
        return $myvalues;
    }
	
    /**
     * Get all the form contents for rendering
     * @return type renderable array
     */
    function getForm($form, &$form_state, $disabled, $myvalues)
    {
		$dtF = new DateTime("@0");
        //$form = $this->m_oPageHelper->getForm($form, $form_state, $disabled, $myvalues, $this->m_aHelpText);

        $form["data_entry_area1"] = array(
            '#prefix' => "\n<section class='user-admin raptor-dialog-table'>\n",
            '#suffix' => "\n</section>\n",
        );
        $form["data_entry_area1"]['table_container'] = array(
            '#type' => 'item', 
            '#prefix' => '<div class="raptor-dialog-table-container">',
            '#suffix' => '</div>', 
            '#tree' => TRUE,
        );

        $rows = '';
		foreach($myvalues as $val)
		{
			if(((string)$val['_year']>0) && ((string)$val['quarter']>0) && ((string)$val['week']>0))
			{
				$max_A_S = round((int)$val['Max_Time_A_S']);
				$dtT = new DateTime("@$max_A_S");
				$max_A_S = $dtF->diff($dtT)->format('%a days, %h hours and %i minutes');
				
				$avg_A_S = round((int)$val['Avg_Time_A_S']);
				$dtT = new DateTime("@$avg_A_S");
				$avg_A_S = $dtF->diff($dtT)->format('%a days, %h hours and %i minutes');
				
				$max_A_C = round((int)$val['Max_Time_A_C']);
				$dtT = new DateTime("@$max_A_C");
				$max_A_C = $dtF->diff($dtT)->format('%a days, %h hours and %i minutes');
				
				$avg_A_C = round((int)$val['Avg_Time_A_C']);
				$dtT = new DateTime("@$avg_A_C");
				$avg_A_C = $dtF->diff($dtT)->format('%a days, %h hours and %i minutes');
				
				$max_collab = round((int)$val['Max_Time_Collab']);
				$dtT = new DateTime("@$max_collab");
				$max_collab = $dtF->diff($dtT)->format('%a days, %h hours and %i minutes');
				
				$avg_collab = round((int)$val['Avg_Time_Collab']);
				$dtT = new DateTime("@$avg_collab");
				$avg_collab = $dtF->diff($dtT)->format('%a days, %h hours and %i minutes');
				
				$rows .= '<tr>'
					. '<td>' . $val['modality_abbr'] . '</td>'
					. '<td>' . $val['_year'] . '</td>'
					. '<td>' . $val['quarter'] . '</td>'
					. '<td>' . $val['week'] . '</td>'
					. '<td>' . $val['day'] . '</td>'
					. '<td title="'.$val['uid'].'">' . $val['username'] . '</td>'
					. '<td>' . $val['role_nm'] . '</td>'
					. '<td>' . $val['Total_Approved']  . '</td>'<commit_msg>report fix<commit_after><?php
/**
 * ------------------------------------------------------------------------------------
 * Created by SAN Business Consultants for RAPTOR phase 2
 * Open Source VA Innovation Project 2011-2015
 * VA Innovator: Dr. <NAME>
 * SAN Implementation: <NAME>, <NAME>, et al
 * Contacts: <EMAIL>, <EMAIL>
 * ------------------------------------------------------------------------------------
 *  
 */

namespace raptor;

use \DateTime;

require_once 'AReport.php';

/**
 * This class returns the Admin Information input content
 *
 * CLIN2 1.7
 * 
 * @author <NAME> of SAN Business Consultants
 */
class ViewReport2Page extends AReport
{

    public function getName() 
    {
        return 'User Activity Analysis';
    }

    public function getDescription() 
    {
        return 'Shows analysis of user activity in the system';
    }

    public function getRequiredPrivileges() 
    {
        $aRequire['VREP2'] = 1;
        return $aRequire;
    }
    
    public function getMenuKey() 
    {
        return 'raptor/viewrepusract1';
    }
    
    /**
     * Get the values to populate the form.
     * @return type result of the queries as an array
     */
    function getFieldValues()
    {
        $myvalues = array();
        //$myvalues['formmode'] = 'V';
        
		$result = db_query("Call raptor_user_dept_analysis('user')")
				->execute();
		
		$result = db_select('temp4', 't')
				->fields('t')
				->orderBy('modality_abbr', 'DESC')
				->orderBy('_year', 'DESC')
				->orderBy('quarter', 'DESC')
				->orderBy('week', 'DESC')
				->orderBy('day', 'DESC')
				->orderBy('username', 'DESC')
				->execute();
		
		while($res = $result->fetchAssoc())
		{
			$myvalues[] = $res;
		}
        return $myvalues;
    }
	
    /**
     * Get all the form contents for rendering
     * @return type renderable array
     */
    function getForm($form, &$form_state, $disabled, $myvalues)
    {
		$dtF = new DateTime("@0");
        //$form = $this->m_oPageHelper->getForm($form, $form_state, $disabled, $myvalues, $this->m_aHelpText);

        $form["data_entry_area1"] = array(
            '#prefix' => "\n<section class='user-admin raptor-dialog-table'>\n",
            '#suffix' => "\n</section>\n",
        );
        $form["data_entry_area1"]['table_container'] = array(
            '#type' => 'item', 
            '#prefix' => '<div class="raptor-dialog-table-container">',
            '#suffix' => '</div>', 
            '#tree' => TRUE,
        );

        $rows = '';
		foreach($myvalues as $val)
		{
			if(((string)$val['_year']>0) && ((string)$val['quarter']>0) && ((string)$val['week']>0))
			{
				$max_A_S = round((int)$val['Max_Time_A_S']);
				$dtT = new DateTime("@$max_A_S");
				$max_A_S = $dtF->diff($dtT)->format('%a days, %h hours and %i minutes');
				
				$avg_A_S = round((int)$val['Avg_Time_A_S']);
				$dtT = new DateTime("@$avg_A_S");
				$avg_A_S = $dtF->diff($dtT)->format('%a days, %h hours and %i minutes');
				
				$max_A_C = round((int)$val['Max_Time_A_C']);
				$dtT = new DateTime("@$max_A_C");
				$max_A_C = $dtF->diff($dtT)->format('%a days, %h hours and %i minutes');
				
				$avg_A_C = round((int)$val['Avg_Time_A_C']);
				$dtT = new DateTime("@$avg_A_C");
				$avg_A_C = $dtF->diff($dtT)->format('%a days, %h hours and %i minutes');
				
				$max_collab = round((int)$val['Max_Time_Collab']);
				$dtT = new DateTime("@$max_collab");
				$max_collab = $dtF->diff($dtT)->format('%a days, %h hours and %i minutes');
				
				$avg_collab = round((int)$val['Avg_Time_Collab']);
				$dtT = new DateTime("@$avg_collab");
				$avg_collab = $dtF->diff($dtT)->format('%a days, %h hours and %i minutes');
				
				$rows .= '<tr>'
					. '<td>' . $val['modality_abbr'] . '</td>'
					. '<td>' . $val['_year'] . '</td>'
					. '<td>' . $val['quarter'] . '</td>'
					. '<td>' . $val['week'] . '</td>'
					. '<td>' . $val['day'] . '</td>'
					. '<td title="'.$val['uid'].'">' . $val['username'] . '</td>'
					. '<td>' . $val['role_nm'] . '</td>'
					. '<td>' . $val['most_recent_login_dt'] . '</td>'
					. '<td>' . $val['Total_Approved']  . '</td>'
{'fraction_non_alphanumeric': 0.24248717322257513, 'fraction_numerical': 0.005619350109943806, 'mean_word_length': 2.342997141690486, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 127, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4434524', 'n_tokens_mistral': 3179, 'n_tokens_neox': 2795, 'n_words': 585}