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


PHP TTnew函数代码示例

本文整理汇总了PHP中TTnew函数的典型用法代码示例。如果您正苦于以下问题:PHP TTnew函数的具体用法?PHP TTnew怎么用?PHP TTnew使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: postInstall

 function postInstall()
 {
     Debug::text('postInstall: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
     //Loop through all permission control rows and set the levels as best we can.
     $pclf = TTnew('PermissionControlListFactory');
     $pclf->getAll();
     if ($pclf->getRecordCount() > 0) {
         $pf = TTnew('PermissionFactory');
         $preset_options = $pf->getOptions('preset');
         $preset_level_options = $pf->getOptions('preset_level');
         foreach ($pclf as $pc_obj) {
             $name = $pc_obj->getName();
             $closest_preset_id = Misc::findClosestMatch($name, $preset_options, 75);
             if (isset($preset_level_options[$closest_preset_id])) {
                 $preset_level = $preset_level_options[$closest_preset_id];
             } else {
                 $preset_level = 1;
                 //Use the lowest level if we can't find one, so by default they can't add a new administrator/supervisor.
                 //Try to count the number of permissions and match them to the number of permissions in each preset and use the closest level?
                 $permission_user_data = $pc_obj->getPermission();
                 if (is_array($permission_user_data)) {
                     foreach ($preset_options as $preset => $preset_name) {
                         $tmp_preset_permissions = $pf->getPresetPermissions($preset, array());
                         $preset_permission_diff_arr = Misc::arrayDiffAssocRecursive($permission_user_data, $tmp_preset_permissions);
                         $preset_permission_diff_count = count($preset_permission_diff_arr, COUNT_RECURSIVE);
                         Debug::text('Preset Permission Diff Count...: ' . $preset_permission_diff_count . ' Preset ID: ' . $preset, __FILE__, __LINE__, __METHOD__, 10);
                         $preset_match[$preset] = $preset_permission_diff_count;
                     }
                     unset($tmp_preset_permissions);
                     krsort($preset_match);
                     //Flip the array so if there are more then one preset with the same match_count, we use the smallest preset value.
                     $preset_match = array_flip($preset_match);
                     //Flip the array back so the key is the match_preset again.
                     $preset_match = array_flip($preset_match);
                     foreach ($preset_match as $best_match_preset => $match_value) {
                         break;
                     }
                     Debug::Arr($preset_match, 'Preset Match: Best Match: ' . $best_match_preset . ' Value: ' . $match_value . ' Current Name: ' . $pc_obj->getName(), __FILE__, __LINE__, __METHOD__, 10);
                     if (isset($preset_options[$best_match_preset])) {
                         $preset_level = $preset_level_options[$best_match_preset];
                         //Use the preset level minus one, so they don't match exactly.
                         if ($preset_level > 1) {
                             $preset_level--;
                         }
                         Debug::Text('Closest PreSet Match Level: ' . $preset_level . ' Tmp: ' . $preset_options[$best_match_preset], __FILE__, __LINE__, __METHOD__, 10);
                     }
                 }
             }
             Debug::Text('Closest Match For: ' . $name . ' ID: ' . (int) $closest_preset_id . ' Level: ' . $preset_level, __FILE__, __LINE__, __METHOD__, 10);
             //Update level for permission group.
             $pc_obj->setLevel($preset_level);
             if ($pc_obj->isValid()) {
                 $pc_obj->Save();
             }
             unset($pc_obj);
         }
     }
     unset($pclf);
     return TRUE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:60,代码来源:InstallSchema_1040A.class.php

示例2: postInstall

 function postInstall()
 {
     Debug::text('postInstall: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
     //Go through each permission group, and enable payroll export report for anyone who can see pay stub summary report.
     $clf = TTnew('CompanyListFactory');
     $clf->getAll();
     if ($clf->getRecordCount() > 0) {
         foreach ($clf as $c_obj) {
             Debug::text('Company: ' . $c_obj->getName(), __FILE__, __LINE__, __METHOD__, 9);
             if ($c_obj->getStatus() != 30) {
                 $pclf = TTnew('PermissionControlListFactory');
                 $pclf->getByCompanyId($c_obj->getId(), NULL, NULL, NULL, array('name' => 'asc'));
                 //Force order to avoid referencing column that was added in a later version (level)
                 if ($pclf->getRecordCount() > 0) {
                     foreach ($pclf as $pc_obj) {
                         Debug::text('Permission Group: ' . $pc_obj->getName(), __FILE__, __LINE__, __METHOD__, 9);
                         $plf = TTnew('PermissionListFactory');
                         $plf->getByCompanyIdAndPermissionControlIdAndSectionAndName($c_obj->getId(), $pc_obj->getId(), 'report', 'view_pay_stub_summary');
                         if ($plf->getRecordCount() > 0) {
                             Debug::text('Found permission group with pay stub report enabled: ' . $plf->getCurrent()->getValue(), __FILE__, __LINE__, __METHOD__, 9);
                             $pc_obj->setPermission(array('report' => array('view_payroll_export' => TRUE)));
                         } else {
                             Debug::text('Permission group does NOT have pay stub report enabled...', __FILE__, __LINE__, __METHOD__, 9);
                         }
                     }
                 }
             }
         }
     }
     return TRUE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:31,代码来源:InstallSchema_1024A.class.php

示例3: _getFactoryOptions

 function _getFactoryOptions($name, $parent = NULL)
 {
     $retval = NULL;
     switch ($name) {
         case 'columns':
             $retval = array('-1100-type' => TTi18n::gettext('Type'), '-1110-status' => TTi18n::gettext('Status'), '-1210-time_stamp' => TTi18n::gettext('Date/Time'), '-1220-date' => TTi18n::gettext('Date'), '-1230-time' => TTi18n::gettext('Time'), '-1239-in_type' => TTi18n::gettext('In Type'), '-1240-in_time_stamp' => TTi18n::gettext('In Date/Time'), '-1250-in_punch_date' => TTi18n::gettext('In Date'), '-1260-in_punch_time' => TTi18n::gettext('In Time'), '-1269-out_type' => TTi18n::gettext('Out Type'), '-1270-out_time_stamp' => TTi18n::gettext('Out Date/Time'), '-1280-out_punch_date' => TTi18n::gettext('Out Date'), '-1290-out_punch_time' => TTi18n::gettext('Out Time'), '-1310-branch' => TTi18n::gettext('Branch'), '-1320-department' => TTi18n::gettext('Department'), '-1410-station_id' => TTi18n::gettext('Station ID'), '-1420-longitude' => TTi18n::gettext('Longitude'), '-1430-latitude' => TTi18n::gettext('Latitude'), '-1500-note' => TTi18n::gettext('Note'));
             //Since getOptions() can be called without first setting a company, we don't always know the product edition for the currently
             //logged in employee.
             if (is_object($this->getCompanyObject()) and $this->getCompanyObject()->getProductEdition() >= TT_PRODUCT_CORPORATE or !is_object($this->getCompanyObject()) and getTTProductEdition() >= TT_PRODUCT_CORPORATE) {
                 $retval += array('-1330-job' => TTi18n::gettext('Job'), '-1340-job_item' => TTi18n::gettext('Task'), '-1350-quantity' => TTi18n::gettext('Quantity'), '-1360-bad_quantity' => TTi18n::gettext('Bad Quantity'));
             }
             $retval = Misc::addSortPrefix(Misc::prependArray($this->getUserIdentificationColumns(), Misc::trimSortPrefix($retval)));
             ksort($retval);
             break;
         case 'column_aliases':
             //Used for converting column names after they have been parsed.
             $retval = array('type' => 'type_id', 'status' => 'status_id', 'branch' => 'branch_id', 'department' => 'department_id', 'job' => 'job_id', 'job_item' => 'job_item_id');
             break;
         case 'import_options':
             $retval = array('-1010-fuzzy_match' => TTi18n::getText('Enable smart matching.'), '-1020-disable_rounding' => TTi18n::getText('Disable rounding.'));
             break;
         case 'parse_hint':
             $upf = TTnew('UserPreferenceFactory');
             $retval = array('branch' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'department' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'job' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'job_item' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'time_stamp' => $upf->getOptions('date_time_format'), 'in_time_stamp' => $upf->getOptions('date_time_format'), 'out_time_stamp' => $upf->getOptions('date_time_format'), 'date' => $upf->getOptions('date_format'), 'in_punch_date' => $upf->getOptions('date_format'), 'out_punch_date' => $upf->getOptions('date_format'), 'time' => $upf->getOptions('time_format'), 'in_punch_time' => $upf->getOptions('time_format'), 'out_punch_time' => $upf->getOptions('time_format'));
             break;
     }
     return $retval;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:28,代码来源:ImportPunch.class.php

示例4: postInstall

 function postInstall()
 {
     Debug::text('postInstall: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
     //Make sure Medicare Employer uses the same include/exclude accounts as Medicare Employee.
     $clf = TTnew('CompanyListFactory');
     $clf->getAll();
     if ($clf->getRecordCount() > 0) {
         foreach ($clf as $c_obj) {
             Debug::text('Company: ' . $c_obj->getName(), __FILE__, __LINE__, __METHOD__, 9);
             if ($c_obj->getStatus() != 30) {
                 $ppslf = TTNew('PayPeriodScheduleListFactory');
                 $ppslf->getByCompanyID($c_obj->getId());
                 if ($ppslf->getRecordCount() > 0) {
                     $minimum_time_between_shifts = $ppslf->getCurrent()->getNewDayTriggerTime();
                 }
                 if (isset($minimum_time_between_shifts)) {
                     $pplf = TTNew('PremiumPolicyListFactory');
                     $pplf->getAPISearchByCompanyIdAndArrayCriteria($c_obj->getID(), array('type_id' => 50));
                     if ($pplf->getRecordCount() > 0) {
                         foreach ($pplf as $pp_obj) {
                             $pp_obj->setMinimumTimeBetweenShift($minimum_time_between_shifts);
                             if ($pp_obj->isValid()) {
                                 $pp_obj->Save();
                             }
                         }
                     }
                 }
             }
         }
     }
     return TRUE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:32,代码来源:InstallSchema_1056A.class.php

示例5: postInstall

 function postInstall()
 {
     Debug::text('postInstall: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
     //Modify all hierarchies with the request object type included, to add new request object types.
     $hclf = TTnew('HierarchyControlListFactory');
     $hclf->getAll();
     if ($hclf->getRecordCount() > 0) {
         foreach ($hclf as $hc_obj) {
             $src_object_types = $hc_obj->getObjectType();
             $request_key = array_search(50, $src_object_types);
             if ($request_key !== FALSE) {
                 Debug::Text('Found request object type, ID: ' . $hc_obj->getId() . ' Company ID: ' . $hc_obj->getCompany(), __FILE__, __LINE__, __METHOD__, 10);
                 unset($src_object_types[$request_key]);
                 $src_object_types[] = 1010;
                 $src_object_types[] = 1020;
                 $src_object_types[] = 1030;
                 $src_object_types[] = 1040;
                 $src_object_types[] = 1100;
                 $src_object_types = array_unique($src_object_types);
                 $hc_obj->setObjectType($src_object_types);
                 if ($hc_obj->isValid()) {
                     $hc_obj->Save();
                 }
             } else {
                 Debug::Text('Request object type not found for ID: ' . $hc_obj->getId() . ' Company ID: ' . $hc_obj->getCompany(), __FILE__, __LINE__, __METHOD__, 10);
             }
         }
     }
     return TRUE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:30,代码来源:InstallSchema_1041A.class.php

示例6: setCompany

 function setCompany($id)
 {
     $id = trim($id);
     $clf = TTnew('CompanyListFactory');
     if ($id == 0 or $this->Validator->isResultSetWithRows('company', $clf->getByID($id), TTi18n::gettext('Company is invalid'))) {
         $this->data['company_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:10,代码来源:CompanyUserCountFactory.class.php

示例7: setRoundInterValPolicy

 function setRoundInterValPolicy($id)
 {
     $id = trim($id);
     $riplf = TTnew('RoundIntervalPolicyListFactory');
     if ($id == 0 or $this->Validator->isResultSetWithRows('round_inteval_policy', $riplf->getByID($id), TTi18n::gettext('Selected Interval Rounding Policy is invalid'))) {
         $this->data['round_interval_policy_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:10,代码来源:PolicyGroupRoundIntervalPolicyFactory.class.php

示例8: setHelp

 function setHelp($id)
 {
     $id = trim($id);
     $hlf = TTnew('HelpListFactory');
     if ($this->Validator->isResultSetWithRows('help', $hlf->getByID($id), TTi18n::gettext('Help Entry is invalid'))) {
         $this->data['help_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:10,代码来源:HelpGroupFactory.class.php

示例9: setAccrualPolicy

 function setAccrualPolicy($id)
 {
     $id = trim($id);
     $aplf = TTnew('AccrualPolicyListFactory');
     if ($id == 0 or $this->Validator->isResultSetWithRows('over_time_policy', $aplf->getByID($id), TTi18n::gettext('Selected Accrual Policy is invalid'))) {
         $this->data['accrual_policy_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:10,代码来源:PolicyGroupAccrualPolicyFactory.class.php

示例10: setUser

 function setUser($id)
 {
     $id = trim($id);
     $ulf = TTnew('UserListFactory');
     if ($this->Validator->isResultSetWithRows('user', $ulf->getByID($id), TTi18n::gettext('User is invalid'))) {
         $this->data['user_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:10,代码来源:HierarchyShareFactory.class.php

示例11: setHierarchyControl

 function setHierarchyControl($id)
 {
     $id = trim($id);
     $hclf = TTnew('HierarchyControlListFactory');
     Debug::Text('Hierarchy Control ID: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
     if ($id != 0 or $this->Validator->isResultSetWithRows('hierarchy_control_id', $hclf->getByID($id), TTi18n::gettext('Invalid Hierarchy Control'))) {
         $this->data['hierarchy_control_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:11,代码来源:HierarchyObjectTypeFactory.class.php

示例12: setCompanyDeduction

 function setCompanyDeduction($id)
 {
     $id = trim($id);
     Debug::Text('ID: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
     $cdlf = TTnew('CompanyDeductionListFactory');
     if ($this->Validator->isResultSetWithRows('company_deduction', $cdlf->getByID($id), TTi18n::gettext('Deduction is invalid'))) {
         $this->data['company_deduction_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:11,代码来源:UserDefaultCompanyDeductionFactory.class.php

示例13: setSystemLog

 function setSystemLog($id)
 {
     $id = trim($id);
     //Allow NULL ids.
     if ($id == '' or $id == NULL) {
         $id = 0;
     }
     $llf = TTnew('LogListFactory');
     if ($id == 0 or $this->Validator->isResultSetWithRows('user', $llf->getByID($id), TTi18n::gettext('System log is invalid'))) {
         $this->data['system_log_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:14,代码来源:LogDetailFactory.class.php

示例14: createPresets

 function createPresets($data)
 {
     if (!$this->getPermissionObject()->Check('pay_period_schedule', 'enabled') or !($this->getPermissionObject()->Check('pay_period_schedule', 'edit') or $this->getPermissionObject()->Check('pay_period_schedule', 'edit_own') or $this->getPermissionObject()->Check('pay_period_schedule', 'edit_child') or $this->getPermissionObject()->Check('pay_period_schedule', 'add'))) {
         return $this->getPermissionObject()->PermissionDenied();
     }
     if (is_array($data)) {
         $this->getProgressBarObject()->start($this->getAMFMessageID(), count($data) + 1, NULL, TTi18n::getText('Creating policies...'));
         $this->getMainClassObject()->setCompany($this->getCurrentCompanyObject()->getId());
         $this->getMainClassObject()->setUser($this->getCurrentUserObject()->getId());
         $this->getMainClassObject()->createPresets();
         $already_processed_country = array();
         $i = 1;
         foreach ($data as $location) {
             if (isset($location['country']) and isset($location['province'])) {
                 if ($location['province'] == '00') {
                     $location['province'] = NULL;
                 }
                 if (!in_array($location['country'], $already_processed_country)) {
                     $this->getMainClassObject()->createPresets($location['country']);
                 }
                 $this->getMainClassObject()->createPresets($location['country'], $location['province']);
                 Debug::text('Creating presets for Country: ' . $location['country'] . ' Province: ' . $location['province'], __FILE__, __LINE__, __METHOD__, 9);
                 $already_processed_country[] = $location['country'];
             }
             $this->getProgressBarObject()->set($this->getAMFMessageID(), $i);
             $i++;
         }
         $this->getProgressBarObject()->set($this->getAMFMessageID(), $i++, TTi18n::getText('Creating Permissions...'));
         $this->getMainClassObject()->Permissions();
         $this->getMainClassObject()->UserDefaults();
         //Assign the current user to the only existing pay period schedule.
         $ppslf = TTnew('PayPeriodScheduleListFactory');
         $ppslf->getByCompanyId($this->getCurrentCompanyObject()->getId());
         if ($ppslf->getRecordCount() == 1) {
             $pps_obj = $ppslf->getCurrent();
             $pps_obj->setUser($this->getCurrentUserObject()->getId());
             Debug::text('Assigning current user to pay period schedule: ' . $pps_obj->getID(), __FILE__, __LINE__, __METHOD__, 9);
             if ($pps_obj->isValid()) {
                 $pps_obj->Save();
             }
         }
         $this->getCurrentCompanyObject()->setSetupComplete(TRUE);
         if ($this->getCurrentCompanyObject()->isValid()) {
             $this->getCurrentCompanyObject()->Save();
         }
         $this->getProgressBarObject()->stop($this->getAMFMessageID());
     }
     return TRUE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:49,代码来源:APISetupPresets.class.php

示例15: postInstall

    function postInstall()
    {
        Debug::text('postInstall: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
        //Go through each permission group, and enable affordable_care report for for anyone who can view W2's.
        $clf = TTnew('CompanyListFactory');
        $clf->getAll();
        if ($clf->getRecordCount() > 0) {
            foreach ($clf as $c_obj) {
                Debug::text('Company: ' . $c_obj->getName(), __FILE__, __LINE__, __METHOD__, 9);
                if ($c_obj->getStatus() != 30) {
                    $pclf = TTnew('PermissionControlListFactory');
                    $pclf->getByCompanyId($c_obj->getId(), NULL, NULL, NULL, array('name' => 'asc'));
                    //Force order to prevent references to columns that haven't been created yet.
                    if ($pclf->getRecordCount() > 0) {
                        foreach ($pclf as $pc_obj) {
                            Debug::text('Permission Group: ' . $pc_obj->getName(), __FILE__, __LINE__, __METHOD__, 9);
                            $plf = TTnew('PermissionListFactory');
                            $plf->getByCompanyIdAndPermissionControlIdAndSectionAndName($c_obj->getId(), $pc_obj->getId(), 'report', array('view_formW2'));
                            if ($plf->getRecordCount() > 0) {
                                Debug::text('Found permission group with view_formW2 enabled: ' . $plf->getCurrent()->getValue(), __FILE__, __LINE__, __METHOD__, 9);
                                $pc_obj->setPermission(array('report' => array('view_affordable_care' => TRUE)));
                            } else {
                                Debug::text('Permission group does NOT have view_formW2 enabled...', __FILE__, __LINE__, __METHOD__, 9);
                            }
                        }
                    }
                }
            }
        }
        //Go through all stations and disable ones that don't have any employees activated for them.
        //This greatly speeds up station checks, as most stations never have employees activated.
        $query = 'update station set status_id = 10
					where status_id = 20
					AND
					(
						( user_group_selection_type_id = 20 AND NOT EXISTS( select b.id from station_user_group as b WHERE id = b.station_id ) )
						AND
						( branch_selection_type_id = 20 AND NOT EXISTS( select c.id from station_branch as c WHERE id = c.station_id ) )
						AND
						( department_selection_type_id = 20 AND NOT EXISTS( select d.id from station_department as d WHERE id = d.station_id ) )
						AND
						NOT EXISTS( select f.id from station_exclude_user as f WHERE id = f.station_id )
						AND
						NOT EXISTS( select e.id from station_include_user as e WHERE id = e.station_id )
					)
					AND ( deleted = 0 )';
        $this->getDatabaseConnection()->Execute($query);
        return TRUE;
    }
开发者ID:alachaum,项目名称:timetrex,代码行数:49,代码来源:InstallSchema_1060A.class.php


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