当前位置: 首页>>代码示例>>PHP>>正文


PHP TTDate::getAPIDate方法代码示例

本文整理汇总了PHP中TTDate::getAPIDate方法的典型用法代码示例。如果您正苦于以下问题:PHP TTDate::getAPIDate方法的具体用法?PHP TTDate::getAPIDate怎么用?PHP TTDate::getAPIDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TTDate的用法示例。


在下文中一共展示了TTDate::getAPIDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getRecurringScheduleControlDefaultData

 /**
  * Get default recurring_schedule_control data for creating new recurring_schedule_controles.
  * @return array
  */
 function getRecurringScheduleControlDefaultData()
 {
     $company_obj = $this->getCurrentCompanyObject();
     Debug::Text('Getting recurring_schedule_control default data...', __FILE__, __LINE__, __METHOD__, 10);
     $data = array('company_id' => $company_obj->getId(), 'start_week' => 1, 'start_date' => TTDate::getAPIDate('DATE', TTDate::getBeginWeekEpoch(TTDate::getTime())), 'end_date' => NULL);
     return $this->returnHandler($data);
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:11,代码来源:APIRecurringScheduleControl.class.php

示例2: getRecurringScheduleTemplateDefaultData

 /**
  * Get default recurring_schedule_template data for creating new recurring_schedule_templates.
  * @return array
  */
 function getRecurringScheduleTemplateDefaultData()
 {
     $company_obj = $this->getCurrentCompanyObject();
     Debug::Text('Getting recurring_schedule_template default data...', __FILE__, __LINE__, __METHOD__, 10);
     $data = array('id' => -1, 'week' => 1, 'mon' => TRUE, 'tue' => TRUE, 'wed' => TRUE, 'thu' => TRUE, 'fri' => TRUE, 'start_time' => TTDate::getAPIDate('TIME', strtotime('08:00')), 'end_time' => TTDate::getAPIDate('TIME', strtotime('17:00')), 'total_time' => 9 * 3600, 'branch_id' => -1, 'department_id' => -1, 'schedule_policy_id' => 0, 'open_shift_multiplier' => 1);
     return $this->returnHandler($data);
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:11,代码来源:APIRecurringScheduleTemplate.class.php

示例3: getUserWageDefaultData

 /**
  * Get default branch data for creating new branches.
  * @return array
  */
 function getUserWageDefaultData($user_id = NULL)
 {
     $company_obj = $this->getCurrentCompanyObject();
     Debug::Text('Getting wage default data...', __FILE__, __LINE__, __METHOD__, 10);
     //If user_id is passed, check for other wage entries, if none, default to the employees hire date.
     if ($user_id > 0) {
         //Check for existing wage entries.
         $uwlf = TTnew('UserWageListFactory');
         $uwlf->getLastWageByUserId($user_id);
         if ($uwlf->getRecordCount() == 1) {
             Debug::Text('Previous wage entry already exists...', __FILE__, __LINE__, __METHOD__, 10);
             $effective_date = time();
         } else {
             Debug::Text('Trying to use hire date...', __FILE__, __LINE__, __METHOD__, 10);
             $ulf = TTnew('UserListFactory');
             $ulf->getByIdAndCompanyId($user_id, $this->getCurrentCompanyObject()->getId());
             if ($ulf->getRecordCount() > 0) {
                 $effective_date = $ulf->getCurrent()->getHireDate();
             }
         }
     } else {
         Debug::Text('No user specified...', __FILE__, __LINE__, __METHOD__, 10);
         $effective_date = time();
     }
     $data = array('company_id' => $company_obj->getId(), 'type_id' => 10, 'wage' => '0.00', 'hourly_rate' => '0.00', 'effective_date' => TTDate::getAPIDate('DATE', $effective_date), 'labor_burden_percent' => 0, 'weekly_time' => 3600 * 40);
     return $this->returnHandler($data);
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:31,代码来源:APIUserWage.class.php

示例4: getHolidayDefaultData

 /**
  * Get default holiday data for creating new holidayes.
  * @return array
  */
 function getHolidayDefaultData()
 {
     $company_obj = $this->getCurrentCompanyObject();
     Debug::Text('Getting holiday default data...', __FILE__, __LINE__, __METHOD__, 10);
     $data = array('company_id' => $company_obj->getId(), 'date_stamp' => TTDate::getAPIDate('DATE', TTDate::getTime()));
     return $this->returnHandler($data);
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:11,代码来源:APIHoliday.class.php

示例5: getPayPeriodScheduleDefaultData

 /**
  * Get default data for creating pay period schedules.
  * @return array
  */
 function getPayPeriodScheduleDefaultData()
 {
     $company_id = $this->getCurrentCompanyObject()->getId();
     Debug::Text('Getting user default data...', __FILE__, __LINE__, __METHOD__, 10);
     $data = array('company_id' => $this->getCurrentCompanyObject()->getId(), 'anchor_date' => TTDate::getAPIDate('DATE', TTDate::getBeginMonthEpoch(time())), 'shift_assigned_day_id' => 10, 'day_start_time' => 0, 'new_day_trigger_time' => 3600 * 4, 'maximum_shift_time' => 3600 * 16, 'time_zone' => $this->getCurrentUserPreferenceObject()->getTimeZone(), 'type_id' => 20, 'start_week_day_id' => 0, 'start_day_of_week' => 0, 'timesheet_verify_type_id' => 10, 'timesheet_verify_before_end_date' => 0, 'timesheet_verify_before_transaction_date' => 0);
     Debug::Arr($data, 'Data: ', __FILE__, __LINE__, __METHOD__, 10);
     return $this->returnHandler($data);
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:12,代码来源:APIPayPeriodSchedule.class.php

示例6: getROEDefaultData

 /**
  * Get default roe data for creating new roe.
  * @return array
  */
 function getROEDefaultData($user_id = NULL)
 {
     $company_obj = $this->getCurrentCompanyObject();
     if ($user_id > 0) {
         //Debug::Text('Current User Id: '.$user_id, __FILE__, __LINE__, __METHOD__,10);
         $rf = new ROEFactory();
         $first_date = $rf->calculateFirstDate($user_id);
         $last_date = $rf->calculateLastDate($user_id);
         $pay_period = $rf->calculatePayPeriodType($user_id, $last_date);
         Debug::Text('Getting roe default data...', __FILE__, __LINE__, __METHOD__, 10);
         $data = array('company_id' => $company_obj->getId(), 'user_id' => $user_id, 'pay_period_type_id' => $pay_period['pay_period_type_id'], 'first_date' => TTDate::getAPIDate('DATE', $first_date), 'last_date' => TTDate::getAPIDate('DATE', $last_date), 'pay_period_end_date' => TTDate::getAPIDate('DATE', $pay_period['pay_period_end_date']));
     } else {
         $data = array('company_id' => $company_obj->getId());
     }
     return $this->returnHandler($data);
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:20,代码来源:APIROE.class.php

示例7: getObjectAsArray

 function getObjectAsArray($include_columns = NULL, $permission_children_ids = FALSE)
 {
     $variable_function_map = $this->getVariableToFunctionMap();
     if (is_array($variable_function_map)) {
         foreach ($variable_function_map as $variable => $function_stub) {
             if ($include_columns == NULL or isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) {
                 $function = 'get' . $function_stub;
                 switch ($variable) {
                     case 'accrual_policy':
                     case 'first_name':
                     case 'last_name':
                     case 'title':
                     case 'user_group':
                     case 'default_branch':
                     case 'default_department':
                         $data[$variable] = $this->getColumn($variable);
                         break;
                     case 'accrual_policy_type':
                         $data[$variable] = Option::getByKey($this->getColumn('accrual_policy_type_id'), $this->getOptions($variable));
                         break;
                     case 'type':
                         $function = 'get' . $variable;
                         if (method_exists($this, $function)) {
                             $data[$variable] = Option::getByKey($this->{$function}(), $this->getOptions($variable));
                         }
                         break;
                     case 'time_stamp':
                         if (method_exists($this, $function)) {
                             $data[$variable] = TTDate::getAPIDate('DATE', $this->{$function}());
                         }
                         break;
                     case 'date_stamp':
                         //This is a combination of the time_stamp and user_date.date_stamp columns.
                         $data[$variable] = TTDate::getAPIDate('DATE', strtotime($this->getColumn($variable)));
                         break;
                     default:
                         if (method_exists($this, $function)) {
                             $data[$variable] = $this->{$function}();
                         }
                         break;
                 }
             }
         }
         $this->getPermissionColumns($data, $this->getUser(), $this->getCreatedBy(), $permission_children_ids, $include_columns);
         $this->getCreatedAndUpdatedColumns($data, $include_columns);
     }
     //Debug::Arr($data, 'Data Object: ', __FILE__, __LINE__, __METHOD__, 10);
     return $data;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:49,代码来源:AccrualFactory.class.php

示例8: getUserDefaultData

 /**
  * Get default user data for creating new users.
  * @return array
  */
 function getUserDefaultData($tmp_company_id = NULL)
 {
     //Allow getting default data from other companies, so it makes it easier to create the first employee of a company.
     if ($tmp_company_id != '' and $tmp_company_id > 0 and $this->getPermissionObject()->Check('company', 'enabled') and $this->getPermissionObject()->Check('company', 'view')) {
         $company_id = $tmp_company_id;
     } else {
         $company_id = $this->getCurrentCompanyObject()->getId();
     }
     Debug::Text('Getting user default data for Company ID: ' . $company_id . ' TMP Company ID: ' . $tmp_company_id, __FILE__, __LINE__, __METHOD__, 10);
     //Get New Hire Defaults.
     $udlf = TTnew('UserDefaultListFactory');
     $udlf->getByCompanyId($company_id);
     if ($udlf->getRecordCount() > 0) {
         Debug::Text('Using User Defaults, as they exist...', __FILE__, __LINE__, __METHOD__, 10);
         $udf_obj = $udlf->getCurrent();
         $data = array('company_id' => $company_id, 'status_id' => 10, 'title_id' => $udf_obj->getTitle(), 'employee_number' => UserFactory::getNextAvailableEmployeeNumber($company_id), 'city' => $udf_obj->getCity(), 'country' => $udf_obj->getCountry(), 'province' => $udf_obj->getProvince(), 'work_phone' => $udf_obj->getWorkPhone(), 'work_phone_ext' => $udf_obj->getWorkPhoneExt(), 'work_email' => $udf_obj->getWorkEmail(), 'hire_date' => TTDate::getAPIDate('DATE', $udf_obj->getHireDate()), 'sex_id' => 5, 'default_branch_id' => $udf_obj->getDefaultBranch(), 'default_department_id' => $udf_obj->getDefaultDepartment(), 'permission_control_id' => $udf_obj->getPermissionControl(), 'pay_period_schedule_id' => $udf_obj->getPayPeriodSchedule(), 'policy_group_id' => $udf_obj->getPolicyGroup(), 'currency_id' => $udf_obj->getCurrency());
     }
     if (!isset($data['company_id'])) {
         $data['company_id'] = $company_id;
     }
     if (!isset($data['country'])) {
         $data['country'] = 'US';
     }
     $ulf = TTnew('UserListFactory');
     $ulf->getHighestEmployeeNumberByCompanyId($company_id);
     if ($ulf->getRecordCount() > 0) {
         Debug::Text('Highest Employee Number: ' . $ulf->getCurrent()->getEmployeeNumber(), __FILE__, __LINE__, __METHOD__, 10);
         if (is_numeric($ulf->getCurrent()->getEmployeeNumber()) == TRUE) {
             $data['next_available_employee_number'] = $ulf->getCurrent()->getEmployeeNumber() + 1;
         } else {
             Debug::Text('Highest Employee Number is not an integer.', __FILE__, __LINE__, __METHOD__, 10);
             $data['next_available_employee_number'] = NULL;
         }
     } else {
         $data['next_available_employee_number'] = 1;
     }
     if (!isset($data['hire_date']) or $data['hire_date'] == '') {
         $data['hire_date'] = TTDate::getAPIDate('DATE', time());
     }
     return $this->returnHandler($data);
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:45,代码来源:APIUser.class.php

示例9: getObjectAsArray

 function getObjectAsArray($include_columns = NULL, $permission_children_ids = FALSE)
 {
     //
     //When using the Recurring Schedule view, it returns the user list for every single row and runs out of memory at about 1000 rows.
     //Need to make the 'user' column explicitly defined instead perhaps?
     //
     $variable_function_map = $this->getVariableToFunctionMap();
     if (is_array($variable_function_map)) {
         foreach ($variable_function_map as $variable => $function_stub) {
             if ($include_columns == NULL or isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) {
                 $function = 'get' . $function_stub;
                 switch ($variable) {
                     case 'first_name':
                     case 'last_name':
                         $data[$variable] = $this->getColumn($variable) == '' ? TTi18n::getText('OPEN') : $this->getColumn($variable);
                         break;
                     case 'title':
                     case 'user_group':
                     case 'default_branch':
                     case 'default_department':
                     case 'recurring_schedule_template_control':
                     case 'recurring_schedule_template_control_description':
                     case 'user_id':
                         $data[$variable] = $this->getColumn($variable);
                         break;
                     case 'start_date':
                     case 'end_date':
                         $data[$variable] = TTDate::getAPIDate('DATE', TTDate::strtotime($this->{$function}()));
                         break;
                     default:
                         if (method_exists($this, $function)) {
                             $data[$variable] = $this->{$function}();
                         }
                         break;
                 }
             }
         }
         //Handle expanded and non-expanded mode. In non-expanded mode we need to get all the users
         //so we can check is_owner/is_child permissions on them.
         if ($this->getColumn('user_id') !== FALSE) {
             $user_ids = $this->getColumn('user_id');
         } else {
             $user_ids = $this->getUser();
         }
         $this->getPermissionColumns($data, $user_ids, $this->getCreatedBy(), $permission_children_ids, $include_columns);
         //$this->getPermissionColumns( $data, $this->getColumn('user_id'), $this->getCreatedBy(), $permission_children_ids, $include_columns );
         $this->getCreatedAndUpdatedColumns($data, $include_columns);
     }
     return $data;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:50,代码来源:RecurringScheduleControlFactory.class.php

示例10: getObjectAsArray

 function getObjectAsArray($include_columns = NULL)
 {
     $uf = TTnew('UserFactory');
     $variable_function_map = $this->getVariableToFunctionMap();
     if (is_array($variable_function_map)) {
         foreach ($variable_function_map as $variable => $function_stub) {
             if ($include_columns == NULL or isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) {
                 $function = 'get' . $function_stub;
                 switch ($variable) {
                     case 'hire_date':
                         $data[$variable] = TTDate::getAPIDate('DATE', $this->getHireDate());
                         break;
                     default:
                         if (method_exists($this, $function)) {
                             $data[$variable] = $this->{$function}();
                         }
                         break;
                 }
             }
         }
         $this->getCreatedAndUpdatedColumns($data, $include_columns);
     }
     return $data;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:24,代码来源:UserDefaultFactory.class.php

示例11: getObjectAsArray

 function getObjectAsArray($include_columns = NULL)
 {
     $uf = new UserFactory();
     $variable_function_map = $this->getVariableToFunctionMap();
     if (is_array($variable_function_map)) {
         foreach ($variable_function_map as $variable => $function_stub) {
             if ($include_columns == NULL or isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) {
                 $function = 'get' . $function_stub;
                 switch ($variable) {
                     case 'user_id':
                     case 'first_name':
                     case 'last_name':
                     case 'user_status_id':
                     case 'group_id':
                     case 'group':
                     case 'title_id':
                     case 'title':
                     case 'default_branch_id':
                     case 'default_branch':
                     case 'default_department_id':
                     case 'default_department':
                     case 'schedule_policy_id':
                     case 'schedule_policy':
                     case 'pay_period_id':
                     case 'branch':
                     case 'department':
                         $data[$variable] = $this->getColumn($variable);
                         break;
                     case 'status':
                         $function = 'get' . $variable;
                         if (method_exists($this, $function)) {
                             $data[$variable] = Option::getByKey($this->{$function}(), $this->getOptions($variable));
                         }
                         break;
                     case 'user_status':
                         $data[$variable] = Option::getByKey((int) $this->getColumn('user_status_id'), $uf->getOptions('status'));
                         break;
                     case 'date_stamp':
                         $data[$variable] = TTDate::getAPIDate('DATE', TTDate::parseDateTime($this->getColumn('date_stamp')));
                         break;
                     case 'start_date':
                         $data[$variable] = TTDate::getAPIDate('DATE+TIME', $this->getStartTime());
                         //Include both date+time
                         break;
                     case 'end_date':
                         $data[$variable] = TTDate::getAPIDate('DATE+TIME', $this->getEndTime());
                         //Include both date+time
                         break;
                     case 'start_time':
                     case 'end_time':
                         if (method_exists($this, $function)) {
                             $data[$variable] = TTDate::getAPIDate('TIME', $this->{$function}());
                             //Just include time, so Mass Edit sees similar times without dates
                         }
                         break;
                     default:
                         if (method_exists($this, $function)) {
                             $data[$variable] = $this->{$function}();
                         }
                         break;
                 }
             }
         }
         $this->getCreatedAndUpdatedColumns(&$data, $include_columns);
     }
     return $data;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:67,代码来源:ScheduleFactory.class.php

示例12: getObjectAsArray

 function getObjectAsArray($include_columns = NULL, $permission_children_ids = FALSE)
 {
     $variable_function_map = $this->getVariableToFunctionMap();
     if (is_array($variable_function_map)) {
         foreach ($variable_function_map as $variable => $function_stub) {
             if ($include_columns == NULL or isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) {
                 $function = 'get' . $function_stub;
                 switch ($variable) {
                     case 'first_name':
                     case 'last_name':
                     case 'title':
                     case 'user_group':
                     case 'default_branch':
                     case 'default_department':
                     case 'user_id':
                         $data[$variable] = $this->getColumn($variable);
                         break;
                     case 'message':
                         //Message is attached in the message factory, so we can't return it here.
                         break;
                     case 'status':
                     case 'type':
                         $function = 'get' . $variable;
                         if (method_exists($this, $function)) {
                             $data[$variable] = Option::getByKey($this->{$function}(), $this->getOptions($variable));
                         }
                         break;
                     case 'date_stamp':
                         $data[$variable] = TTDate::getAPIDate('DATE', TTDate::strtotime($this->getColumn('date_stamp')));
                         break;
                     default:
                         if (method_exists($this, $function)) {
                             $data[$variable] = $this->{$function}();
                         }
                         break;
                 }
             }
         }
         $this->getPermissionColumns($data, $this->getColumn('user_id'), $this->getCreatedBy(), $permission_children_ids, $include_columns);
         $this->getCreatedAndUpdatedColumns($data, $include_columns);
     }
     return $data;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:43,代码来源:RequestFactory.class.php

示例13: getObjectAsArray

 function getObjectAsArray($include_columns = NULL, $permission_children_ids = FALSE)
 {
     $uf = TTnew('UserFactory');
     $variable_function_map = $this->getVariableToFunctionMap();
     if (is_array($variable_function_map)) {
         foreach ($variable_function_map as $variable => $function_stub) {
             if ($include_columns == NULL or isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) {
                 $function = 'get' . $function_stub;
                 switch ($variable) {
                     case 'first_name':
                     case 'last_name':
                     case 'user_status_id':
                     case 'group_id':
                     case 'user_group':
                     case 'title_id':
                     case 'title':
                     case 'default_branch_id':
                     case 'default_branch':
                     case 'default_department_id':
                     case 'default_department':
                     case 'pay_stub_entry_name':
                         $data[$variable] = $this->getColumn($variable);
                         break;
                     case 'user_status':
                         $data[$variable] = Option::getByKey((int) $this->getColumn('user_status_id'), $uf->getOptions('status'));
                         break;
                     case 'status':
                     case 'type':
                         $function = 'get' . $variable;
                         if (method_exists($this, $function)) {
                             $data[$variable] = Option::getByKey($this->{$function}(), $this->getOptions($variable));
                         }
                         break;
                     case 'effective_date':
                         if (method_exists($this, $function)) {
                             $data[$variable] = TTDate::getAPIDate('DATE', $this->{$function}());
                         }
                         break;
                     default:
                         if (method_exists($this, $function)) {
                             $data[$variable] = $this->{$function}();
                         }
                         break;
                 }
             }
         }
         $this->getPermissionColumns($data, $this->getID(), $this->getCreatedBy(), $permission_children_ids, $include_columns);
         $this->getCreatedAndUpdatedColumns($data, $include_columns);
     }
     return $data;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:51,代码来源:PayStubAmendmentFactory.class.php

示例14: getObjectAsArray


//.........这里部分代码省略.........
                     case 'default_job_item':
                     case 'permission_control':
                     case 'pay_period_schedule':
                     case 'policy_group':
                     case 'password_updated_date':
                         $data[$variable] = $this->getColumn($variable);
                         break;
                         //The below fields may be set if APISearch ListFactory is used to obtain the data originally,
                         //but if it isn't, use the explicit function to get the data instead.
                     //The below fields may be set if APISearch ListFactory is used to obtain the data originally,
                     //but if it isn't, use the explicit function to get the data instead.
                     case 'permission_control_id':
                         //These functions are slow to obtain (especially in a large loop), so make sure the column is requested explicitly before we include it.
                         //Flex currently doesn't specify these fields in the Edit view though, so this breaks Flex.
                         //if ( isset($include_columns[$variable]) AND $include_columns[$variable] == TRUE ) {
                         $data[$variable] = $this->getColumn($variable);
                         if ($data[$variable] == FALSE) {
                             $data[$variable] = $this->getPermissionControl();
                         }
                         //}
                         break;
                     case 'pay_period_schedule_id':
                         //These functions are slow to obtain (especially in a large loop), so make sure the column is requested explicitly before we include it.
                         //Flex currently doesn't specify these fields in the Edit view though, so this breaks Flex.
                         //if ( isset($include_columns[$variable]) AND $include_columns[$variable] == TRUE ) {
                         $data[$variable] = $this->getColumn($variable);
                         if ($data[$variable] == FALSE) {
                             $data[$variable] = $this->getPayPeriodSchedule();
                         }
                         //}
                         break;
                     case 'policy_group_id':
                         //These functions are slow to obtain (especially in a large loop), so make sure the column is requested explicitly before we include it.
                         //Flex currently doesn't specify these fields in the Edit view though, so this breaks Flex.
                         //if ( isset($include_columns[$variable]) AND $include_columns[$variable] == TRUE ) {
                         $data[$variable] = $this->getColumn($variable);
                         if ($data[$variable] == FALSE) {
                             $data[$variable] = $this->getPolicyGroup();
                         }
                         //}
                         break;
                     case 'hierarchy_control':
                         //These functions are slow to obtain (especially in a large loop), so make sure the column is requested explicitly before we include it.
                         //Flex currently doesn't specify these fields in the Edit view though, so this breaks Flex.
                         //if ( isset($include_columns[$variable]) AND $include_columns[$variable] == TRUE ) {
                         $data[$variable] = $this->getHierarchyControl();
                         //}
                         break;
                     case 'hierarchy_control_display':
                         //These functions are slow to obtain (especially in a large loop), so make sure the column is requested explicitly before we include it.
                         //if ( isset($include_columns[$variable]) AND $include_columns[$variable] == TRUE ) {
                         $data[$variable] = $this->getHierarchyControlDisplay();
                         //}
                         break;
                     case 'hierarchy_level_display':
                         $data[$variable] = $this->getHierarchyLevelDisplay();
                         break;
                     case 'password':
                         //Don't return password
                         break;
                         //case 'sin': //This is handled in the API class instead.
                         //	$data[$variable] = $this->getSecureSIN();
                         //	break;
                     //case 'sin': //This is handled in the API class instead.
                     //	$data[$variable] = $this->getSecureSIN();
                     //	break;
                     case 'last_login_date':
                     case 'hire_date':
                     case 'birth_date':
                     case 'termination_date':
                         if (method_exists($this, $function)) {
                             $data[$variable] = TTDate::getAPIDate('DATE', $this->{$function}());
                         }
                         break;
                     case 'birth_date_age':
                         $data[$variable] = (int) floor((time() - $this->getBirthDate()) / 60 / 60 / 24 / 30 / 12);
                         break;
                     case 'hire_date_age':
                         if ($this->getTerminationDate() != '') {
                             $end_epoch = $this->getTerminationDate();
                         } else {
                             $end_epoch = time();
                         }
                         $data[$variable] = (int) floor(($end_epoch - $this->getHireDate()) / 60 / 60 / 24 / 30 / 12);
                         unset($end_epoch);
                         break;
                     default:
                         if (method_exists($this, $function)) {
                             $data[$variable] = $this->{$function}();
                         }
                         break;
                 }
             }
             unset($function);
         }
         $this->getPermissionColumns($data, $this->getID(), $this->getCreatedBy(), $permission_children_ids, $include_columns);
         $this->getCreatedAndUpdatedColumns($data, $include_columns);
     }
     return $data;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:101,代码来源:UserFactory.class.php

示例15: getObjectAsArray

 function getObjectAsArray($include_columns = NULL)
 {
     $variable_function_map = $this->getVariableToFunctionMap();
     if (is_array($variable_function_map)) {
         $ppsf = TTnew('PayPeriodScheduleFactory');
         foreach ($variable_function_map as $variable => $function_stub) {
             if ($include_columns == NULL or isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) {
                 $function = 'get' . $function_stub;
                 switch ($variable) {
                     case 'status':
                         $function = 'get' . $variable;
                         if (method_exists($this, $function)) {
                             $data[$variable] = Option::getByKey($this->{$function}(), $this->getOptions($variable));
                         }
                         break;
                     case 'type':
                         //Make sure type_id is set first.
                         $data[$variable] = Option::getByKey($this->getColumn('type_id'), $ppsf->getOptions($variable));
                         break;
                     case 'type_id':
                     case 'pay_period_schedule':
                         $data[$variable] = $this->getColumn($variable);
                         break;
                     case 'start_date':
                     case 'end_date':
                     case 'transaction_date':
                         if (method_exists($this, $function)) {
                             $data[$variable] = TTDate::getAPIDate('DATE+TIME', $this->{$function}());
                         }
                         break;
                     case 'total_punches':
                     case 'pending_requests':
                     case 'ps_amendments':
                     case 'pay_stubs':
                         //These functions are slow to obtain, so make sure the column is requested explicitly before we include it.
                         if (isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) {
                             $data[$variable] = $this->{$function}();
                         }
                         break;
                     case 'exceptions_critical':
                     case 'exceptions_high':
                     case 'exceptions_medium':
                     case 'exceptions_low':
                         //These functions are slow to obtain, so make sure the column is requested explicitly before we include it.
                         if (isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) {
                             if (!isset($exceptions_arr)) {
                                 $exceptions_arr = $this->getExceptions();
                             }
                             $data[$variable] = $exceptions_arr[$variable];
                         }
                         break;
                     case 'verified_timesheets':
                     case 'pending_timesheets':
                     case 'total_timesheets':
                         //These functions are slow to obtain, so make sure the column is requested explicitly before we include it.
                         if (isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) {
                             if (!isset($timesheet_arr)) {
                                 $timesheet_arr = $this->getTimeSheets();
                             }
                             $data[$variable] = $timesheet_arr[$variable];
                         }
                         break;
                     default:
                         if (method_exists($this, $function)) {
                             $data[$variable] = $this->{$function}();
                         }
                         break;
                 }
             }
         }
         $this->getCreatedAndUpdatedColumns($data, $include_columns);
     }
     return $data;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:74,代码来源:PayPeriodFactory.class.php


注:本文中的TTDate::getAPIDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。