public function addpopupAction()
 {
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $cand_model = new Default_Model_Candidatedetails();
     $requi_model = new Default_Model_Requisition();
     $interview_model = new Default_Model_Interviewdetails();
     $interview_round_model = new Default_Model_Interviewrounddetails();
     $auth = Zend_Auth::getInstance();
     $inter_options = array();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $deptid = $this->getRequest()->getParam('deptid');
     if ($deptid == '') {
         $deptid = $this->getRequest()->getParam('deptidform');
     }
     $idData = $this->getRequest()->getParam('unitId');
     $ir_form = new Default_Form_Interviewrounds();
     $ir_form->setAttrib('action', BASE_URL . 'interviewrounds/addpopup/unitId/' . $idData);
     $ir_form->removeElement("sel_inter_status");
     $ir_form->removeElement('req_id');
     $ir_form->removeElement('candidate_name');
     $ir_form->removeElement('cand_status');
     $ir_form->removeElement('interview_status');
     $data = array();
     if (isset($_POST['country']) && $_POST['country'] != '') {
         $ir_form->country->setValue(intval($_POST['country']));
         $statesmodel = new Default_Model_States();
         $statesmodeldata = $statesmodel->getBasicStatesList(intval($_POST['country']));
         $st_opt = array();
         if (count($statesmodeldata) > 0) {
             foreach ($statesmodeldata as $dstate) {
                 $st_opt[$dstate['state_id_org'] . '!@#' . $dstate['state']] = $dstate['state'];
             }
         }
         $ir_form->state->addMultiOptions(array('' => 'Select State') + $st_opt);
     }
     if (isset($_POST['state']) && $_POST['state'] != '') {
         $citiesmodel = new Default_Model_Cities();
         $citiesmodeldata = $citiesmodel->getBasicCitiesList(intval($_POST['state']));
         $ct_opt = array();
         if (count($citiesmodeldata) > 0) {
             foreach ($citiesmodeldata as $dcity) {
                 $ct_opt[$dcity['city_org_id'] . '!@#' . $dcity['city']] = $dcity['city'];
             }
         }
         $ir_form->city->addMultiOptions(array('' => 'Select City') + $ct_opt);
     }
     //giving only for hr,management and super admin
     if ($loginuserGroup == HR_GROUP || $loginuserGroup == '' || $loginuserGroup == MANAGEMENT_GROUP) {
         $ir_form->round_status->addMultiOptions(array('Decision pending' => 'Decision pending', 'On hold' => 'On hold'));
     }
     $data = $cand_model->getCandidateById($idData);
     $allData = $interview_model->getCandidateDetailsById($idData);
     $interview_status = $allData['interview_status'];
     $previousroundstatus = $interview_model->getinterviewroundnumber($idData);
     $interview_max_date = $interview_round_model->getMaxRoundDateByInterviewId($idData);
     $previousroundstatus = $previousroundstatus['round_status'];
     if ($interview_status != 'Completed' || $previousroundstatus == 'Schedule for next round') {
         $round_count = $interview_round_model->getRoundCnt($data['candidate_id'], $idData);
         $interviewer_data = $requi_model->getReportingmanagers('', $loginUserId, '', $deptid, 'interviewer');
         $inter_options = $interviewer_data;
         $ir_form->submit->setLabel('Add');
         $this->view->form = $ir_form;
         $this->view->data = $data;
         $this->view->deptid = $deptid;
         $this->view->round_count = $round_count;
         $this->view->interview_status = $interview_status;
         $this->view->interview_max_date = $interview_max_date;
         $this->view->inter_options = $inter_options;
         if ($this->getRequest()->getPost()) {
             $result = $this->save($ir_form);
             $this->view->msgarray = $result;
             $this->view->messages = $result;
         }
     } else {
         if ($interview_status == 'Completed') {
             $this->view->ermsg = 'completed';
         } else {
             if ($previousroundstatus == 'Schedule for next round') {
                 $this->view->ermsg = 'notscheduled';
             } else {
                 $this->view->ermsg = 'nodata';
             }
         }
     }
 }