예제 #1
0
 public function chkcurrenttimeAction()
 {
     $sel_time = $this->_getParam('sel_time', null);
     $sel_date = $this->_getParam('sel_date', null);
     $now_date = date('Y-m-d');
     $sel_date_obj = new DateTime($sel_date);
     $new_sel_date = $sel_date_obj->format('Y-m-d');
     $greater = 'no';
     if ($new_sel_date == $now_date) {
         $now_time = date("H:i");
         $selected_time = date("H:i", strtotime($sel_time));
         if ($selected_time > $now_time) {
             $greater = 'yes';
         }
     }
     $timeformat = '';
     if ($greater == 'no') {
         $timeformat = sapp_Global::change_time($sel_time, 'view');
     }
     $this->_helper->_json(array('timeformat' => $timeformat, 'greater' => $greater));
 }
예제 #2
0
 public function userlogsearchajaxAction()
 {
     if ($this->getRequest()->getPost()) {
         $field = $this->_request->getParam('byField');
         $searchString = $this->_request->getParam('searchstring');
         switch ($field) {
             case 'userfullname':
                 $where = "cc.userfullname like '%" . $searchString . "%'";
                 break;
             case 'groupname':
                 $groupIds = $this->activitylog_model->getgroupIdByString($searchString);
                 $groupIdCsv = @implode(",", $groupIds);
                 $where = "cc.group_id IN (" . $groupIdCsv . ")";
                 break;
             case 'role':
                 $empRoleIds = $this->activitylog_model->getemproleIdByString($searchString);
                 $empRoleIdCsv = @implode(",", $empRoleIds);
                 $where = "cc.emprole IN (" . $empRoleIdCsv . ")";
                 break;
             case 'emailaddress':
                 $where = "cc.emailaddress like '%" . $searchString . "%'";
                 break;
             case 'logindatetime':
                 $where = "cc.logindatetime like '%" . $searchString . "%'";
                 break;
             case 'empipaddress':
                 $where = "cc.empipaddress like '%" . $searchString . "%'";
                 break;
         }
         $userlog = $this->activitylog_model->getUserLogManagerDataSearch(1, $this->perPage, $where);
         $userArray = array();
         $empRoleArray = array();
         $groupArray = array();
         if (!empty($userlog)) {
             foreach ($userlog as $key => $curr) {
                 if (!in_array($curr['userid'], $userArray)) {
                     array_push($userArray, $curr['userid']);
                 }
                 if (!in_array($curr['emprole'], $empRoleArray)) {
                     array_push($empRoleArray, $curr['emprole']);
                 }
                 if (!in_array($curr['group_id'], $groupArray)) {
                     array_push($groupArray, $curr['group_id']);
                 }
             }
             $userNameArray = $this->activitylog_model->getuserNamesByIds($userArray);
             $roleNameArray = $this->activitylog_model->getEmpRoleNamesByIds($empRoleArray);
             $groupNameArray = $this->activitylog_model->getGroupNamesByIds($groupArray);
             $html = '';
             foreach ($userlog as $user) {
                 $userName = isset($userNameArray[$user['userid']]) ? $userNameArray[$user['userid']] : "";
                 $groupName = isset($groupNameArray[$user['group_id']]) ? $groupNameArray[$user['group_id']] : "";
                 $roleName = isset($roleNameArray[$user['emprole']]) ? $roleNameArray[$user['emprole']] : "";
                 $imageUrl = '';
                 $imagetag = '';
                 if ($user['profileimg']) {
                     $imageUrl = DOMAIN . 'public/uploads/preview/' . $user['profileimg'];
                     $imagetag = '<img src="' . $imageUrl . '" height="30" width="30">';
                 }
                 $html .= '<div class="rowDiv"><div class="cellDiv">' . $imagetag . $user['userfullname'] . ' (' . $user['employeeId'] . ')</div><div class="cellDiv">' . $groupName . '</div><div class="cellDiv">' . $roleName . '</div><div class="cellDiv">' . $user['emailaddress'] . '</div><div class="cellDiv">' . sapp_Global::change_date($user['logindatetime'], 'view') . ' at ' . sapp_Global::change_time($user['logindatetime'], 'view') . '</div><div class="cellDiv  lastCell">' . $user['empipaddress'] . '</div>';
             }
             echo $html;
             exit;
         } else {
             echo 'No matches found';
             exit;
         }
     }
 }
