public function addpopupAction()
 {
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->getRequest()->getParam('id');
     $msgarray = array();
     $controllername = 'appraisalcategory';
     $appraisalCategoryForm = new Default_Form_Appraisalcategory();
     $appraisalCategoryModel = new Default_Model_Appraisalcategory();
     $appraisalCategoryForm->setAction(BASE_URL . 'appraisalcategory/addpopup');
     if ($this->getRequest()->getPost()) {
         if ($appraisalCategoryForm->isValid($this->_request->getPost())) {
             $id = $this->_request->getParam('id');
             $category_name = $this->_request->getParam('category_name');
             $description = $this->_request->getParam('description');
             $actionflag = '';
             $tableid = '';
             $data = array('category_name' => $category_name, 'description' => $description, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             if ($id != '') {
                 $where = array('id=?' => $id);
                 $actionflag = 2;
             } else {
                 $data['createdby'] = $loginUserId;
                 $data['createddate'] = gmdate("Y-m-d H:i:s");
                 $data['isactive'] = 1;
                 $where = '';
                 $actionflag = 1;
             }
             $Id = $appraisalCategoryModel->SaveorUpdateAppraisalCategoryData($data, $where);
             $tableid = $Id;
             $menuID = APPRAISALCATEGORIES;
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
             $appraisalcategoryData = $appraisalCategoryModel->getAppraisalCategorysData();
             $opt = '';
             foreach ($appraisalcategoryData as $record) {
                 $opt .= sapp_Global::selectOptionBuilder($record['id'], utf8_encode($record['category_name']));
             }
             $this->view->departmentData = $opt;
             $this->view->eventact = 'added';
             $close = 'close';
             $this->view->popup = $close;
         } else {
             $messages = $appraisalCategoryForm->getMessages();
             foreach ($messages as $key => $val) {
                 foreach ($val as $key2 => $val2) {
                     $msgarray[$key] = $val2;
                     break;
                 }
             }
             $this->view->msgarray = $msgarray;
         }
     }
     $this->view->controllername = $controllername;
     $this->view->form = $appraisalCategoryForm;
     $this->view->ermsg = '';
     $this->render('form');
 }
Example #2
0
    public static function update_QsParmas_Allemps($questions, $categoryids = '')
    {
        $auth = Zend_Auth::getInstance();
        if ($auth->hasIdentity()) {
            $loginUserId = $auth->getStorage()->read()->id;
        }
        $appraisalQsModel = new Default_Model_Appraisalquestions();
        $appraisalCategoryModel = new Default_Model_Appraisalcategory();
        if ($questions != '') {
            $QsdataArr = array('isused' => 1, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
            $Qswhere = " id IN({$questions}) ";
            $QsId = $appraisalQsModel->SaveorUpdateAppraisalQuestionData($QsdataArr, $Qswhere);
        }
        if ($categoryids != '') {
            $CatdataArr = array('isused' => 1, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
            $Catwhere = " id IN({$categoryids}) ";
            $CatId = $appraisalCategoryModel->SaveorUpdateAppraisalCategoryData($CatdataArr, $Catwhere);
        }
        ?>
	    
	<?php 
    }
Example #3
0
 public function savecategoryAction()
 {
     $ajaxContext = $this->_helper->getHelper('AjaxContext');
     $ajaxContext->addActionContext('savecategory', 'json')->initContext();
     $this->_helper->layout->disableLayout();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $result['result'] = '';
     $result['id'] = '';
     $result['category_name'] = '';
     $result['description'] = '';
     $appraisalCategoryModel = new Default_Model_Appraisalcategory();
     try {
         $categoryName = trim($this->_request->getParam('category_name'));
         $description = $this->_request->getParam('description');
         $isParameterExist = $appraisalCategoryModel->checkDuplicateParameterName($categoryName);
         if (!empty($isParameterExist)) {
             if ($isParameterExist[0]['count'] > 0) {
                 $result['msg'] = 'Parameter name already exists.';
                 $result['id'] = '';
                 $result['category_name'] = '';
                 $result['description'] = '';
             } else {
                 $actionflag = '';
                 $tableid = '';
                 $data = array('category_name' => $categoryName, 'description' => $description != '' ? trim($description) : NULL, 'createdby' => $loginUserId, 'createddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $where = '';
                 $actionflag = 1;
                 $Id = $appraisalCategoryModel->SaveorUpdateAppraisalCategoryData($data, $where);
                 if ($Id) {
                     $menuID = APPRAISALCATEGORIES;
                     $logresult = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $Id);
                     $result['msg'] = 'success';
                     $result['id'] = $Id;
                     $result['category_name'] = $categoryName;
                     $result['description'] = $description;
                 } else {
                     $result['msg'] = 'error';
                     $result['id'] = '';
                     $result['groupname'] = '';
                     $result['description'] = '';
                 }
             }
         }
     } catch (Exception $e) {
         $result['msg'] = $e->getMessage();
         $result['id'] = '';
         $result['groupname'] = '';
         $result['description'] = '';
     }
     $this->_helper->json($result);
 }