Ejemplo n.º 1
0
 public function updateprivilegesforallemployees($initializestep, $appraisaldata)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
         $loginuserArr = array('loginuserid' => $loginUserId, 'loginuserrole' => $loginuserRole, 'loginusergroup' => $loginuserGroup);
         $loginUserEmpId = $auth->getStorage()->read()->employeeId;
         $loginUserfullname = $auth->getStorage()->read()->userfullname;
     }
     $appraisalQsModel = new Default_Model_Appraisalquestions();
     $app_init_model = new Default_Model_Appraisalinit();
     $appraisalPrivMainModel = new Default_Model_Appraisalqsmain();
     $appraisalPrivTempModel = new Default_Model_Appraisalqstemp();
     $appraisalempratingsmodel = new Default_Model_Appraisalemployeeratings();
     $usersmodel = new Default_Model_Users();
     $departmentsmodel = new Default_Model_Departments();
     $announcementsModel = new Default_Model_Announcements();
     $deptids = '';
     $title = 'Performance Appraisal';
     $description = 'Performance appraisal initialized';
     //echo '<pre>';print_r($this->getRequest()->getPost());exit;
     $questionArr = $this->_request->getParam('check');
     $managercmntsArr = $this->_request->getParam('mgrcmnt');
     $managerratingsArr = $this->_request->getParam('mgrrating');
     $empratingsArr = $this->_request->getParam('empratings');
     $empcmntsArr = $this->_request->getParam('empcmnt');
     $appraisalid = $this->_request->getParam('appraisalid');
     $initializeflag = $this->_request->getParam('initializeflag');
     $initializestep = $this->_request->getParam('initializestep');
     $group_settings = $this->_request->getParam('group_settings');
     $finalarray = array();
     $msgarray = array();
     $mgrIndex = 'MC';
     $mgrratIndex = 'MR';
     $empIndex = 'EC';
     $empratIndex = 'ER';
     $questions = '';
     $qsprivileges = '';
     $trDb = Zend_Db_Table::getDefaultAdapter();
     $trDb->beginTransaction();
     try {
         if (!empty($questionArr)) {
             for ($i = 0; $i < sizeof($questionArr); $i++) {
                 if (isset($managercmntsArr[$questionArr[$i]])) {
                     $managercomments = 1;
                 } else {
                     $managercomments = 0;
                 }
                 if (isset($managerratingsArr[$questionArr[$i]])) {
                     $managerratings = 1;
                 } else {
                     $managerratings = 0;
                 }
                 if (isset($empratingsArr[$questionArr[$i]])) {
                     $empratings = 1;
                 } else {
                     $empratings = 0;
                 }
                 if (isset($empcmntsArr[$questionArr[$i]])) {
                     $empcomments = 1;
                 } else {
                     $empcomments = 0;
                 }
                 /*$finalstring = '{'."$mgrratIndex:1,$mgrIndex:$managercomments,$empratIndex:$empratings,$empIndex:$empcomments".'}';
                 		$finalarray[$questionArr[$i]] = $finalstring;
                 		$finalstring = '';*/
                 $commntsarry = array($mgrratIndex => $managerratings, $mgrIndex => $managercomments, $empratIndex => $empratings, $empIndex => $empcomments);
                 $finalarray[$questionArr[$i]] = $commntsarry;
             }
             $questions = implode(',', $questionArr);
             $qsprivileges = json_encode($finalarray, true);
             $tablename = 'main_pa_questions_privileges_temp';
             /* Updating Group settings if it is 0 */
             if ($group_settings == 0) {
                 $updatestatus = $app_init_model->updategroupsettings(1, $appraisalid);
             }
             /* End */
             /* Updating privileges tables with questions */
             $privilegesdata = array('hr_qs' => $questions, 'hr_group_qs_privileges' => $qsprivileges, 'modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $privielgeswhere = " pa_initialization_id = '" . $appraisalid . "' and module_flag=1 and isactive= 1 ";
             $updateprivileges = $appraisalPrivTempModel->SaveorUpdateData($privilegesdata, $privielgeswhere);
             //$updateprivileges = $appraisalQsModel->updatequestionprivileges($tablename,$questions, $qsprivileges,$appraisalid,$loginuserArr);
             /* End */
             $initdata = array('initialize_status' => 2, 'modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $initwhere = array('id=?' => $appraisalid);
             /**  Initialization 
              * If initialize
              * Inserting to main table from temp table
              * Updating temp table to isactive 0
              * Updating initialization status in initialization table
              * Sending mails to managers
              * Else
              * Updating initialization status in initialization table
              */
             if ($initializestep == 1) {
                 $initdata['initialize_status'] = 1;
                 $insertQstable = $appraisalQsModel->insertQsData($appraisalid, $loginuserArr);
                 $updateTmptable = $appraisalPrivTempModel->updateQsTempData($appraisalid, $loginuserArr);
                 $app_init_model->SaveorUpdateAppraisalInitData($initdata, $initwhere);
                 if ($appraisaldata['enable_step'] == 2) {
                     /**
                      * Start 
                      * Inserting or Updating employee ratings table when enabled to employees
                      * If record exists then updating else inserting
                      */
                     $employeeidArr = $appraisalPrivMainModel->getemployeeIDs($appraisalid);
                     if (!empty($employeeidArr)) {
                         foreach ($employeeidArr as $emp) {
                             $emprating_Arr = array('pa_initialization_id' => $appraisalid, 'employee_id' => $emp['employee_id'], 'line_manager_1' => $emp['line_manager_1'] != '' ? $emp['line_manager_1'] : NULL, 'line_manager_2' => $emp['line_manager_2'] != '' ? $emp['line_manager_2'] : NULL, 'line_manager_3' => $emp['line_manager_3'] != '' ? $emp['line_manager_3'] : NULL, 'line_manager_4' => $emp['line_manager_4'] != '' ? $emp['line_manager_4'] : NULL, 'line_manager_5' => $emp['line_manager_5'] != '' ? $emp['line_manager_5'] : NULL, 'modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                             $employeeexistArr = $appraisalempratingsmodel->checkEmployeeExists($appraisalid, $emp['employee_id']);
                             if ($employeeexistArr[0]['empcount'] > 0) {
                                 $qwhere = " employee_id = '" . $emp['employee_id'] . "' and pa_initialization_id='" . $appraisalid . "' and isactive=1";
                             } else {
                                 $emprating_Arr['createdby'] = $loginUserId;
                                 $emprating_Arr['createdby_role'] = $loginuserRole;
                                 $emprating_Arr['createdby_group'] = $loginuserGroup;
                                 $emprating_Arr['createddate'] = gmdate("Y-m-d H:i:s");
                                 $qwhere = '';
                             }
                             $appraisalempratingsmodel->SaveorUpdateAppraisalSkillsData($emprating_Arr, $qwhere);
                             /**
                              * End updating emp ratings table
                              */
                         }
                     }
                 }
                 //enable_step=2 scenario
                 //Logs storing
                 $actionflag = 1;
                 $tableid = '';
                 $menuID = INITIALIZE_APPRAISAL;
                 sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
                 /**
                  * Sending mails to HR,Super Admin,Management,(managers OR employees) based on enable step.
                  */
                 $appraisalratingsmodel = new Default_Model_Appraisalratings();
                 $app_manager_model = new Default_Model_Appraisalmanager();
                 //to get initialization details using appraisal Id for Business Unit,Department,To Year
                 $appraisal_details = $appraisalratingsmodel->getappdata($appraisalid);
                 if (!empty($appraisal_details)) {
                     $businessUnit = $appraisal_details['businessunit_id'];
                     $department = $appraisal_details['deptid'];
                     $bunit = $appraisal_details['unitname'];
                     $dept = $appraisal_details['deptname'];
                     $to_year = $appraisal_details['to_year'];
                     $appraisalconfigmodel = new Default_Model_Appraisalconfig();
                     if ($department != '') {
                         $employeeDetailsArr = $appraisalconfigmodel->getUserDetailsByID($businessUnit, $department);
                     } else {
                         $employeeDetailsArr = $appraisalconfigmodel->getUserDetailsByID($businessUnit, '');
                     }
                     $dept_str = $dept == '' ? " " : "and department <b>{$dept}</b> ";
                     $emp_id_str = $loginuserRole == SUPERADMINROLE ? " " : "({$loginUserEmpId})";
                     //Preparing Employee array for Bcc
                     $empArr = array();
                     if (!empty($employeeDetailsArr)) {
                         $empArrList = '';
                         foreach ($employeeDetailsArr as $emp) {
                             array_push($empArr, $emp['emailaddress']);
                         }
                     }
                     $mail_str = $appraisaldata['enable_step'] == 1 ? 'to managers' : 'to employees';
                     $empmgrArr = array();
                     if ($appraisaldata['enable_step'] == 1) {
                         $getLine1ManagerId = $appraisalPrivMainModel->getLine1ManagerIdMain($appraisalid);
                         foreach ($getLine1ManagerId as $mgr) {
                             array_push($empmgrArr, $mgr['emailaddress']);
                         }
                     } else {
                         $empIdArr = array();
                         $empIdList = '';
                         $employeeidArr = $appraisalPrivMainModel->getemployeeIDs($appraisalid);
                         //fetching Employee Ids
                         if (!empty($employeeidArr)) {
                             foreach ($employeeidArr as $emp) {
                                 array_push($empIdArr, $emp['employee_id']);
                             }
                             $empIdList = implode(',', $empIdArr);
                             //Preparing Employee Id List
                             $empDetailsArr = $app_manager_model->getUserDetailsByEmpID($empIdList);
                             //Fetching employee details
                             if (!empty($empDetailsArr)) {
                                 foreach ($empDetailsArr as $emp) {
                                     array_push($empmgrArr, $emp['emailaddress']);
                                     //preparing Bcc array
                                 }
                             }
                         }
                     }
                     $totalArr = array_merge($empArr, $empmgrArr);
                     //Sending mail to Super admin
                     $options['subject'] = APPLICATION_NAME . ': Performance Appraisal Initialization';
                     $options['header'] = 'Performance Appraisal Initialization : ' . $to_year;
                     $options['toEmail'] = SUPERADMIN_EMAIL;
                     $options['toName'] = 'Super Admin';
                     $options['bcc'] = $totalArr;
                     $options['message'] = "<div style='padding: 0; text-align: left; font-size:14px; font-family:Arial, Helvetica, sans-serif;'>\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span style='color:#3b3b3b;'>Hi,</span><br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 0 0;color:#3b3b3b;'>Performance appraisal has been initialized {$mail_str} for the year <b>{$to_year}</b> for business unit <b>{$bunit}</b>  {$dept_str} by " . $loginUserfullname . $emp_id_str . " </div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 10px 0;'>Please <a href=" . BASE_URL . " target='_blank' style='color:#b3512f;'>click here</a> to login  to your <b>" . APPLICATION_NAME . "</b> account to check the details.</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div> ";
                     $mail_id = sapp_Global::_sendEmail($options);
                 }
                 sapp_PerformanceHelper::update_QsParmas_Allemps($questions, $appraisaldata['category_id']);
             } else {
                 $app_init_model->SaveorUpdateAppraisalInitData($initdata, $initwhere);
             }
             $trDb->commit();
             if ($initializestep == 1) {
                 $msgarray = $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => 'Appraisal initialized successfully'));
                 $this->_redirect('appraisalinit');
             } else {
                 $msgarray = $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => 'Appraisal configurations are saved to be initialized later.'));
                 $this->_redirect('appraisalinit/assigngroups/i/' . sapp_Global::_encrypt($appraisalid));
             }
         }
     } catch (Exception $e) {
         $trDb->rollBack();
         $msgarray = $this->_helper->getHelper("FlashMessenger")->addMessage(array("error" => $e->getMessage()));
     }
     return $msgarray;
 }
 public function updateprivilegesforallemployees($initializestep, $appraisaldata)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
         $loginuserArr = array('loginuserid' => $loginUserId, 'loginuserrole' => $loginuserRole, 'loginusergroup' => $loginuserGroup);
     }
     $appraisalQsModel = new Default_Model_Appraisalquestions();
     $app_init_model = new Default_Model_Appraisalinit();
     $appraisalPrivMainModel = new Default_Model_Appraisalqsmain();
     $appraisalPrivTempModel = new Default_Model_Appraisalqstemp();
     $appraisalempratingsmodel = new Default_Model_Appraisalemployeeratings();
     $usersmodel = new Default_Model_Users();
     $departmentsmodel = new Default_Model_Departments();
     $announcementsModel = new Default_Model_Announcements();
     $deptids = '';
     $title = 'Performance Appraisal';
     $description = 'Performance appraisal initialized';
     //echo '<pre>';print_r($this->getRequest()->getPost());exit;
     $questionArr = $this->_request->getParam('check');
     $managercmntsArr = $this->_request->getParam('mgrcmnt');
     $managerratingsArr = $this->_request->getParam('mgrrating');
     $empratingsArr = $this->_request->getParam('empratings');
     $empcmntsArr = $this->_request->getParam('empcmnt');
     $appraisalid = $this->_request->getParam('appraisalid');
     $initializeflag = $this->_request->getParam('initializeflag');
     $initializestep = $this->_request->getParam('initializestep');
     $group_settings = $this->_request->getParam('group_settings');
     $finalarray = array();
     $msgarray = array();
     $mgrIndex = 'MC';
     $mgrratIndex = 'MR';
     $empIndex = 'EC';
     $empratIndex = 'ER';
     $questions = '';
     $qsprivileges = '';
     $trDb = Zend_Db_Table::getDefaultAdapter();
     $trDb->beginTransaction();
     try {
         if (!empty($questionArr)) {
             for ($i = 0; $i < sizeof($questionArr); $i++) {
                 if (isset($managercmntsArr[$questionArr[$i]])) {
                     $managercomments = 1;
                 } else {
                     $managercomments = 0;
                 }
                 if (isset($managerratingsArr[$questionArr[$i]])) {
                     $managerratings = 1;
                 } else {
                     $managerratings = 0;
                 }
                 if (isset($empratingsArr[$questionArr[$i]])) {
                     $empratings = 1;
                 } else {
                     $empratings = 0;
                 }
                 if (isset($empcmntsArr[$questionArr[$i]])) {
                     $empcomments = 1;
                 } else {
                     $empcomments = 0;
                 }
                 /*$finalstring = '{'."$mgrratIndex:1,$mgrIndex:$managercomments,$empratIndex:$empratings,$empIndex:$empcomments".'}';
                 		$finalarray[$questionArr[$i]] = $finalstring;
                 		$finalstring = '';*/
                 $commntsarry = array($mgrratIndex => $managerratings, $mgrIndex => $managercomments, $empratIndex => $empratings, $empIndex => $empcomments);
                 $finalarray[$questionArr[$i]] = $commntsarry;
             }
             $questions = implode(',', $questionArr);
             $qsprivileges = json_encode($finalarray, true);
             $tablename = 'main_pa_questions_privileges_temp';
             /* Updating Group settings if it is 0 */
             if ($group_settings == 0) {
                 $updatestatus = $app_init_model->updategroupsettings(1, $appraisalid);
             }
             /* End */
             /* Updating privileges tables with questions */
             $privilegesdata = array('hr_qs' => $questions, 'hr_group_qs_privileges' => $qsprivileges, 'modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $privielgeswhere = " pa_initialization_id = '" . $appraisalid . "' and module_flag=1 and isactive= 1 ";
             $updateprivileges = $appraisalPrivTempModel->SaveorUpdateData($privilegesdata, $privielgeswhere);
             //$updateprivileges = $appraisalQsModel->updatequestionprivileges($tablename,$questions, $qsprivileges,$appraisalid,$loginuserArr);
             /* End */
             $initdata = array('initialize_status' => 2, 'modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $initwhere = array('id=?' => $appraisalid);
             /**  Initialization 
              * If initialize
              * Inserting to main table from temp table
              * Updating temp table to isactive 0
              * Updating initialization status in initialization table
              * Sending mails to managers
              * Else
              * Updating initialization status in initialization table
              */
             if ($initializestep == 1) {
                 $initdata['initialize_status'] = 1;
                 $insertQstable = $appraisalQsModel->insertQsData($appraisalid, $loginuserArr);
                 $updateTmptable = $appraisalPrivTempModel->updateQsTempData($appraisalid, $loginuserArr);
                 $app_init_model->SaveorUpdateAppraisalInitData($initdata, $initwhere);
                 /**
                  * Sending mails to managers OR employees based on enable step.
                  */
                 if ($appraisaldata['enable_step'] == 1) {
                     /**
                      * Start 
                      * Sending Mails to Managers if enabled to managers
                      */
                     $getLine1ManagerId = $appraisalPrivMainModel->getLine1ManagerIdMain($appraisalid);
                     if (!empty($getLine1ManagerId)) {
                         foreach ($getLine1ManagerId as $val) {
                             $options['subject'] = APPLICATION_NAME . ': Performance Appraisal Initiated.';
                             $options['header'] = 'Performance Appraisal';
                             $options['toEmail'] = $val['emailaddress'];
                             $options['toName'] = $val['userfullname'];
                             $options['message'] = 'Dear ' . $val['userfullname'] . ', performance appraisal initiated.';
                             $options['cron'] = 'yes';
                             // sapp_Global::_sendEmail($options);
                         }
                     }
                     /**
                      * Mail to performance appraisal group
                      */
                     if (defined('PER_APPRAISAL_' . $appraisaldata['businessunit_id']) && $appraisaldata['businessunit_id'] != '') {
                         $options['subject'] = APPLICATION_NAME . ': Performance Appraisal Initiated To managers.';
                         $options['header'] = 'Performance Appraisal';
                         $options['toEmail'] = constant('PER_APPRAISAL_' . $appraisaldata['businessunit_id']);
                         $options['toName'] = 'Performance Appraisal';
                         $options['message'] = 'Performance appraisal initiated to managers.';
                         $options['cron'] = 'yes';
                         //sapp_Global::_sendEmail($options);
                     }
                     /**
                      * End
                      */
                 } else {
                     /**
                      * Start 
                      * Inserting or Updating employee ratings table when enabled to employees
                      * If record exists then updating else inserting
                      */
                     $employeeidArr = $appraisalPrivMainModel->getemployeeIDs($appraisalid);
                     if (!empty($employeeidArr)) {
                         foreach ($employeeidArr as $emp) {
                             $emprating_Arr = array('pa_initialization_id' => $appraisalid, 'employee_id' => $emp['employee_id'], 'line_manager_1' => $emp['line_manager_1'] != '' ? $emp['line_manager_1'] : NULL, 'line_manager_2' => $emp['line_manager_2'] != '' ? $emp['line_manager_2'] : NULL, 'line_manager_3' => $emp['line_manager_3'] != '' ? $emp['line_manager_3'] : NULL, 'line_manager_4' => $emp['line_manager_4'] != '' ? $emp['line_manager_4'] : NULL, 'line_manager_5' => $emp['line_manager_5'] != '' ? $emp['line_manager_5'] : NULL, 'modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                             $employeeexistArr = $appraisalempratingsmodel->checkEmployeeExists($appraisalid, $emp['employee_id']);
                             if ($employeeexistArr[0]['empcount'] > 0) {
                                 $qwhere = " employee_id = '" . $emp['employee_id'] . "' and pa_initialization_id='" . $appraisalid . "' and isactive=1";
                             } else {
                                 $emprating_Arr['createdby'] = $loginUserId;
                                 $emprating_Arr['createdby_role'] = $loginuserRole;
                                 $emprating_Arr['createdby_group'] = $loginuserGroup;
                                 $emprating_Arr['createddate'] = gmdate("Y-m-d H:i:s");
                                 $qwhere = '';
                             }
                             $appraisalempratingsmodel->SaveorUpdateAppraisalSkillsData($emprating_Arr, $qwhere);
                             /**
                              * End
                              */
                             /** Start
                              * Sending Mails to employees
                              */
                             $employeeDetailsArr = $usersmodel->getUserDetailsByID($emp['employee_id'], '');
                             if (!empty($employeeDetailsArr)) {
                                 $options['subject'] = APPLICATION_NAME . ': Performance Appraisal Initiated.';
                                 $options['header'] = 'Performance Appraisal';
                                 $options['toEmail'] = $employeeDetailsArr[0]['emailaddress'];
                                 $options['toName'] = $employeeDetailsArr[0]['userfullname'];
                                 $options['message'] = 'Dear ' . $employeeDetailsArr[0]['userfullname'] . ', performance appraisal initiated.';
                                 $options['cron'] = 'yes';
                                 //  sapp_Global::_sendEmail($options);
                             }
                             /**
                              * End
                              */
                         }
                     }
                     if (defined('PER_APPRAISAL_' . $appraisaldata['businessunit_id']) && $appraisaldata['businessunit_id'] != '') {
                         $options['subject'] = APPLICATION_NAME . ': Performance Appraisal Initiated To Employees.';
                         $options['header'] = 'Performance Appraisal';
                         $options['toEmail'] = constant('PER_APPRAISAL_' . $appraisaldata['businessunit_id']);
                         $options['toName'] = 'Performance Appraisal';
                         $options['message'] = 'Performance appraisal initiated to employees.';
                         $options['cron'] = 'yes';
                         // sapp_Global::_sendEmail($options);
                     }
                 }
                 /**
                  * End Sending Mails and updating emp ratings table
                  */
                 /** Start
                  * Announecements
                  */
                 if ($appraisaldata['enable_step'] == 2) {
                     $appImpleData = sapp_PerformanceHelper::check_per_implmentation($appraisaldata['businessunit_id'], $appraisaldata['department_id']);
                     if ($appImpleData['performance_app_flag'] == 1) {
                         $deptArr = $departmentsmodel->getAllDeptsForUnit($appraisaldata['businessunit_id']);
                         if (!empty($deptArr)) {
                             foreach ($deptArr as $dept) {
                                 $deptids .= $dept['id'] . ',';
                             }
                             $deptids = rtrim($deptids, ',');
                         }
                     } else {
                         $deptids = $initialize_Arr['deptid'];
                     }
                     /*	$announcement_arr = array(
                                                   'businessunit_id' => $appraisaldata['businessunit_id']!=''?$appraisaldata['businessunit_id']:NULL,
                                                   'department_id' => $deptids!=''?$deptids:NULL,
                                                   'title' => $title,
                                                   'description' => $description,
                                                   'attachments' => NULL,
                                                   'status' => 2,
                                                   'isactive' => 1,
                     			'createdby' => $loginUserId,
                     						'createdby_role'=>$loginuserRole,
                     			'createdby_group'=>$loginuserGroup,
                                                   'modifiedby' => $loginUserId,
                     						'modifiedby_role'=>$loginuserRole,
                     			'modifiedby_group'=>$loginuserGroup,
                     			'createddate'=>gmdate("Y-m-d H:i:s"),
                                                   'modifieddate'=>gmdate("Y-m-d H:i:s")
                                       			);
                                       			
                                       	$Id = $announcementsModel->SaveorUpdateAnnouncementsData($announcement_arr, ''); */
                 }
                 /**
                  * End
                  */
                 sapp_PerformanceHelper::update_QsParmas_Allemps($questions, $appraisaldata['category_id']);
             } else {
                 $app_init_model->SaveorUpdateAppraisalInitData($initdata, $initwhere);
             }
             $trDb->commit();
             if ($initializestep == 1) {
                 $msgarray = $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => 'Appraisal initialized successfully'));
                 $this->_redirect('appraisalinit');
             } else {
                 $msgarray = $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => 'Appraisal configurations are saved to be initialized later.'));
                 $this->_redirect('appraisalinit/assigngroups/i/' . sapp_Global::_encrypt($appraisalid));
             }
         }
     } catch (Exception $e) {
         $trDb->rollBack();
         $msgarray = $this->_helper->getHelper("FlashMessenger")->addMessage(array("error" => $e->getMessage()));
     }
     return $msgarray;
 }