• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Misc类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: formatKey

 public function formatKey($data = array())
 {
     $cache_key = array_merge(array_keys($data), $data);
     $key = $this->table . '_' . Misc::implodeMultiArr($cache_key, '-');
     $cache_key = strlen($key) < 32 ? $key : md5($key);
     return $cache_key;
 }
开发者ID:homekuanyi,项目名称:windphp,代码行数:7,代码来源:DbModel.class.php


示例2: _getFactoryOptions

 function _getFactoryOptions($name)
 {
     $retval = NULL;
     switch ($name) {
         case 'type':
             $retval = array(10 => TTi18n::gettext('Auto-Deduct'), 15 => TTi18n::gettext('Auto-Add'), 20 => TTi18n::gettext('Normal'));
             break;
         case 'auto_detect_type':
             $retval = array(10 => TTi18n::gettext('Time Window'), 20 => TTi18n::gettext('Punch Time'));
             break;
         case 'columns':
             $retval = array('-1010-type' => TTi18n::gettext('Type'), '-1020-name' => TTi18n::gettext('Name'), '-1030-amount' => TTi18n::gettext('Break Time'), '-1040-trigger_time' => TTi18n::gettext('Active After'), '-1050-auto_detect_type' => TTi18n::gettext('Auto Detect Breaks By'), '-1100-include_break_punch_time' => TTi18n::gettext('Include Break Punch'), '-1110-include_multiple_breaks' => TTi18n::gettext('Include Multiple Breaks'), '-2000-created_by' => TTi18n::gettext('Created By'), '-2010-created_date' => TTi18n::gettext('Created Date'), '-2020-updated_by' => TTi18n::gettext('Updated By'), '-2030-updated_date' => TTi18n::gettext('Updated Date'));
             break;
         case 'list_columns':
             $retval = Misc::arrayIntersectByKey($this->getOptions('default_display_columns'), Misc::trimSortPrefix($this->getOptions('columns')));
             break;
         case 'default_display_columns':
             //Columns that are displayed by default.
             $retval = array('name', 'type', 'amount', 'updated_date', 'updated_by');
             break;
         case 'unique_columns':
             //Columns that are unique, and disabled for mass editing.
             $retval = array('name');
             break;
         case 'linked_columns':
             //Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
             $retval = array();
             break;
     }
     return $retval;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:31,代码来源:BreakPolicyFactory.class.php


示例3: api_exit

function api_exit($code, $msg = '')
{
    global $remotehost, $cfg;
    if ($code != EX_SUCCESS && $cfg->alertONMailParseError()) {
        //Error occured...
        $_SESSION['api']['errors'] += 1;
        $_SESSION['api']['time'] = time();
        $alert = sprintf("Possible issues with the API\n\n Error Code: %d\nErrors: %d\nRemote IP:%s\n\n%s", $code, $_SESSION['api']['errors'], $_SERVER['REMOTE_ADDR'], $msg);
        //echo 'API Error(s) '.$msg;
        Misc::alertAdmin('API Error(s)', $msg);
    }
    if ($remotehost) {
        switch ($code) {
            case EX_SUCCESS:
                Http::response(200, $code, 'text/plain');
                break;
            case EX_UNAVAILABLE:
                Http::response(405, $code, 'text/plain');
                break;
            case EX_NOPERM:
                Http::response(403, $code, 'text/plain');
                break;
            case EX_DATAERR:
            case EX_NOINPUT:
            default:
                Http::response(416, $code, 'text/plain');
        }
    }
    exit($code);
}
开发者ID:googlecode-mirror,项目名称:barbos,代码行数:30,代码来源:api.inc.php


示例4: _getFactoryOptions

 function _getFactoryOptions($name)
 {
     $retval = NULL;
     switch ($name) {
         case 'ach_transaction_type':
             //ACH transactions require a transaction code that matches the bank account.
             $retval = array(22 => TTi18n::getText('Checking'), 32 => TTi18n::getText('Savings'));
             break;
         case 'columns':
             $retval = array('-1010-first_name' => TTi18n::gettext('First Name'), '-1020-last_name' => TTi18n::gettext('Last Name'), '-1090-title' => TTi18n::gettext('Title'), '-1099-user_group' => TTi18n::gettext('Group'), '-1100-default_branch' => TTi18n::gettext('Branch'), '-1110-default_department' => TTi18n::gettext('Department'), '-5010-transit' => TTi18n::gettext('Transit/Routing'), '-5020-account' => TTi18n::gettext('Account'), '-5030-institution' => TTi18n::gettext('Institution'), '-2000-created_by' => TTi18n::gettext('Created By'), '-2010-created_date' => TTi18n::gettext('Created Date'), '-2020-updated_by' => TTi18n::gettext('Updated By'), '-2030-updated_date' => TTi18n::gettext('Updated Date'));
             break;
         case 'list_columns':
             $retval = Misc::arrayIntersectByKey($this->getOptions('default_display_columns'), Misc::trimSortPrefix($this->getOptions('columns')));
             break;
         case 'default_display_columns':
             //Columns that are displayed by default.
             $retval = array('first_name', 'last_name', 'account', 'institution');
             break;
         case 'linked_columns':
             //Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
             $retval = array();
             break;
     }
     return $retval;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:25,代码来源:BankAccountFactory.class.php


示例5: getOptions

 static function getOptions($name, $interval = 1)
 {
     $all_array_option = array('*' => TTi18n::getText('-- All --'));
     $retval = FALSE;
     switch ($name) {
         case 'minute':
             for ($i = 0; $i <= 59; $i += $interval) {
                 $retval[$i] = $i;
             }
             $retval = Misc::prependArray($all_array_option, $retval);
             break;
         case 'hour':
             for ($i = 0; $i <= 23; $i += $interval) {
                 $retval[$i] = $i;
             }
             $retval = Misc::prependArray($all_array_option, $retval);
             break;
         case 'day_of_month':
             $retval = Misc::prependArray($all_array_option, TTDate::getDayOfMonthArray());
             break;
         case 'month':
             $retval = Misc::prependArray($all_array_option, TTDate::getMonthOfYearArray());
             break;
         case 'day_of_week':
             $retval = Misc::prependArray($all_array_option, TTDate::getDayOfWeekArray());
             break;
     }
     return $retval;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:29,代码来源:Cron.class.php


示例6: _getFactoryOptions

 function _getFactoryOptions($name)
 {
     $retval = NULL;
     switch ($name) {
         case 'columns':
             $retval = array('-1010-status' => TTi18n::gettext('Status'), '-1020-type' => TTi18n::gettext('Type'), '-1030-name' => TTi18n::gettext('Tax / Deduction'), '-1040-calculation' => TTi18n::gettext('Calculation'), '-1110-first_name' => TTi18n::gettext('First Name'), '-1120-last_name' => TTi18n::gettext('Last Name'), '-2000-created_by' => TTi18n::gettext('Created By'), '-2010-created_date' => TTi18n::gettext('Created Date'), '-2020-updated_by' => TTi18n::gettext('Updated By'), '-2030-updated_date' => TTi18n::gettext('Updated Date'));
             break;
         case 'list_columns':
             $retval = Misc::arrayIntersectByKey($this->getOptions('default_display_columns'), Misc::trimSortPrefix($this->getOptions('columns')));
             break;
         case 'default_display_columns':
             //Columns that are displayed by default.
             $retval = array('status', 'type', 'name', 'calculation');
             break;
         case 'unique_columns':
             //Columns that are unique, and disabled for mass editing.
             $retval = array();
             break;
         case 'linked_columns':
             //Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
             $retval = array();
             break;
     }
     return $retval;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:25,代码来源:UserDeductionFactory.class.php


示例7: newFromUrl

 public static function newFromUrl($url, $langCode, $dbType)
 {
     $url = str_replace('http://www.wikihow.com/', '', $url);
     $pageTitle = Misc::getUrlDecodedData($url);
     $row = self::getDBRowFromPageTitle($pageTitle, $langCode, $dbType);
     return is_null($row) ? null : BabelfishArticle::newFromDBRow($row, $dbType);
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:7,代码来源:BabelfishArticle.class.php


示例8: _getFactoryOptions

 function _getFactoryOptions($name)
 {
     $retval = NULL;
     switch ($name) {
         case 'type':
             $retval = array(10 => TTi18n::gettext('Missed Punch'), 20 => TTi18n::gettext('Punch Adjustment'), 30 => TTi18n::gettext('Absence (incl. Vacation)'), 40 => TTi18n::gettext('Schedule Adjustment'), 100 => TTi18n::gettext('Other'));
             break;
         case 'status':
             $retval = array(10 => TTi18n::gettext('INCOMPLETE'), 20 => TTi18n::gettext('OPEN'), 30 => TTi18n::gettext('PENDING'), 40 => TTi18n::gettext('AUTHORIZATION OPEN'), 50 => TTi18n::gettext('AUTHORIZED'), 55 => TTi18n::gettext('DECLINED'), 60 => TTi18n::gettext('DISABLED'));
             break;
         case 'columns':
             $retval = array('-1010-first_name' => TTi18n::gettext('First Name'), '-1020-last_name' => TTi18n::gettext('Last Name'), '-1060-title' => TTi18n::gettext('Title'), '-1070-user_group' => TTi18n::gettext('Group'), '-1080-default_branch' => TTi18n::gettext('Branch'), '-1090-default_department' => TTi18n::gettext('Department'), '-1110-date_stamp' => TTi18n::gettext('Date'), '-1120-status' => TTi18n::gettext('Status'), '-1130-type' => TTi18n::gettext('Type'), '-2000-created_by' => TTi18n::gettext('Created By'), '-2010-created_date' => TTi18n::gettext('Created Date'), '-2020-updated_by' => TTi18n::gettext('Updated By'), '-2030-updated_date' => TTi18n::gettext('Updated Date'));
             break;
         case 'list_columns':
             $retval = Misc::arrayIntersectByKey(array('date_stamp', 'status', 'type'), Misc::trimSortPrefix($this->getOptions('columns')));
             break;
         case 'default_display_columns':
             //Columns that are displayed by default.
             $retval = array('first_name', 'last_name', 'type', 'date_stamp', 'status');
             break;
         case 'unique_columns':
             //Columns that are unique, and disabled for mass editing.
             $retval = array();
             break;
         case 'linked_columns':
             //Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
             $retval = array();
             break;
     }
     return $retval;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:31,代码来源:RequestFactory.class.php


示例9: _sleep

 private static function _sleep($values)
 {
     if (isset($values['ms']) == false) {
         return false;
     }
     return Misc::sleep(Basic::handle($values['ms']));
 }
开发者ID:pythias,项目名称:mock,代码行数:7,代码来源:Callback.php


示例10: _getFactoryOptions

 function _getFactoryOptions($name)
 {
     $retval = NULL;
     switch ($name) {
         case 'columns':
             $retval = array('-1020-name' => TTi18n::gettext('Name'), '-1030-meal_policy' => TTi18n::gettext('Meal Policy'), '-1040-absence_policy' => TTi18n::gettext('Absence Policy'), '-1050-over_time_policy' => TTi18n::gettext('Overtime Policy'), '-1060-start_stop_window' => TTi18n::gettext('Window'), '-2000-created_by' => TTi18n::gettext('Created By'), '-2010-created_date' => TTi18n::gettext('Created Date'), '-2020-updated_by' => TTi18n::gettext('Updated By'), '-2030-updated_date' => TTi18n::gettext('Updated Date'));
             break;
         case 'list_columns':
             $retval = Misc::arrayIntersectByKey($this->getOptions('default_display_columns'), Misc::trimSortPrefix($this->getOptions('columns')));
             break;
         case 'default_display_columns':
             //Columns that are displayed by default.
             $retval = array('name', 'meal_policy', 'start_stop_window', 'updated_date', 'updated_by');
             break;
         case 'unique_columns':
             //Columns that are unique, and disabled for mass editing.
             $retval = array('name');
             break;
         case 'linked_columns':
             //Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
             $retval = array();
             break;
     }
     return $retval;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:25,代码来源:SchedulePolicyFactory.class.php


示例11: _getFactoryOptions

 function _getFactoryOptions($name)
 {
     $retval = NULL;
     switch ($name) {
         case 'status':
             $retval = array(10 => TTi18n::gettext('INCOMPLETE'), 20 => TTi18n::gettext('OPEN'), 30 => TTi18n::gettext('PENDING AUTHORIZATION'), 40 => TTi18n::gettext('AUTHORIZATION OPEN'), 45 => TTi18n::gettext('PENDING EMPLOYEE VERIFICATION'), 50 => TTi18n::gettext('Verified'), 55 => TTi18n::gettext('AUTHORIZATION DECLINED'), 60 => TTi18n::gettext('DISABLED'));
             break;
         case 'columns':
             $retval = array('-1010-first_name' => TTi18n::gettext('First Name'), '-1020-last_name' => TTi18n::gettext('Last Name'), '-1060-title' => TTi18n::gettext('Title'), '-1070-user_group' => TTi18n::gettext('Group'), '-1080-default_branch' => TTi18n::gettext('Branch'), '-1090-default_department' => TTi18n::gettext('Department'), '-1110-start_date' => TTi18n::gettext('Start Date'), '-1112-end_date' => TTi18n::gettext('End Date'), '-1115-transaction_date' => TTi18n::gettext('Transaction Date'), '-1120-status' => TTi18n::gettext('Status'), '-2000-created_by' => TTi18n::gettext('Created By'), '-2010-created_date' => TTi18n::gettext('Created Date'), '-2020-updated_by' => TTi18n::gettext('Updated By'), '-2030-updated_date' => TTi18n::gettext('Updated Date'));
             break;
         case 'list_columns':
             $retval = Misc::arrayIntersectByKey($this->getOptions('default_display_columns'), Misc::trimSortPrefix($this->getOptions('columns')));
             break;
         case 'default_display_columns':
             //Columns that are displayed by default.
             $retval = array('first_name', 'last_name', 'start_date', 'end_date', 'status');
             break;
         case 'unique_columns':
             //Columns that are unique, and disabled for mass editing.
             $retval = array();
             break;
         case 'linked_columns':
             //Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
             $retval = array();
             break;
     }
     return $retval;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:28,代码来源:PayPeriodTimeSheetVerifyFactory.class.php


示例12: _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


示例13: _getFactoryOptions

 function _getFactoryOptions($name)
 {
     $retval = NULL;
     switch ($name) {
         case 'length_of_service_unit':
             $retval = array(10 => TTi18n::gettext('Day(s)'), 20 => TTi18n::gettext('Week(s)'), 30 => TTi18n::gettext('Month(s)'), 40 => TTi18n::gettext('Year(s)'), 50 => TTi18n::gettext('Hour(s)'));
             break;
         case 'columns':
             $retval = array('-1010-length_of_service' => TTi18n::gettext('Length Of Service'), '-1020-length_of_service_unit' => TTi18n::gettext('Units'), '-1030-accrual_rate' => TTi18n::gettext('Accrual Rate'), '-1050-maximum_time' => TTi18n::gettext('Maximum Time'), '-1050-rollover_time' => TTi18n::gettext('Rollover Time'), '-2000-created_by' => TTi18n::gettext('Created By'), '-2010-created_date' => TTi18n::gettext('Created Date'), '-2020-updated_by' => TTi18n::gettext('Updated By'), '-2030-updated_date' => TTi18n::gettext('Updated Date'));
             break;
         case 'list_columns':
             $retval = Misc::arrayIntersectByKey($this->getOptions('default_display_columns'), Misc::trimSortPrefix($this->getOptions('columns')));
             break;
         case 'default_display_columns':
             //Columns that are displayed by default.
             $retval = array('length_of_service', 'length_of_service_unit', 'accrual_rate', 'maximum_time', 'rollover_time');
             break;
         case 'unique_columns':
             //Columns that are unique, and disabled for mass editing.
             $retval = array();
             break;
         case 'linked_columns':
             //Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
             $retval = array();
             break;
     }
     return $retval;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:28,代码来源:AccrualPolicyMilestoneFactory.class.php


示例14: index

 public function index()
 {
     Cache::loadPage('', 30);
     $inputData = array();
     $postid = 0;
     $curPage = 0;
     // Model::loadWithPath('home',System::getThemePath().'model/');
     if (!($match = Uri::match('tag\\/(\\w+)\\/?'))) {
         Redirect::to('404page');
     }
     $friendly_url = addslashes($match[1]);
     if ($match = Uri::match('page\\/(\\d+)')) {
         $curPage = (int) $match[1];
     }
     $loadData = Post::get(array('limitShow' => 10, 'limitPage' => $curPage, 'cacheTime' => 30, 'where' => "where postid IN (select postid from post_tags where title='{$friendly_url}')", 'orderby' => "order by postid desc"));
     if (!isset($loadData[0]['postid'])) {
         Redirect::to('404page');
     }
     $inputData['newPost'] = $loadData;
     $inputData['keywords'] = $friendly_url;
     $inputData['listPage'] = Misc::genPage('tag/' . $friendly_url, $curPage);
     System::setTitle('Tag "' . $friendly_url . '" results:');
     self::makeContent('tag', $inputData);
     Cache::savePage();
 }
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:25,代码来源:themeTag.php


示例15: index

 public function index()
 {
     $post = array('alert' => '');
     Model::load('admincp/pages');
     if ($match = Uri::match('\\/pages\\/(\\w+)')) {
         if (method_exists("controlPages", $match[1])) {
             $method = $match[1];
             $this->{$method}();
             die;
         }
     }
     $curPage = 0;
     if ($match = Uri::match('\\/page\\/(\\d+)')) {
         $curPage = $match[1];
     }
     if (Request::has('btnAction')) {
         actionProcess();
     }
     if (Request::has('btnSearch')) {
         filterProcess();
     } else {
         $post['pages'] = Misc::genSmallPage('admincp/pages', $curPage);
         $filterPending = '';
         $post['theList'] = Pages::get(array('limitShow' => 20, 'limitPage' => $curPage, 'cacheTime' => 1));
     }
     System::setTitle('Pages list - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('pagesList', $post);
     View::make('admincp/footer');
 }
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:30,代码来源:controlPages.php


示例16: 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


示例17: index

 public function index()
 {
     $post = array('alert' => '');
     Model::load('admincp/comments');
     if ($match = Uri::match('\\/comments\\/(\\w+)')) {
         if (method_exists("controlComments", $match[1])) {
             $method = $match[1];
             $this->{$method}();
             die;
         }
     }
     $curPage = 0;
     if ($match = Uri::match('\\/page\\/(\\d+)')) {
         $curPage = $match[1];
     }
     if (Request::has('btnAction')) {
         actionProcess();
     }
     if (Request::has('btnSearch')) {
         filterProcess();
     } else {
         $post['pages'] = Misc::genSmallPage('admincp/comments', $curPage);
         $filterPending = '';
         if (Uri::has('\\/status\\/pending')) {
             $filterPending = " AND c.status='0' ";
         }
         $post['theList'] = Comments::get(array('limitShow' => 20, 'limitPage' => $curPage, 'query' => "select c.*,p.title from " . Database::getPrefix() . "post p," . Database::getPrefix() . "comments c where c.postid=p.postid order by c.commentid desc", 'cacheTime' => 1));
     }
     System::setTitle('Comments list - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('commentsList', $post);
     View::make('admincp/footer');
 }
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:33,代码来源:controlComments.php


示例18: _getFactoryOptions

 function _getFactoryOptions($name)
 {
     $retval = NULL;
     switch ($name) {
         case 'status':
             $retval = array(10 => TTi18n::gettext('System'), 20 => TTi18n::gettext('Worked'), 30 => TTi18n::gettext('Absence'));
             break;
         case 'type':
             $retval = array(10 => TTi18n::gettext('Total'), 20 => TTi18n::gettext('Regular'), 30 => TTi18n::gettext('Overtime'), 40 => TTi18n::gettext('Premium'), 100 => TTi18n::gettext('Lunch'), 110 => TTi18n::gettext('Break'));
             break;
         case 'status_type':
             $retval = array(10 => array(10, 20, 30, 40, 100, 110), 20 => array(10), 30 => array(10));
             break;
         case 'columns':
             $retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-user_status' => TTi18n::gettext('Employee Status'), '-1010-title' => TTi18n::gettext('Title'), '-1039-group' => TTi18n::gettext('Group'), '-1040-default_branch' => TTi18n::gettext('Default Branch'), '-1050-default_department' => TTi18n::gettext('Default Department'), '-1160-branch' => TTi18n::gettext('Branch'), '-1170-department' => TTi18n::gettext('Department'), '-1200-type' => TTi18n::gettext('Type'), '-1202-status' => TTi18n::gettext('Status'), '-1210-date_stamp' => TTi18n::gettext('Date'), '-1290-total_time' => TTi18n::gettext('Time'), '-2000-created_by' => TTi18n::gettext('Created By'), '-2010-created_date' => TTi18n::gettext('Created Date'), '-2020-updated_by' => TTi18n::gettext('Updated By'), '-2030-updated_date' => TTi18n::gettext('Updated Date'));
             break;
         case 'list_columns':
             $retval = Misc::arrayIntersectByKey($this->getOptions('default_display_columns'), Misc::trimSortPrefix($this->getOptions('columns')));
             break;
         case 'default_display_columns':
             //Columns that are displayed by default.
             $retval = array('status', 'time_stamp');
             break;
         case 'unique_columns':
             //Columns that are unique, and disabled for mass editing.
             $retval = array();
             break;
         case 'linked_columns':
             //Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
             $retval = array();
             break;
     }
     return $retval;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:34,代码来源:UserDateTotalFactory.class.php


示例19: saveAndEndForetagsTavling_krillo_debug

/**
 *  debug only, stripped version of Foretag.saveAndEndForetagsTavling()
 *  only printout
 */
function saveAndEndForetagsTavling_krillo_debug()
{
    $emailName = "Tavling avslutad - tisdag";
    global $db;
    $sql = 'SELECT a.id FROM mm_medlem a, mm_foretagsnycklar b, mm_foretag c
    WHERE a.id = b.medlem_id
    AND b.foretag_id = c.id
    AND a.epostBekraftad = 1
    AND UNIX_TIMESTAMP(c.startDatum) >= ' . (time() - (Foretag::TAVLINGSPERIOD_DAGAR + 3) * 86400) . ' AND UNIX_TIMESTAMP(c.startDatum) < ' . (time() - Foretag::TAVLINGSPERIOD_DAGAR * 86400);
    $unixtimestamp_first = time() - (Foretag::TAVLINGSPERIOD_DAGAR + 3) * 86400;
    $unixtimestamp_second = time() - Foretag::TAVLINGSPERIOD_DAGAR * 86400;
    echo "unixtimestamp_first : " . $unixtimestamp_first . " |   " . date("Y-m-d", $unixtimestamp_first) . "<br/>";
    echo "unixtimestamp_second : " . $unixtimestamp_second . " |   " . date("Y-m-d", $unixtimestamp_second) . "<br/><br/>";
    $slutDatum = date("Y-m-d", time());
    $slutDatum = Misc::dateToTimestamp($slutDatum);
    $tavling = new Tavling('0000-00-00');
    $save = array();
    foreach ($db->valuesAsArray($sql) as $user) {
        $medlem = Medlem::loadById($user);
        if (isset($medlem)) {
            $slutVecka = strftime("%V", $slutDatum);
            $foretagsSlutVecka = strftime("%V", Misc::dateToTimestamp($medlem->getForetag()->getSlutdatum()));
            echo "{$slutVecka}: " . $slutVecka . " | " . "{$foretagsSlutVecka}: " . $foretagsSlutVecka . "<br>";
            if (Misc::isEmail($medlem->getEpost(), false) && $medlem->getForetag() && $medlem->getLag()) {
                //self::logEmailSend(false, $emailName, "try", $medlem);
                echo " " . $medlem->getForetag()->getNamn() . " " . $medlem->getForetag()->getNamn() . " | epost: " . $medlem->getEpost() . "<br/>";
            }
        }
    }
}
开发者ID:krillo,项目名称:motiomera,代码行数:34,代码来源:krillo_testar_slutmail_datum.php


示例20: _getFactoryOptions

 function _getFactoryOptions($name)
 {
     $retval = NULL;
     switch ($name) {
         case 'object_type':
             $retval = array(90 => 'timesheet', 200 => 'expense', 1010 => 'request_punch', 1020 => 'request_punch_adjust', 1030 => 'request_absence', 1040 => 'request_schedule', 1100 => 'request_other');
             break;
         case 'columns':
             $retval = array('-1010-created_by' => TTi18n::gettext('Name'), '-1020-created_date' => TTi18n::gettext('Date'), '-1030-authorized' => TTi18n::gettext('Authorized'));
             break;
         case 'list_columns':
             $retval = Misc::arrayIntersectByKey($this->getOptions('default_display_columns'), Misc::trimSortPrefix($this->getOptions('columns')));
             break;
         case 'default_display_columns':
             //Columns that are displayed by default.
             $retval = array('created_by', 'created_date', 'authorized');
             break;
         case 'unique_columns':
             //Columns that are unique, and disabled for mass editing.
             $retval = array();
             break;
         case 'linked_columns':
             //Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
             $retval = array();
             break;
     }
     return $retval;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:28,代码来源:AuthorizationFactory.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP MiscLib类代码示例发布时间:2022-05-23
下一篇:
PHP MircroShopControl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap