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


PHP UserListFactory::getById方法代码示例

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


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

示例1: smarty_function_EmbeddedAuthorizationList

/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */
function smarty_function_EmbeddedAuthorizationList($params, &$smarty)
{
    global $current_company, $current_user;
    $object_type_id = $params['object_type_id'];
    $object_id = $params['object_id'];
    $ulf = new UserListFactory();
    $hlf = new HierarchyListFactory();
    $hotlf = new HierarchyObjectTypeListFactory();
    $alf = new AuthorizationListFactory();
    $alf->setObjectType($object_type_id);
    //$authorizing_obj = $alf->getObjectHandler()->getById( $object_id )->getCurrent();
    $tmp_authorizing_obj = $alf->getObjectHandler()->getById($object_id);
    if (is_object($tmp_authorizing_obj)) {
        $authorizing_obj = $tmp_authorizing_obj->getCurrent();
    } else {
        return FALSE;
    }
    //var_dump($authorizing_obj);
    unset($alf);
    $user_id = $authorizing_obj->getUserObject()->getId();
    $alf = new AuthorizationListFactory();
    $alf->getByObjectTypeAndObjectId($object_type_id, $object_id);
    foreach ($alf as $authorization_obj) {
        $authorization_data[] = array('id' => $authorization_obj->getId(), 'created_by_full_name' => $ulf->getById($authorization_obj->getCreatedBy())->getCurrent()->getFullName(), 'authorized' => $authorization_obj->getAuthorized(), 'created_date' => $authorization_obj->getCreatedDate(), 'created_by' => $authorization_obj->getCreatedBy(), 'updated_date' => $authorization_obj->getUpdatedDate(), 'updated_by' => $authorization_obj->getUpdatedBy(), 'deleted_date' => $authorization_obj->getDeletedDate(), 'deleted_by' => $authorization_obj->getDeletedBy());
        $user_id = $authorization_obj->getCreatedBy();
    }
    if ($authorizing_obj->getStatus() == 30) {
        //If the object is still pending authorization, display who its waiting on...
        $hierarchy_id = $hotlf->getByCompanyIdAndObjectTypeId($current_company->getId(), $object_type_id)->getCurrent()->getHierarchyControl();
        Debug::Text('Hierarchy ID: ' . $hierarchy_id, __FILE__, __LINE__, __METHOD__, 10);
        //Get Parents
        $parent_level_user_ids = $hlf->getParentLevelIdArrayByHierarchyControlIdAndUserId($hierarchy_id, $user_id);
        Debug::Arr($parent_level_user_ids, 'Parent Level Ids', __FILE__, __LINE__, __METHOD__, 10);
        if ($parent_level_user_ids !== FALSE and count($parent_level_user_ids) > 0) {
            Debug::Text('Adding Pending Line: ', __FILE__, __LINE__, __METHOD__, 10);
            foreach ($parent_level_user_ids as $parent_user_id) {
                $created_by_full_name[] = $ulf->getById($parent_user_id)->getCurrent()->getFullName();
            }
            $authorization_data[] = array('id' => NULL, 'created_by_full_name' => implode('<br>', $created_by_full_name), 'authorized' => NULL, 'created_date' => NULL, 'created_by' => NULL);
        }
    }
    $smarty->assign_by_ref('authorization_data', $authorization_data);
    $smarty->display('authorization/EmbeddedAuthorizationList.tpl');
}
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:49,代码来源:function.embeddedauthorizationlist.php

