本文整理汇总了PHP中UserListFactory::getByIdAndCompanyId方法的典型用法代码示例。如果您正苦于以下问题:PHP UserListFactory::getByIdAndCompanyId方法的具体用法?PHP UserListFactory::getByIdAndCompanyId怎么用?PHP UserListFactory::getByIdAndCompanyId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserListFactory
的用法示例。
在下文中一共展示了UserListFactory::getByIdAndCompanyId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UserDeductionListFactory
$data['deduction_options'] = $cdlf->getByCompanyIdAndStatusIdArray($current_company->getId(), 10, FALSE);
$udlf = new UserDeductionListFactory();
$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');
示例2: 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');
示例3: getSchedule
function getSchedule($filter_data, $start_week_day = 0, $group_schedule = FALSE)
{
global $current_user, $current_user_prefs;
//Individual is one schedule per employee, or all on one schedule.
if (!is_array($filter_data)) {
return FALSE;
}
$current_epoch = time();
//Debug::Text('Start Date: '. TTDate::getDate('DATE', $start_date) .' End Date: '. TTDate::getDate('DATE', $end_date) , __FILE__, __LINE__, __METHOD__,10);
Debug::text(' Start Date: ' . TTDate::getDate('DATE+TIME', $filter_data['start_date']) . ' End Date: ' . TTDate::getDate('DATE+TIME', $filter_data['end_date']) . ' Start Week Day: ' . $start_week_day, __FILE__, __LINE__, __METHOD__, 10);
$pdf = new TTPDF('L', 'pt', 'Letter');
$left_margin = 20;
$top_margin = 20;
$pdf->setMargins($left_margin, $top_margin);
$pdf->SetAutoPageBreak(TRUE, 30);
//$pdf->SetAutoPageBreak(FALSE);
$pdf->SetFont('freesans', '', 10);
$border = 0;
$adjust_x = 0;
$adjust_y = 0;
if ($group_schedule == FALSE) {
$valid_schedules = 0;
$sf = new ScheduleFactory();
$tmp_schedule_shifts = $sf->getScheduleArray($filter_data);
//Re-arrange array by user_id->date
if (is_array($tmp_schedule_shifts)) {
foreach ($tmp_schedule_shifts as $day_epoch => $day_schedule_shifts) {
foreach ($day_schedule_shifts as $day_schedule_shift) {
$raw_schedule_shifts[$day_schedule_shift['user_id']][$day_epoch][] = $day_schedule_shift;
}
}
}
unset($tmp_schedule_shifts);
//Debug::Arr($raw_schedule_shifts, 'Raw Schedule Shifts: ', __FILE__, __LINE__, __METHOD__,10);
if (is_array($raw_schedule_shifts)) {
foreach ($raw_schedule_shifts as $user_id => $day_schedule_shifts) {
foreach ($day_schedule_shifts as $day_epoch => $day_schedule_shifts) {
foreach ($day_schedule_shifts as $day_schedule_shift) {
//Debug::Arr($day_schedule_shift, 'aDay Schedule Shift: ', __FILE__, __LINE__, __METHOD__,10);
$tmp_schedule_shifts[$day_epoch][$day_schedule_shift['branch']][$day_schedule_shift['department']][] = $day_schedule_shift;
if (isset($schedule_shift_totals[$day_epoch]['total_shifts'])) {
$schedule_shift_totals[$day_epoch]['total_shifts']++;
} else {
$schedule_shift_totals[$day_epoch]['total_shifts'] = 1;
}
//$week_of_year = TTDate::getWeek( strtotime($day_epoch) );
$week_of_year = TTDate::getWeek(strtotime($day_epoch), $start_week_day);
if (!isset($schedule_shift_totals[$day_epoch]['labels'])) {
$schedule_shift_totals[$day_epoch]['labels'] = 0;
}
if ($day_schedule_shift['branch'] != '--' and !isset($schedule_shift_totals[$day_epoch]['branch'][$day_schedule_shift['branch']])) {
$schedule_shift_totals[$day_epoch]['branch'][$day_schedule_shift['branch']] = TRUE;
$schedule_shift_totals[$day_epoch]['labels']++;
}
if ($day_schedule_shift['department'] != '--' and !isset($schedule_shift_totals[$day_epoch]['department'][$day_schedule_shift['branch']][$day_schedule_shift['department']])) {
$schedule_shift_totals[$day_epoch]['department'][$day_schedule_shift['branch']][$day_schedule_shift['department']] = TRUE;
$schedule_shift_totals[$day_epoch]['labels']++;
}
if (!isset($max_week_data[$week_of_year]['shift'])) {
Debug::text('Date: ' . $day_epoch . ' Week: ' . $week_of_year . ' Setting Max Week shift to 0', __FILE__, __LINE__, __METHOD__, 10);
$max_week_data[$week_of_year]['shift'] = 1;
$max_week_data[$week_of_year]['labels'] = 0;
}
if (isset($max_week_data[$week_of_year]['shift']) and $schedule_shift_totals[$day_epoch]['total_shifts'] + $schedule_shift_totals[$day_epoch]['labels'] > $max_week_data[$week_of_year]['shift'] + $max_week_data[$week_of_year]['labels']) {
Debug::text('Date: ' . $day_epoch . ' Week: ' . $week_of_year . ' Setting Max Week shift to: ' . $schedule_shift_totals[$day_epoch]['total_shifts'] . ' Labels: ' . $schedule_shift_totals[$day_epoch]['labels'], __FILE__, __LINE__, __METHOD__, 10);
$max_week_data[$week_of_year]['shift'] = $schedule_shift_totals[$day_epoch]['total_shifts'];
$max_week_data[$week_of_year]['labels'] = $schedule_shift_totals[$day_epoch]['labels'];
}
//Debug::Arr($schedule_shift_totals, ' Schedule Shift Totals: ', __FILE__, __LINE__, __METHOD__,10);
//Debug::Arr($max_week_data, ' zMaxWeekData: ', __FILE__, __LINE__, __METHOD__,10);
}
}
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());
//.........这里部分代码省略.........
示例4: BankAccountListFactory
}
$baf->setTransit($bank_data['transit']);
$baf->setAccount($bank_data['account']);
if ($baf->isValid()) {
$baf->Save();
Redirect::Page(URLBuilder::getURL(array('user_id' => $user_id, 'company_id' => $company_id, 'data_saved' => TRUE), Environment::getBaseURL() . '/bank_account/EditBankAccount.php'));
break;
}
default:
$balf = new BankAccountListFactory();
$ulf = new UserListFactory();
if ($user_id == '' and $company_id == '' and $permission->Check('user', 'edit_own_bank')) {
//Current user
$balf->getUserAccountByCompanyIdAndUserId($current_company->getId(), $current_user->getId());
$user_id = $current_user->getId();
$user_obj = $ulf->getByIdAndCompanyId($user_id, $current_company->getId())->getCurrent();
$country = $user_obj->getCountry();
} elseif ($user_id != '' and $permission->Check('user', 'edit_bank')) {
//Specified User
$balf->getUserAccountByCompanyIdAndUserId($current_company->getId(), $user_id);
$user_obj = $ulf->getByIdAndCompanyId($user_id, $current_company->getId())->getCurrent();
$country = $user_obj->getCountry();
} elseif ($company_id != '' and $permission->Check('company', 'edit_own_bank')) {
//Company bank.
$balf->getCompanyAccountByCompanyId($current_company->getId());
$country = $current_company->getCountry();
} else {
$permission->Redirect(FALSE);
}
if (!isset($action)) {
BreadCrumb::setCrumb($title);
示例5: enroll
function enroll($user_id, $id, $type = 'iButton', $number = 0, $extra_value = NULL)
{
Debug::text('Client Version: ' . $this->getClientVersion() . ' User ID : ' . $user_id . ' ID: ' . substr($id, 0, 100) . ' Type: ' . $type . ' Number: ' . $number, __FILE__, __LINE__, __METHOD__, 10);
$user_id = trim($user_id);
$id = trim($id);
$type = strtolower($type);
$number = trim($number);
$ulf = new UserListFactory();
if (version_compare($this->getClientVersion(), '2.7.0', '<')) {
Debug::text('aVersion: ' . $this->getClientVersion(), __FILE__, __LINE__, __METHOD__, 10);
//Fingerprints can send $id=NULL to clear an enrollment.
if (strpos($type, 'finger_print') === FALSE and $id == '') {
Debug::text('ID is not valid: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
return FALSE;
}
//Check to make sure the logged in user has edit_advance permissions
if ($this->getPermissionObject()->Check('user', 'enroll') or $this->getPermissionObject()->Check('user', 'enroll_child')) {
Debug::text('User : ' . $this->getUserObject()->getFullName() . ' has Enroll permission', __FILE__, __LINE__, __METHOD__, 10);
switch ($type) {
case 'finger_print_1':
case 'finger_print_2':
case 'finger_print_3':
case 'finger_print_4':
$enroll_user_obj = $ulf->getByIdAndCompanyId($user_id, $this->getUserObject()->getCompany());
if ($enroll_user_obj->getRecordCount() == 1) {
Debug::text('Enroller User ID : ' . $user_id . ' FOUND', __FILE__, __LINE__, __METHOD__, 10);
$enroll_user_obj = $enroll_user_obj->getCurrent();
switch ($type) {
case 'finger_print_1':
$number = 10;
break;
case 'finger_print_2':
$number = 20;
break;
case 'finger_print_3':
$number = 30;
break;
case 'finger_print_4':
$number = 40;
break;
}
$uilf = new UserIdentificationListFactory();
$uilf->getByUserIdAndTypeIdAndNumber($enroll_user_obj->getID(), 20, $number);
if ($uilf->getRecordCount() > 0) {
$uif = $uilf->getCurrent();
} else {
$uif = new UserIdentificationFactory();
}
if ($id == '' and $uilf->getRecordCount() > 0) {
Debug::text('Deleting Fingerprint...', __FILE__, __LINE__, __METHOD__, 10);
$uif->setDeleted(TRUE);
if ($uif->isValid()) {
if ($uif->save()) {
return TRUE;
}
}
} elseif ($id != '') {
$uif->setUser($enroll_user_obj->getId());
$uif->setType(20);
//Griaule
$uif->setNumber($number);
$uif->setValue($id);
if ($uif->isValid()) {
if ($uif->save()) {
return TRUE;
}
}
}
Debug::text('Enroll User Object not valid : ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
} else {
Debug::text('User ID : ' . $user_id . ' NOT FOUND', __FILE__, __LINE__, __METHOD__, 10);
}
break;
case 'ibutton':
//Remove ibutton from current user.
$uilf = new UserIdentificationListFactory();
$uilf->getByCompanyIdAndTypeIdAndValue($this->getUserObject()->getCompany(), 10, $id);
if ($uilf->getRecordCount() > 0) {
foreach ($uilf as $ui_obj) {
Debug::text('Removing iButton ID from User: ' . $ui_obj->getUserObject()->getUserName(), __FILE__, __LINE__, __METHOD__, 10);
$ui_obj->setDeleted(TRUE);
if ($ui_obj->isValid()) {
$ui_obj->Save();
}
}
unset($ui_obj);
} else {
Debug::text('Didnt find current user with iButton assigned...', __FILE__, __LINE__, __METHOD__, 10);
}
$enroll_user_obj = $ulf->getByIdAndCompanyId($user_id, $this->getUserObject()->getCompany());
if ($enroll_user_obj->getRecordCount() == 1) {
Debug::text('Enroller User ID : ' . $user_id . ' FOUND', __FILE__, __LINE__, __METHOD__, 10);
$enroll_user_obj = $enroll_user_obj->getCurrent();
$uilf = new UserIdentificationListFactory();
$uilf->getByUserIdAndTypeIdAndNumber($enroll_user_obj->getID(), 10, 0);
if ($uilf->getRecordCount() > 0) {
$uif = $uilf->getCurrent();
} else {
$uif = new UserIdentificationFactory();
}
//.........这里部分代码省略.........
示例6: unset
Debug::Text('Login as different user: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
$authentication->changeObject($id);
TTLog::addEntry($current_user->getID(), 'Login', TTi18n::getText('Switch User') . ': ' . TTi18n::getText('SourceIP') . ': ' . $authentication->getIPAddress() . ' ' . TTi18n::getText('SessionID') . ': ' . $authentication->getSessionID() . ' ' . TTi18n::getText('UserID') . ': ' . $id, $current_user->getId(), 'authentication');
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 {
示例7: UserListFactory
break;
case 'delete':
case 'undelete':
//Debug::setVerbosity( 11 );
if (strtolower($action) == 'delete') {
$delete = TRUE;
} else {
$delete = FALSE;
}
if (DEMO_MODE == FALSE and ($permission->Check('user', 'delete') or $permission->Check('user', 'delete_own') or $permission->Check('user', 'delete_child'))) {
if (is_array($ids)) {
$ulf = new UserListFactory();
$ulf->StartTransaction();
foreach ($ids as $id) {
if ($id != $current_user->getId()) {
$ulf->getByIdAndCompanyId($id, $current_company->getID());
foreach ($ulf as $user) {
$is_owner = $permission->isOwner($user->getCreatedBy(), $user->getID());
$is_child = $permission->isChild($user->getId(), $permission_children_ids);
if ($permission->Check('user', 'delete') or $permission->Check('user', 'delete_child') and $is_child === TRUE or $permission->Check('user', 'delete_own') and $is_owner === TRUE) {
$user->setDeleted($delete);
$user->Save();
}
}
}
}
$ulf->CommitTransaction();
}
}
Redirect::Page(URLBuilder::getURL(array('saved_search_id' => $saved_search_id), 'UserList.php'));
break;