本文整理汇总了PHP中TTDate::parseDateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP TTDate::parseDateTime方法的具体用法?PHP TTDate::parseDateTime怎么用?PHP TTDate::parseDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTDate
的用法示例。
在下文中一共展示了TTDate::parseDateTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse_effective_date
function parse_effective_date($input, $default_value = NULL, $parse_hint = NULL)
{
if (isset($parse_hint) and $parse_hint != '') {
TTDate::setDateFormat($parse_hint);
}
return TTDate::parseDateTime($input);
}
示例2: getTimeSheetDates
/**
* Get all necessary dates for building the TimeSheet in a single call, this is mainly as a performance optimization.
* @param array $data filter data
* @return array
*/
function getTimeSheetDates($base_date)
{
$epoch = TTDate::parseDateTime($base_date);
if ($epoch == '') {
$epoch = TTDate::getTime();
}
$start_date = TTDate::getBeginWeekEpoch($epoch, $this->getCurrentUserPreferenceObject()->getStartWeekDay());
$end_date = TTDate::getEndWeekEpoch($epoch, $this->getCurrentUserPreferenceObject()->getStartWeekDay());
$retarr = array('base_date' => $epoch, 'start_date' => $start_date, 'end_date' => $end_date, 'base_display_date' => TTDate::getAPIDate('DATE', $epoch), 'start_display_date' => TTDate::getAPIDate('DATE', $start_date), 'end_display_date' => TTDate::getAPIDate('DATE', $end_date));
return $retarr;
}
示例3: extract
*/
require_once '../../includes/global.inc.php';
require_once Environment::getBasePath() . 'includes/Interface.inc.php';
//Debug::setVerbosity(11);
if (!$permission->Check('request', 'enabled') or !($permission->Check('request', 'edit') or $permission->Check('request', 'edit_own'))) {
$permission->Redirect(FALSE);
//Redirect
}
$smarty->assign('title', TTi18n::gettext($title = 'Edit Request'));
// See index.php
/*
* Get FORM variables
*/
extract(FormVariables::GetVariables(array('action', 'id', 'data')));
if (isset($data)) {
$data['date_stamp'] = TTDate::parseDateTime($data['date_stamp']);
}
$rf = new RequestFactory();
$action = Misc::findSubmitButton();
$action = strtolower($action);
switch ($action) {
case 'submit':
//Debug::setVerbosity(11);
Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
$rf->StartTransaction();
$rf->setId($data['id']);
$rf->setUserDate($data['user_id'], $data['date_stamp']);
$rf->setType($data['type_id']);
$rf->setStatus(30);
if ($rf->isNew()) {
Debug::Text('Object is NEW!', __FILE__, __LINE__, __METHOD__, 10);
示例4: setObjectFromArray
function setObjectFromArray($data)
{
if (is_array($data)) {
$variable_function_map = $this->getVariableToFunctionMap();
foreach ($variable_function_map as $key => $function) {
if (isset($data[$key])) {
$function = 'set' . $function;
switch ($key) {
case 'first_date':
$this->setFirstDate(TTDate::parseDateTime($data['first_date']));
break;
case 'last_date':
$this->setLastDate(TTDate::parseDateTime($data['last_date']));
break;
case 'pay_period_end_date':
$this->setPayPeriodEndDate(TTDate::parseDateTime($data['pay_period_end_date']));
break;
case 'recall_date':
$this->setRecallDate(TTDate::parseDateTime($data['recall_date']));
break;
default:
if (method_exists($this, $function)) {
$this->{$function}($data[$key]);
}
break;
}
}
}
$this->setCreatedAndUpdatedColumns($data);
return TRUE;
}
return FALSE;
}
示例5: array
if ($permission->Check('schedule', 'view') == FALSE) {
if ($permission->Check('schedule', 'view_child') == FALSE) {
$permission_children_ids = array();
}
if ($permission->Check('schedule', 'view_own')) {
$permission_children_ids[] = $current_user->getId();
}
$filter_data['permission_children_ids'] = $permission_children_ids;
}
$do = Misc::findSubmitButton('do');
switch ($do) {
case 'view_schedule':
default:
$user_ids = array();
if ($filter_data['start_date'] != '' and $filter_data['show_days'] != '') {
$start_date = $filter_data['start_date'] = TTDate::getBeginDayEpoch(TTDate::parseDateTime($filter_data['start_date']));
$end_date = $filter_data['end_date'] = $start_date + ($filter_data['show_days'] * 86400 - 3601);
} else {
$start_date = $filter_data['start_date'] = TTDate::getBeginWeekEpoch(TTDate::getTime(), $current_user_prefs->getStartWeekDay());
$end_date = $filter_data['end_date'] = $start_date + $filter_data['show_days'] * (86400 - 3601);
}
Debug::text(' Start Date: ' . TTDate::getDate('DATE+TIME', $start_date) . ' End Date: ' . TTDate::getDate('DATE+TIME', $end_date), __FILE__, __LINE__, __METHOD__, 10);
$sf = TTnew('ScheduleFactory');
$raw_schedule_shifts = $sf->getScheduleArray($filter_data);
if (is_array($raw_schedule_shifts)) {
foreach ($raw_schedule_shifts as $day_epoch => $day_schedule_shifts) {
foreach ($day_schedule_shifts as $day_schedule_shift) {
$user_ids[] = $day_schedule_shift['user_id'];
$day_schedule_shift['is_owner'] = $permission->isOwner($day_schedule_shift['user_created_by'], $day_schedule_shift['user_id']);
$day_schedule_shift['is_child'] = $permission->isChild($day_schedule_shift['user_id'], $permission_children_ids);
$tmp_schedule_shifts[$day_epoch][$day_schedule_shift['branch']][$day_schedule_shift['department']][] = $day_schedule_shift;
示例6: setObjectFromArray
function setObjectFromArray($data)
{
if (is_array($data)) {
$variable_function_map = $this->getVariableToFunctionMap();
foreach ($variable_function_map as $key => $function) {
if (isset($data[$key])) {
$function = 'set' . $function;
switch ($key) {
case 'start_date':
case 'end_date':
$this->{$function}(TTDate::parseDateTime($data[$key]));
break;
default:
if (method_exists($this, $function)) {
$this->{$function}($data[$key]);
}
break;
}
}
}
$this->setCreatedAndUpdatedColumns($data);
return TRUE;
}
return FALSE;
}
示例7: extract
extract(FormVariables::GetVariables(array('action', 'id', 'pay_period_schedule_id', 'data')));
if (isset($data)) {
if (isset($data['start_date'])) {
$data['start_date'] = TTDate::parseDateTime($data['start_date']);
}
if (isset($data['end_date'])) {
$data['end_date'] = TTDate::parseDateTime($data['end_date']);
}
if (isset($data['transaction_date'])) {
$data['transaction_date'] = TTDate::parseDateTime($data['transaction_date']);
}
if (isset($data['advance_end_date'])) {
$data['advance_end_date'] = TTDate::parseDateTime($data['advance_end_date']);
}
if (isset($data['advance_transaction_date'])) {
$data['advance_transaction_date'] = TTDate::parseDateTime($data['advance_transaction_date']);
}
}
$ppf = TTnew('PayPeriodFactory');
$action = Misc::findSubmitButton();
$action = strtolower($action);
switch ($action) {
case 'submit':
//Debug::setVerbosity(11);
Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
$ppf->StartTransaction();
if ($data['id'] == '') {
$ppf->setCompany($current_company->getId());
$ppf->setStatus(10);
//Open
} else {
示例8: createPremiumPolicy
function createPremiumPolicy($company_id, $type)
{
$ppf = new PremiumPolicyFactory();
$ppf->setCompany($company_id);
switch ($type) {
case 10:
//Simple weekend premium
$ppf->setName('Weekend');
$ppf->setType(10);
$ppf->setPayType(20);
$ppf->setStartDate('');
$ppf->setEndDate('');
$ppf->setStartTime(TTDate::parseDateTime('12:00 AM'));
$ppf->setEndTime(TTDate::parseDateTime('11:59 PM'));
$ppf->setMon(FALSE);
$ppf->setTue(FALSE);
$ppf->setWed(FALSE);
$ppf->setThu(FALSE);
$ppf->setFri(FALSE);
$ppf->setSat(TRUE);
$ppf->setSun(TRUE);
$ppf->setRate('1.33');
//$1.33 per hour
$ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1'));
break;
case 20:
//Simple evening premium
$ppf->setName('Evening');
$ppf->setType(10);
$ppf->setPayType(10);
//Pay multiplied by factor
$ppf->setIncludePartialPunch(TRUE);
$ppf->setStartDate('');
$ppf->setEndDate('');
$ppf->setStartTime(TTDate::parseDateTime('5:00 PM'));
$ppf->setEndTime(TTDate::parseDateTime('11:59 PM'));
$ppf->setMon(FALSE);
$ppf->setTue(FALSE);
$ppf->setWed(FALSE);
$ppf->setThu(FALSE);
$ppf->setFri(TRUE);
$ppf->setSat(FALSE);
$ppf->setSun(FALSE);
$ppf->setWageGroup($this->user_wage_groups[0]);
$ppf->setRate('1.50');
$ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 2'));
break;
}
if ($ppf->isValid()) {
$insert_id = $ppf->Save();
Debug::Text('Premium Policy ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10);
return $insert_id;
}
Debug::Text('Failed Creating Premium Policy!', __FILE__, __LINE__, __METHOD__, 10);
return FALSE;
}
示例9: extract
extract(FormVariables::GetVariables(array('action', 'id', 'pc_data', 'filter_user_id')));
$punch_full_time_stamp = NULL;
if (isset($pc_data)) {
if ($pc_data['start_date_stamp'] != '' and !is_numeric($pc_data['start_date_stamp']) and $pc_data['end_date_stamp'] != '' and !is_numeric($pc_data['end_date_stamp']) and $pc_data['time_stamp'] != '' and !is_numeric($pc_data['time_stamp'])) {
$pc_data['start_punch_full_time_stamp'] = TTDate::parseDateTime($pc_data['start_date_stamp'] . ' ' . $pc_data['time_stamp']);
$pc_data['end_punch_full_time_stamp'] = TTDate::parseDateTime($pc_data['end_date_stamp'] . ' ' . $pc_data['time_stamp']);
$pc_data['time_stamp'] = TTDate::parseDateTime($pc_data['start_date_stamp'] . ' ' . $pc_data['time_stamp']);
} else {
$pc_data['start_punch_full_time_stamp'] = NULL;
$pc_data['end_punch_full_time_stamp'] = NULL;
}
if ($pc_data['start_date_stamp'] != '') {
$pc_data['start_date_stamp'] = TTDate::parseDateTime($pc_data['start_date_stamp']);
}
if ($pc_data['end_date_stamp'] != '') {
$pc_data['end_date_stamp'] = TTDate::parseDateTime($pc_data['end_date_stamp']);
}
}
//Get Permission Hierarchy Children first, as this can be used for viewing, or editing.
$hlf = new HierarchyListFactory();
$permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($current_company->getId(), $current_user->getId());
$filter_data = array();
//Debug::Arr($permission_children_ids,'Permission Children Ids:', __FILE__, __LINE__, __METHOD__,10);
if ($permission->Check('punch', 'edit') == FALSE) {
if ($permission->Check('punch', 'edit_child')) {
$filter_data['permission_children_ids'] = $permission_children_ids;
}
if ($permission->Check('punch', 'edit_own')) {
$filter_data['permission_children_ids'][] = $current_user->getId();
}
}
示例10: extract
*/
require_once '../../includes/global.inc.php';
require_once Environment::getBasePath() . 'includes/Interface.inc.php';
if (!$permission->Check('pay_stub_amendment', 'enabled') or !($permission->Check('pay_stub_amendment', 'edit') or $permission->Check('pay_stub_amendment', 'edit_own'))) {
$permission->Redirect(FALSE);
//Redirect
}
$smarty->assign('title', TTi18n::gettext($title = 'Edit Pay Stub Amendment'));
// See index.php
/*
* Get FORM variables
*/
extract(FormVariables::GetVariables(array('action', 'id', 'user_id', 'pay_stub_amendment_data')));
if (isset($pay_stub_amendment_data)) {
if ($pay_stub_amendment_data['effective_date'] != '') {
$pay_stub_amendment_data['effective_date'] = TTDate::parseDateTime($pay_stub_amendment_data['effective_date']);
}
}
$psaf = TTnew('PayStubAmendmentFactory');
$action = Misc::findSubmitButton();
$action = strtolower($action);
switch ($action) {
case 'submit':
//Debug::setVerbosity( 11 );
Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
$psaf->StartTransaction();
$fail_transaction = FALSE;
if (isset($pay_stub_amendment_data['filter_user_id']) and is_array($pay_stub_amendment_data['filter_user_id']) and count($pay_stub_amendment_data['filter_user_id']) > 0) {
foreach ($pay_stub_amendment_data['filter_user_id'] as $user_id) {
$psaf->setId($pay_stub_amendment_data['id']);
$psaf->setUser($user_id);
示例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;
}
示例12: setObjectFromArray
function setObjectFromArray($data)
{
if (is_array($data)) {
$variable_function_map = $this->getVariableToFunctionMap();
foreach ($variable_function_map as $key => $function) {
if (isset($data[$key])) {
$function = 'set' . $function;
switch ($key) {
/*
case 'new_day_trigger_time':
case 'maximum_shift_time':
Debug::text('Raw Time Unit: '. $data[$key] .' Parsing To: '. TTDate::parseTimeUnit( $data[$key] ), __FILE__, __LINE__, __METHOD__, 10);
if ( method_exists( $this, $function ) ) {
$this->$function( TTDate::parseTimeUnit( $data[$key] ) );
}
break;
*/
case 'anchor_date':
if (method_exists($this, $function)) {
$this->{$function}(TTDate::parseDateTime($data[$key]));
}
break;
default:
if (method_exists($this, $function)) {
$this->{$function}($data[$key]);
}
break;
}
}
}
$this->setCreatedAndUpdatedColumns($data);
return TRUE;
}
return FALSE;
}
示例13: setPunchData
function setPunchData($data)
{
//Debug::Arr($data, 'punchDataArray', __FILE__, __LINE__, __METHOD__,10);
/*
<b>TimeTrexSoapServer::setPunchData()</b>: Data: <pre> array(10) {
["date_stamp"]=> string(9) "05-Nov-05"
["transfer"]=> int(0)
["branch_id"]=> string(1) "0"
["time_stamp"]=> string(7) "4:42 PM"
["user_date_id"]=> string(5) "14774"
["punch_control_id"]=> string(5) "26614"
["type_id"]=> string(2) "10"
["department_id"]=> string(1) "0"
["status_id"]=> string(2) "20"
["user_id"]=> string(1) "1" } </pre><br>
*/
//Debug::Arr($data, ' Data: ', __FILE__, __LINE__, __METHOD__,10);
//User prefs should be set before we parse the date/time.
$punch_full_time_stamp = TTDate::parseDateTime($data['date_stamp'] . ' ' . $data['time_stamp']);
Debug::Text(' Punch Full TimeStamp: ' . date('r' . $punch_full_time_stamp) . ' (' . $punch_full_time_stamp . ') TimeZone: ' . $this->getUserObject()->getUserPreferenceObject()->getTimeZone(), __FILE__, __LINE__, __METHOD__, 10);
$pf = new PunchFactory();
$pf->StartTransaction();
//Set User before setTimeStamp so rounding can be done properly.
$pf->setUser($this->getUserObject()->getId());
if (isset($data['transfer']) and $data['transfer'] == 1) {
Debug::Text(' Enabling Transfer!: ', __FILE__, __LINE__, __METHOD__, 10);
$data['type_id'] = 10;
$data['status_id'] = 10;
$pf->setTransfer(TRUE);
}
$pf->setType($data['type_id']);
$pf->setStatus($data['status_id']);
$pf->setTimeStamp($punch_full_time_stamp);
if (isset($data['status_id']) and $data['status_id'] == 20 and isset($data['punch_control_id']) and $data['punch_control_id'] != '') {
$pf->setPunchControlID($data['punch_control_id']);
} else {
$pf->setPunchControlID($pf->findPunchControlID());
}
$pf->setStation($this->getStationObject()->getId());
if ($pf->isNew()) {
$pf->setActualTimeStamp($punch_full_time_stamp);
$pf->setOriginalTimeStamp($pf->getTimeStamp());
}
if ($pf->isValid() == TRUE) {
$return_date = $pf->getTimeStamp();
if ($pf->getStatus() == 10) {
$label = 'In';
} else {
$label = 'Out';
}
if ($pf->Save(FALSE) == TRUE) {
$pcf = new PunchControlFactory();
$pcf->setId($pf->getPunchControlID());
$pcf->setPunchObject($pf);
if (isset($data['branch_id']) and $data['branch_id'] != '') {
$pcf->setBranch($data['branch_id']);
}
if (isset($data['department_id']) and $data['department_id'] != '') {
$pcf->setDepartment($data['department_id']);
}
if (isset($data['job_id']) and $data['job_id'] != '') {
$pcf->setJob($data['job_id']);
}
if (isset($data['job_item_id']) and $data['job_item_id'] != '') {
$pcf->setJobItem($data['job_item_id']);
}
if (isset($data['quantity']) and $data['quantity'] != '') {
$pcf->setQuantity($data['quantity']);
}
if (isset($data['bad_quantity']) and $data['bad_quantity'] != '') {
$pcf->setBadQuantity($data['bad_quantity']);
}
//Don't overwrite note if a new one isn't set. This makes it more difficult to delete a note if they want to,
//But thats better then accidently deleting it.
if (isset($data['note']) and $data['note'] != '') {
$pcf->setNote($data['note']);
}
if (isset($data['other_id1']) and $data['other_id1'] != '') {
$pcf->setOtherID1($data['other_id1']);
}
if (isset($data['other_id2']) and $data['other_id2'] != '') {
$pcf->setOtherID2($data['other_id2']);
}
if (isset($data['other_id3']) and $data['other_id3'] != '') {
$pcf->setOtherID3($data['other_id3']);
}
if (isset($data['other_id4']) and $data['other_id4'] != '') {
$pcf->setOtherID4($data['other_id4']);
}
if (isset($data['other_id5']) and $data['other_id5'] != '') {
$pcf->setOtherID5($data['other_id5']);
}
//$pcf->setEnableStrictJobValidation( TRUE );
$pcf->setEnableCalcUserDateID(TRUE);
$pcf->setEnableCalcTotalTime(TRUE);
$pcf->setEnableCalcSystemTotalTime(TRUE);
$pcf->setEnableCalcUserDateTotal(TRUE);
$pcf->setEnableCalcException(TRUE);
$pcf->setEnablePreMatureException(TRUE);
//Enable pre-mature exceptions at this point.
//.........这里部分代码省略.........
示例14: getAPISearchByCompanyIdAndArrayCriteria
//.........这里部分代码省略.........
b.last_name as last_name,
b.country as country,
b.province as province,
udf.date_stamp as date_stamp,
udf.user_id as user_id,
c.id as default_branch_id,
c.name as default_branch,
d.id as default_department_id,
d.name as default_department,
e.id as user_group_id,
e.name as user_group,
f.id as title_id,
f.name as title
from ' . $this->getTable() . ' as a
LEFT JOIN ' . $udf->getTable() . ' as udf ON ( a.user_date_id = udf.id AND udf.deleted = 0 )
LEFT JOIN ' . $uf->getTable() . ' as b ON ( udf.user_id = b.id AND b.deleted = 0 )
LEFT JOIN ' . $huf->getTable() . ' as huf ON ( udf.user_id = huf.user_id )
LEFT JOIN ' . $bf->getTable() . ' as c ON ( b.default_branch_id = c.id AND c.deleted = 0)
LEFT JOIN ' . $df->getTable() . ' as d ON ( b.default_department_id = d.id AND d.deleted = 0)
LEFT JOIN ' . $ugf->getTable() . ' as e ON ( b.group_id = e.id AND e.deleted = 0 )
LEFT JOIN ' . $utf->getTable() . ' as f ON ( b.title_id = f.id AND f.deleted = 0 )
where b.company_id = ?
';
if (isset($filter_data['permission_children_ids']) and isset($filter_data['permission_children_ids'][0]) and !in_array(-1, (array) $filter_data['permission_children_ids'])) {
$query .= ' AND udf.user_id in (' . $this->getListSQL($filter_data['permission_children_ids'], $ph) . ') ';
}
if (isset($filter_data['user_id']) and isset($filter_data['user_id'][0]) and !in_array(-1, (array) $filter_data['user_id'])) {
$query .= ' AND udf.user_id in (' . $this->getListSQL($filter_data['user_id'], $ph) . ') ';
}
if (isset($filter_data['id']) and isset($filter_data['id'][0]) and !in_array(-1, (array) $filter_data['id'])) {
$query .= ' AND a.id in (' . $this->getListSQL($filter_data['id'], $ph) . ') ';
}
if (isset($filter_data['exclude_id']) and isset($filter_data['exclude_id'][0]) and !in_array(-1, (array) $filter_data['exclude_id'])) {
$query .= ' AND udf.user_id not in (' . $this->getListSQL($filter_data['exclude_id'], $ph) . ') ';
}
if (isset($filter_data['type_id']) and isset($filter_data['type_id'][0]) and !in_array(-1, (array) $filter_data['type_id'])) {
$query .= ' AND a.type_id in (' . $this->getListSQL($filter_data['type_id'], $ph) . ') ';
}
if (isset($filter_data['status_id']) and isset($filter_data['status_id'][0]) and !in_array(-1, (array) $filter_data['status_id'])) {
$query .= ' AND a.status_id in (' . $this->getListSQL($filter_data['status_id'], $ph) . ') ';
}
if (isset($filter_data['group_id']) and isset($filter_data['group_id'][0]) and !in_array(-1, (array) $filter_data['group_id'])) {
if (isset($filter_data['include_subgroups']) and (bool) $filter_data['include_subgroups'] == TRUE) {
$uglf = new UserGroupListFactory();
$filter_data['group_id'] = $uglf->getByCompanyIdAndGroupIdAndSubGroupsArray($company_id, $filter_data['group_id'], TRUE);
}
$query .= ' AND b.group_id in (' . $this->getListSQL($filter_data['group_id'], $ph) . ') ';
}
if (isset($filter_data['default_branch_id']) and isset($filter_data['default_branch_id'][0]) and !in_array(-1, (array) $filter_data['default_branch_id'])) {
$query .= ' AND b.default_branch_id in (' . $this->getListSQL($filter_data['default_branch_id'], $ph) . ') ';
}
if (isset($filter_data['default_department_id']) and isset($filter_data['default_department_id'][0]) and !in_array(-1, (array) $filter_data['default_department_id'])) {
$query .= ' AND b.default_department_id in (' . $this->getListSQL($filter_data['default_department_id'], $ph) . ') ';
}
if (isset($filter_data['title_id']) and isset($filter_data['title_id'][0]) and !in_array(-1, (array) $filter_data['title_id'])) {
$query .= ' AND b.title_id in (' . $this->getListSQL($filter_data['title_id'], $ph) . ') ';
}
if (isset($filter_data['country']) and isset($filter_data['country'][0]) and !in_array(-1, (array) $filter_data['country'])) {
$query .= ' AND b.country in (' . $this->getListSQL($filter_data['country'], $ph) . ') ';
}
if (isset($filter_data['province']) and isset($filter_data['province'][0]) and !in_array(-1, (array) $filter_data['province']) and !in_array('00', (array) $filter_data['province'])) {
$query .= ' AND b.province in (' . $this->getListSQL($filter_data['province'], $ph) . ') ';
}
//Handle authorize list criteria here.
if (isset($filter_data['authorized']) and isset($filter_data['authorized'][0]) and !in_array(-1, (array) $filter_data['authorized'])) {
$query .= ' AND a.authorized in (' . $this->getListSQL($filter_data['authorized'], $ph) . ') ';
}
if (isset($filter_data['hierarchy_level_map']) and is_array($filter_data['hierarchy_level_map'])) {
$query .= ' AND huf.id IS NOT NULL ';
//Make sure the user maps to a hierarchy.
$query .= ' AND ( ' . HierarchyLevelFactory::convertHierarchyLevelMapToSQL($filter_data['hierarchy_level_map'], 'a.', 'huf.', 'a.type_id') . ' )';
} elseif (isset($filter_data['hierarchy_level_map']) and $filter_data['hierarchy_level_map'] == FALSE) {
//If hierarchy_level_map is not an array, don't return any requests.
$query .= ' AND huf.id = -1 ';
//Make sure the user maps to a hierarchy.
}
if (isset($filter_data['start_date']) and trim($filter_data['start_date']) != '') {
$ph[] = $this->db->BindDate(TTDate::parseDateTime($filter_data['start_date']));
$query .= ' AND udf.date_stamp >= ?';
}
if (isset($filter_data['end_date']) and trim($filter_data['end_date']) != '') {
$ph[] = $this->db->BindDate(TTDate::parseDateTime($filter_data['end_date']));
$query .= ' AND udf.date_stamp <= ?';
}
$query .= isset($filter_data['created_by']) ? $this->getWhereClauseSQL(array('a.created_by', 'y.first_name', 'y.last_name'), $filter_data['created_by'], 'user_id_or_name', $ph) : NULL;
$query .= isset($filter_data['updated_by']) ? $this->getWhereClauseSQL(array('a.updated_by', 'z.first_name', 'z.last_name'), $filter_data['updated_by'], 'user_id_or_name', $ph) : NULL;
$query .= '
AND a.deleted = 0
';
$query .= $this->getWhereSQL($where);
$query .= $this->getSortSQL($order, $strict, $additional_order_fields);
//Debug::Arr($ph,'Query: '. $query, __FILE__, __LINE__, __METHOD__,10);
$this->ExecuteSQL($query, $ph, $limit, $page);
return $this;
}
示例15: PayPeriodListFactory
$pay_period_ids[] = $pay_period_obj->getId();
$pay_period_end_dates[$pay_period_obj->getId()] = $pay_period_obj->getEndDate();
if ($pp == 0) {
$default_transaction_start_date = $pay_period_obj->getEndDate();
$default_transaction_end_date = $pay_period_obj->getTransactionDate() + 86400;
}
$pp++;
}
$pplf = new PayPeriodListFactory();
$pay_period_options = $pplf->getByIdListArray($pay_period_ids, NULL, array('start_date' => 'desc'));
}
if (isset($filter_data['transaction_start_date'])) {
$filter_data['transaction_start_date'] = TTDate::getBeginDayEpoch(TTDate::parseDateTime($filter_data['transaction_start_date']));
}
if (isset($filter_data['transaction_end_date'])) {
$filter_data['transaction_end_date'] = TTDate::getEndDayEpoch(TTDate::parseDateTime($filter_data['transaction_end_date']));
}
$filter_data = Misc::preSetArrayValues($filter_data, array('include_user_ids', 'exclude_user_ids', 'user_status_ids', 'group_ids', 'branch_ids', 'department_ids', 'user_title_ids', 'currency_ids', 'pay_period_ids', 'column_ids'), array());
//Get Permission Hierarchy Children first, as this can be used for viewing, or editing.
$permission_children_ids = array();
if ($permission->Check('pay_stub', 'view') == FALSE) {
$hlf = new HierarchyListFactory();
$permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($current_company->getId(), $current_user->getId());
Debug::Arr($permission_children_ids, 'Permission Children Ids:', __FILE__, __LINE__, __METHOD__, 10);
if ($permission->Check('pay_stub', 'view_child') == FALSE) {
$permission_children_ids = array();
}
if ($permission->Check('pay_stub', 'view_own')) {
$permission_children_ids[] = $current_user->getId();
}
$filter_data['permission_children_ids'] = $permission_children_ids;