/**
  * test testGetAllowedActions().
  */
 public function testGetAllowedActions()
 {
     $authManager = new RecruitmentAuthManager();
     $app = JobApplication::getJobApplication(1);
     $app5 = JobApplication::getJobApplication(5);
     // Different users
     $admin = new authorize(null, authorize::YES);
     $hiring = new authorize('011', authorize::NO);
     $first = new authorize(13, authorize::NO);
     $second = new authorize(14, authorize::NO);
     $manager = new authorize(15, authorize::NO);
     $nonManager = new authorize(16, authorize::NO);
     $director = new authorize(17, authorize::NO);
     $otherDirector = new authorize(18, authorize::NO);
     /* SUBMITTED */
     $app->setStatus(JobApplication::STATUS_SUBMITTED);
     $expected = array(JobApplication::ACTION_REJECT, JobApplication::ACTION_SCHEDULE_FIRST_INTERVIEW);
     $actions = $authManager->getAllowedActions($admin, $app);
     $this->assertEquals($expected, $actions);
     $expected = array(JobApplication::ACTION_REJECT, JobApplication::ACTION_SCHEDULE_FIRST_INTERVIEW);
     $actions = $authManager->getAllowedActions($hiring, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($first, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($second, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($manager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($nonManager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($director, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($otherDirector, $app);
     $this->assertEquals($expected, $actions);
     /* FIRST INTERVIEW SCHEDULED (scheduled) */
     $app->setStatus(JobApplication::STATUS_FIRST_INTERVIEW_SCHEDULED);
     $event = $app->getEventOfType(JobApplicationEvent::EVENT_SCHEDULE_FIRST_INTERVIEW);
     $event->setStatus(JobApplicationEvent::STATUS_INTERVIEW_SCHEDULED);
     $expected = array(JobApplication::ACTION_REJECT);
     $actions = $authManager->getAllowedActions($admin, $app);
     $this->assertEquals($expected, $actions);
     $expected = array(JobApplication::ACTION_REJECT);
     $actions = $authManager->getAllowedActions($hiring, $app);
     $this->assertEquals($expected, $actions);
     $expected = array(JobApplication::ACTION_REJECT);
     $role = $authManager->getRoleForApplication($first, $app);
     $this->assertEquals(RecruitmentAuthManager::ROLE_INTERVIEW1_MANAGER, $role);
     $actions = $authManager->getAllowedActions($first, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($second, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($manager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($nonManager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($director, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($otherDirector, $app);
     $this->assertEquals($expected, $actions);
     /* FIRST INTERVIEW SCHEDULED (finished) */
     $event = $app->getEventOfType(JobApplicationEvent::EVENT_SCHEDULE_FIRST_INTERVIEW);
     $event->setStatus(JobApplicationEvent::STATUS_INTERVIEW_FINISHED);
     $expected = array(JobApplication::ACTION_REJECT, JobApplication::ACTION_SCHEDULE_SECOND_INTERVIEW);
     $actions = $authManager->getAllowedActions($admin, $app);
     $this->assertEquals($expected, $actions);
     $expected = array(JobApplication::ACTION_REJECT, JobApplication::ACTION_SCHEDULE_SECOND_INTERVIEW);
     $actions = $authManager->getAllowedActions($hiring, $app);
     $this->assertEquals($expected, $actions);
     $expected = array(JobApplication::ACTION_REJECT, JobApplication::ACTION_SCHEDULE_SECOND_INTERVIEW);
     $actions = $authManager->getAllowedActions($first, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($second, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($manager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($nonManager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($director, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($otherDirector, $app);
     $this->assertEquals($expected, $actions);
     /* SECOND INTERVIEW SCHEDULED (scheduled) */
     $app->setStatus(JobApplication::STATUS_SECOND_INTERVIEW_SCHEDULED);
     $event = $app->getEventOfType(JobApplicationEvent::EVENT_SCHEDULE_SECOND_INTERVIEW);
     $event->setStatus(JobApplicationEvent::STATUS_INTERVIEW_SCHEDULED);
     $app->setEvents(array($event));
     $expected = array(JobApplication::ACTION_REJECT);
     $actions = $authManager->getAllowedActions($admin, $app);
     $this->assertEquals($expected, $actions);
     $expected = array(JobApplication::ACTION_REJECT);
     $actions = $authManager->getAllowedActions($hiring, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($first, $app);
     $this->assertEquals($expected, $actions);
     $expected = array(JobApplication::ACTION_REJECT);
     $actions = $authManager->getAllowedActions($second, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($manager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($nonManager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($director, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($otherDirector, $app);
     $this->assertEquals($expected, $actions);
     /* SECOND INTERVIEW SCHEDULED (finished) */
     $event = $app->getEventOfType(JobApplicationEvent::EVENT_SCHEDULE_SECOND_INTERVIEW);
     $event->setStatus(JobApplicationEvent::STATUS_INTERVIEW_FINISHED);
     $expected = array(JobApplication::ACTION_REJECT, JobApplication::ACTION_OFFER_JOB);
     $actions = $authManager->getAllowedActions($admin, $app);
     $this->assertEquals($expected, $actions);
     $expected = array(JobApplication::ACTION_REJECT, JobApplication::ACTION_OFFER_JOB);
     $actions = $authManager->getAllowedActions($hiring, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($first, $app);
     $this->assertEquals($expected, $actions);
     $expected = array(JobApplication::ACTION_REJECT, JobApplication::ACTION_OFFER_JOB);
     $actions = $authManager->getAllowedActions($second, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($manager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($nonManager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($director, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($otherDirector, $app);
     $this->assertEquals($expected, $actions);
     // Job Offered
     $app->setStatus(JobApplication::STATUS_JOB_OFFERED);
     $expected = array(JobApplication::ACTION_MARK_OFFER_DECLINED, JobApplication::ACTION_SEEK_APPROVAL);
     $actions = $authManager->getAllowedActions($admin, $app);
     $this->assertEquals($expected, $actions);
     $expected = array(JobApplication::ACTION_MARK_OFFER_DECLINED, JobApplication::ACTION_SEEK_APPROVAL);
     $actions = $authManager->getAllowedActions($hiring, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($first, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($second, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($manager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($nonManager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($director, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($otherDirector, $app);
     $this->assertEquals($expected, $actions);
     // Offer Declined
     $app->setStatus(JobApplication::STATUS_OFFER_DECLINED);
     $expected = array();
     $actions = $authManager->getAllowedActions($admin, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($hiring, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($first, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($second, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($manager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($nonManager, $app);
     $this->assertEquals($expected, $actions);
     // Pending approval
     $app5->setStatus(JobApplication::STATUS_PENDING_APPROVAL);
     $expected = array();
     $actions = $authManager->getAllowedActions($admin, $app5);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($hiring, $app5);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($first, $app5);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($second, $app5);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($manager, $app5);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($nonManager, $app5);
     $this->assertEquals($expected, $actions);
     $expected = array(JobApplication::ACTION_REJECT, JobApplication::ACTION_APPROVE);
     $actions = $authManager->getAllowedActions($director, $app5);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($otherDirector, $app5);
     $this->assertEquals($expected, $actions);
     // Hired
     $app->setStatus(JobApplication::STATUS_HIRED);
     $expected = array();
     $actions = $authManager->getAllowedActions($admin, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($hiring, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($first, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($second, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($manager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($nonManager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($director, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($otherDirector, $app);
     $this->assertEquals($expected, $actions);
     // Rejected
     $app->setStatus(JobApplication::STATUS_REJECTED);
     $expected = array();
     $actions = $authManager->getAllowedActions($admin, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($hiring, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($first, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($second, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($manager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($nonManager, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($director, $app);
     $this->assertEquals($expected, $actions);
     $expected = array();
     $actions = $authManager->getAllowedActions($otherDirector, $app);
     $this->assertEquals($expected, $actions);
 }
            <span class="eventDate">(<?php 
    echo $statusDate;
    ?>
)</span>
            <?php 
}
?>
        </div><br/>
        <div class="txtName"><?php 
echo $lang_Recruit_JobApplicationDetails_Actions;
?>
</div><div class="txtValue">
            <?php 
$authManager = new RecruitmentAuthManager();
$authorize = new authorize($_SESSION['empID'], $_SESSION['isAdmin']);
$actions = $authManager->getAllowedActions($authorize, $application);
$applicationId = $application->getId();
foreach ($actions as $action) {
    $resourceName = 'lang_Recruit_JobApplicationAction_' . $action;
    $actionName = isset(${$resourceName}) ? ${$resourceName} : $action;
    $actionURL = $baseURL . '&action=Confirm' . $action . '&id=' . $applicationId;
    ?>
                <a href="<?php 
    echo $actionURL;
    ?>
" style="white-space:nowrap;">
                    <?php 
    echo $actionName;
    ?>
                </a>&nbsp;&nbsp;
            <?php