function getByCompanyIdArray($company_id, $include_blank = TRUE)
 {
     $splf = new SchedulePolicyListFactory();
     $splf->getByCompanyId($company_id);
     if ($include_blank == TRUE) {
         $list[0] = '--';
     }
     foreach ($splf as $sp_obj) {
         $list[$sp_obj->getID()] = $sp_obj->getName();
     }
     if (isset($list)) {
         return $list;
     }
     return FALSE;
 }
Пример #2
0
        }
        $splf = new SchedulePolicyListFactory();
        foreach ($ids as $id) {
            $splf->getByIdAndCompanyId($id, $current_company->getId());
            foreach ($splf as $sp_obj) {
                $sp_obj->setDeleted($delete);
                if ($sp_obj->isValid()) {
                    $sp_obj->Save();
                }
            }
        }
        Redirect::Page(URLBuilder::getURL(NULL, 'SchedulePolicyList.php'));
        break;
    default:
        $splf = new SchedulePolicyListFactory();
        $splf->getByCompanyId($current_company->getId());
        $pager = new Pager($splf);
        $aplf = new AbsencePolicyListFactory();
        $absence_options = $aplf->getByCompanyIDArray($current_company->getId(), TRUE);
        $mplf = new MealPolicyListFactory();
        $meal_options = $mplf->getByCompanyIDArray($current_company->getId(), TRUE);
        foreach ($splf as $sp_obj) {
            $policies[] = array('id' => $sp_obj->getId(), 'name' => $sp_obj->getName(), 'meal_policy_id' => $sp_obj->getMealPolicyID(), 'meal_policy' => Option::getByKey($sp_obj->getMealPolicyID(), $meal_options), 'absence_policy_id' => $sp_obj->getAbsencePolicyID(), 'absence_policy' => Option::getByKey($sp_obj->getAbsencePolicyID(), $absence_options), 'start_stop_window' => $sp_obj->getStartStopWindow(), 'deleted' => $sp_obj->getDeleted());
        }
        $smarty->assign_by_ref('policies', $policies);
        $smarty->assign_by_ref('sort_column', $sort_column);
        $smarty->assign_by_ref('sort_order', $sort_order);
        $smarty->assign_by_ref('paging_data', $pager->getPageVariables());
        break;
}
$smarty->display('policy/SchedulePolicyList.tpl');