$pplf = new PayPeriodListFactory();
 $pplf->getByCompanyId($current_company->getId());
 $pay_period_options = $pplf->getArrayByListFactory($pplf, FALSE, FALSE);
 $pay_period_ids = array_keys((array) $pay_period_options);
 if (isset($pay_period_ids[0]) and (!isset($filter_data['pay_period_id']) or $filter_data['pay_period_id'] == '')) {
     $filter_data['pay_period_id'] = '-1';
 }
 $filter_data['pay_period_status_id'] = array(10);
 $filter_data['type_id'] = array(30, 40, 50, 55, 60, 70);
 if (isset($filter_data['pre_mature'])) {
     $filter_data['type_id'][] = 5;
 }
 $elf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data, $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array);
 $pager = new Pager($elf);
 $epf = new ExceptionPolicyFactory();
 $exception_policy_type_options = $epf->getOptions('type');
 $exception_policy_severity_options = $epf->getOptions('severity');
 $utlf = new UserTitleListFactory();
 $utlf->getByCompanyId($current_company->getId());
 $title_options = $utlf->getArrayByListFactory($utlf, FALSE, TRUE);
 $blf = new BranchListFactory();
 $blf->getByCompanyId($current_company->getId());
 $branch_options = $blf->getArrayByListFactory($blf, FALSE, TRUE);
 $dlf = new DepartmentListFactory();
 $dlf->getByCompanyId($current_company->getId());
 $department_options = $dlf->getArrayByListFactory($dlf, FALSE, TRUE);
 $uglf = new UserGroupListFactory();
 $group_options = $uglf->getArrayByNodes(FastTree::FormatArray($uglf->getByCompanyIdArray($current_company->getId()), 'TEXT', TRUE));
 $ulf = new UserListFactory();
 $user_options = $ulf->getByCompanyIdArray($current_company->getID(), FALSE);
 foreach ($elf as $e_obj) {
                							$ep_obj->setDeleted(TRUE);
                							if ( $ep_obj->isValid() ) {
                								$ep_obj->Save();
                							}
                						}
                
                					}
                				} else {
                					$exceptions = array();
                				}
                */
                //Populate default values.
                $default_exceptions = $epf->getExceptionTypeDefaultValues(array_keys($exceptions), $current_company->getProductEdition());
                $exceptions = array_merge($exceptions, $default_exceptions);
                $data = array('id' => $epc_obj->getId(), 'name' => $epc_obj->getName(), 'exceptions' => $exceptions, 'created_date' => $epc_obj->getCreatedDate(), 'created_by' => $epc_obj->getCreatedBy(), 'updated_date' => $epc_obj->getUpdatedDate(), 'updated_by' => $epc_obj->getUpdatedBy(), 'deleted_date' => $epc_obj->getDeletedDate(), 'deleted_by' => $epc_obj->getDeletedBy());
            }
        } elseif ($action != 'submit') {
            //Populate default values.
            $exceptions = $epf->getExceptionTypeDefaultValues(NULL, $current_company->getProductEdition());
            $data = array('exceptions' => $exceptions);
        }
        //print_r($data);
        //Select box options;
        $data['severity_options'] = $epf->getOptions('severity');
        $data['email_notification_options'] = $epf->getOptions('email_notification');
        $smarty->assign_by_ref('data', $data);
        break;
}
$smarty->assign_by_ref('epf', $epf);
$smarty->assign_by_ref('epcf', $epcf);
$smarty->display('policy/EditExceptionPolicyControl.tpl');
     unset($exception_data_arr);
 }
 if (isset($date_exceptions)) {
     foreach ($calendar_array as $cal_arr) {
         if (isset($date_exceptions[$cal_arr['epoch']])) {
             $exception_data = $date_exceptions[$cal_arr['epoch']];
         } else {
             $exception_data = NULL;
         }
         $date_exception_total_rows[] = $exception_data;
     }
 }
 //Get exception names for legend.
 if (isset($unique_exceptions)) {
     $epf = new ExceptionPolicyFactory();
     $exception_options = $epf->getOptions('type');
     foreach ($unique_exceptions as $unique_exception) {
         $unique_exceptions[$unique_exception['exception_policy_type_id']]['name'] = $exception_options[$unique_exception['exception_policy_type_id']];
     }
     sort($unique_exceptions);
 }
 /*
 	Get Pending Requests
 */
 $rlf = new RequestListFactory();
 $rlf->getByCompanyIDAndUserIdAndStatusAndStartDateAndEndDate($current_company->getID(), $user_id, 30, $start_date, $end_date);
 if ($rlf->getRecordCount() > 0) {
     Debug::text('Found Requests!!: ', __FILE__, __LINE__, __METHOD__, 10);
     foreach ($rlf as $r_obj) {
         $user_date_stamp = TTDate::strtotime($r_obj->getColumn('date_stamp'));
         $request_data_arr = array('id' => $r_obj->getId());