public function addAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $leavemanagementform = new Default_Form_leavemanagement();
     $leavemanagementmodel = new Default_Model_Leavemanagement();
     $requi_model = new Default_Model_Requisition();
     $monthslistmodel = new Default_Model_Monthslist();
     $weekdaysmodel = new Default_Model_Weekdays();
     $busineesUnitModel = new Default_Model_Businessunits();
     $departmentsmodel = new Default_Model_Departments();
     $msgarray = array();
     $bu_msg = '';
     $months_msg = '';
     $days_msg = '';
     $businessunitData = $busineesUnitModel->getDeparmentList();
     //getDeparmentList --- gets the business units
     if (sizeof($businessunitData) > 0) {
         $leavemanagementform->businessunit->addMultiOption('0', 'No Business Unit');
         foreach ($businessunitData as $businessunitres) {
             $leavemanagementform->businessunit->addMultiOption($businessunitres['id'], $businessunitres['unitname']);
         }
         $department_ids = $leavemanagementmodel->getActiveDepartmentIds();
         $deptstr = '';
         if (!empty($department_ids)) {
             foreach ($department_ids as $depid) {
                 $deptstr .= $depid['deptid'] . ",";
             }
             $deptstr = rtrim($deptstr, ',');
         } else {
             $msgarray['department_id'] = 'Departments are not added yet.';
         }
         if (isset($_POST['businessunit']) && $_POST['businessunit'] != '') {
             $departments_list = $departmentsmodel->getUniqueDepartmentList($deptstr, $_POST['businessunit']);
             foreach ($departments_list as $departmentsres) {
                 $leavemanagementform->department_id->addMultiOption($departmentsres['id'], utf8_encode($departmentsres['deptname']));
             }
         } else {
             $departments_list = $departmentsmodel->getUniqueDepartmentList($deptstr, '0');
             foreach ($departments_list as $departmentsres) {
                 $leavemanagementform->department_id->addMultiOption($departmentsres['id'], utf8_encode($departmentsres['deptname']));
             }
         }
     } else {
         $msgarray['businessunit'] = 'Business units are not added yet.';
         $msgarray['department_id'] = 'Departments are not added yet.';
         $bu_msg = 'no bu';
     }
     $monthslistdata = $monthslistmodel->getMonthlistData();
     if (sizeof($monthslistdata) > 0) {
         foreach ($monthslistdata as $monthslistres) {
             $leavemanagementform->cal_startmonth->addMultiOption($monthslistres['month_id'], utf8_encode($monthslistres['month_name']));
         }
     } else {
         $msgarray['cal_startmonth'] = 'Months list is not configured yet.';
         $months_msg = 'no months';
     }
     $weekdaysdata = $weekdaysmodel->getWeeklistData();
     if (sizeof($weekdaysdata) > 0) {
         foreach ($weekdaysdata as $weekdaysres) {
             $leavemanagementform->weekend_startday->addMultiOption($weekdaysres['day_id'], utf8_encode($weekdaysres['day_name']));
             $leavemanagementform->weekend_endday->addMultiOption($weekdaysres['day_id'], utf8_encode($weekdaysres['day_name']));
         }
     } else {
         $msgarray['weekend_startday'] = 'Weekdays are not configured yet.';
         $msgarray['weekend_endday'] = 'Weekdays are not configured yet.';
         $days_msg = 'no weeks';
     }
     $leavemanagementform->setAttrib('action', BASE_URL . 'leavemanagement/add');
     $this->view->form = $leavemanagementform;
     $this->view->bu_msg = $bu_msg;
     $this->view->months_msg = $months_msg;
     $this->view->days_msg = $days_msg;
     $this->view->msgarray = $msgarray;
     if ($this->getRequest()->getPost()) {
         $result = $this->save($leavemanagementform);
         $this->view->msgarray = $result;
     }
 }