示例2: getUserObject

 function getUserObject()
 {
     if (is_object($this->user_obj)) {
         return $this->user_obj;
     } else {
         $ulf = new UserListFactory();
         $this->user_obj = $ulf->getById($this->getUser())->getCurrent();
         return $this->user_obj;
     }
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:10,代码来源:UserIdentificationFactory.class.php

示例3: 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;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:45,代码来源:RecurringScheduleControlFactory.class.php

示例4: unset

 case 'login':
     if ($permission->Check('company', 'view') and $permission->Check('company', 'login_other_user')) {
         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();
                 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:EditUser.php

示例5: Pager

        /*
        if ( $permission->Check('company','view') ) {
        	//View all default_schedules
        	//$dsclf->GetByCompanyId($current_company->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array );
        	$ulf->GetAll( $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array );
        } else {
                    //$dsclf->GetByCompanyId($current_company->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, array($sort_column => $sort_order) );
        	//$dsclf->GetByUserId($current_user->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array );
        	$ulf->GetByCompanyID($current_company->getID(), $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array );
        }
        */
        $roelf->getByUserId($user_id, $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array);
        $pager = new Pager($roelf);
        $roe_code_options = $roelf->getOptions('code');
        foreach ($roelf as $roe) {
            //$company_name = $clf->getById( $user->getCompany() )->getCurrent()->getName();
            $roes[] = array('id' => $roe->getId(), 'user_id' => $roe->getUser(), 'pay_period_type_id' => $roe->getPayPeriodType(), 'code_id' => $roe->getCode(), 'code' => $roe_code_options[$roe->getCode()], 'first_date' => $roe->getFirstDate(), 'last_date' => $roe->getLastDate(), 'pay_period_end_date' => $roe->getPayPeriodEndDate(), 'recall_date' => $roe->getRecallDate(), 'insurable_hours' => $roe->getInsurableHours(), 'insurable_earnings' => $roe->getInsurableEarnings(), 'vacation_pay' => $roe->getVacationPay(), 'serial' => $roe->getSerial(), 'comments' => $roe->getComments(), 'created_date' => $roe->getCreatedDate(), 'created_by' => $roe->getCreatedBy(), 'updated_date' => $roe->getUpdatedDate(), 'updated_by' => $roe->getUpdatedBy(), 'deleted_date' => $roe->getDeletedDate(), 'deleted_by' => $roe->getDeletedBy());
        }
        $smarty->assign_by_ref('roes', $roes);
        $smarty->assign_by_ref('user_id', $user_id);
        if (isset($user_id)) {
            $ulf = new UserListFactory();
            $user_obj = $ulf->getById($user_id)->getCurrent();
            $smarty->assign_by_ref('user_full_name', $user_obj->getFullName());
        }
        $smarty->assign_by_ref('sort_column', $sort_column);
        $smarty->assign_by_ref('sort_order', $sort_order);
        $smarty->assign_by_ref('paging_data', $pager->getPageVariables());
        break;
}
$smarty->display('roe/ROEList.tpl');
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:ROEList.php

示例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;
//.........这里部分代码省略.........
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:101,代码来源:DemoData.class.php

示例7: getByHierarchyControlId

 function getByHierarchyControlId($tree_id)
 {
     if ($tree_id == '') {
         return FALSE;
     }
     $this->getFastTreeObject()->setTree($tree_id);
     $children = $this->getFastTreeObject()->getAllChildren(NULL, 'RECURSE');
     $ulf = new UserListFactory();
     $hslf = new HierarchyShareListFactory();
     $hslf->getByHierarchyControlId($tree_id);
     $shared_user_ids = array();
     foreach ($hslf as $hierarchy_share) {
         $shared_user_ids[] = $hierarchy_share->getUser();
     }
     if ($children !== FALSE) {
         foreach ($children as $object_id => $level) {
             if ($object_id !== 0) {
                 $user_obj = $ulf->getById($object_id)->getCurrent();
                 unset($shared);
                 if (in_array($object_id, $shared_user_ids) === TRUE) {
                     $shared = TRUE;
                 } else {
                     $shared = FALSE;
                 }
                 $nodes[] = array('id' => $object_id, 'name' => $user_obj->getFullName(), 'level' => $level, 'shared' => $shared);
             }
         }
         if (isset($nodes)) {
             return $nodes;
         }
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:33,代码来源:HierarchyListFactory.class.php

示例8: MessageListFactory

         $mf->setBody($message_data['body']);
         if ($mf->isValid()) {
             $mf->Save();
             Redirect::Page(URLBuilder::getURL(array('template' => $template, 'close' => 1, 'object_type_id' => $object_type_id, 'object_id' => $object_id), 'EmbeddedMessageList.php'));
             break;
         }
     }
 default:
     if (isset($object_type_id) and isset($object_id)) {
         $mlf = new MessageListFactory();
         $mlf->getByObjectTypeAndObject($object_type_id, $object_id);
         $i = 0;
         foreach ($mlf as $message) {
             //Get user info
             $ulf = new UserListFactory();
             $messages[] = array('id' => $message->getId(), 'parent_id' => $message->getParent(), 'object_type' => $message->getObjectType(), 'object_id' => $message->getObject(), 'priority' => $message->getPriority(), 'status' => $message->getStatus(), 'subject' => $message->getSubject(), 'body' => $message->getBody(), 'created_date' => $message->getCreatedDate(), 'created_by' => $message->getCreatedBy(), 'created_by_full_name' => $ulf->getById($message->getCreatedBy())->getCurrent()->getFullName(), 'updated_date' => $message->getUpdatedDate(), 'updated_by' => $message->getUpdatedBy(), 'deleted_date' => $message->getDeletedDate(), 'deleted_by' => $message->getDeletedBy());
             //Mark own messages as read.
             if ($message->getCreatedBy() != $current_user->getId()) {
                 $mlf_b = new MessageListFactory();
                 $message_obj = $mlf_b->getById($message->getId())->getCurrent();
                 $message_obj->setStatus(20);
                 $message_obj->Save();
             }
             if ($i == 0) {
                 $parent_id = $message->getId();
                 $default_subject = TTi18n::gettext('Re:') . ' ' . $message->getSubject();
             }
             $i++;
         }
         //Get object data
         $object_name_options = $mlf->getOptions('object_name');
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:EmbeddedMessageList.php

示例9: foreach

 $t4sum->setEmployeeCPP($rows[$last_row]['employee_cpp']);
 $t4sum->setEmployeeEI($rows[$last_row]['employee_ei']);
 $t4sum->setEmployerCPP($rows[$last_row]['employer_cpp']);
 $t4sum->setEmployerEI($rows[$last_row]['employer_ei']);
 $t4sum->setEmployeeRPP($rows[$last_row]['rpp']);
 $t4sum->setPensionAdjustment($rows[$last_row]['pension_adjustment']);
 $total_deductions = Misc::MoneyFormat($rows[$last_row]['employee_cpp'] + $rows[$last_row]['employer_cpp'] + $rows[$last_row]['employee_ei'] + $rows[$last_row]['employer_ei'] + $rows[$last_row]['income_tax'], FALSE);
 $t4sum->setTotalDeductions($total_deductions);
 $t4->addT4Summary($t4sum);
 $i = 0;
 foreach ($rows as $row) {
     if ($i == $last_row) {
         continue;
     }
     $ulf = new UserListFactory();
     $user_obj = $ulf->getById($row['user_id'])->getCurrent();
     $t4ee = new T4Employee();
     $t4ee->setSin($row['sin']);
     $t4ee->setFirstName($user_obj->getFirstName());
     $t4ee->setMiddleName($user_obj->getMiddleName());
     $t4ee->setLastName($user_obj->getLastName());
     $t4ee->setAddress1($user_obj->getAddress1());
     $t4ee->setAddress2($user_obj->getAddress2());
     $t4ee->setCity($user_obj->getCity());
     $t4ee->setProvince($user_obj->getProvince());
     $t4ee->setPostalCode($user_obj->getPostalCode());
     //$t4ee->setEmployementCode( );
     //Get User Tax / Deductions by Pay Stub Account.
     $udlf = new UserDeductionListFactory();
     if (isset($setup_data['employee_cpp_psea_id'])) {
         $udlf->getByUserIdAndPayStubEntryAccountID($user_obj->getId(), $setup_data['employee_cpp_psea_id']);
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:T4Summary.php

示例10: postSave

 function postSave()
 {
     //Handle dirty work here.
     Debug::Text('ID we just saved: ' . $this->getId(), __FILE__, __LINE__, __METHOD__, 10);
     if ($this->getEnableReCalculate() == TRUE) {
         //Set User Termination date to Last Day.
         $ulf = new UserListFactory();
         $ulf->getById($this->getUser());
         if ($ulf->getRecordCount() > 0) {
             Debug::Text('Setting User Termination Date', __FILE__, __LINE__, __METHOD__, 10);
             $user_obj = $ulf->getCurrent();
             $user_obj->setTerminationDate($this->getLastDate());
             if ($user_obj->isValid()) {
                 $user_obj->Save();
                 UserGenericStatusFactory::queueGenericStatus($this->getUserObject()->getFullName(TRUE) . ' - ' . TTi18n::gettext('Employee Record'), 30, TTi18n::gettext('Setting employee termination date to:') . ' ' . TTDate::getDate('DATE', $this->getLastDate()), NULL);
             }
         }
         $this->ReCalculate();
     }
     return TRUE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:21,代码来源:ROEFactory.class.php

示例11: MessageListFactory

 if (isset($object_type_id) and isset($object_id)) {
     BreadCrumb::setCrumb($title);
     $mlf = new MessageListFactory();
     $mlf->getByObjectTypeAndObjectAndId($object_type_id, $object_id, $id);
     $ack_message_id = NULL;
     $require_ack = FALSE;
     $i = 0;
     foreach ($mlf as $message) {
         //Get user info
         $ulf = new UserListFactory();
         if ($message->getRequireAck() == TRUE and $message->isAck() == FALSE and $ack_message_id == NULL and $message->getCreatedBy() != $current_user->getId()) {
             $require_ack = TRUE;
             $ack_message_id = $message->getId();
         }
         if ($message->getAckBy() != '') {
             $ack_by_full_name = $ulf->getById($message->getAckBy())->getCurrent()->getFullName();
         } else {
             $ack_by_full_name = NULL;
         }
         $messages[] = array('id' => $message->getId(), 'parent_id' => $message->getParent(), 'object_type' => $message->getObjectType(), 'object_id' => $message->getObject(), 'priority' => $message->getPriority(), 'status' => $message->getStatus(), 'require_ack' => $message->getRequireAck(), 'ack_date' => $message->getAckDate(), 'ack_by' => $message->getAckBy(), 'ack_by_full_name' => $ack_by_full_name, 'is_ack' => $message->isAck(), 'subject' => $message->getSubject(), 'body' => $message->getBody(), 'created_date' => $message->getCreatedDate(), 'created_by' => $message->getCreatedBy(), 'created_by_full_name' => $ulf->getById($message->getCreatedBy())->getCurrent()->getFullName(), 'updated_date' => $message->getUpdatedDate(), 'updated_by' => $message->getUpdatedBy(), 'deleted_date' => $message->getDeletedDate(), 'deleted_by' => $message->getDeletedBy());
         //Mark own messages as read.
         if ($message->getCreatedBy() != $current_user->getId()) {
             $mlf_b = new MessageListFactory();
             $message_obj = $mlf_b->getById($message->getId())->getCurrent();
             if ($message_obj->getStatus() == 10) {
                 $message_obj->setStatus(20);
                 $message_obj->Save();
             }
         }
         if ($i == 0) {
             $parent_id = $message->getId();
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:ViewMessage.php

示例12: 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;
    }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:72,代码来源:StationListFactory.class.php

示例13: foreach

            $balf->getCompanyAccountByCompanyId($current_company->getId());
            $country = $current_company->getCountry();
        } else {
            $permission->Redirect(FALSE);
        }
        if (!isset($action)) {
            BreadCrumb::setCrumb($title);
            foreach ($balf as $bank_account) {
                //Debug::Arr($department,'Department', __FILE__, __LINE__, __METHOD__,10);
                $bank_data = array('id' => $bank_account->getId(), 'country' => strtolower($country), 'institution' => $bank_account->getInstitution(), 'transit' => $bank_account->getTransit(), 'account' => $bank_account->getAccount(), 'created_date' => $bank_account->getCreatedDate(), 'created_by' => $bank_account->getCreatedBy(), 'updated_date' => $bank_account->getUpdatedDate(), 'updated_by' => $bank_account->getUpdatedBy(), 'deleted_date' => $bank_account->getDeletedDate(), 'deleted_by' => $bank_account->getDeletedBy());
            }
        }
        if (isset($user_id) and $company_id == '') {
            //$user_id = $current_user->getId();
            $ulf = new UserListFactory();
            $full_name = $ulf->getById($user_id)->getCurrent()->getFullName();
        } elseif ($company_id != '') {
            $clf = new CompanyListFactory();
            $full_name = $clf->getById($company_id)->getCurrent()->getName();
        }
        $bank_data['full_name'] = $full_name;
        $bank_data['country'] = strtolower($country);
        $bank_data['user_id'] = $user_id;
        $bank_data['company_id'] = $company_id;
        //var_dump($bank_data);
        $smarty->assign_by_ref('bank_data', $bank_data);
        $smarty->assign_by_ref('data_saved', $data_saved);
        break;
}
$smarty->assign_by_ref('baf', $baf);
//$smarty->assign_by_ref('current_time', TTDate::getDate('TIME') );
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:EditBankAccount.php

示例14: getData

 function getData()
 {
     $psenlf = new PayStubEntryNameListFactory();
     $pslf = new PayStubListFactory();
     //$pslf->getByIdAndUserId($id, $current_user->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, array($sort_column => $sort_order) );
     $pslf->getById($this->pay_stub_id);
     $pager = new Pager($pslf);
     foreach ($pslf as $pay_stub_obj) {
         //Get pay stub entries.
         $pself = new PayStubEntryListFactory();
         $pself->getByPayStubId($pay_stub_obj->getId());
         $prev_type = NULL;
         $description_subscript_counter = 1;
         foreach ($pself as $pay_stub_entry) {
             $description_subscript = NULL;
             $pay_stub_entry_name_obj = $psenlf->getById($pay_stub_entry->getPayStubEntryNameId())->getCurrent();
             if ($prev_type == 40 or $pay_stub_entry_name_obj->getType() != 40) {
                 $type = $pay_stub_entry_name_obj->getType();
             }
             if ($pay_stub_entry->getDescription() !== NULL and $pay_stub_entry->getDescription() !== FALSE) {
                 $pay_stub_entry_descriptions[] = array('subscript' => $description_subscript_counter, 'description' => $pay_stub_entry->getDescription());
                 $description_subscript = $description_subscript_counter;
                 $description_subscript_counter++;
             }
             $this->pay_stub_entries[$type][] = array('id' => $pay_stub_entry->getId(), 'pay_stub_entry_name_id' => $pay_stub_entry->getPayStubEntryNameId(), 'type' => $pay_stub_entry_name_obj->getType(), 'name' => $pay_stub_entry_name_obj->getName(), 'display_name' => $pay_stub_entry_name_obj->getDescription(), 'rate' => $pay_stub_entry->getRate(), 'units' => $pay_stub_entry->getUnits(), 'ytd_units' => $pay_stub_entry->getYTDUnits(), 'amount' => $pay_stub_entry->getAmount(), 'ytd_amount' => $pay_stub_entry->getYTDAmount(), 'description' => $pay_stub_entry->getDescription(), 'description_subscript' => $description_subscript, 'created_date' => $pay_stub_entry->getCreatedDate(), 'created_by' => $pay_stub_entry->getCreatedBy(), 'updated_date' => $pay_stub_entry->getUpdatedDate(), 'updated_by' => $pay_stub_entry->getUpdatedBy(), 'deleted_date' => $pay_stub_entry->getDeletedDate(), 'deleted_by' => $pay_stub_entry->getDeletedBy());
             $prev_type = $pay_stub_entry_name_obj->getType();
         }
         //'entries' => $pay_stub_entries,
         $this->pay_stub = array('id' => $pay_stub_obj->getId(), 'user_id' => $pay_stub_obj->getUser(), 'pay_period_id' => $pay_stub_obj->getPayPeriod(), 'advance' => $pay_stub_obj->getAdvance(), 'status' => $pay_stub_obj->getStatus(), 'created_date' => $pay_stub_obj->getCreatedDate(), 'created_by' => $pay_stub_obj->getCreatedBy(), 'updated_date' => $pay_stub_obj->getUpdatedDate(), 'updated_by' => $pay_stub_obj->getUpdatedBy(), 'deleted_date' => $pay_stub_obj->getDeletedDate(), 'deleted_by' => $pay_stub_obj->getDeletedBy());
         //Get Pay Period information
         $pplf = new PayPeriodListFactory();
         $pay_period_obj = $pplf->getById($pay_stub_obj->getPayPeriod())->getCurrent();
         if ($pay_stub_obj->getAdvance() == TRUE) {
             $pp_start_date = $pay_period_obj->getStartDate();
             $pp_end_date = $pay_period_obj->getAdvanceEndDate();
             $pp_transaction_date = $pay_period_obj->getAdvanceTransactionDate();
         } else {
             $pp_start_date = $pay_period_obj->getStartDate();
             $pp_end_date = $pay_period_obj->getEndDate();
             $pp_transaction_date = $pay_period_obj->getTransactionDate();
         }
         $this->pay_period = array('start_date' => TTDate::getDate('DATE', $pp_start_date), 'end_date' => TTDate::getDate('DATE', $pp_end_date), 'transaction_date' => TTDate::getDate('DATE', $pp_transaction_date));
         //Get User information
         $ulf = new UserListFactory();
         $this->user_obj = $ulf->getById($pay_stub_obj->getUser())->getCurrent();
         //Get company information
         $clf = new CompanyListFactory();
         $this->company_obj = $clf->getById($this->user_obj->getCompany())->getCurrent();
     }
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:50,代码来源:PayStubPDF.class.php

示例15: 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;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:65,代码来源:ExceptionFactory.class.php


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