本文整理汇总了PHP中UserListFactory::getCurrent方法的典型用法代码示例。如果您正苦于以下问题:PHP UserListFactory::getCurrent方法的具体用法?PHP UserListFactory::getCurrent怎么用?PHP UserListFactory::getCurrent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserListFactory
的用法示例。
在下文中一共展示了UserListFactory::getCurrent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postInstall
function postInstall()
{
Debug::text('postInstall: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
$clf = new CompanyListFactory();
$clf->StartTransaction();
$clf->getAll();
if ($clf->getRecordCount() > 0) {
foreach ($clf as $c_obj) {
if ($c_obj->getStatus() == 10) {
$ulf = new UserListFactory();
$ulf->getHighestEmployeeNumberByCompanyId($c_obj->getId());
if ($ulf->getRecordCount() > 0) {
$next_available_employee_number = $ulf->getCurrent()->getEmployeeNumber() + 1;
} else {
$next_available_employee_number = 1;
}
$ulf->getByCompanyId($c_obj->getId(), NULL, NULL, NULL, array('hire_date' => 'asc'));
if ($ulf->getRecordCount() > 0) {
foreach ($ulf as $u_obj) {
if ($u_obj->getEmployeeNumber() == '') {
Debug::text('Setting Employee Number to: ' . $next_available_employee_number . ' for ' . $u_obj->getUserName(), __FILE__, __LINE__, __METHOD__, 9);
$u_obj->setEmployeeNumber($next_available_employee_number);
if ($u_obj->isValid()) {
$u_obj->Save();
$next_available_employee_number++;
}
} else {
Debug::text('NOT Setting Employee Number for ' . $u_obj->getUserName() . ' already set to: ' . $u_obj->getEmployeeNumber(), __FILE__, __LINE__, __METHOD__, 9);
}
}
}
}
}
}
//$clf->FailTransaction();
$clf->CommitTransaction();
return TRUE;
}
示例2: getSchedule
//.........这里部分代码省略.........
}
}
if (isset($tmp_schedule_shifts)) {
//Sort Branches/Departments first
foreach ($tmp_schedule_shifts as $day_epoch => $day_tmp_schedule_shift) {
ksort($day_tmp_schedule_shift);
$tmp_schedule_shifts[$day_epoch] = $day_tmp_schedule_shift;
foreach ($day_tmp_schedule_shift as $branch => $department_schedule_shifts) {
ksort($tmp_schedule_shifts[$day_epoch][$branch]);
}
}
//Sort each department by start time.
foreach ($tmp_schedule_shifts as $day_epoch => $day_tmp_schedule_shift) {
foreach ($day_tmp_schedule_shift as $branch => $department_schedule_shifts) {
foreach ($department_schedule_shifts as $department => $department_schedule_shift) {
$department_schedule_shift = Sort::multiSort($department_schedule_shift, 'start_time');
$this->schedule_shifts[$day_epoch][$branch][$department] = $department_schedule_shift;
}
}
}
}
unset($day_tmp_schedule_shift, $department_schedule_shifts, $department_schedule_shift, $tmp_schedule_shifts, $branch, $department);
$calendar_array = TTDate::getCalendarArray($filter_data['start_date'], $filter_data['end_date'], $start_week_day);
//var_dump($calendar_array);
if (!is_array($calendar_array) or !isset($this->schedule_shifts) or !is_array($this->schedule_shifts)) {
continue;
//Skip to next user.
}
$ulf = new UserListFactory();
$ulf->getByIdAndCompanyId($user_id, $current_user->getCompany());
if ($ulf->getRecordCount() != 1) {
continue;
} else {
$user_obj = $ulf->getCurrent();
$pdf->AddPage();
$pdf->setXY(670, $top_margin);
$pdf->SetFont('freesans', '', 10);
$pdf->Cell(100, 15, TTDate::getDate('DATE+TIME', $current_epoch), $border, 0, 'R');
$pdf->setXY($left_margin, $top_margin);
$pdf->SetFont('freesans', 'B', 25);
$pdf->Cell(0, 25, $user_obj->getFullName() . ' - ' . TTi18n::getText('Schedule'), $border, 0, 'C');
$pdf->Ln();
}
$pdf->SetFont('freesans', 'B', 16);
$pdf->Cell(0, 15, TTDate::getDate('DATE', $filter_data['start_date']) . ' - ' . TTDate::getDate('DATE', $filter_data['end_date']), $border, 0, 'C');
//$pdf->Ln();
$pdf->Ln();
$pdf->Ln();
$pdf->SetFont('freesans', '', 8);
$cell_width = floor(($pdf->GetPageWidth() - $left_margin * 2) / 7);
$cell_height = 100;
$i = 0;
$total_days = count($calendar_array) - 1;
$boader = 1;
foreach ($calendar_array as $calendar) {
if ($i == 0) {
//Calendar Header
$pdf->SetFont('freesans', 'B', 8);
$calendar_header = TTDate::getDayOfWeekArrayByStartWeekDay($start_week_day);
foreach ($calendar_header as $header_name) {
$pdf->Cell($cell_width, 15, $header_name, 1, 0, 'C');
}
$pdf->Ln();
unset($calendar_header, $header_name);
}
$month_name = NULL;
示例3: UserTaxListFactory
$utlf = new UserTaxListFactory();
//$uwlf->GetByUserIdAndCompanyId($current_user->getId(), $current_company->getId() );
$utlf->GetByUserId($user_id);
foreach ($utlf as $tax) {
//Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10);
//$user_id = $tax->getUser();
$tax_data = array('id' => $tax->getId(), 'user_id' => $tax->getUser(), 'country' => $user_obj->getCountry(), 'federal_claim' => $tax->getFederalClaim(), 'provincial_claim' => $tax->getProvincialClaim(), 'federal_additional_deduction' => $tax->getFederalAdditionalDeduction(), 'wcb_rate' => $tax->getWCBRate(), 'vacation_rate' => $tax->getVacationRate(), 'release_vacation' => $tax->getReleaseVacation(), 'ei_exempt' => $tax->getEIExempt(), 'cpp_exempt' => $tax->getCPPExempt(), 'federal_tax_exempt' => $tax->getFederalTaxExempt(), 'provincial_tax_exempt' => $tax->getProvincialTaxExempt(), 'federal_filing_status_id' => $tax->getFederalFilingStatus(), 'state_filing_status_id' => $tax->getStateFilingStatus(), 'federal_allowance' => $tax->getFederalAllowance(), 'state_allowance' => $tax->getStateAllowance(), 'state_additional_deduction' => $tax->getStateAdditionalDeduction(), 'state_ui_rate' => $tax->getStateUIRate(), 'state_ui_wage_base' => $tax->getStateUIWageBase(), 'social_security_exempt' => $tax->getSocialSecurityExempt(), 'ui_exempt' => $tax->getUIExempt(), 'medicare_exempt' => $tax->getMedicareExempt(), 'created_date' => $tax->getCreatedDate(), 'created_by' => $tax->getCreatedBy(), 'updated_date' => $tax->getUpdatedDate(), 'updated_by' => $tax->getUpdatedBy(), 'deleted_date' => $tax->getDeletedDate(), 'deleted_by' => $tax->getDeletedBy());
}
if (!isset($tax_data)) {
$tax_data = array('country' => $user_obj->getCountry(), 'wcb_rate' => 0, 'vacation_rate' => 0, 'federal_claim' => 0, 'provincial_claim' => 0, 'federal_additional_deduction' => 0, 'federal_allowance' => 0, 'state_allowance' => 0, 'state_additional_deduction' => 0, 'state_ui_rate' => 0, 'state_ui_wage_base' => 0);
}
} else {
if ($tax_data['user_id'] != '') {
$user_id = $tax_data['user_id'];
}
}
$tax_data['user_options'] = UserListFactory::getByCompanyIdArray($current_company->getId(), FALSE);
$tax_data['federal_filing_status_options'] = $utf->getOptions('federal_filing_status');
$tax_data['state_filing_status_options'] = $utf->getOptions('state_filing_status');
//var_dump($tax_data);
$smarty->assign_by_ref('tax_data', $tax_data);
$smarty->assign_by_ref('user_id', $user_id);
$ulf = new UserListFactory();
$ulf->getByIdAndCompanyId($user_id, $current_company->getId());
$user_data = $ulf->getCurrent();
$smarty->assign_by_ref('full_name', $user_data->getFullName());
$smarty->assign_by_ref('data_saved', $data_saved);
break;
}
$smarty->assign_by_ref('utf', $utf);
$smarty->display('users/EditUserTax.tpl');
示例4: postInstall
//.........这里部分代码省略.........
$serialized_path = serialize($parent_groups);
$paths_to_root[$serialized_path][] = $id;
unset($serialized_path);
}
unset($parent_groups, $parents);
}
}
Debug::Arr($paths_to_root, ' Paths To Root: ', __FILE__, __LINE__, __METHOD__, 10);
//Decode path_to_root array
if (isset($paths_to_root) and count($paths_to_root) > 0) {
foreach ($paths_to_root as $serialized_path => $children) {
$path_arr = unserialize($serialized_path);
$decoded_paths[] = array('hierarchy_control_id' => $hierarchy_id, 'path' => $path_arr, 'children' => $children);
}
unset($path_arr, $children);
Debug::Arr($decoded_paths, ' Decoded Paths: ', __FILE__, __LINE__, __METHOD__, 10);
if (isset($decoded_paths) and is_array($decoded_paths)) {
foreach ($decoded_paths as $decoded_path) {
Debug::Text(' Company ID: ' . $company_id, __FILE__, __LINE__, __METHOD__, 10);
//Create new hierarchy_control
$hcf = new HierarchyControlFactory();
$hcf->setCompany($company_id);
$hcf->setObjectType($object_types[$decoded_path['hierarchy_control_id']]);
//Generate meaningful name
$name = FALSE;
if (isset($decoded_path['path']) and is_array($decoded_path['path'])) {
ksort($decoded_path['path']);
//Sort by level.
foreach ($decoded_path['path'] as $level => $superior_ids) {
foreach ($superior_ids as $superior_id) {
$ulf = new UserListFactory();
$ulf->getById($superior_id);
if ($ulf->getRecordCount() > 0) {
$name[] = $level . '. ' . $ulf->getCurrent()->getFullName();
}
}
}
unset($level, $superior_ids, $superior_id);
}
if (isset($name)) {
$name = $hc_obj->getName() . ' ' . implode(', ', $name) . ' (#' . rand(1000, 9999) . ')';
} else {
$name = $hc_obj->getName() . ' (#' . rand(1000, 9999) . ')';
}
$hcf->setName(substr($name, 0, 249));
$hcf->setDescription(TTi18n::getText('Automatically created by TimeTrex'));
if ($hcf->isValid()) {
$hc_id = $hcf->Save(FALSE);
Debug::Text('Hierarchy Control ID: ' . $hc_id, __FILE__, __LINE__, __METHOD__, 10);
$hcf->setUser($decoded_path['children']);
if (isset($decoded_path['path']) and is_array($decoded_path['path'])) {
foreach ($decoded_path['path'] as $level => $superior_ids) {
foreach ($superior_ids as $superior_id) {
$hlf = new HierarchyLevelFactory();
$hlf->setHierarchyControl($hc_id);
$hlf->setLevel($level);
$hlf->setUser($superior_id);
if ($hlf->isValid()) {
$hlf->Save();
Debug::Text('Saving Level Row ID... User ID: ' . $superior_id, __FILE__, __LINE__, __METHOD__, 10);
}
}
}
unset($level, $superior_ids, $superior_id);
}
}
示例5: setUser
function setUser($ids)
{
Debug::text('Setting User IDs : ', __FILE__, __LINE__, __METHOD__, 10);
if (is_array($ids) and count($ids) > 0) {
if (!$this->isNew()) {
//If needed, delete mappings first.
$rsulf = new RecurringScheduleUserListFactory();
$rsulf->getByRecurringScheduleControlId($this->getId());
$tmp_ids = array();
foreach ($rsulf as $obj) {
$id = $obj->getUser();
Debug::text('Recurring Schedule ID: ' . $obj->getRecurringScheduleControl() . ' ID: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
//Delete users that are not selected.
if (!in_array($id, $ids)) {
Debug::text('Deleting: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
$obj->Delete();
} else {
//Save ID's that need to be updated.
Debug::text('NOT Deleting : ' . $id, __FILE__, __LINE__, __METHOD__, 10);
$tmp_ids[] = $id;
}
}
unset($id, $obj);
}
//Insert new mappings.
$ulf = new UserListFactory();
foreach ($ids as $id) {
if (isset($ids) and !in_array($id, $tmp_ids)) {
$ulf->getById($id);
if ($ulf->getRecordCount() > 0) {
$obj = $ulf->getCurrent();
$rsuf = new RecurringScheduleUserFactory();
$rsuf->setRecurringScheduleControl($this->getId());
$rsuf->setUser($id);
if ($this->Validator->isTrue('user', $rsuf->Validator->isValid(), TTi18n::gettext('Selected Employee is invalid') . ' (' . $obj->getFullName() . ')')) {
$rsuf->save();
}
}
}
}
return TRUE;
}
Debug::text('No User IDs to set.', __FILE__, __LINE__, __METHOD__, 10);
return FALSE;
}
示例6: generateData
function generateData()
{
global $current_company, $current_user;
TTDate::setTimeZone('PST8PDT');
$current_epoch = time();
$cf = new CompanyFactory();
$cf->StartTransaction();
$company_id = $this->createCompany();
$clf = new CompanyListFactory();
$clf->getById($company_id);
$current_company = $clf->getCurrent();
if ($company_id !== FALSE) {
Debug::Text('Company Created Successfully!', __FILE__, __LINE__, __METHOD__, 10);
$this->createPermissionGroups($company_id);
//Create currency
$currency_ids[] = $this->createCurrency($company_id, 10);
//USD
$currency_ids[] = $this->createCurrency($company_id, 20);
//CAD
//Create branch
$branch_ids[] = $this->createBranch($company_id, 10);
//NY
$branch_ids[] = $this->createBranch($company_id, 20);
//WA
//Create departments
$department_ids[] = $this->createDepartment($company_id, 10);
$department_ids[] = $this->createDepartment($company_id, 20);
//Create stations
$station_id = $this->createStation($company_id);
//Create pay stub accounts.
$this->createPayStubAccount($company_id);
//Link pay stub accounts.
$this->createPayStubAccountLink($company_id);
//Company Deductions
$this->createCompanyDeduction($company_id);
//Wage Groups
$wage_group_ids[] = $this->createUserWageGroups($company_id);
//User Groups
$user_group_ids[] = $this->createUserGroup($company_id, 10, 0);
$user_group_ids[] = $this->createUserGroup($company_id, 20, $user_group_ids[0]);
$user_group_ids[] = $this->createUserGroup($company_id, 30, $user_group_ids[0]);
$user_group_ids[] = $this->createUserGroup($company_id, 40, 0);
$user_group_ids[] = $this->createUserGroup($company_id, 50, $user_group_ids[3]);
//Users
$user_ids[] = $this->createUser($company_id, 10, 0, $branch_ids[0], $department_ids[0], $currency_ids[0], $user_group_ids[0]);
$user_ids[] = $this->createUser($company_id, 11, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[0]);
$user_ids[] = $this->createUser($company_id, 12, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[0]);
$user_ids[] = $this->createUser($company_id, 13, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[0]);
$user_ids[] = $this->createUser($company_id, 14, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[1]);
$user_ids[] = $this->createUser($company_id, 15, 0, $branch_ids[0], $department_ids[0], $currency_ids[0], $user_group_ids[1]);
$user_ids[] = $this->createUser($company_id, 16, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[1]);
$user_ids[] = $this->createUser($company_id, 17, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[1]);
$user_ids[] = $this->createUser($company_id, 18, 0, $branch_ids[0], $department_ids[0], $currency_ids[0], $user_group_ids[2]);
$user_ids[] = $this->createUser($company_id, 19, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[2]);
$user_ids[] = $this->createUser($company_id, 20, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[2]);
$user_ids[] = $this->createUser($company_id, 21, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[3]);
$user_ids[] = $this->createUser($company_id, 22, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[3]);
$user_ids[] = $this->createUser($company_id, 23, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[3]);
$user_ids[] = $this->createUser($company_id, 24, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[3]);
$user_ids[] = $this->createUser($company_id, 25, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[4]);
$user_ids[] = $this->createUser($company_id, 26, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[4]);
$user_ids[] = $this->createUser($company_id, 27, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[4]);
$user_ids[] = $this->createUser($company_id, 28, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[4]);
$user_ids[] = $this->createUser($company_id, 29, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[4]);
$user_ids[] = $this->createUser($company_id, 30, 0, $branch_ids[1], $department_ids[0], $currency_ids[0], $user_group_ids[4]);
$user_ids[] = $this->createUser($company_id, 40, 0, $branch_ids[1], $department_ids[0], $currency_ids[0], $user_group_ids[4]);
$current_user_id = $user_ids[] = $this->createUser($company_id, 100, 0, $branch_ids[0], $department_ids[0], $currency_ids[0], $user_group_ids[1]);
//Create random users.
for ($i = 0; $i <= $this->getMaxRandomUsers(); $i++) {
$tmp_user_id = $this->createUser($company_id, 999, 0, $branch_ids[$i % 2], $department_ids[$i % 2], $currency_ids[0], $user_group_ids[$i % 5]);
if ($tmp_user_id != FALSE) {
$user_ids[] = $tmp_user_id;
}
}
Debug::Arr($user_ids, 'All User IDs:', __FILE__, __LINE__, __METHOD__, 10);
$ulf = new UserListFactory();
$ulf->getById($current_user_id);
$current_user = $ulf->getCurrent();
unset($current_user_id);
//Create policies
$policy_ids['round'][] = $this->createRoundingPolicy($company_id, 10);
//In
$policy_ids['round'][] = $this->createRoundingPolicy($company_id, 20);
//Out
$policy_ids['accrual'][] = $this->createAccrualPolicy($company_id, 10);
//Bank Time
$policy_ids['accrual'][] = $this->createAccrualPolicy($company_id, 20);
//Vacaction
$policy_ids['accrual'][] = $this->createAccrualPolicy($company_id, 30);
//Sick
$policy_ids['overtime'][] = $this->createOverTimePolicy($company_id, 10);
$policy_ids['overtime'][] = $this->createOverTimePolicy($company_id, 20, $policy_ids['accrual'][0]);
$policy_ids['premium'][] = $this->createPremiumPolicy($company_id, 10);
$policy_ids['absence'][] = $this->createAbsencePolicy($company_id, 10, $policy_ids['accrual'][1]);
$policy_ids['absence'][] = $this->createAbsencePolicy($company_id, 20, $policy_ids['accrual'][0]);
$policy_ids['absence'][] = $this->createAbsencePolicy($company_id, 30, $policy_ids['accrual'][2]);
$policy_ids['meal_1'] = $this->createMealPolicy($company_id);
$policy_ids['schedule_1'] = $this->createSchedulePolicy($company_id, $policy_ids['meal_1']);
$policy_ids['exception_1'] = $this->createExceptionPolicy($company_id);
$hierarchy_user_ids = $user_ids;
//.........这里部分代码省略.........
示例7: getByUserIdAndStatusAndType
function getByUserIdAndStatusAndType($user_id, $status, $type, $order = NULL)
{
if ($user_id == '') {
return FALSE;
}
if ($status == '') {
return FALSE;
}
if ($type == '') {
return FALSE;
}
$status_key = Option::getByValue($status, $this->getOptions('status'));
if ($status_key !== FALSE) {
$status = $status_key;
}
$type_key = Option::getByValue($type, $this->getOptions('type'));
if ($type_key !== FALSE) {
$type = $type_key;
}
$ulf = new UserListFactory();
$ulf->getById($user_id);
if ($ulf->getRecordCount() != 1) {
return FALSE;
}
$sugf = new StationUserGroupFactory();
$sbf = new StationBranchFactory();
$sdf = new StationDepartmentFactory();
$siuf = new StationIncludeUserFactory();
$seuf = new StationExcludeUserFactory();
$uf = new UserFactory();
$ph = array('user_id_a' => $user_id, 'company_id' => $ulf->getCurrent()->getCompany(), 'status' => $status, 'type' => $type);
$query = '
select a.*
from ' . $this->getTable() . ' as a
LEFT JOIN ' . $uf->getTable() . ' as z ON z.id = ?
where a.company_id = ?
AND a.status_id = ?
AND a.type_id = ?
AND
(
(
(
a.user_group_selection_type_id = 10
OR ( a.user_group_selection_type_id = 20 AND z.group_id in ( select b.group_id from ' . $sugf->getTable() . ' as b WHERE a.id = b.station_id ) )
OR ( a.user_group_selection_type_id = 30 AND z.group_id not in ( select b.group_id from ' . $sugf->getTable() . ' as b WHERE a.id = b.station_id ) )
)
AND
(
a.branch_selection_type_id = 10
OR ( a.branch_selection_type_id = 20 AND z.default_branch_id in ( select c.branch_id from ' . $sbf->getTable() . ' as c WHERE a.id = c.station_id ) )
OR ( a.branch_selection_type_id = 30 AND z.default_branch_id not in ( select c.branch_id from ' . $sbf->getTable() . ' as c WHERE a.id = c.station_id ) )
)
AND
(
a.department_selection_type_id = 10
OR ( a.department_selection_type_id = 20 AND z.default_department_id in ( select d.department_id from ' . $sdf->getTable() . ' as d WHERE a.id = d.station_id ) )
OR ( a.department_selection_type_id = 30 AND z.default_department_id not in ( select d.department_id from ' . $sdf->getTable() . ' as d WHERE a.id = d.station_id ) )
)
AND z.id not in ( select f.user_id from ' . $seuf->getTable() . ' as f WHERE a.id = f.station_id )
)
OR z.id in ( select e.user_id from ' . $siuf->getTable() . ' as e WHERE a.id = e.station_id )
)
AND ( a.deleted = 0 AND z.deleted = 0 )
ORDER BY lower(a.source) = \'any\' desc, lower(station_id) = \'any\' desc
';
//Try to order the SQL query to hit wildcard stations first.
//$query .= $this->getSortSQL( $order, $strict );
//Debug::text('Query: '. $query, __FILE__, __LINE__, __METHOD__, 10);
//Debug::arr($ph, 'PH: ', __FILE__, __LINE__, __METHOD__, 10);
$this->rs = $this->db->Execute($query, $ph);
return $this;
}
示例8: Pager
$pager = new Pager($mlf);
$require_ack = FALSE;
foreach ($mlf as $message) {
//Get user info
$ulf = new UserListFactory();
if ($message->isAck() == FALSE) {
$require_ack = TRUE;
}
if ($message->getRequireAck() == TRUE) {
$show_ack_column = TRUE;
}
$sent_to_full_name = NULL;
if ($message->getColumn('sent_to_user_id') != FALSE) {
$ulf->getById($message->getColumn('sent_to_user_id'));
if ($ulf->getRecordCount() > 0) {
$sent_to_full_name = $ulf->getCurrent()->getFullName();
}
}
$created_by_full_name = NULL;
if ($message->getCreatedBy() != FALSE) {
$ulf->getById($message->getCreatedBy());
if ($ulf->getRecordCount() > 0) {
$created_by_full_name = $ulf->getCurrent()->getFullName();
}
}
$messages[] = array('id' => $message->getId(), 'parent_id' => $message->getParent(), 'object_type_id' => $message->getObjectType(), 'object_type' => $object_name_options[$message->getObjectType()], 'object_id' => $message->getObject(), 'priority' => $message->getPriority(), 'status_id' => $message->getStatus(), 'require_ack' => $message->getRequireAck(), 'ack_date' => $message->getAckDate(), 'subject' => $message->getSubject(), 'body' => $message->getBody(), 'sent_to_user_id' => $message->getColumn('sent_to_user_id'), 'sent_to_full_name' => $sent_to_full_name, 'created_date' => $message->getCreatedDate(), 'created_by' => $message->getCreatedBy(), 'created_by_full_name' => $created_by_full_name, 'updated_date' => $message->getUpdatedDate(), 'updated_by' => $message->getUpdatedBy(), 'deleted_date' => $message->getDeletedDate(), 'deleted_by' => $message->getDeletedBy());
}
//var_dump($messages);
$smarty->assign_by_ref('messages', $messages);
$smarty->assign_by_ref('require_ack', $require_ack);
$smarty->assign_by_ref('show_ack_column', $show_ack_column);
示例9: unset
Redirect::Page(URLBuilder::getURL(NULL, '../index.php'));
}
break;
case 'submit':
//Debug::setVerbosity( 11 );
Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
unset($id);
//Do this so it doesn't reload the data from the DB.
//Additional permission checks.
if ($permission->Check('company', 'view')) {
$ulf->getById($user_data['id']);
} else {
$ulf->getByIdAndCompanyId($user_data['id'], $current_company->getId());
}
if ($ulf->getRecordCount() > 0) {
$user = $ulf->getCurrent();
$is_owner = $permission->isOwner($user->getCreatedBy(), $user->getID());
$is_child = $permission->isChild($user->getId(), $permission_children_ids);
if ($permission->Check('user', 'edit') or $permission->Check('user', 'edit_child') and $is_child === TRUE or $permission->Check('user', 'edit_own') and $is_owner === TRUE) {
// Security measure.
if (!empty($user_data['id'])) {
if ($permission->Check('company', 'view')) {
$uf = $ulf->getById($user_data['id'])->getCurrent();
} else {
$uf = $ulf->getByIdAndCompanyId($user_data['id'], $current_company->getId())->getCurrent();
}
}
} else {
$permission->Redirect(FALSE);
//Redirect
exit;
示例10: getEmailExceptionAddresses
function getEmailExceptionAddresses($u_obj = NULL, $ep_obj = NULL)
{
Debug::text(' Attempting to Email Notification...', __FILE__, __LINE__, __METHOD__, 10);
//Make sure type is not pre-mature.
if ($this->getType() > 5) {
if (!is_object($ep_obj)) {
$ep_obj = $this->getExceptionPolicyObject();
}
//Make sure exception policy email notifications are enabled.
if ($ep_obj->getEmailNotification() > 0) {
if (!is_object($u_obj)) {
$u_obj = $this->getUserDateObject()->getUserObject();
}
$up_obj = $this->getUserDateObject()->getUserObject()->getUserPreferenceObject();
//Make sure user email notifications are enabled.
if (($ep_obj->getEmailNotification() == 10 or $ep_obj->getEmailNotification() == 100) and $up_obj->getEnableEmailNotificationException() == TRUE) {
Debug::Text(' Emailing exception to user!', __FILE__, __LINE__, __METHOD__, 10);
if ($u_obj->getWorkEmail() != '') {
$retarr[] = $u_obj->getWorkEmail();
}
if ($up_obj->getEnableEmailNotificationHome() == TRUE and $u_obj->getHomeEmail() != '') {
$retarr[] = $u_obj->getHomeEmail();
}
} else {
Debug::Text(' Skipping email to user.', __FILE__, __LINE__, __METHOD__, 10);
}
//Make sure supervisor email notifcations are enabled
if ($ep_obj->getEmailNotification() == 20 or $ep_obj->getEmailNotification() == 100) {
//Find supervisor
$hlf = new HierarchyListFactory();
$parent_user_id = $hlf->getHierarchyParentByCompanyIdAndUserIdAndObjectTypeID($u_obj->getCompany(), $u_obj->getId(), 80);
if ($parent_user_id != FALSE) {
$ulf = new UserListFactory();
$ulf->getById($parent_user_id);
if ($ulf->getRecordCount() > 0) {
$parent_user_obj = $ulf->getCurrent();
if (is_object($parent_user_obj->getUserPreferenceObject()) and $parent_user_obj->getUserPreferenceObject()->getEnableEmailNotificationException() == TRUE) {
Debug::Text(' Emailing exception to supervisor!', __FILE__, __LINE__, __METHOD__, 10);
if ($parent_user_obj->getWorkEmail() != '') {
$retarr[] = $parent_user_obj->getWorkEmail();
}
if ($up_obj->getEnableEmailNotificationHome() == TRUE and $parent_user_obj->getHomeEmail() != '') {
$retarr[] = $parent_user_obj->getHomeEmail();
}
} else {
Debug::Text(' Skipping email to supervisor.', __FILE__, __LINE__, __METHOD__, 10);
}
}
} else {
Debug::Text(' No Hierarchy Parent Found, skipping email to supervisor.', __FILE__, __LINE__, __METHOD__, 10);
}
}
if (isset($retarr) and is_array($retarr)) {
return $retarr;
} else {
Debug::text(' No user objects to email too...', __FILE__, __LINE__, __METHOD__, 10);
}
} else {
Debug::text(' Exception Policy Email Exceptions are disabled, skipping email...', __FILE__, __LINE__, __METHOD__, 10);
}
} else {
Debug::text(' Pre-Mature exception, or not in production mode, skipping email...', __FILE__, __LINE__, __METHOD__, 10);
}
return FALSE;
}
示例11: setUser
function setUser($id)
{
$id = trim($id);
$ulf = new UserListFactory();
$hulf = new HierarchyUserListFactory();
if ($this->getHierarchyControl() == FALSE) {
return FALSE;
}
//Get user object so we can get the users full name to display as an error message.
$ulf->getById($id);
if ($id == 0 or $ulf->getRecordCount() > 0 and $this->Validator->isResultSetWithRows('user', $ulf->getByID($id), TTi18n::gettext('Invalid Employee')) and $this->Validator->isNotResultSetWithRows('user', $hulf->getByHierarchyControlAndUserId($this->getHierarchyControl(), $id), TTi18n::gettext($ulf->getCurrent()->getFullName() . ' is assigned as both a superior and subordinate'))) {
$this->data['user_id'] = $id;
return TRUE;
}
return FALSE;
}
示例12: addAccrualPolicyTime
function addAccrualPolicyTime($epoch = NULL, $offset = 79200, $daily_total_time = NULL)
{
//22hr offset
if ($epoch == '') {
$epoch = TTDate::getTime();
}
Debug::Text('Accrual Policy ID: ' . $this->getId() . ' Current EPOCH: ' . TTDate::getDate('DATE+TIME', $epoch), __FILE__, __LINE__, __METHOD__, 10);
$pglf = new PolicyGroupListFactory();
$pglf->StartTransaction();
$pglf->getSearchByCompanyIdAndArrayCriteria($this->getCompany(), array('accrual_policy_id' => array($this->getId())));
if ($pglf->getRecordCount() > 0) {
Debug::Text('Found Policy Group...', __FILE__, __LINE__, __METHOD__, 10);
foreach ($pglf as $pg_obj) {
//Get all users assigned to this policy group.
$policy_group_users = $pg_obj->getUser();
if (is_array($policy_group_users) and count($policy_group_users) > 0) {
Debug::Text('Found Policy Group Users: ' . count($policy_group_users), __FILE__, __LINE__, __METHOD__, 10);
foreach ($policy_group_users as $user_id) {
Debug::Text('Policy Group User ID: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
//Get User Object
$ulf = new UserListFactory();
$ulf->getByIDAndCompanyID($user_id, $this->getCompany());
if ($ulf->getRecordCount() == 1) {
$u_obj = $ulf->getCurrent();
Debug::Text('User: ' . $u_obj->getFullName() . ' Status: ' . $u_obj->getStatus(), __FILE__, __LINE__, __METHOD__, 10);
//Make sure only active employees accrue time. Will this negative affect
//Employees who may be on leave?
if ($u_obj->getStatus() == 10 and ($this->getMinimumEmployedDays() == 0 or TTDate::getDays($epoch - $u_obj->getHireDate()) >= $this->getMinimumEmployedDays())) {
Debug::Text(' User is active and has been employed long enough.', __FILE__, __LINE__, __METHOD__, 10);
$annual_pay_periods = 0;
$in_apply_frequency_window = FALSE;
$accrual_balance = 0;
$accrual_amount = 0;
if ($this->getType() == 30) {
Debug::Text(' Accrual policy is hour based, real-time window.', __FILE__, __LINE__, __METHOD__, 10);
//Hour based, apply frequency is real-time.
$in_apply_frequency_window = TRUE;
} else {
if ($this->getApplyFrequency() == 10) {
//Because of pay period frequencies, and users being assigned to different
//pay period schedules we need to get the last pay period of each user individually.
//This will return the pay period that just ended in the offset time.
$pplf = new PayPeriodListFactory();
$pplf->getByUserIdAndEndDate($user_id, $epoch - $offset);
if ($pplf->getRecordCount() > 0) {
foreach ($pplf as $pp_obj) {
Debug::Text(' Pay Period End Date: ' . TTDate::getDate('DATE+TIME', $pp_obj->getEndDate()), __FILE__, __LINE__, __METHOD__, 10);
if ($this->inApplyFrequencyWindow($epoch, $offset, $pp_obj->getEndDate()) == TRUE) {
$in_apply_frequency_window = TRUE;
$annual_pay_periods = $pp_obj->getPayPeriodScheduleObject()->getAnnualPayPeriods();
break;
} else {
Debug::Text(' User not in Apply Frequency Window: ', __FILE__, __LINE__, __METHOD__, 10);
}
}
} else {
Debug::Text(' No Pay Period Found.', __FILE__, __LINE__, __METHOD__, 10);
}
} elseif ($this->inApplyFrequencyWindow($epoch, $offset) == TRUE) {
Debug::Text(' User IS in NON-PayPeriod Apply Frequency Window.', __FILE__, __LINE__, __METHOD__, 10);
$in_apply_frequency_window = TRUE;
} else {
Debug::Text(' User is not in Apply Frequency Window.', __FILE__, __LINE__, __METHOD__, 10);
$in_apply_frequency_window = FALSE;
}
}
if ($in_apply_frequency_window == TRUE) {
$milestone_obj = $this->getActiveMilestoneObject($u_obj, $epoch);
if (isset($milestone_obj) and is_object($milestone_obj)) {
Debug::Text(' Found Matching Milestone, Accrual Rate: (ID: ' . $milestone_obj->getId() . ') ' . $milestone_obj->getAccrualRate() . '/year', __FILE__, __LINE__, __METHOD__, 10);
$accrual_balance = $this->getCurrentAccrualBalance($user_id, $this->getId());
if ($accrual_balance < $milestone_obj->getMaximumTime()) {
$accrual_amount = $this->calcAccrualAmount($milestone_obj, 0, $annual_pay_periods);
if ($accrual_amount > 0) {
$new_accrual_balance = bcadd($accrual_balance, $accrual_amount);
//If Maximum time is set to 0, make that unlimited.
if ($milestone_obj->getMaximumTime() > 0 and $new_accrual_balance > $milestone_obj->getMaximumTime()) {
$accrual_amount = bcsub($milestone_obj->getMaximumTime(), $accrual_balance, 0);
}
Debug::Text(' Min/Max Adjusted Accrual Amount: ' . $accrual_amount . ' Limits: Min: ' . $milestone_obj->getMinimumTime() . ' Max: ' . $milestone_obj->getMaximumTime(), __FILE__, __LINE__, __METHOD__, 10);
//Check to make sure there isn't an identical entry already made.
$alf = new AccrualListFactory();
$alf->getByCompanyIdAndUserIdAndAccrualPolicyIDAndTimeStampAndAmount($u_obj->getCompany(), $user_id, $this->getId(), TTDate::getMiddleDayEpoch($epoch), $accrual_amount);
if ($alf->getRecordCount() == 0) {
//Round to nearest 1min
$af = new AccrualFactory();
$af->setUser($user_id);
$af->setType(75);
//Accrual Policy
$af->setAccrualPolicyID($this->getId());
$af->setAmount($accrual_amount);
$af->setTimeStamp(TTDate::getMiddleDayEpoch($epoch));
$af->setEnableCalcBalance(TRUE);
if ($af->isValid()) {
$af->Save();
}
} else {
Debug::Text(' Found duplicate accrual entry, skipping...', __FILE__, __LINE__, __METHOD__, 10);
}
unset($accrual_amount, $accrual_balance, $new_accrual_balance);
//.........这里部分代码省略.........
示例13: setUser
function setUser($ids)
{
Debug::text('Setting User IDs : ', __FILE__, __LINE__, __METHOD__, 10);
if (is_array($ids)) {
if (!$this->isNew()) {
//If needed, delete mappings first.
$hulf = new HierarchyUserListFactory();
$hulf->getByHierarchyControlID($this->getId());
$tmp_ids = array();
foreach ($hulf as $obj) {
$id = $obj->getUser();
Debug::text('HierarchyControl ID: ' . $obj->getHierarchyControl() . ' ID: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
//Delete users that are not selected.
if (!in_array($id, $ids)) {
Debug::text('Deleting: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
$obj->Delete();
} else {
//Save ID's that need to be updated.
Debug::text('NOT Deleting : ' . $id, __FILE__, __LINE__, __METHOD__, 10);
$tmp_ids[] = $id;
}
}
unset($id, $obj);
}
//Insert new mappings.
$ulf = new UserListFactory();
foreach ($ids as $id) {
if (isset($ids) and !in_array($id, $tmp_ids)) {
$huf = new HierarchyUserFactory();
$huf->setHierarchyControl($this->getId());
$huf->setUser($id);
$ulf->getById($id);
if ($ulf->getRecordCount() > 0) {
$obj = $ulf->getCurrent();
if ($this->Validator->isTrue('user', $huf->Validator->isValid(), TTi18n::gettext('Selected subordinate is invalid or already assigned to another hierarchy with the same objects ') . ' (' . $obj->getFullName() . ')')) {
$huf->save();
}
}
}
}
return TRUE;
}
Debug::text('No User IDs to set.', __FILE__, __LINE__, __METHOD__, 10);
return FALSE;
}
示例14: foreach
$udlf->getByCompanyIdAndUserId($current_company->getId(), $user_id);
if ($udlf->getRecordCount() > 0) {
//Remove deductions from select box that are already assigned to user.
$deduction_ids = array_keys($data['deduction_options']);
foreach ($udlf as $ud_obj) {
if (in_array($ud_obj->getCompanyDeduction(), $deduction_ids)) {
unset($data['deduction_options'][$ud_obj->getCompanyDeduction()]);
}
}
}
}
//Get user full name
$ulf = new UserListFactory();
$ulf->getByIdAndCompanyId($data['user_id'], $current_company->getId());
if ($ulf->getRecordCount() > 0) {
$data['user_full_name'] = $ulf->getCurrent()->getFullName();
}
}
//Select box options;
$data['us_eic_filing_status_options'] = $cdf->getOptions('us_eic_filing_status');
$data['federal_filing_status_options'] = $cdf->getOptions('federal_filing_status');
$data['state_filing_status_options'] = $cdf->getOptions('state_filing_status');
$data['state_ga_filing_status_options'] = $cdf->getOptions('state_ga_filing_status');
$data['state_nj_filing_status_options'] = $cdf->getOptions('state_nj_filing_status');
$data['state_nc_filing_status_options'] = $cdf->getOptions('state_nc_filing_status');
$data['state_ma_filing_status_options'] = $cdf->getOptions('state_ma_filing_status');
$data['state_al_filing_status_options'] = $cdf->getOptions('state_al_filing_status');
$data['state_ct_filing_status_options'] = $cdf->getOptions('state_ct_filing_status');
$data['state_wv_filing_status_options'] = $cdf->getOptions('state_wv_filing_status');
$data['state_me_filing_status_options'] = $cdf->getOptions('state_me_filing_status');
$data['state_de_filing_status_options'] = $cdf->getOptions('state_de_filing_status');
示例15: checkCompanyStatus
function checkCompanyStatus($user_name)
{
$ulf = new UserListFactory();
$ulf->getByUserName(strtolower($user_name));
if ($ulf->getRecordCount() == 1) {
$u_obj = $ulf->getCurrent();
if (is_object($u_obj)) {
$clf = new CompanyListFactory();
$clf->getById($u_obj->getCompany());
if ($clf->getRecordCount() == 1) {
if ($clf->getCurrent()->getStatus() == 10) {
return TRUE;
}
}
}
}
return FALSE;
}