function getJobs($station_id) { Debug::Text('Getting Jobs for Station ID: ' . $station_id, __FILE__, __LINE__, __METHOD__, 10); if ($station_id == '') { return FALSE; } if (getTTProductEdition() != TT_PRODUCT_PROFESSIONAL) { return FALSE; } $slf = new StationListFactory(); $slf->getByStationID($station_id); if ($slf->getRecordCount() > 0) { $s_obj = $slf->getCurrent(); $company_id = $s_obj->getCompany(); Debug::Text('Company ID: ' . $company_id, __FILE__, __LINE__, __METHOD__, 10); if ($company_id != FALSE) { //Gets all users allowed to punch in/out from this station $jlf = new JobListFactory(); //$jlf->getByCompanyIdAndUserIdAndStatus( $company_id, $current_user->getId(), array(10), TRUE ); $jlf->getByStatusIdAndCompanyId(10, $company_id); if ($jlf->getRecordCount() > 0) { $x = 0; foreach ($jlf as $j_obj) { $job_list["'{$x}'"] = array('id' => (int) $j_obj->getId(), 'manual_id' => (int) $j_obj->getManualID(), 'name' => $j_obj->getName()); $x++; } if (isset($job_list)) { return $job_list; } } } } Debug::Text('Returning FALSE!', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }
$user_options = Misc::arrayDiffByKey((array) $filter_user_id, $src_user_options); $filter_user_options = Misc::arrayIntersectByKey((array) $filter_user_id, $src_user_options); $prepend_array_option = array(0 => '--', -1 => TTi18n::gettext('-- Default --')); $splf = new SchedulePolicyListFactory(); $schedule_policy_options = $splf->getByCompanyIdArray($current_company->getId()); $aplf = new AbsencePolicyListFactory(); $absence_policy_options = $aplf->getByCompanyIdArray($current_company->getId()); $blf = new BranchListFactory(); $blf->getByCompanyId($current_company->getId()); $branch_options = Misc::prependArray($prepend_array_option, $blf->getArrayByListFactory($blf, FALSE, TRUE)); $dlf = new DepartmentListFactory(); $dlf->getByCompanyId($current_company->getId()); $department_options = Misc::prependArray($prepend_array_option, $dlf->getArrayByListFactory($dlf, FALSE, TRUE)); if ($current_company->getProductEdition() == 20) { $jlf = new JobListFactory(); $jlf->getByStatusIdAndCompanyId(array(10, 20, 30, 40), $current_company->getId()); //$jlf->getByCompanyIdAndUserIdAndStatus( $current_company->getId(), $data['user_id'], array(10,20,30,40) ); $data['job_options'] = $jlf->getArrayByListFactory($jlf, TRUE, TRUE); $data['job_manual_id_options'] = $jlf->getManualIDArrayByListFactory($jlf, TRUE); $jilf = new JobItemListFactory(); $jilf->getByCompanyId($current_company->getId()); $data['job_item_options'] = $jilf->getArrayByListFactory($jilf, TRUE); $data['job_item_manual_id_options'] = $jilf->getManualIdArrayByListFactory($jilf, TRUE); } //Select box options; $smarty->assign_by_ref('user_options', $user_options); $smarty->assign_by_ref('filter_user_options', $filter_user_options); $data['status_options'] = $sf->getOptions('status'); $data['schedule_policy_options'] = $schedule_policy_options; $data['absence_policy_options'] = $absence_policy_options; //$data['type_options'] = $pf->getOptions('type');