public function deleteAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('objid');
     $messages['message'] = '';
     $messages['msgtype'] = '';
     $count = 0;
     $actionflag = 3;
     if ($id) {
         $appraisalCategoryModel = new Default_Model_Appraisalcategory();
         $appCategorydata = $appraisalCategoryModel->getAppraisalCategoryDatabyID($id);
         if ($appCategorydata[0]['isused'] == 0) {
             $appQuestionModel = new Default_Model_Appraisalquestions();
             $appQuesData = $appQuestionModel->getAppraisalQuestionsByCategotyID($id);
             $d = array();
             foreach ($appQuesData as $key => $value) {
                 $d[] = $value['id'];
             }
             $d = implode(',', $d);
             if (sizeof($appQuesData) == 0) {
                 $data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $where = array('id=?' => $id);
                 $Id = $appraisalCategoryModel->SaveorUpdateAppraisalCategoryData($data, $where);
                 if ($Id == 'update') {
                     $menuID = APPRAISALCATEGORIES;
                     $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
                     /***
                     			** commented on 29-04-2015 by sapplica
                     			** need to integrate mail template
                     				$configmail = sapp_Global::send_configuration_mail('Category',$appCategorydata[0]['category_name']);	
                     			***/
                     $messages['message'] = 'Parameter deleted successfully.';
                     $messages['msgtype'] = 'success';
                 } else {
                     $messages['message'] = 'Parameter cannot be deleted.';
                     $messages['msgtype'] = 'error';
                 }
             } else {
                 $messages['message'] = 'Parameter cannot be deleted as there are active questions assigned to it.';
                 $messages['msgtype'] = 'error';
             }
             if (sizeof($appQuesData) > 0) {
                 $data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $where = array('id=?' => $id);
                 $Id = $appraisalCategoryModel->SaveorUpdateAppraisalCategoryData($data, $where);
                 $appQuestionModel->UpdateAppraisalQuestionData($d);
                 if ($Id == 'update') {
                     $menuID = APPRAISALCATEGORIES;
                     $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
                     /***
                     			 ** commented on 29-04-2015 by sapplica
                     			 ** need to integrate mail template
                     			 $configmail = sapp_Global::send_configuration_mail('Category',$appCategorydata[0]['category_name']);
                     			***/
                     $messages['message'] = 'Parameter deleted successfully.';
                     $messages['msgtype'] = 'success';
                 } else {
                     $messages['message'] = 'Parameter cannot be deleted.';
                     $messages['msgtype'] = 'error';
                 }
             }
         } else {
             $messages['message'] = 'Parameter cannot be deleted as it is being used in appraisal process.';
             $messages['msgtype'] = 'error';
         }
     } else {
         $messages['message'] = 'Parameter cannot be deleted.';
         $messages['msgtype'] = 'error';
     }
     $this->_helper->json($messages);
 }
 public function deleteAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('objid');
     $messages['message'] = '';
     $messages['msgtype'] = '';
     $count = 0;
     $actionflag = 3;
     if ($id) {
         $appraisalCategoryModel = new Default_Model_Appraisalcategory();
         $menumodel = new Default_Model_Menu();
         $appCategorydata = $appraisalCategoryModel->getAppraisalCategoryDatabyID($id);
         if ($appCategorydata[0]['isused'] == 0) {
             $appQuestionModel = new Default_Model_Appraisalquestions();
             $appQuesData = $appQuestionModel->getAppraisalQuestionsByCategotyID($id);
             if (sizeof($appQuesData) == 0) {
                 $data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $where = array('id=?' => $id);
                 $Id = $appraisalCategoryModel->SaveorUpdateAppraisalCategoryData($data, $where);
                 if ($Id == 'update') {
                     $menuidArr = $menumodel->getMenuObjID('/appraisalcategory');
                     $menuID = $menuidArr[0]['id'];
                     $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
                     $configmail = sapp_Global::send_configuration_mail('Category', $appCategorydata[0]['category_name']);
                     $messages['message'] = 'Category deleted successfully.';
                     $messages['msgtype'] = 'success';
                 } else {
                     $messages['message'] = 'Category cannot be deleted.';
                     $messages['msgtype'] = 'error';
                 }
             } else {
                 $messages['message'] = 'Category cannot be deleted. Delete the questions under this category.';
                 $messages['msgtype'] = 'error';
             }
         } else {
             $messages['message'] = 'Category cannot be deleted as its using in appraisal process.';
             $messages['msgtype'] = 'error';
         }
     } else {
         $messages['message'] = 'Category cannot be deleted.';
         $messages['msgtype'] = 'error';
     }
     $this->_helper->json($messages);
 }