<commit_before><?php

/**
 * reports actions.
 *
 * @package    mediaSCORE
 * @subpackage reports
 * @author     <NAME>
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class reportsActions extends sfActions {

    public function executeIndex(sfWebRequest $request) {
        
    }

    /**
     * Assets Groups Scoring Reports From reporting module
     * 
     * @param sfWebRequest $request 
     */
    public function executeAssetsgroupsscoringreports(sfWebRequest $request) {
        $this->form = new ReportsForm();

        if ($request->isMethod(sfRequest::POST)) {

            $AssetScoreReportArray = array();
            $Assets = array();
            $params = $request->getPostParameter('reports');

            $commonFunctions = new commonFunctions();
            $listUnits_RRD = $params['listUnits_RRD'];
            $format_id = $params['format_id'];
            $ExportType = $params['ExportType'];
            if ($listUnits_RRD) {
                $Units = Doctrine_Query::Create()
                        ->from('Unit u')
                        ->select('u.* ,p.*,sl.*')
                        ->LeftJoin('u.Personnel p ')
                        ->LeftJoin('u.StorageLocations sl ')
                        ->where('u.id  = ?', $listUnits_RRD)
                        ->fetchArray();
            } else {

                $Units = Doctrine_Query::Create()
                        ->from('Unit u')
                        ->select('u.* ,p.*,sl.*')
                        ->LeftJoin('u.Personnel p ')
                        ->LeftJoin('u.StorageLocations sl ')
                        ->fetchArray();
            }
            foreach ($Units as $Unit) {
                $Collections = Doctrine_Query::Create()
                        ->from('Collection c')
                        ->select('c.*,sl.*')
                        ->where('c.parent_node_id  = ?', $Unit['id'])
                        ->fetchArray();
                foreach ($Collections as $Collection) {
                    if ($format_id) {
                        $Asset = Doctrine_Query::Create()
                                ->from('AssetGroup a')
                                ->select('a.*, ft.*')
                                ->LeftJoin("a.FormatType ft")
                                ->where('a.parent_node_id  = ?', $Collection['id'])
                                ->where('ft.type  = ?', $format_id)
                                ->addOrderBy('ft.asset_score DESC')
                                ->fetchArray();
                    } else {

                        $Asset = Doctrine_Query::Create()
                                ->from('AssetGroup a')
                                ->select('a.*, ft.*')
                                ->LeftJoin("a.FormatType ft")
                                ->where('a.parent_node_id  = ?', $Collection['id'])
                                ->addOrderBy('ft.asset_score DESC')
                                ->fetchArray();
                    }

                    $SolutionArray = array();
                    $SolutionArray['AssetGroup'] = $Asset[0];
                    $SolutionArray['Collection'] = $Collection;
                    $SolutionArray['Unit'] = $Unit;
                    $Assets[] = $SolutionArray;
                }
            }
            if ($Assets) {
                foreach ($Assets as $Asset) {
                    $FormatType = FormatType::$formatTypesValue1d[$Asset['AssetGroup']['type']];
                    foreach (FormatType::$typeNames as $typeNames) {
                        foreach ($typeNames as $key => $type) {
                            if ($type == $FormatType) {
                                $value = $key;
                            }
                        }
                    }
                    $value::$constants;
                    $AssetScoreReport = array();<commit_msg>first Report Assest Group score  done<commit_after><?php

/**
 * reports actions.
 *
 * @package    mediaSCORE
 * @subpackage reports
 * @author     <NAME>
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class reportsActions extends sfActions {

    public function executeIndex(sfWebRequest $request) {
        
    }

    /**
     * Assets Groups Scoring Reports From reporting module
     * 
     * @param sfWebRequest $request 
     */
    public function executeAssetsgroupsscoringreports(sfWebRequest $request) {
        $this->form = new ReportsForm();

        if ($request->isMethod(sfRequest::POST)) {

            $AssetScoreReportArray = array();
            $Assets = array();
            $params = $request->getPostParameter('reports');

            $commonFunctions = new commonFunctions();
            $listUnits_RRD = $params['listUnits_RRD'];
            $format_id = $params['format_id'];
            $ExportType = $params['ExportType'];
            if ($listUnits_RRD) {
                $Units = Doctrine_Query::Create()
                        ->from('Unit u')
                        ->select('u.* ,p.*,sl.*')
                        ->LeftJoin('u.Personnel p ')
                        ->LeftJoin('u.StorageLocations sl ')
                        ->where('u.id  = ?', $listUnits_RRD)
                        ->fetchArray();
            } else {

                $Units = Doctrine_Query::Create()
                        ->from('Unit u')
                        ->select('u.* ,p.*,sl.*')
                        ->LeftJoin('u.Personnel p ')
                        ->LeftJoin('u.StorageLocations sl ')
                        ->fetchArray();
            }
            foreach ($Units as $Unit) {
                $Collections = Doctrine_Query::Create()
                        ->from('Collection c')
                        ->select('c.*,sl.*')
                        ->where('c.parent_node_id  = ?', $Unit['id'])
                        ->fetchArray();
                foreach ($Collections as $Collection) {
                    if ($format_id) {
                        $Asset = Doctrine_Query::Create()
                                ->from('AssetGroup a')
                                ->select('a.*, ft.*')
                                ->LeftJoin("a.FormatType ft")
                                ->where('a.parent_node_id  = ?', $Collection['id'])
                                ->where('ft.type  = ?', $format_id)
                                ->addOrderBy('ft.asset_score DESC')
                                ->fetchArray();
                    } else {

                        $Asset = Doctrine_Query::Create()
                                ->from('AssetGroup a')
                                ->select('a.*, ft.*')
                                ->LeftJoin("a.FormatType ft")
                                ->where('a.parent_node_id  = ?', $Collection['id'])
                                ->addOrderBy('ft.asset_score DESC')
                                ->fetchArray();
                    }

                    $SolutionArray = array();
                    $SolutionArray['AssetGroup'] = $Asset[0];
                    $SolutionArray['Collection'] = $Collection;
                    $SolutionArray['Unit'] = $Unit;
                    $Assets[] = $SolutionArray;
                }
            }
            var_dump($Assets);
            exit;
            if ($Assets) {
                foreach ($Assets as $Asset) {
                    $FormatType = FormatType::$formatTypesValue1d[$Asset['AssetGroup']['type']];
                    foreach (FormatType::$typeNames as $typeNames) {
                        foreach ($typeNames as $key => $type) {
                            if ($type == $FormatType) {
                                $value = $key;
                            }
                        }
                    }
                    $value::$constants;
                    $AssetScoreReport = array();
{'fraction_non_alphanumeric': 0.13051124230624295, 'fraction_numerical': 0.005275719130762467, 'mean_word_length': 1.104678826328311, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 69, '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': '2887766', 'n_tokens_mistral': 2021, 'n_tokens_neox': 1860, 'n_words': 342}