예제 #3
0
    public static function format1($url = '')
    {
        try {
            $widgetsModel = new Default_Model_Widgets();
            $format1 = $widgetsModel->format1();
            if (!empty($url)) {
                $url = substr($url, 1);
            }
            // Get login user data
            $auth = Zend_Auth::getInstance();
            $session = $auth->getStorage()->read();
            $loginUserId = $session->id;
            $login_user_name = $session->userfullname;
            $login_user_profile_image = $session->profileimg;
            // Get job title name
            if ($session->emprole == 1) {
                $job_title_name = "Super Admin";
            } else {
                $result = $widgetsModel->getJobTitleName($session->jobtitle_id);
                $job_title_name = $result["jobtitlename"];
            }
            $login_user_name1 = strlen($login_user_name) > 13 ? substr($login_user_name, 0, 13) . '..' : $login_user_name;
            $job_title = strlen($job_title_name) > 13 ? substr($job_title_name, 0, 13) . '..' : $job_title_name;
            if (empty($format1)) {
                $htmlContent = '<div id="format1_div" class="interview_shed_block no_interview_shed_block" >
					<div class="left_block_shed">
						<div class="users_left_list_div users_list">
							<span class="values">
								<div class="profile_img">
									<img src="' . DOMAIN . 'public/uploads/profile/' . $login_user_profile_image . '" width="80px" height="80px" onerror=\'this.src="' . DOMAIN . 'public/media/images/default-profile-pic.jpg"\'>
								</div> 
							</span>
							<div class="member_name" title="' . $login_user_name . '">' . $login_user_name1 . '</div>		
							<div class="member_jname" title="' . $job_title_name . '">' . $job_title . '</div>
						</div>
					</div>
			  <div class="interview_shed_box" style="display:none;"><h4><div>Interview Schedules, <span>' . date("D j, M Y") . '</span></div> ';
                $htmlContent .= "<div class='no_interview'>No interviews scheduled for today.</div> </h4>";
            } else {
                $htmlContent = '<div id="format1_div" class="interview_shed_block" >
					<div class="left_block_shed">
						<div class="users_left_list_div users_list">
							<span class="values">
								<div class="profile_img">
									<img src="' . DOMAIN . 'public/uploads/profile/' . $login_user_profile_image . '" width="80px" height="80px" onerror=\'this.src="' . DOMAIN . 'public/media/images/default-profile-pic.jpg"\'>
								</div> 
							</span>
							<div class="member_name" title="' . $login_user_name . '">' . $login_user_name1 . '</div>		
							<div class="member_jname" title="' . $job_title_name . '">' . $job_title . '</div>
						</div>
						<h4><div>Interview Schedules</div><span>' . date("D j, M Y") . '</span></h4>
					</div>
					<div class="interview_shed_box" style="display:none;">';
                if (!empty($url)) {
                    $htmlContent .= '<div class="box_link view_link"><a href="' . BASE_URL . $url . '" >All</a></div>';
                }
                $htmlContent .= '<ul>';
                foreach ($format1 as $interview_scheduled) {
                    $candidate_id = $interview_scheduled['id'];
                    $candidate_name = $interview_scheduled['candidate_name'];
                    $interview_type = $interview_scheduled['interview_mode'];
                    $interview_time = sapp_Global::change_time($interview_scheduled['interview_time'], 'interview_time');
                    $contact_number = $interview_scheduled['contact_number'];
                    $interview_id = $interview_scheduled['interview_id'];
                    $emailid = $interview_scheduled['emailid'];
                    $cand_resume = $interview_scheduled['cand_resume'];
                    $candidate_name_shrt = strlen($candidate_name) > 10 ? substr($candidate_name, 0, 10) : $candidate_name;
                    $htmlContent .= '<li>
					 <span class="emp_lable me_label">Candidate</span>
					 <span class="can_name_lable" title="' . $candidate_name . '">' . $candidate_name_shrt . '(' . $interview_type . '),</span>
					 <span class="txt_lable">At:</span>
					 <span class="txt_block">' . $interview_time . ',</span>';
                    if (!empty($contact_number)) {
                        $htmlContent .= '<div style="display: inline-block;"><span class="txt_lable">Phone:</span>
					 <span class="txt_block">' . $contact_number . ',</span></div>';
                    }
                    if (!empty($emailid)) {
                        $htmlContent .= '<div style="display: inline-block;"><span class="txt_lable">Email:</span>
					 <span class="txt_block">' . $emailid . ',</span></div>';
                    }
                    $htmlContent .= '<span class="emp_resume_link"><a href="' . BASE_URL . 'scheduleinterviews/downloadresume/id/' . $candidate_id . '/int_id/' . $interview_id . '" title="' . $cand_resume . '">';
                    if (!empty($cand_resume)) {
                        $htmlContent .= 'Resume';
                    } else {
                        $htmlContent .= 'View';
                    }
                    $htmlContent .= '</a></span></li>';
                }
                $htmlContent .= '</ul>';
            }
            return $htmlContent .= '</div><div class="clear"></div></div>';
        } catch (Expection $e) {
            echo $e->getMessage();
        }
    }
 /**
  * 
  * @param type $form
  * @param type $data
  * @return type
  */
 public function save($form, $data)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $cand_model = new Default_Model_Candidatedetails();
     $requi_model = new Default_Model_Requisition();
     $interview_model = new Default_Model_Interviewdetails();
     $user_model = new Default_Model_Usermanagement();
     $interview_round_model = new Default_Model_Interviewrounddetails();
     $form->round_status->setRequired(false);
     $form->interview_feedback->setRequired(false);
     $cand_status = $this->_getParam('cand_status', null);
     $interview_status = $this->_getParam('interview_status', null);
     $flag = 'true';
     if ($interview_status == 'On hold' && $cand_status != 'On hold') {
         $msgarray['statusErr'] = 'Since the interview status is onhold, the candidate status should be onhold.';
         $flag = 'false';
     }
     if ($interview_status == 'Completed' && ($cand_status != 'Disqualified' && $cand_status != 'Shortlisted')) {
         $msgarray['statusErr'] = 'Since interview status is completed, the candidate status can be either disqualified or shortlisted.';
         $flag = 'false';
     }
     if ($interview_status == 'In process' && ($cand_status == 'Disqualified' || $cand_status == 'Shortlisted')) {
         $msgarray['statusErr'] = 'Since the interview status is in process, the candidate cannot be shortlisted or disqualified.';
         $flag = 'false';
     }
     if ($form->isValid($this->_request->getPost()) && $flag != 'false') {
         $id = $this->_getParam('id', null);
         $requisition_id = $this->_getParam('req_id', null);
         $candidate_id = $this->_getParam('candidate_name', null);
         $interviewer_ids = $this->_getParam('interviewer_id', null);
         $interview_panel = implode(",", $interviewer_ids);
         $interviewer_id = 0;
         foreach ($interviewer_ids as $interview) {
             $interviewer_id = $interview;
             break;
         }
         $int_location = $this->_getParam('int_location', null);
         $country = $this->_getParam('country', null);
         $state = $this->_getParam('state', null);
         $city = $this->_getParam('city', null);
         $interview_mode = $this->_getParam('interview_mode', null);
         $interview_type_details = $this->_getParam('interview_Type_Details', null);
         $interview_time = $this->_getParam('interview_time', null);
         $interview_date = $this->_getParam('interview_date', null);
         $interview_round = $this->_getParam('interview_round', null);
         if (!isset($candidate_id)) {
             $candidate_id = $data['id'];
         }
         if (empty($data)) {
             $getExistingCandidateRecord = $interview_model->getCandidateInInterviewProcess(trim($candidate_id));
             if ($getExistingCandidateRecord > 0) {
                 $this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Interview already scheduled for this candidate.');
                 $this->_redirect('/scheduleinterviews');
             }
         }
         if (empty($data)) {
             $idata = array('req_id' => $requisition_id, 'candidate_id' => trim($candidate_id), 'interview_status' => trim($interview_status), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $idata['interview_status'] = 'In process';
             $iwhere = "";
             $actionflag = 1;
             $iresult = $interview_model->SaveorUpdateInterviewData($idata, $iwhere);
             if ($id == '') {
                 $tableid = $iresult;
             }
             if ($iresult != '') {
                 $irdata = array('interview_id' => $iresult, 'req_id' => $requisition_id, 'candidate_id' => $candidate_id, 'interviewer_id' => $interviewer_id, 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date($interview_date, 'database'), 'interview_mode' => $interview_mode, 'interview_mode_details' => $interview_type_details, 'interview_round_number' => 1, 'interview_round' => trim($interview_round), 'int_location' => trim($int_location), 'int_country' => trim(intval($country)), 'int_state' => trim(intval($state)), 'int_city' => trim(intval($city)), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"), 'interview_panel' => $interview_panel);
                 $ir_result = $interview_round_model->SaveorUpdateInterviewroundData($irdata, '');
                 $requisition_data = $requi_model->getRequisitionDataById($requisition_id);
                 $cand_data = $cand_model->getCandidateById($candidate_id);
                 $hrgroupemail = $requi_model->getgroupemailid("REQ_HR", $requisition_data["department_id"]);
                 $requisition_data = $requi_model->getrequisitiondetails($requisition_id);
                 $requesteremailaddress = $requi_model->getemployeeemailaddress($requisition_data["createdby"]);
                 $reportingmanageremailaddress = $requi_model->getemployeeemailaddress($requisition_data["reporting_id"]);
                 $mail_arr = array('HR' => $hrgroupemail["groupEmail"], $requesteremailaddress['userfullname'] => $requesteremailaddress['emailaddress'], $reportingmanageremailaddress['userfullname'] => $reportingmanageremailaddress['emailaddress']);
                 $loginuser_person_data = $user_model->getUserDataById($loginUserId);
                 $interview_panel = $interview_panel . "," . $loginUserId;
                 $interviewpanelnamesemailaddresss = $requi_model->GetInterviewPanelMamesEmailaddress($interview_panel);
                 /* $emailtemp = array();
                    $nametemp = array();
                    foreach ($interviewpanelnamesemailaddress as $row) {
                    array_push($emailtemp, $row['emailaddress']);
                    array_push($nametemp, $row['userfullname']);
                    }
                    $email = implode(";", $emailtemp);
                    $ename = implode(";", $nametemp); */
                 $cal_unique_id = $this->getCalendarUniqueID();
                 foreach ($interviewpanelnamesemailaddresss as $interviewpanelnamesemailaddress) {
                     $description = "Meeting From : " . $from_name . "\r\n" . "Candidate Name : " . $cand_data['candidate_name'] . "\r\n" . "Interview Type : " . $interview_mode . "\r\n" . "Interview Location : " . $int_location . "\r\n" . "Interview Date : " . $interview_date . "\r\n" . "Interview Time : " . sapp_Global::change_time($interview_time, 'view') . "\r\n" . " " . " " . "\r\n";
                     /* $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                                               $options['subject'] = APPLICATION_NAME . ': Interview schedule';
                                               $options['header'] = 'Interview schedule';
                                               $options['toEmail'] = $interviewpanelnamesemailaddress['emailaddress'];
                                               $options['toName'] = $interviewpanelnamesemailaddress['userfullname'];
                                               $options['message'] = $description;
                                               $options['location'] = $int_location;
                                               $options['interviewdate'] = $interview_date;
                                               $options['starttime'] = sapp_Global::add_time($interview_time, 'view', 0);
                                               $options['endtime'] = sapp_Global::add_time($interview_time, 'view', 3600);
                     
                                               //Interview Calendar Invite will be send from login user account
                                               $options['fromEmail'] = trim($loginuser_person_data['emailaddress']);
                                               $options['fromName'] = $loginuser_person_data['userfullname'];
                                               $options['calUniqueID'] = $cal_unique_id;
                                               $options['method'] = 'REQUEST';
                     
                                               //sapp_Global::_sendCalendarEmail($options); */
                     $from_name = trim($loginuser_person_data['userfullname']);
                     $from_address = trim($loginuser_person_data['emailaddress']);
                     $to_name = trim($interviewpanelnamesemailaddress['userfullname']);
                     $to_address = trim($interviewpanelnamesemailaddress['emailaddress']);
                     $startTime = sapp_Global::_getInterviewStartDateTime(sapp_Global::change_date($interview_date), sapp_Global::change_time(trim($interview_time)), 3600);
                     $endTime = sapp_Global::_getInterviewStartDateTime(sapp_Global::change_date($interview_date), sapp_Global::change_time(trim($interview_time)));
                     $subject = APPLICATION_NAME . ': Interview schedule';
                     $location = $int_location;
                     $calRequest = 'REQUEST';
                     sapp_Global::sendIcalEvent($from_name, $from_address, $to_name, $to_address, $startTime, $endTime, $subject, $description, $location, $calRequest, $cal_unique_id);
                 }
                 // update Calendar Invite ID to DB
                 $where = "id = " . $ir_result;
                 $irdata = array('calendarinviteid' => $cal_unique_id);
                 $ir_result1 = $interview_round_model->SaveorUpdateInterviewroundData($irdata, $where);
                 $candData = array('cand_status' => 'Scheduled', 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $where = "id = " . $candidate_id;
                 $candResult = $cand_model->SaveorUpdateCandidateData($candData, $where);
             }
         } else {
             $idata = array('interview_status' => trim($interview_status), 'isactive' => 1, 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $iwhere = "id = " . $id;
             $tableid = $id;
             $actionflag = 2;
             $iresult = $interview_model->SaveorUpdateInterviewData($idata, $iwhere);
             $candData = array('cand_status' => 'Scheduled', 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
             if ($cand_status && $cand_status != '0') {
                 $candData['cand_status'] = $cand_status;
             }
             $where = "id = " . $candidate_id;
             $candResult = $cand_model->SaveorUpdateCandidateData($candData, $where);
             //send email
             $currentInterviewData = $requi_model->getinterviewdetails($id);
             $requisition_data = $requi_model->getrequisitiondetails($currentInterviewData["req_id"]);
             $currentrequisition_data = $requi_model->getrequisitiondetails($currentInterviewData["req_id"]);
             $cand_data = $cand_model->getCandidateById($candidate_id);
             //$hrgroupemail = $requi_model->getgroupemailid("REQ_HR", $requisition_data["department_id"]);
             $requesteremailaddress = $requi_model->getemployeeemailaddress($requisition_data["createdby"]);
             $reportingmanageremailaddress = $requi_model->getemployeeemailaddress($requisition_data["reporting_id"]);
             //HR Group
             $mail_arr[0]['name'] = 'HR';
             $mail_arr[0]['email'] = constant('REQ_HR_0');
             //Requester
             $mail_arr[1]['name'] = $requesteremailaddress['userfullname'];
             $mail_arr[1]['email'] = $requesteremailaddress['emailaddress'];
             //Reporting Manager
             $mail_arr[2]['name'] = $reportingmanageremailaddress['userfullname'];
             $mail_arr[2]['email'] = $reportingmanageremailaddress['emailaddress'];
             //Management Group
             $mail_arr[3]['name'] = 'Management';
             $mail_arr[3]['email'] = constant('REQ_MGMT_0');
             //Recruiter Panel
             $requisition_recruiters_data = $requi_model->GetRequisitionRecruiterEmailaddress($currentrequisition_data["requisition_code"]);
             $emailCnt = 4;
             foreach ($requisition_recruiters_data as $requisition_recruiters_data1) {
                 $mail_arr[$emailCnt]['name'] = $requisition_recruiters_data1['userfullname'];
                 $mail_arr[$emailCnt]['email'] = $requisition_recruiters_data1['emailaddress'];
                 $emailCnt = $emailCnt + 1;
             }
             //Technical Panel
             $pnlIDS = implode(',', $requi_model->getRequisitionInterviewPanelIDs($currentInterviewData["req_id"]));
             $interviewpanelnamesemailaddresss = $requi_model->GetInterviewPanelMamesEmailaddress($pnlIDS);
             foreach ($interviewpanelnamesemailaddresss as $interviewpanelnamesemailaddress1) {
                 $mail_arr[$emailCnt]['name'] = $interviewpanelnamesemailaddress1['userfullname'];
                 $mail_arr[$emailCnt]['email'] = $interviewpanelnamesemailaddress1['emailaddress'];
                 $emailCnt = $emailCnt + 1;
             }
             for ($ii = 0; $ii < count($mail_arr); $ii++) {
                 $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                 $view = $this->getHelper('ViewRenderer')->view;
                 $this->view->emp_name = $mail_arr[$ii]['name'];
                 $this->view->type = 'InterviewSummary';
                 $this->view->requisition_data = $currentrequisition_data;
                 $this->view->candidate_details = $cand_data;
                 $this->view->round_data = $currentInterviewData;
                 $this->view->base_url = $base_url;
                 $text = $view->render('mailtemplates/requisition.phtml');
                 $options['subject'] = APPLICATION_NAME . ': Interview feedback';
                 //$options['header'] = 'Interview feedback';
                 $options['toEmail'] = $mail_arr[$ii]['email'];
                 $options['toName'] = $mail_arr[$ii]['name'];
                 $options['message'] = $text;
                 sapp_Global::_sendEmail($options, "interviewrounds_feedback", REQUISITIONMODULESENDEMAIL);
             }
         }
         $menumodel = new Default_Model_Menu();
         $objidArr = $menumodel->getMenuObjID('/scheduleinterviews');
         $objID = $objidArr[0]['id'];
         $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $tableid);
         if ($id == '') {
             $this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Interview scheduled successfully.');
         } else {
             $this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Interview details updated successfully.');
         }
         $this->_redirect('/scheduleinterviews');
     } else {
         $messages = $form->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }
 public function editAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $sess_vals = $auth->getStorage()->read();
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $messages['message'] = '';
     $id = $this->getRequest()->getParam('id', null);
     $meetingRoom = new Default_Model_Meetingroom();
     $taskModel = new Default_Model_Createtasks();
     $currprojectsModel = new Default_Model_Createprojects();
     $activityModel = new Default_Model_Createactivities();
     $requi_model = new Default_Model_Requisition();
     $usersModel = new Default_Model_Users();
     $currentUserSummary = $usersModel->getEmployeeSummaryByID($loginUserId);
     $taskAllocationModel = new Default_Model_Tasksallocation();
     $where = "";
     $actionflag = 1;
     $form = new Default_Form_createprojects();
     //$form = new Default_Form_createprojects();
     $form->setAttrib('action', DOMAIN . 'meetingroomblock/edit/id/' . $id);
     $this->view->activeprojects = $taskModel->getActiveProjects();
     $this->view->activeprojects = $taskAllocationModel->getActiveProjectsForTasksForUser($currentUserSummary['businessunit_id'], $loginUserId, $loginuserGroup);
     $this->view->projectCategories = $taskModel->getProjectCategories();
     $this->view->business_units_list = $meetingRoom->getBusinessUnits();
     $this->view->meetingrooms = $meetingRoom->getActiveMeetingRooms();
     $this->view->allusers = array();
     //$this->view->allusers = $usersModel->getAllActiveUsers();
     try {
         if ($id > 0 && is_numeric($id)) {
             //update code
             $where = "";
             $actionflag = 2;
             $id = abs($id);
             $meetingdata = $meetingRoom->getMeetingRoomDataByID($id);
             // $Currprojectdata = $currprojectsModel->getProjectDataByID($taskdata['projectid']);
             $form->submit->setLabel('Update Meeting');
             $this->view->taskpagerefresh = '0';
             $this->view->MeetingRoomID = $id;
             $this->view->loginuserGroup = $loginuserGroup;
             $this->view->form = $form;
             $this->view->isEdit = "1";
             $this->view->data = $meetingdata;
             $this->view->delta_recipents_list = $meetingRoom->getRecipentsByBU($meetingdata['businessunit']);
             if ($this->getRequest()->getPost()) {
                 $trDb = Zend_Db_Table::getDefaultAdapter();
                 // starting transaction
                 $trDb->beginTransaction();
                 try {
                     $bFlag = true;
                     //Meeting Room Details
                     $deltameetingrooms = $this->_getParam('deltameetingrooms', null);
                     $meetingDate = $this->_getParam('meetingDate', null);
                     $meetingStartTime = $this->_getParam('meetingStartTime', null);
                     $meetingEndTime = $this->_getParam('meetingEndTime', null);
                     $projectBU = $this->_getParam('projectBU', null);
                     $buResources = $this->_getParam('buResources', null);
                     $clientrecipients = $this->_getParam('clientrecipients', null);
                     $meetingtitle = $this->_getParam('meetingtitle', null);
                     $meetingnotes = $this->_getParam('meetingnotes', null);
                     $deltaOwnerResource = $this->_getParam('deltaOwnerResource', null);
                     $clientOwnerResource = $this->_getParam('clientOwnerResource', null);
                     if ($deltameetingrooms <= 0) {
                         $validationMsg['message'] = 'Please select meetingroom.';
                         $validationMsg['msgtype'] = 'error';
                         $this->view->validationMsg = $validationMsg;
                         $bFlag = false;
                     } else {
                         if (strlen(trim($meetingDate)) <= 0) {
                             $validationMsg['message'] = 'Meeting Date cannot be empty.';
                             $validationMsg['msgtype'] = 'error';
                             $this->view->validationMsg = $validationMsg;
                             $bFlag = false;
                         } else {
                             if (strlen(trim($meetingStartTime)) <= 0) {
                                 $validationMsg['message'] = 'Meeting Start Time cannot be empty.';
                                 $validationMsg['msgtype'] = 'error';
                                 $this->view->validationMsg = $validationMsg;
                                 $bFlag = false;
                             } else {
                                 if (strlen(trim($meetingEndTime)) <= 0) {
                                     $validationMsg['message'] = 'Meeting End Time cannot be empty.';
                                     $validationMsg['msgtype'] = 'error';
                                     $this->view->validationMsg = $validationMsg;
                                     $bFlag = false;
                                 } else {
                                     if (count($projectBU) <= 0) {
                                         $validationMsg['message'] = 'Please select Business Unit.';
                                         $validationMsg['msgtype'] = 'error';
                                         $this->view->validationMsg = $validationMsg;
                                         $bFlag = false;
                                     } else {
                                         if (count($buResources) <= 0) {
                                             $validationMsg['message'] = 'Please select Recipients.';
                                             $validationMsg['msgtype'] = 'error';
                                             $this->view->validationMsg = $validationMsg;
                                             $bFlag = false;
                                         } else {
                                             if (strlen(trim($meetingtitle)) <= 0) {
                                                 $validationMsg['message'] = 'Title cannot be empty.';
                                                 $validationMsg['msgtype'] = 'error';
                                                 $this->view->validationMsg = $validationMsg;
                                                 $bFlag = false;
                                             } else {
                                                 if (strlen(trim($meetingnotes)) <= 0) {
                                                     $validationMsg['message'] = 'Description cannot be empty.';
                                                     $validationMsg['msgtype'] = 'error';
                                                     $this->view->validationMsg = $validationMsg;
                                                     $bFlag = false;
                                                 } else {
                                                     if ($deltaOwnerResource <= 0) {
                                                         $validationMsg['message'] = 'Please select Delta Owner.';
                                                         $validationMsg['msgtype'] = 'error';
                                                         $this->view->validationMsg = $validationMsg;
                                                         $bFlag = false;
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     if ($bFlag) {
                         $mpolicydata = array('roomid' => trim($deltameetingrooms), 'blockmeetingdate' => trim($meetingDate), 'blockmeetingstarttime' => sapp_Global::change_time(trim($meetingStartTime) . 'database'), 'blockmeetingendtime' => sapp_Global::change_time(trim($meetingEndTime), 'database'), 'businessunit' => implode(',', $projectBU), 'createdby' => trim($loginUserId), 'title' => trim($meetingtitle), 'clientrecipients' => trim($clientrecipients), 'deltarecipients' => implode(',', $buResources), 'createddate' => gmdate("Y-m-d H:i:s"), 'description' => trim($meetingnotes), 'deltaowner' => trim($deltaOwnerResource), 'clientowner' => trim($clientOwnerResource), 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
                         $where = array('id = ?' => $id);
                         $Id = $meetingRoom->SaveorUpdateData($mpolicydata, $where);
                         $this->sendInvite(implode(',', $buResources), $loginUserId, trim($meetingDate), trim($meetingStartTime), trim($meetingEndTime), $id, $meetingnotes, $meetingtitle);
                         $menuID = 99;
                         sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
                         $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Project details successfully updated."));
                         /* } else {
                            $this->_helper->getHelper("FlashMessenger")->addMessage(array("error" => "Error while updating project details."));
                            } */
                         $trDb->commit();
                         $this->_redirect('/meetingroomblock');
                     }
                 } catch (Exception $e) {
                     $trDb->rollBack();
                     $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Something went wrong, please try again later."));
                     $this->_redirect('/meetingroomblock');
                 }
             }
         } else {
             //Insert code
             $actionflag = 1;
             if ($this->getRequest()->getPost()) {
                 #$result = $this->save($form, $policydata);
                 $trDb = Zend_Db_Table::getDefaultAdapter();
                 // starting transaction
                 $trDb->beginTransaction();
                 try {
                     $bFlag = true;
                     //Meeting Room Details
                     $deltameetingrooms = $this->_getParam('deltameetingrooms', null);
                     $meetingDate = $this->_getParam('meetingDate', null);
                     $meetingStartTime = $this->_getParam('meetingStartTime', null);
                     $meetingEndTime = $this->_getParam('meetingEndTime', null);
                     $projectBU = $this->_getParam('projectBU', null);
                     $buResources = $this->_getParam('buResources', null);
                     $clientrecipients = $this->_getParam('clientrecipients', null);
                     $meetingtitle = $this->_getParam('meetingtitle', null);
                     $meetingnotes = $this->_getParam('meetingnotes', null);
                     $deltaOwnerResource = $this->_getParam('deltaOwnerResource', null);
                     $clientOwnerResource = $this->_getParam('clientOwnerResource', null);
                     if ($deltameetingrooms <= 0) {
                         $validationMsg['message'] = 'Please select meetingroom.';
                         $validationMsg['msgtype'] = 'error';
                         $this->view->validationMsg = $validationMsg;
                         $bFlag = false;
                     } else {
                         if (strlen(trim($meetingDate)) <= 0) {
                             $validationMsg['message'] = 'Meeting Date cannot be empty.';
                             $validationMsg['msgtype'] = 'error';
                             $this->view->validationMsg = $validationMsg;
                             $bFlag = false;
                         } else {
                             if (strlen(trim($meetingStartTime)) <= 0) {
                                 $validationMsg['message'] = 'Meeting Start Time cannot be empty.';
                                 $validationMsg['msgtype'] = 'error';
                                 $this->view->validationMsg = $validationMsg;
                                 $bFlag = false;
                             } else {
                                 if (strlen(trim($meetingEndTime)) <= 0) {
                                     $validationMsg['message'] = 'Meeting End Time cannot be empty.';
                                     $validationMsg['msgtype'] = 'error';
                                     $this->view->validationMsg = $validationMsg;
                                     $bFlag = false;
                                 } else {
                                     if (count($projectBU) <= 0) {
                                         $validationMsg['message'] = 'Please select Business Unit.';
                                         $validationMsg['msgtype'] = 'error';
                                         $this->view->validationMsg = $validationMsg;
                                         $bFlag = false;
                                     } else {
                                         if (count($buResources) <= 0) {
                                             $validationMsg['message'] = 'Please select Recipients.';
                                             $validationMsg['msgtype'] = 'error';
                                             $this->view->validationMsg = $validationMsg;
                                             $bFlag = false;
                                         } else {
                                             if (strlen(trim($meetingtitle)) <= 0) {
                                                 $validationMsg['message'] = 'Title cannot be empty.';
                                                 $validationMsg['msgtype'] = 'error';
                                                 $this->view->validationMsg = $validationMsg;
                                                 $bFlag = false;
                                             } else {
                                                 if (strlen(trim($meetingnotes)) <= 0) {
                                                     $validationMsg['message'] = 'Description cannot be empty.';
                                                     $validationMsg['msgtype'] = 'error';
                                                     $this->view->validationMsg = $validationMsg;
                                                     $bFlag = false;
                                                 } else {
                                                     if ($deltaOwnerResource <= 0) {
                                                         $validationMsg['message'] = 'Please select Delta Owner.';
                                                         $validationMsg['msgtype'] = 'error';
                                                         $this->view->validationMsg = $validationMsg;
                                                         $bFlag = false;
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     $mpolicydata = array('roomid' => trim($deltameetingrooms), 'blockmeetingdate' => trim($meetingDate), 'blockmeetingstarttime' => sapp_Global::change_time(trim($meetingStartTime), 'database'), 'blockmeetingendtime' => sapp_Global::change_time(trim($meetingEndTime), 'database'), 'businessunit' => implode(',', $projectBU), 'createdby' => trim($loginUserId), 'title' => trim($meetingtitle), 'clientrecipients' => trim($clientrecipients), 'deltarecipients' => implode(',', $buResources), 'createddate' => gmdate("Y-m-d H:i:s"), 'description' => trim($meetingnotes), 'deltaowner' => trim($deltaOwnerResource), 'clientowner' => trim($clientOwnerResource), 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
                     if ($bFlag) {
                         $Id = $meetingRoom->SaveorUpdateData($mpolicydata, $where);
                         $this->sendInvite(implode(',', $buResources), $loginUserId, trim($meetingDate), trim($meetingStartTime), trim($meetingEndTime), $Id, $meetingnotes, $meetingtitle);
                         $menuID = 99;
                         sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
                         $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Project details successfully added."));
                     } else {
                         $this->_helper->getHelper("FlashMessenger")->addMessage(array("error" => "Error while adding project details."));
                     }
                     $trDb->commit();
                     $this->_redirect('/meetingroomblock');
                 } catch (Exception $e) {
                     $trDb->rollBack();
                     $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Something went wrong, please try again later."));
                     $this->_redirect('/meetingroomblock');
                 }
             }
             if ($tprojectSelected > 0) {
                 $Currprojectdata = $currprojectsModel->getProjectDataByID($tprojectSelected);
                 $this->view->BUUsers = $usersModel->getAllActiveUsersByBU($Currprojectdata['businessunit']);
             }
             $form->submit->setLabel('Add Task');
             $this->view->loginuserGroup = $loginuserGroup;
             $this->view->TaskID = "0";
             $this->view->form = $form;
             $this->view->isEdit = "0";
             $this->view->data = $mpolicydata;
         }
     } catch (Exception $e) {
         $this->view->nodata = 'nodata';
     }
 }
 public function save($form, $data)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $cand_model = new Default_Model_Candidatedetails();
     $requi_model = new Default_Model_Requisition();
     $interview_model = new Default_Model_Interviewdetails();
     $user_model = new Default_Model_Usermanagement();
     $interview_round_model = new Default_Model_Interviewrounddetails();
     $cand_status = $this->_getParam('cand_status', null);
     $interview_status = $this->_getParam('interview_status', null);
     $flag = 'true';
     if ($interview_status == 'On hold' && $cand_status != 'On hold') {
         $msgarray['statusErr'] = 'Since the interview status is onhold, the candidate status should be onhold.';
         $flag = 'false';
     }
     if ($interview_status == 'Completed' && ($cand_status != 'Disqualified' && $cand_status != 'Shortlisted')) {
         $msgarray['statusErr'] = 'Since interview status is completed, the candidate status can be either disqualified or shortlisted.';
         $flag = 'false';
     }
     if ($interview_status == 'In process' && ($cand_status == 'Disqualified' || $cand_status == 'Shortlisted')) {
         $msgarray['statusErr'] = 'Since the interview status is in process, the candidate cannot be shortlisted or disqualified.';
         $flag = 'false';
     }
     if ($form->isValid($this->_request->getPost()) && $flag != 'false') {
         $id = $this->_getParam('id', null);
         $requisition_id = $this->_getParam('req_id', null);
         $candidate_id = $this->_getParam('candidate_name', null);
         $interviewer_id = $this->_getParam('interviewer_id', null);
         $int_location = $this->_getParam('int_location', null);
         $country = $this->_getParam('country', null);
         $state = $this->_getParam('state', null);
         $city = $this->_getParam('city', null);
         $interview_mode = $this->_getParam('interview_mode', null);
         $interview_time = $this->_getParam('interview_time', null);
         $interview_date = $this->_getParam('interview_date', null);
         $interview_round = $this->_getParam('interview_round', null);
         if (!isset($candidate_id)) {
             $candidate_id = $data['id'];
         }
         if (empty($data)) {
             $getExistingCandidateRecord = $interview_model->getCandidateInInterviewProcess(trim($candidate_id));
             if ($getExistingCandidateRecord > 0) {
                 $this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Interview already scheduled for this candidate.');
                 $this->_redirect('/scheduleinterviews');
             }
         }
         if (empty($data)) {
             $idata = array('req_id' => $requisition_id, 'candidate_id' => trim($candidate_id), 'interview_status' => trim($interview_status), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $idata['interview_status'] = 'In process';
             $iwhere = "";
             $actionflag = 1;
             $iresult = $interview_model->SaveorUpdateInterviewData($idata, $iwhere);
             if ($id == '') {
                 $tableid = $iresult;
             }
             if ($iresult != '') {
                 $irdata = array('interview_id' => $iresult, 'req_id' => $requisition_id, 'candidate_id' => $candidate_id, 'interviewer_id' => $interviewer_id, 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date($interview_date, 'database'), 'interview_mode' => $interview_mode, 'interview_round_number' => 1, 'interview_round' => trim($interview_round), 'int_location' => trim($int_location), 'int_country' => trim(intval($country)), 'int_state' => trim(intval($state)), 'int_city' => trim(intval($city)), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $ir_result = $interview_round_model->SaveorUpdateInterviewroundData($irdata, '');
                 $requisition_data = $requi_model->getRequisitionDataById($requisition_id);
                 $cand_data = $cand_model->getCandidateById($candidate_id);
                 $report_person_data = $user_model->getUserDataById($interviewer_id);
                 $mail_arr = array('HR' => defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "", $report_person_data['userfullname'] => $report_person_data['emailaddress']);
                 foreach ($mail_arr as $ename => $email) {
                     $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                     $view = $this->getHelper('ViewRenderer')->view;
                     $this->view->emp_name = $ename;
                     $this->view->base_url = $base_url;
                     $this->view->candidate_name = $cand_data['candidate_name'];
                     $this->view->interview_type = $interview_mode;
                     $this->view->interview_location = $int_location;
                     $this->view->interview_date = $interview_date;
                     $this->view->interview_time = sapp_Global::change_time($interview_time, 'view');
                     $this->view->requisition_code = $requisition_data['requisition_code'];
                     $text = $view->render('mailtemplates/interviewrounds.phtml');
                     $options['subject'] = APPLICATION_NAME . ': Interview schedule';
                     $options['header'] = 'Interview schedule';
                     $options['toEmail'] = $email;
                     $options['toName'] = $ename;
                     $options['message'] = $text;
                     $options['cron'] = 'yes';
                     sapp_Global::_sendEmail($options);
                 }
                 $candData = array('cand_status' => 'Scheduled', 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $where = "id = " . $candidate_id;
                 $candResult = $cand_model->SaveorUpdateCandidateData($candData, $where);
             }
         } else {
             $idata = array('interview_status' => trim($interview_status), 'isactive' => 1, 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $iwhere = "id = " . $id;
             $tableid = $id;
             $actionflag = 2;
             $iresult = $interview_model->SaveorUpdateInterviewData($idata, $iwhere);
             $candData = array('cand_status' => 'Scheduled', 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
             if ($cand_status && $cand_status != '0') {
                 $candData['cand_status'] = $cand_status;
             }
             $where = "id = " . $candidate_id;
             $candResult = $cand_model->SaveorUpdateCandidateData($candData, $where);
         }
         $menumodel = new Default_Model_Menu();
         $objidArr = $menumodel->getMenuObjID('/scheduleinterviews');
         $objID = $objidArr[0]['id'];
         $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $tableid);
         if ($id == '') {
             $this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Interview scheduled successfully.');
         } else {
             $this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Interview details updated successfully.');
         }
         $this->_redirect('/scheduleinterviews');
     } else {
         $messages = $form->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }
 public function save($form)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $requi_model = new Default_Model_Requisition();
     $round_model = new Default_Model_Interviewrounddetails();
     $intrvwModel = new Default_Model_Interviewdetails();
     $user_model = new Default_Model_Usermanagement();
     $cand_model = new Default_Model_Candidatedetails();
     $intrvwId = $this->getRequest()->getParam('unitId');
     if ($form->isValid($this->_request->getPost())) {
         $reqData = $intrvwModel->getReqByintrvwID($intrvwId);
         if (!empty($reqData)) {
             $reqId = $reqData['req_id'];
             $candid = $reqData['candidate_id'];
             $id = $this->getRequest()->getParam('id');
             $interview_id = $intrvwId;
             $interviewer_id = $this->getRequest()->getParam('interviewer_id');
             $interview_round = $this->getRequest()->getParam('interview_round');
             $interview_mode = $this->getRequest()->getParam('interview_mode');
             $int_location = $this->getRequest()->getParam('int_location');
             $interview_time = $this->getRequest()->getParam('interview_time');
             $interview_date = $this->getRequest()->getParam('interview_date');
             $interview_feedback = $this->getRequest()->getParam('interview_feedback');
             $interview_comments = $this->getRequest()->getParam('interview_comments');
             $round_status = $this->getRequest()->getParam('round_status', null);
             $hid_round_status = $this->getRequest()->getParam('hid_round_status', null);
             $data = array('candidate_id' => $candid, 'req_id' => $reqId, 'interview_id' => trim($intrvwId), 'interviewer_id' => trim($interviewer_id), 'interview_mode' => trim($interview_mode), 'int_location' => trim($int_location), 'int_country' => trim($this->_getParam('country', null)), 'int_state' => trim($this->_getParam('state', null)), 'int_city' => trim($this->_getParam('city', null)), 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date(trim($interview_date), 'database'), 'interview_round' => trim($interview_round), 'interview_feedback' => trim($interview_feedback), 'interview_comments' => trim($interview_comments), 'round_status' => trim($round_status), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $roundnumberData = $intrvwModel->getinterviewroundnumber($interview_id);
             $roundnumber = $roundnumberData['interview_round_number'];
             $data['interview_round_number'] = $roundnumber + 1;
             $where = "";
             $actionflag = 1;
             if ($id != '') {
                 unset($data['createdby']);
                 unset($data['createdon']);
                 unset($data['isactive']);
                 unset($data['interview_round_number']);
                 $where = array("id = " . $id);
                 $tableid = $id;
                 $actionflag = 2;
                 if ($hid_round_status != '') {
                     $data = array();
                     $data['round_status'] = trim($round_status);
                 }
             }
             if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP || $loginuserGroup == EMPLOYEE_GROUP || ($loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP) && $interviewer_id == $loginUserId) {
                 unset($data['interviewer_id']);
                 unset($data['interview_mode']);
                 unset($data['int_location']);
                 unset($data['int_country']);
                 unset($data['int_state']);
                 unset($data['int_city']);
                 unset($data['interview_time']);
                 unset($data['interview_date']);
                 unset($data['interview_round']);
             }
             $result = $round_model->SaveorUpdateInterviewroundData($data, $where);
             if ($id == '') {
                 //start of mailing
                 $requisition_data = $requi_model->getRequisitionDataById($reqId);
                 $cand_data = $cand_model->getCandidateById($candid);
                 $report_person_data = $user_model->getUserDataById($interviewer_id);
                 $mail_arr = array('HR' => defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "", $report_person_data['userfullname'] => $report_person_data['emailaddress']);
                 foreach ($mail_arr as $ename => $email) {
                     $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                     $view = $this->getHelper('ViewRenderer')->view;
                     $this->view->emp_name = $ename;
                     $this->view->base_url = $base_url;
                     $this->view->candidate_name = $cand_data['candidate_name'];
                     $this->view->interview_type = $interview_mode;
                     $this->view->interview_location = $int_location;
                     $this->view->interview_date = $interview_date;
                     $this->view->interview_time = sapp_Global::change_time($interview_time, 'view');
                     $this->view->requisition_code = $requisition_data['requisition_code'];
                     $text = $view->render('mailtemplates/interviewrounds.phtml');
                     $options['subject'] = APPLICATION_NAME . ': Interview schedule';
                     $options['header'] = 'Interview schedule';
                     $options['toEmail'] = $email;
                     $options['toName'] = $ename;
                     $options['message'] = $text;
                     $options['cron'] = 'yes';
                     sapp_Global::_sendEmail($options);
                 }
                 //end of mailing
                 $tableid = $result;
                 $this->view->eventact = 'scheduled';
             } else {
                 if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP || $loginuserGroup == EMPLOYEE_GROUP || $loginuserGroup == MANAGEMENT_GROUP) {
                     $requisition_data = $requi_model->getRequisitionDataById($reqId);
                     $cand_data = $cand_model->getCandidateById($candid);
                     $round_data = $round_model->getSingleRoundData($id);
                     $report_person_data = $user_model->getUserDataById($loginUserId);
                     $mail_arr = array('HR' => defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "", $report_person_data['userfullname'] => $report_person_data['emailaddress']);
                     foreach ($mail_arr as $ename => $email) {
                         $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                         $view = $this->getHelper('ViewRenderer')->view;
                         $this->view->emp_name = $ename;
                         $this->view->base_url = $base_url;
                         $this->view->candidate_name = $cand_data['candidate_name'];
                         $this->view->interview_type = $round_data['interview_mode'];
                         $this->view->interview_location = $round_data['int_location'];
                         $this->view->interview_date = sapp_Global::change_date($round_data['interview_date'], 'view');
                         $this->view->interview_time = sapp_Global::change_time($round_data['interview_time'], 'view');
                         $this->view->interview_feedback = $interview_feedback;
                         $this->view->interview_comments = $interview_comments;
                         $this->view->round_status = $round_status;
                         $this->view->reporting_person = $report_person_data['userfullname'];
                         $text = $view->render('mailtemplates/interviewrounds_feedback.phtml');
                         $options['subject'] = APPLICATION_NAME . ': Interview feedback';
                         $options['header'] = 'Interview feedback';
                         $options['toEmail'] = $email;
                         $options['toName'] = $ename;
                         $options['message'] = $text;
                         $options['cron'] = 'yes';
                         sapp_Global::_sendEmail($options);
                     }
                 }
                 $tableid = $id;
                 $this->view->eventact = 'updated';
             }
             $menumodel = new Default_Model_Menu();
             $objidArr = $menumodel->getMenuObjID('/scheduleinterviews');
             $objID = $objidArr[0]['id'];
             $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $intrvwId);
             $close = 'close';
             $this->view->popup = $close;
             $this->view->ermsg = '';
         } else {
             $this->view->ermsg = 'nodata';
         }
     } else {
         $messages = $form->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }
 /**
  * 
  * @param type $form
  * @return type
  */
 public function save($form)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $requi_model = new Default_Model_Requisition();
     $round_model = new Default_Model_Interviewrounddetails();
     $round_reschedule_model = new Default_Model_Interviewroundrescheduledetails();
     $intrvwModel = new Default_Model_Interviewdetails();
     $user_model = new Default_Model_Usermanagement();
     $cand_model = new Default_Model_Candidatedetails();
     $roundId = $this->getRequest()->getParam('id');
     $intrvwId = $this->getRequest()->getParam('unitId');
     if ($form->isValid($this->_request->getPost())) {
         $reqData = $intrvwModel->getReqByintrvwID($intrvwId);
         if (!empty($reqData)) {
             $reqId = $reqData['req_id'];
             $candid = $reqData['candidate_id'];
             $id = $this->getRequest()->getParam('id');
             $interviewrnd_id = $intrvwId;
             $interviewer_id1 = $this->getRequest()->getParam('interviewer_id');
             if (is_array($interviewer_id1)) {
                 $interview_id = $interviewer_id1[0];
             } else {
                 $interview_id = $interviewer_id1;
             }
             $interview_round = $this->getRequest()->getParam('interview_round');
             $interview_mode = $this->getRequest()->getParam('interview_mode');
             $interview_Type_Details = $this->getRequest()->getParam('interview_Type_Details');
             $int_location = $this->getRequest()->getParam('int_location');
             $interview_time = $this->getRequest()->getParam('interview_time');
             $interview_date = $this->getRequest()->getParam('interview_date');
             $interview_feedback = $this->getRequest()->getParam('interview_feedback');
             $interview_comments = $this->getRequest()->getParam('interview_comments');
             $round_status = $this->getRequest()->getParam('round_status', null);
             $hid_round_status = $this->getRequest()->getParam('hid_round_status', null);
             if (is_array($interviewer_id1)) {
                 $interview_panel = implode(",", $this->getRequest()->getParam('interviewer_id', null));
             } else {
                 $interview_id = $interviewer_id1;
             }
             if ($id != null) {
                 //get Feedback Matrix values from Request
                 $requisitionSkillMatrix = $round_model->getRequisitionSkillMatrix($id);
                 $currRowCount = 0;
                 foreach ($requisitionSkillMatrix as $skill) {
                     $unqCode = $skill['uniquecode'];
                     $skillSelValue = $this->getRequest()->getParam($unqCode, null);
                     if ($skillSelValue != null) {
                         $requisitionSkillMatrix[$currRowCount]['Rating'] = $skillSelValue;
                     }
                     $currRowCount++;
                 }
             }
             //check if Skill matrix is filled as per business logic
             $skillsmatrixvalidate = true;
             if ($round_status == "Schedule for next round" || $round_status == "Qualified" || $round_status == "Selected" || $round_status == "Disqualified") {
                 if ($interview_round == "Technical") {
                     foreach ($requisitionSkillMatrix as $skill) {
                         if ($skill['Category'] == "Technical" && ($skill['Rating'] <= 0 || $skill['Rating'] == null)) {
                             $skillsmatrixvalidate = false;
                             break;
                         }
                     }
                 }
                 /* else if ($interview_round == "Managerial") {
                    foreach ($requisitionSkillMatrix as $skill) {
                    if ($skill['Category'] == "Non-Technical" && ($skill['Rating'] <= 0 || $skill['Rating'] == null)) {
                    $skillsmatrixvalidate = false;
                    break;
                    }
                    }
                    } */
             }
             if ($skillsmatrixvalidate != true) {
                 $alertMsg = ($interview_round == "Managerial" ? 'Non-Technical' : 'Technical') . " Skill Rating is Mandatory...!";
                 echo '<script language="javascript">';
                 echo 'alert("' . $alertMsg . '")';
                 echo '</script>';
             } else {
                 // for Interview Reschedule & Cancellations
                 if ($round_status == "Re-Scheduled-Interviewer Request" || $round_status == "Re-Scheduled-Candidate Request" || $round_status == "Cancelled") {
                     $round_data = $round_model->getSingleRoundData($id);
                     $cand_data = $cand_model->getCandidateById($candid);
                     $requisition_data = $requi_model->getRequisitionDataById($reqId);
                     $interviewpanelnamesemailaddress = $requi_model->GetInterviewPanelMamesEmailaddress($round_data['interview_panel']);
                     $loginuser_person_data = $user_model->getUserDataById($loginUserId);
                     $data = array('interviewround_id' => $id, 'interview_id' => trim($intrvwId), 'req_id' => $reqId, 'candidate_id' => $candid, 'interview_location_old' => $round_data['int_location'], 'interview_round_old' => $round_data['interview_round'], 'interview_date_old' => $round_data['interview_date'], 'interview_time_old' => $round_data['interview_time'], 'interview_mode_old' => $round_data['interview_mode'], 'interview_mode_details_old' => $round_data['interview_mode_details'], 'interview_location' => $int_location, 'interview_round' => $interview_round, 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date(trim($interview_date), 'database'), 'interview_mode' => $interview_mode, 'interview_mode_details' => $interview_Type_Details, 'interview_feedback' => trim($interview_feedback), 'round_status' => trim($round_status), 'createdby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"));
                     $result1 = $round_reschedule_model->SaveorUpdateInterviewroundData($data, "");
                     $intRound_where = array("id = " . $id);
                     if ($round_status == "Cancelled") {
                         $data_intRound = array('int_location' => $int_location, 'interview_round' => $interview_round, 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date(trim($interview_date), 'database'), 'interview_mode' => $interview_mode, 'interview_mode_details' => $interview_Type_Details, 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"), 'isactive' => 0);
                     } else {
                         $data_intRound = array('int_location' => $int_location, 'interview_round' => $interview_round, 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date(trim($interview_date), 'database'), 'interview_mode' => $interview_mode, 'interview_mode_details' => $interview_Type_Details, 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"), 'interview_panel' => $interview_panel);
                     }
                     $result2 = $round_model->SaveorUpdateInterviewroundData($data_intRound, $intRound_where);
                     if ($result1 > 0 && $result2 == "update") {
                         //send Reschedule meeting invite
                         $emailtemp = array();
                         $nametemp = array();
                         foreach ($interviewpanelnamesemailaddress as $row) {
                             array_push($emailtemp, $row['emailaddress']);
                             array_push($nametemp, $row['userfullname']);
                         }
                         $email = implode(";", $emailtemp);
                         $ename = implode(";", $nametemp);
                         $cal_unique_id = $round_data['calendarinviteid'];
                         $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                         $description = "Meeting From : " . $ename . "\r\n" . "Candidate Name : " . $cand_data['candidate_name'] . "\r\n" . "Interview Type : " . $interview_mode . "\r\n" . "Interview Location : " . $int_location . "\r\n" . "Interview Date : " . $interview_date . "\r\n" . "Interview Time : " . sapp_Global::change_time($interview_time, 'view') . "\r\n" . " " . " " . "\r\n";
                         //$view = $this->getHelper('ViewRenderer')->view;
                         //$this->view->emp_name = "Interviewer";
                         //$this->view->base_url = $base_url;
                         //$this->view->candidate_name = $cand_data['candidate_name'];
                         //$this->view->interview_type = $interview_mode;
                         //$this->view->interview_mode_details = $interview_Type_Details;
                         //$this->view->interview_location = $int_location;
                         //$this->view->interview_date = $interview_date;
                         //$this->view->interview_time = sapp_Global::change_time($interview_time, 'view');
                         //$this->view->requisition_code = $requisition_data['requisition_code'];
                         //$text = $view->render('mailtemplates/interviewrounds.phtml');
                         //$options['subject'] = APPLICATION_NAME . ': Interview schedule';
                         //$options['header'] = 'Interview schedule';
                         //$options['toEmail'] = $email;
                         //$options['toName'] = $ename;
                         //$options['message'] = $description;
                         //$options['location'] = $int_location;
                         //$options['interviewdate'] = $interview_date;
                         //$options['starttime'] = sapp_Global::add_time($interview_time, 'view', 0);
                         //$options['endtime'] = sapp_Global::add_time($interview_time, 'view', 3600);
                         //Interview Calendar Invite will be send from login user account
                         //$options['fromEmail'] = $loginuser_person_data['emailaddress'];
                         //$options['fromName'] = $loginuser_person_data['userfullname'];
                         //$options['fromEmail'] = SUPERADMIN_EMAIL;
                         //$options['fromName'] = "*****@*****.**";
                         //$options['calUniqueID'] = $cal_unique_id;
                         $calRequest = 'REQUEST';
                         if ($round_status == "Cancelled") {
                             $calRequest = 'CANCEL';
                         }
                         $interviewpanelnamesemailaddresss = $requi_model->GetInterviewPanelMamesEmailaddress($interview_panel);
                         foreach ($interviewpanelnamesemailaddresss as $interviewpanelnamesemailaddress) {
                             //sapp_Global::_sendCalendarEmail($options);
                             $from_name = trim($loginuser_person_data['userfullname']);
                             $from_address = trim($loginuser_person_data['emailaddress']);
                             $to_name = trim($interviewpanelnamesemailaddress['userfullname']);
                             $to_address = trim($interviewpanelnamesemailaddress['emailaddress']);
                             $startTime = sapp_Global::_getInterviewStartDateTime(sapp_Global::change_date($interview_date), sapp_Global::change_time(trim($interview_time)), 3600);
                             $endTime = sapp_Global::_getInterviewStartDateTime(sapp_Global::change_date($interview_date), sapp_Global::change_time(trim($interview_time)));
                             $subject = APPLICATION_NAME . ': Interview schedule';
                             $location = $int_location;
                             sapp_Global::sendIcalEvent($from_name, $from_address, $to_name, $to_address, $startTime, $endTime, $subject, $description, $location, $calRequest, $cal_unique_id);
                         }
                         $irwhere = "id = " . $result1;
                         $irdata = array('calendarinviteid' => $cal_unique_id);
                         $interview_round_model = new Default_Model_Interviewrounddetails();
                         $ir_result1 = $interview_round_model->SaveorUpdateInterviewroundData($irdata, $irwhere);
                         $this->view->eventact = 'updated';
                         $actionflag = 1;
                         $menumodel = new Default_Model_Menu();
                         $objidArr = $menumodel->getMenuObjID('/scheduleinterviews');
                         $objID = $objidArr[0]['id'];
                         $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $intrvwId);
                         $close = 'close';
                         $this->view->popup = $close;
                         $this->view->ermsg = '';
                     }
                 } else {
                     $data = array('candidate_id' => $candid, 'req_id' => $reqId, 'interview_id' => trim($intrvwId), 'interviewer_id' => $interview_id, 'interview_mode' => trim($interview_mode), 'interview_mode_details' => $interview_Type_Details, 'int_location' => trim($int_location), 'int_country' => trim($this->_getParam('country', null)), 'int_state' => trim($this->_getParam('state', null)), 'int_city' => trim($this->_getParam('city', null)), 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date(trim($interview_date), 'database'), 'interview_round' => trim($interview_round), 'interview_feedback' => trim($interview_feedback), 'interview_comments' => trim($interview_comments), 'round_status' => trim($round_status), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"), 'interview_panel' => $interview_panel);
                     if ($interviewrnd_id != null) {
                         $roundnumberData = $intrvwModel->getinterviewroundnumber($interviewrnd_id);
                         $roundnumber = $roundnumberData['interview_round_number'];
                     }
                     $data['interview_round_number'] = $roundnumber + 1;
                     $currentinterviewroundnumber = $roundnumber;
                     $where = "";
                     $actionflag = 1;
                     if ($id != '') {
                         //update skill matrix to DB
                         if ($round_status == "Schedule for next round" || $round_status == "Qualified" || $round_status == "Selected" || $round_status == "Disqualified") {
                             $skillupdateresult = $round_model->UpdateOrInsertCandidateSkillMatrix($requisitionSkillMatrix, $id, $intrvwId, $reqId, $candid, $loginUserId, $currentinterviewroundnumber);
                         }
                         unset($data['interview_panel']);
                         unset($data['createdby']);
                         unset($data['createdon']);
                         unset($data['isactive']);
                         unset($data['interview_round_number']);
                         $where = array("id = " . $id);
                         $tableid = $id;
                         $actionflag = 2;
                         if ($hid_round_status != '') {
                             $data = array();
                             $data['round_status'] = trim($round_status);
                         }
                     }
                     if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP || $loginuserGroup == EMPLOYEE_GROUP || ($loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP) && $interviewer_id == $loginUserId) {
                         unset($data['interviewer_id']);
                         unset($data['interview_mode']);
                         unset($data['int_location']);
                         unset($data['int_country']);
                         unset($data['int_state']);
                         unset($data['int_city']);
                         unset($data['interview_time']);
                         unset($data['interview_date']);
                         unset($data['interview_round']);
                     }
                     $result = $round_model->SaveorUpdateInterviewroundData($data, $where);
                     //upadating invite calander id if interview round id is numeric
                     if (is_numeric($result)) {
                         //updating calendarinviteid column in main_interviewrounddetails tabel - start
                         $startTime = sapp_Global::add_time($interview_time, 'view', 0);
                         //$domain = 'deltaintech.com';
                         //$cal_unique_id = date("Ymd\TGis", strtotime($startTime)) . rand() . "@" . $domain;
                         $irwhere = "id = " . $result;
                         $irdata = array('calendarinviteid' => $cal_unique_id);
                         $interview_round_model1 = new Default_Model_Interviewrounddetails();
                         $ir_result1 = $interview_round_model1->SaveorUpdateInterviewroundData($irdata, $irwhere);
                     }
                     //upadating invite calander id if interview round id is numeric - End
                     if ($id == '') {
                         //start of mailing
                         $requisition_data = $requi_model->getRequisitionDataById($reqId);
                         $cand_data = $cand_model->getCandidateById($candid);
                         /* $report_person_data = $user_model->getUserDataById($interviewer_id);
                            $mail_arr = array('HR' => defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "",
                            $report_person_data['userfullname'] => $report_person_data['emailaddress']
                            ); */
                         $report_person_data = $user_model->getUserDataById($interviewer_id);
                         $currentrequisition_data = $requi_model->getrequisitiondetails($reqId);
                         $requesteremailaddress = $requi_model->getemployeeemailaddress($currentrequisition_data["createdby"]);
                         $reportingmanageremailaddress = $requi_model->getemployeeemailaddress($currentrequisition_data["reporting_id"]);
                         $hrgroupemail = $requi_model->getgroupemailid("REQ_HR", $requisition_data["department_id"]);
                         $mail_arr = array('HR' => $hrgroupemail["groupEmail"], $report_person_data['userfullname'] => $report_person_data['emailaddress'], $requesteremailaddress['userfullname'] => $requesteremailaddress['emailaddress'], $reportingmanageremailaddress['userfullname'] => $reportingmanageremailaddress['emailaddress']);
                         //foreach ($mail_arr as $ename => $email) {
                         //$base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                         $description = "Meeting From : " . $ename . "\r\n" . "Candidate Name : " . $cand_data['candidate_name'] . "\r\n" . "Interview Type : " . $interview_mode . "\r\n" . "Interview Location : " . $int_location . "\r\n" . "Interview Date : " . $interview_date . "\r\n" . "Interview Time : " . sapp_Global::change_time($interview_time, 'view') . "\r\n" . " " . " " . "\r\n";
                         //$view = $this->getHelper('ViewRenderer')->view;
                         //$this->view->emp_name = $ename;
                         //$this->view->base_url = $base_url;
                         //$this->view->candidate_name = $cand_data['candidate_name'];
                         //$this->view->interview_type = $interview_mode;
                         //$interview_Type_Details
                         //$this->view->interview_location = $int_location;
                         //$this->view->interview_date = $interview_date;
                         //$this->view->interview_time = sapp_Global::change_time($interview_time, 'view');
                         //$this->view->requisition_code = $requisition_data['requisition_code'];
                         //$text = $view->render('mailtemplates/interviewrounds.phtml');
                         //$options['subject'] = APPLICATION_NAME . ': Interview schedule';
                         //$options['header'] = 'Interview schedule';
                         //$options['toEmail'] = $email;
                         //$options['toName'] = $ename;
                         //$options['message'] = $description;
                         ////$options['cron'] = 'yes';
                         //additional properties for Calendar invite -------------------START
                         //$options['interviewdate'] = $interview_date;
                         //$options['location'] = $int_location;
                         //$options['starttime'] = sapp_Global::add_time($interview_time, 'view', 0);
                         //$options['endtime'] = sapp_Global::add_time($interview_time, 'view', 3600);
                         //$options['calUniqueID'] = $cal_unique_id;
                         //additional properties for Calendar invite -------------------END
                         //sapp_Global::_sendCalendarEmail($options);
                         $loginuser_person_data = $user_model->getUserDataById($loginUserId);
                         $interviewpanelnamesemailaddresss = $requi_model->GetInterviewPanelMamesEmailaddress($interview_panel);
                         foreach ($interviewpanelnamesemailaddresss as $interviewpanelnamesemailaddress) {
                             $cal_unique_id = $this->getCalendarUniqueID();
                             $from_name = trim($loginuser_person_data['userfullname']);
                             $from_address = trim($loginuser_person_data['emailaddress']);
                             $to_name = trim($interviewpanelnamesemailaddress['userfullname']);
                             $to_address = trim($interviewpanelnamesemailaddress['emailaddress']);
                             $startTime = sapp_Global::_getInterviewStartDateTime(sapp_Global::change_date($interview_date), sapp_Global::change_time(trim($interview_time)), 3600);
                             $endTime = sapp_Global::_getInterviewStartDateTime(sapp_Global::change_date($interview_date), sapp_Global::change_time(trim($interview_time)));
                             $subject = APPLICATION_NAME . ': Interview schedule';
                             $location = $int_location;
                             $calRequest = 'REQUEST';
                             sapp_Global::sendIcalEvent($from_name, $from_address, $to_name, $to_address, $startTime, $endTime, $subject, $description, $location, $calRequest, $cal_unique_id);
                         }
                         //}
                         //end of mailing
                         $tableid = $result;
                         $this->view->eventact = 'scheduled';
                     } else {
                         if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP || $loginuserGroup == EMPLOYEE_GROUP || $loginuserGroup == MANAGEMENT_GROUP) {
                             $requisition_data = $requi_model->getRequisitionDataById($reqId);
                             $requisition_data_View = $requi_model->getReqDataForView($reqId);
                             $cand_data = $cand_model->getCandidateById($candid);
                             $round_data = $round_model->getSingleRoundData($id);
                             $report_person_data = $user_model->getUserDataById($interviewer_id);
                             $currentrequisition_data = $requi_model->getrequisitiondetails($reqId);
                             $requesteremailaddress = $requi_model->getemployeeemailaddress($currentrequisition_data["createdby"]);
                             $reportingmanageremailaddress = $requi_model->getemployeeemailaddress($currentrequisition_data["reporting_id"]);
                             //$hrgroupemail = $requi_model->getgroupemailid("REQ_HR", $requisition_data["department_id"]);
                             //HR Group
                             $mail_arr[0]['name'] = 'HR';
                             $mail_arr[0]['email'] = constant('REQ_HR_0');
                             //Requester
                             $mail_arr[1]['name'] = $requesteremailaddress['userfullname'];
                             $mail_arr[1]['email'] = $requesteremailaddress['emailaddress'];
                             //Reporting Manager
                             $mail_arr[2]['name'] = $reportingmanageremailaddress['userfullname'];
                             $mail_arr[2]['email'] = $reportingmanageremailaddress['emailaddress'];
                             //Management Group
                             $mail_arr[3]['name'] = 'Management';
                             $mail_arr[3]['email'] = constant('REQ_MGMT_0');
                             //Recruiter Panel
                             $requisition_recruiters_data = $requi_model->GetRequisitionRecruiterEmailaddress($currentrequisition_data["requisition_code"]);
                             $emailCnt = 4;
                             foreach ($requisition_recruiters_data as $requisition_recruiters_data1) {
                                 $mail_arr[$emailCnt]['name'] = $requisition_recruiters_data1['userfullname'];
                                 $mail_arr[$emailCnt]['email'] = $requisition_recruiters_data1['emailaddress'];
                                 $emailCnt = $emailCnt + 1;
                             }
                             //Technical Panel
                             $interviewpanelnamesemailaddresss = $requi_model->GetInterviewPanelMamesEmailaddress($round_data['interview_panel']);
                             foreach ($interviewpanelnamesemailaddresss as $interviewpanelnamesemailaddress1) {
                                 $mail_arr[$emailCnt]['name'] = $interviewpanelnamesemailaddress1['userfullname'];
                                 $mail_arr[$emailCnt]['email'] = $interviewpanelnamesemailaddress1['emailaddress'];
                                 $emailCnt = $emailCnt + 1;
                             }
                             for ($ii = 0; $ii < count($mail_arr); $ii++) {
                                 $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                                 $view = $this->getHelper('ViewRenderer')->view;
                                 $this->view->emp_name = $mail_arr[$ii]['name'];
                                 $this->view->type = 'InterviewFeedback';
                                 $this->view->requisition_data = $requisition_data_View[0];
                                 $this->view->candidate_details = $cand_data;
                                 $this->view->round_data = $round_data;
                                 $this->view->base_url = $base_url;
                                 $text = $view->render('mailtemplates/requisition.phtml');
                                 $options['subject'] = APPLICATION_NAME . ': Interview feedback';
                                 //$options['header'] = 'Interview feedback';
                                 $options['toEmail'] = $mail_arr[$ii]['email'];
                                 $options['toName'] = $mail_arr[$ii]['name'];
                                 $options['message'] = $text;
                                 sapp_Global::_sendEmail($options, "interviewrounds_feedback", REQUISITIONMODULESENDEMAIL);
                             }
                         }
                         $tableid = $id;
                         $this->view->eventact = 'updated';
                     }
                     $menumodel = new Default_Model_Menu();
                     $objidArr = $menumodel->getMenuObjID('/scheduleinterviews');
                     $objID = $objidArr[0]['id'];
                     $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $intrvwId);
                     $close = 'close';
                     $this->view->popup = $close;
                     $this->view->ermsg = '';
                 }
             }
         } else {
             $this->view->ermsg = 'nodata';
         }
     } else {
         $messages = $form->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }