<?php
 namespace App\Reports\Sources\UsersProfilesAccess; class PopulateInitialImport extends \App\Reports\Sources\PopulateAbstract { public function populate() :void { global $DBTUserProfiles, $DBTUsersProfilesAccess; $reportTable = $this->tableManager->getTableName(); $activeColumns = array_keys( $this->columnsManager->getStdColumns() ); $stdFilters = $this->filtersManager->getStdFilters(); $this->reportGenerationStatusUpdate('extractMainDataFromDb', 'runningMainSQL', 0); $reportCopyInfo = new \App\Reports\Db\ManageRecords\Insert($reportTable); $reportCopyInfo->setMainTable($DBTUsersProfilesAccess, 'profileAccess'); $reportCopyInfo->addJoinTable($DBTUserProfiles, 'profile', 'profile.id=profileAccess.idProfile'); $cols = [ 'idProfile' => 'profile.id', 'profileName' => 'profile.name', 'idSection' => 'profileAccess.idSection', 'type' => 'profileAccess.type', 'optionValue' => 'profileAccess.optionValue', ]; $reportCopyInfo->setStructureColumns($cols); $reportCopyInfo->addStructureColumn("id", "CONCAT(profile.id, '|', profileAccess.idSection)", 'profile'); $reportCopyInfo->addStructureColumn("addTime", "FROM_UNIXTIME(profile.addTime)", 'profile'); $reportCopyInfo->setActiveColumns($activeColumns); if ($stdFilters['addDate']['start']) { $reportCopyInfo->addFilter('profile.addTime', '>=', strtotime($stdFilters['addDate']['start']." 00:00:00")); } if ($stdFilters['addDate']['end']) { $reportCopyInfo->addFilter('profile.addTime', '<=', strtotime($stdFilters['addDate']['end']." 23:59:59")); } $reportCopyInfo->addFilter('profile.deleted', '=', '0'); $reportCopyInfo->populate(); } } 