public function load() { $ids = NGS()->args()->ids; $duplidatedRows = RealVoterNumberManager::getInstance()->selectAdvance('*', ['id', 'in', "({$ids})"], ['create_datetime'], 'asc'); if (!empty($duplidatedRows)) { $numVoter = $duplidatedRows[0]; $voterId = $numVoter->getVoterId(); if ($voterId > 0) { $prevoteData = VoterDataManager::getInstance()->selectByField('voter_id', $voterId); if (!empty($prevoteData)) { $this->addParam('prevoteData', $prevoteData); } $voter = VoterManager::getInstance()->selectByPK($voterId); $areaId = $voter->getAreaId(); $area = AreaManager::getInstance()->selectByPK($areaId); $this->addParam('area', $area); $this->addParam('voter', $voter); } $this->addParam('voter_id', $voterId); $this->addParam('vote_count', count($duplidatedRows)); $areaIdsArray = $this->getAreaIdsArray($duplidatedRows); $areasMappedById = AreaManager::getInstance()->selectbyPKs($areaIdsArray, true); $this->addParam('duplidatedRows', $duplidatedRows); $this->addParam('areasMappedById', $areasMappedById); } }
public function load() { $allAreaIdsMappedByTerritoryId = \hqv\managers\AreaManager::getInstance()->getAllAreaIdsMappedByTerritoryId(); $allTerritoriesIds = array_keys($allAreaIdsMappedByTerritoryId); asort($allTerritoriesIds); $this->addParam('allTerritoryIds', $allTerritoriesIds); }
public function load() { $dataCountGroupByVoter = VoterDataManager::getInstance()->getDataCountGroupByVoterId(); $nonParticipantCounts = VoterDataManager::getInstance()->getNonParticipantCounts(); $participantCounts = VoterDataManager::getInstance()->getParticipantCounts(); $totalPassportDuplicationVotes = AnalyzeManager::getInstance()->getTotalPassportDuplicationVotes(); $totalValidPassportVotesCount = RealVoterPassportManager::getInstance()->getTotalValidVotesCount(); $totalNumberDuplicationVotes = AnalyzeManager::getInstance()->getTotalNumberDuplicationVotes(); $totalValidNumberVotesCount = RealVoterNumberManager::getInstance()->getTotalValidVotesCount(); $allAreaIdsMappedByTerritoryId = \hqv\managers\AreaManager::getInstance()->getAllAreaIdsMappedByTerritoryId(); $allTerritoriesIds = array_keys($allAreaIdsMappedByTerritoryId); asort($allTerritoriesIds); $this->addJsonParam('allTerritoryIds', array_values($allTerritoriesIds)); $passportTotalVotersCountByTerritoryId = []; $numberTotalVotersCountByTerritoryId = []; foreach ($allAreaIdsMappedByTerritoryId as $territoryId => $areaIdsArray) { $passportTotalVotersCountByTerritoryId['t' . $territoryId] = RealVoterPassportManager::getInstance()->getTotalValidVotesCountInAreaIds($areaIdsArray); $numberTotalVotersCountByTerritoryId['t' . $territoryId] = RealVoterNumberManager::getInstance()->getTotalValidVotesCountInAreaIds($areaIdsArray); } $this->addJsonParam('passportTotalVotersCountByTerritoryId', $passportTotalVotersCountByTerritoryId); $this->addJsonParam('numberTotalVotersCountByTerritoryId', $numberTotalVotersCountByTerritoryId); $this->addJsonParam("passportFake", $totalPassportDuplicationVotes); $this->addJsonParam("passportTotal", $totalValidPassportVotesCount); $this->addJsonParam("numberFake", $totalNumberDuplicationVotes); $this->addJsonParam("numberTotal", $totalValidNumberVotesCount); $this->addParam('countGroupByVoter', $dataCountGroupByVoter); $this->addParam('participantCounts', $participantCounts); $this->addParam('nonParticipantCounts', $nonParticipantCounts); }
public function load() { if (isset(NGS()->args()->areaId)) { $areaId = intval(NGS()->args()->areaId); $area = AreaManager::getInstance()->selectByPK($areaId); if (isset($area)) { $areaPassportVoters = RealVoterPassportManager::getInstance()->selectAdvance('*', ['area_id', '=', $areaId]); $this->addParam('areaPassportVotersCount', count($areaPassportVoters)); } } }
public function load() { global $numberAreaId; if (isset(NGS()->args()->areaId)) { $numberAreaId = NGS()->args()->areaId; } $userType = NGS()->getSessionManager()->getUserType(); $moderatorId = NGS()->getSessionManager()->getUserId(); $limit = 20; $page = 1; if (isset(NGS()->args()->page)) { $page = intval(NGS()->args()->page); } if (isset(NGS()->args()->limit)) { $limit = intval(NGS()->args()->limit); } $this->addParam('page', $page); $this->addParam('limit', $limit); $offset = ($page - 1) * $limit; $where = ['area_id', '=', $numberAreaId]; if ($userType == \admin\security\UserGroups::$MODERATOR) { $where[] = 'and'; $where[] = 'moderator_id'; $where[] = '='; $where[] = $moderatorId; } $rows = RealVoterNumberManager::getInstance()->selectAdvance('*', $where, ['create_datetime'], 'DESC', $offset, $limit); $voterIdsArray = $this->getVoterIdsArray($rows); $areaIdsArray = $this->getAreaIdsArray($rows); $duplicatedInListRealVoters = []; $voters = []; $areas = []; $preVoteData = []; if (!empty($voterIdsArray)) { $voters = VoterManager::getInstance()->selectByPKs($voterIdsArray, true); $areas = AreaManager::getInstance()->selectByPKs($areaIdsArray, true); $duplicatedInListRealVoters = RealVoterNumberManager::getInstance()->getDuplicatedInListRealVotersRowIds($voterIdsArray); $voterIdsSqlString = "(" . implode(',', $voterIdsArray) . ")"; $preVoteData = VoterDataManager::getInstance()->selectAdvance('*', ['voter_id', 'in', $voterIdsSqlString]); $preVoteData = $this->MapByVoterId($preVoteData); } $count = RealVoterNumberManager::getInstance()->getLastSelectAdvanceRowsCount(); $pageCount = ceil($count / $limit); if ($count == 0) { $pageCount = 1; } $this->addParam('pageCount', $pageCount); $this->addParam('rows', $rows); $this->addParam('voters', $voters); $this->addParam('areas', $areas); $this->addParam('duplicatedInListMappedById', $duplicatedInListRealVoters); $this->addParam('preVoteData', $preVoteData); }
public function load() { if (!isset(NGS()->args()->hash)) { return; } $hash = NGS()->args()->hash; $voter = VoterManager::getInstance()->getByHash($hash); if (isset($voter)) { $voterData = VoterDataManager::getInstance()->selectByField('voter_id', $voter->getId()); $area = AreaManager::getInstance()->selectByPK($voter->getAreaId()); $this->addParam('voter', $voter); $this->addParam('area', $area); $this->addParam('voter_data', $voterData); } }
public function load() { global $numberAreaId; if (isset(NGS()->args()->rowId)) { $row = RealVoterNumberManager::getInstance()->selectByPK(NGS()->args()->rowId); if (!empty($row)) { $areaId = $row->getAreaId(); if (intval($areaId) > 0) { $area = AreaManager::getInstance()->selectByPK($areaId); $selectedRegion = $area->getRegion(); $selectedRegionCommunity = $area->getCommunity(); $selectedAreaId = $area->getId(); } } } $regionNamesArray = AreaManager::getInstance()->getRegionNamesArray(); if (!isset($selectedRegion)) { $selectedRegion = $regionNamesArray[0]; if (isset(NGS()->args()->selectedRegion)) { $selectedRegion = trim(NGS()->args()->selectedRegion); } } $regionCommunities = AreaManager::getInstance()->getRegionCommunitiesArray($selectedRegion); if (!isset($selectedRegionCommunity)) { $selectedRegionCommunity = $regionCommunities[0]; if (isset(NGS()->args()->selectedRegionCommunity)) { $selectedRegionCommunity = trim(NGS()->args()->selectedRegionCommunity); } } $areasMappedById = AreaManager::getInstance()->getByRegionAndCommunity($selectedRegion, $selectedRegionCommunity); if (!isset($selectedAreaId)) { $areaIds = array_keys($areasMappedById); reset($areaIds); $selectedAreaId = current($areaIds); if (isset(NGS()->args()->selectedAreaId)) { $selectedAreaId = NGS()->args()->selectedAreaId; } } $numberAreaId = $selectedAreaId; $allAreas = AreaManager::getInstance()->selectAll(); $this->addParam('all_areas', $allAreas); $this->addParam('selectedRegion', $selectedRegion); $this->addParam('selectedRegionCommunity', $selectedRegionCommunity); $this->addParam('selectedAreaId', $selectedAreaId); $this->addParam('regions', $regionNamesArray); $this->addParam('regionCommunities', $regionCommunities); $this->addParam('areas', $areasMappedById); }
public function load() { list($birthDate, $firstName, $lastName, $fatherName) = $this->validateParams(); $where = []; if (!empty($birthDate)) { $where[] = 'birth_date'; $where[] = '='; $where[] = "'{$birthDate}'"; } if (!empty($firstName)) { if (!empty($where)) { $where[] = 'and'; } $where[] = 'first_name'; $where[] = 'like'; $where[] = "'{$firstName}%'"; } if (!empty($lastName)) { if (!empty($where)) { $where[] = 'and'; } $where[] = 'last_name'; $where[] = 'like'; $where[] = "'{$lastName}%'"; } if (!empty($fatherName)) { if (!empty($where)) { $where[] = 'and'; } $where[] = 'father_name'; $where[] = 'like'; $where[] = "'{$fatherName}%'"; } $voters = VoterManager::getInstance()->selectAdvance('*', $where, ['first_name', 'last_name', 'father_name'], 'ASC', 0, 100); $areaIds = $this->getAreaIds($voters); $areas = []; if (!empty($areaIds)) { $areaIdsString = implode(',', $areaIds); $areas = AreaManager::getInstance()->selectAdvance('*', ['id', 'in', "({$areaIdsString})"], null, null, null, null, true); } $this->addParam('areas', $areas); $this->addParam('voters', $voters); }
public function load() { $ids = NGS()->args()->ids; $duplidatedRows = VoterDataManager::getInstance()->selectAdvance('*', ['id', 'in', "({$ids})"], ['datetime'], 'asc'); if (!empty($duplidatedRows)) { $voterData = $duplidatedRows[0]; $voterId = $voterData->getVoterId(); if ($voterId > 0) { $voter = VoterManager::getInstance()->selectByPK($voterId); $areaId = $voter->getAreaId(); $area = AreaManager::getInstance()->selectByPK($areaId); $this->addParam('area', $area); $this->addParam('voter', $voter); } $this->addParam('voter_id', $voterId); $this->addParam('vote_count', count($duplidatedRows)); $this->addParam('duplidatedRows', $duplidatedRows); } }
public function load() { $willNotVoteVoters = VoterDataManager::getInstance()->selectAdvance('*', ['will_vote', '=', 0]); $voterIdsArray = $this->getVoterIdsArray($willNotVoteVoters); $voterIdsArraySql = "(" . implode(',', $voterIdsArray) . ")"; $realVoters = RealVoterNumberManager::getInstance()->selectAdvance('*', ['voter_id', '>', 0, 'and', 'voter_id', 'in', $voterIdsArraySql]); $voterIdsArray = $this->getVoterIdsArray($realVoters); $areaIdsArray = $this->getAreaIdsArray($realVoters); $voters = VoterManager::getInstance()->selectByPKs($voterIdsArray, true); $areas = AreaManager::getInstance()->selectByPKs($areaIdsArray, true); $prevotDatas = []; array_unique($voterIdsArray); foreach ($voterIdsArray as $voterId) { $prevotDatas[$voterId] = VoterDataManager::getInstance()->selectAdvance('*', ['voter_id', '=', $voterId]); } $this->addParam("rows", $realVoters); $this->addParam("voters", $voters); $this->addParam("areas", $areas); $this->addParam("prevotDatas", $prevotDatas); }
public function load() { if (isset(NGS()->args()->areaId)) { $area = AreaManager::getInstance()->selectByPK(NGS()->args()->areaId); $selectedRegion = $area->getRegion(); $selectedRegionCommunity = $area->getCommunity(); $selectedAreaId = $area->getId(); } $regionNamesArray = AreaManager::getInstance()->getRegionNamesArray(); if (!isset($selectedRegion)) { $selectedRegion = $regionNamesArray[0]; if (isset(NGS()->args()->selectedRegion)) { $selectedRegion = NGS()->args()->selectedRegion; } } $regionCommunities = AreaManager::getInstance()->getRegionCommunitiesArray($selectedRegion); if (!isset($selectedRegionCommunity)) { $selectedRegionCommunity = $regionCommunities[0]; if (isset(NGS()->args()->selectedRegionCommunity)) { $selectedRegionCommunity = NGS()->args()->selectedRegionCommunity; } } $areasMappedById = AreaManager::getInstance()->getByRegionAndCommunity($selectedRegion, $selectedRegionCommunity); if (!isset($selectedAreaId)) { $areaIds = array_keys($areasMappedById); reset($areaIds); $selectedAreaId = current($areaIds); if (isset(NGS()->args()->selectedAreaId)) { $selectedAreaId = NGS()->args()->selectedAreaId; } } $this->addParam('selectedRegion', $selectedRegion); $this->addParam('selectedRegionCommunity', $selectedRegionCommunity); $this->addParam('selectedAreaId', $selectedAreaId); $this->addParam('regions', $regionNamesArray); $this->addParam('regionCommunities', $regionCommunities); $this->addParam('areas', $areasMappedById); }