private function executeApplicationsForEmployer($appsPerPage, $appJobId, SJB_User $currentUser, $score, $orderInfo, $listingTitle) { $limit['countRows'] = $appsPerPage; $limit['startRow'] = $this->currentPage * $appsPerPage - $appsPerPage; $subuser = false; if ($appJobId) { $isUserOwnerApps = SJB_Applications::isUserOwnsAppsByAppJobId($currentUser->getID(), $appJobId); if (!$isUserOwnerApps) { SJB_FlashMessages::getInstance()->addWarning('NOT_OWNER_OF_APPLICATIONS', array('listingTitle' => $listingTitle)); } $allAppsCountByJobID = SJB_Applications::getCountAppsByJob($appJobId, $score); $this->setPaginationInfo($appsPerPage, $allAppsCountByJobID); $apps = SJB_Applications::getByJob($appJobId, $orderInfo, $score, $limit); } else { if ($currentUser->isSubuser()) { $subuserInfo = $currentUser->getSubuserInfo(); if (!SJB_Acl::getInstance()->isAllowed('subuser_manage_listings', $subuserInfo['sid'])) { $subuser = $subuserInfo['sid']; } } $allAppsCount = SJB_Applications::getCountApplicationsByEmployer($currentUser->getSID(), $score, $subuser); $this->setPaginationInfo($appsPerPage, $allAppsCount); $apps = SJB_Applications::getByEmployer($currentUser->getSID(), $orderInfo, $score, $subuser, $limit); } return $apps; }