예제 #1
0
     if (isset($selected_levels['timesheet']) and isset($timesheet_levels[$selected_levels['timesheet']])) {
         $timesheet_selected_level = $timesheet_levels[$selected_levels['timesheet']];
         Debug::Text(' Switching Levels to Level: ' . $timesheet_selected_level, __FILE__, __LINE__, __METHOD__, 10);
     } elseif (isset($timesheet_levels[1])) {
         $timesheet_selected_level = $request_levels[1];
     } else {
         Debug::Text('No TimeSheet Levels... Not in hierarchy?', __FILE__, __LINE__, __METHOD__, 10);
         $timesheet_selected_level = 0;
     }
     Debug::Text('TimeSheet Selected Level: ' . $timesheet_selected_level, __FILE__, __LINE__, __METHOD__, 10);
     //Get all relevant hierarchy ids
     $timesheet_hierarchy_user_ids = $hlf->getByUserIdAndObjectTypeIDAndLevel($current_user->getId(), 90, (int) $timesheet_selected_level);
     //Debug::Arr( $request_hierarchy_user_ids, 'Request Hierarchy Ids', __FILE__, __LINE__, __METHOD__,10);
     if (is_array($timesheet_hierarchy_user_ids) and isset($timesheet_hierarchy_user_ids['child_level']) and isset($timesheet_hierarchy_user_ids['parent_level']) and isset($timesheet_hierarchy_user_ids['current_level'])) {
         $pptsvlf = new PayPeriodTimeSheetVerifyListFactory();
         $pptsvlf->getByUserIdListAndStatusAndLevelAndMaxLevelAndNotAuthorized($timesheet_hierarchy_user_ids['child_level'], 30, (int) $timesheet_selected_level, (int) end($timesheet_levels), NULL, NULL, NULL, $sort_array);
         $status_options = $pptsvlf->getOptions('status');
         foreach ($pptsvlf as $pptsv_obj) {
             //Grab authorizations for this object.
             $timesheets[] = array('id' => $pptsv_obj->getId(), 'pay_period_id' => $pptsv_obj->getPayPeriod(), 'user_id' => $pptsv_obj->getUser(), 'user_full_name' => $pptsv_obj->getUserObject()->getFullName(), 'pay_period_start_date' => $pptsv_obj->getPayPeriodObject()->getStartDate(), 'pay_period_end_date' => $pptsv_obj->getPayPeriodObject()->getEndDate(), 'status_id' => $pptsv_obj->getStatus(), 'status' => $status_options[$pptsv_obj->getStatus()]);
         }
         $smarty->assign_by_ref('timesheets', $timesheets);
         if (isset($timesheet_levels) and is_array($timesheet_levels)) {
             $smarty->assign_by_ref('timesheet_levels', $timesheet_levels);
             $smarty->assign_by_ref('selected_timesheet_level', $timesheet_selected_level);
         }
     } else {
         Debug::Text('No hierarchy information found...', __FILE__, __LINE__, __METHOD__, 10);
     }
 }
 $smarty->assign_by_ref('selected_levels', $selected_levels);