src/FHI360/Access/Exchange/Controller/DashboardController.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\FHI360\Access\Exchange\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  4. use App\FHI360\Access\Suite\Service\APISuiteCRM;
  5. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  6. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  7. use Symfony\Component\HttpFoundation\Request;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\Filesystem\Filesystem;
  10. use Symfony\Component\HttpFoundation\BinaryFileResponse;
  11. use Symfony\Component\HttpFoundation\ResponseHeaderBag;
  12. class DashboardController extends Controller
  13. {
  14.     /**
  15.      * @Route("/", name="exchange-index")
  16.      */
  17.     public function indexAction()
  18.     {
  19.         return $this->redirectToRoute("exchangedashboard");
  20.     }
  21.     /**
  22.      * @Route("dashboard", name="exchangedashboard")
  23.      */
  24.     public function dashboardAction()
  25.     {
  26.         // App\FHI360\Access\Suite\Service\ExchangeUtils
  27.         $exchangeUtils $this->container->get('exchange_utils');
  28.         $suiteUtils $this->container->get('suite_utils');
  29.         $user_id $this->getUser()->getId();
  30.         $participant_id $exchangeUtils->getParticipantId($user_id);
  31.         //Pass in the status individual instead of putting logic in twig
  32.         $exchange $exchangeUtils->getExchangeInfo($participant_id);
  33.         $passport_upload_status $exchangeUtils->getPassportFilesStatus($participant_id);
  34.         $photo_upload_status $exchangeUtils->getPhotoFileStatus($participant_id);
  35.         $medical_form_upload_status $exchangeUtils->getMedicalFilesStatus($participant_id);
  36.         $tesol_form_upload_status $exchangeUtils->getTESOLFilesStatus($participant_id);
  37.         $passport_info_status $exchangeUtils->getPassportFormStatus($participant_id);
  38.         $participant_info_status $exchangeUtils->getParticipantInfoFormStatus($participant_id);
  39.         //This status are saved in the exchange_participant_action_status table
  40.         $confirm_nominee_status $exchangeUtils->getParticipantActionStatus($participant_id'confirm-nominee');
  41.         $privacy_status $exchangeUtils->getParticipantActionStatus($participant_id,'privacy');
  42.         $release_status $exchangeUtils->getParticipantActionStatus($participant_id,'release');
  43.         $terms_status $exchangeUtils->getParticipantActionStatus($participant_id,'terms');
  44.         $resume_upload_status $exchangeUtils->getParticipantActionStatus($participant_id,'resume''Not Required');
  45.         //Overall Participant Status
  46.         $participant_status $exchangeUtils->getParticipantStatus($participant_id);
  47.         //load the country list from the language file on crm side
  48.         $portal_dir $this->container->get('kernel')->getProjectDir();
  49.         $crm_lanuge_dir $portal_dir "/../crm/custom/include/language/";
  50.         include_once($crm_lanuge_dir "en_us.lang.php");
  51.         $participant_status_list $GLOBALS['app_list_strings']['exchange_participant_status_list'];
  52.         $form_status_list $GLOBALS['app_list_strings']['participant_information_form_status_list'];
  53.         $document_status_list $GLOBALS['app_list_strings']['exchanges_passport_file_status_list'];
  54.         $tesol_form_status_list $GLOBALS['app_list_strings']['tesol_membership_status_list'];
  55.         /*
  56.          *Get the browser check information
  57.          */
  58.         $participant_email $this->getUser()->getEmail();
  59.         $browserDetails $suiteUtils->getBrowserDetails();
  60.         $browserCheckInfo $suiteUtils->getBrowserCheckInfo($participant_email.' - Exchange Participant',$browserDetails);
  61.         $save_browser_info = (isset($browserCheckInfo) && sizeof($browserCheckInfo)>0)?'no':'yes';
  62.         $templateParams = array(
  63.             'exchanges' => $exchange,
  64.             'confirm_nominee_status' => $confirm_nominee_status,
  65.             'passport_info_status' => $passport_info_status,
  66.             'participant_info_status' => $participant_info_status,
  67.             'privacy_status' => $privacy_status,
  68.             'release_status' => $release_status,
  69.             'terms_status' => $terms_status,
  70.             'passport_upload_status' => $passport_upload_status,
  71.             'photo_upload_status' => $photo_upload_status,
  72.             'medical_form_upload_status' => $medical_form_upload_status,
  73.             'tesol_form_upload_status' => $tesol_form_upload_status,
  74.             'resume_upload_status' => $resume_upload_status,
  75.             'participant_status' => $participant_status,
  76.             'participant_status_list' => $participant_status_list,
  77.             'form_status_list' => $form_status_list,
  78.             'document_status_list' => $document_status_list,
  79.             'tesol_form_status_list' => $tesol_form_status_list,
  80.             'save_browser_info' => $save_browser_info,
  81.             'browserDetails' => $browserDetails,
  82.             'ip_address' => $suiteUtils->getUserIP()
  83.         );
  84.         $exchange_id $exchange[0]['id'];
  85.         if($exchange[0]['frontend_template_c']=='custom' && file_exists("{$portal_dir}/src/FHI360/Access/Exchange/Resources/views/Dashboard/{$exchange_id}/dashboard.html.twig")){
  86.             return $this->render("Exchange/Dashboard/{$exchange_id}/dashboard.html.twig"$templateParams);
  87.         }else{
  88.             return $this->render('Exchange/Dashboard/dashboard.html.twig'$templateParams);
  89.         }
  90.     }
  91.     /**
  92.      * @Route("update-to-in-progress", name="update-to-in-progress")
  93.      */
  94.     public function updateToInProgress(Request $request)
  95.     {
  96.         // App\FHI360\Access\Suite\Service\ExchangeUtils
  97.         $exchangeUtils $this->container->get('exchange_utils');
  98.         $user_id $this->getUser()->getId();
  99.         $participant_id $exchangeUtils->getParticipantId($user_id);
  100.         $action_type $request->query->get('action_type');
  101.         if($exchangeUtils->getParticipantActionStatus($participant_id$action_type) == 'Awaiting Action'){
  102.             $exchangeUtils->updateParticipantActionStatus($participant_id$action_type'In Progress');
  103.         }
  104.         return new Response('successful');
  105.     }
  106.     /**
  107.      * @Route("update-to-in-progress-crm", name="update-to-in-progress-crm")
  108.      */
  109.     public function updateFilesToInProgressInCRM(Request $request)
  110.     {
  111.         // App\FHI360\Access\Suite\Service\ExchangeUtils
  112.         $exchangeUtils $this->container->get('exchange_utils');
  113.         $user_id $this->getUser()->getId();
  114.         $participant_id $exchangeUtils->getParticipantId($user_id);
  115.         $status_field_name $request->query->get('field_name');
  116.         if($exchangeUtils->getParticipantActionStatusCRM($participant_id$status_field_name) == 'awaiting_action'){
  117.             $exchangeUtils->updateParticipantActionStatusCRM($participant_id$status_field_name'in_progress');
  118.         }
  119.         return new Response('successful');
  120.     }
  121.     /**
  122.      * @Route("download-blank-medical-form", name="download-blank-medical-form")
  123.      */
  124.     public function downloadBlankMedicalForm(){
  125.         return $this->redirectToRoute("exchangedashboard");
  126.     }
  127.     /**
  128.      * @Route("download-blank-tesol-form", name="download-blank-tesol-form")
  129.      */
  130.     public function downloadBlankTESOLForm(){
  131.         return $this->redirectToRoute("exchangedashboard");
  132.     }
  133. }