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


PHP Utils_RecordBrowserCommon::admin_filter方法代码示例

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


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

示例1: indexer

 public static function indexer($limit = null, &$total = 0)
 {
     $limit_sum = 0;
     $limit_file = DATA_DIR . '/Utils_RecordBrowser/limit';
     if (defined('RB_INDEXER_LIMIT_QUERIES')) {
         //limit queries per hour
         $time = time();
         $limit_time = 0;
         if (file_exists($limit_file)) {
             $tmp = array_filter(explode("\n", file_get_contents($limit_file)));
             $limit_time = array_shift($tmp);
             if ($limit_time > $time - 3600) {
                 $limit_sum = array_sum($tmp);
                 if ($limit_sum > RB_INDEXER_LIMIT_QUERIES) {
                     return;
                 }
             }
         }
         if ($limit_sum == 0) {
             file_put_contents($limit_file, $time . "\n", LOCK_EX);
         }
     }
     if (!$limit) {
         $limit = defined('RB_INDEXER_LIMIT_RECORDS') ? RB_INDEXER_LIMIT_RECORDS : 50;
     }
     $tabs = DB::GetAssoc('SELECT id,tab FROM recordbrowser_table_properties WHERE search_include>0');
     foreach ($tabs as $tab_id => $tab) {
         $lock = DATA_DIR . '/Utils_RecordBrowser/' . $tab_id . '.lock';
         if (file_exists($lock) && filemtime($lock) > time() - 1200) {
             continue;
         }
         $table_rows = self::init($tab);
         self::$admin_filter = ' <tab>.indexed=0 AND <tab>.active=1 AND ';
         $ret = self::get_records($tab, array(), array(), array(), $limit, true);
         self::$admin_filter = '';
         if (!$ret) {
             continue;
         }
         register_shutdown_function(create_function('', '@unlink("' . $lock . '");'));
         if (file_exists($lock) && filemtime($lock) > time() - 1200) {
             continue;
         }
         file_put_contents($lock, '');
         foreach ($ret as $row) {
             self::index_record($tab, $row, $table_rows, $tab_id);
             $total++;
             if ($total >= $limit) {
                 break;
             }
             if (defined('RB_INDEXER_LIMIT_QUERIES') && RB_INDEXER_LIMIT_QUERIES < $limit_sum + DB::GetQueriesQty()) {
                 break;
             }
         }
         @unlink($lock);
         if ($total >= $limit) {
             break;
         }
         if (defined('RB_INDEXER_LIMIT_QUERIES') && RB_INDEXER_LIMIT_QUERIES < $limit_sum + DB::GetQueriesQty()) {
             break;
         }
     }
     if (defined('RB_INDEXER_LIMIT_QUERIES')) {
         file_put_contents($limit_file, DB::GetQueriesQty() . "\n", FILE_APPEND | LOCK_EX);
     }
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:65,代码来源:RecordBrowserCommon_0.php

示例2: show_data


//.........这里部分代码省略.........
                    if ($k[0]=='"') {
                        $search_res['~_'.$k] = $vv;
                        continue;
                    }
					$args = $this->table_rows[$hash[trim($k, '(|')]];
					if ($args['commondata']) $k = $k.'[]';
					elseif (isset($args['ref_field']) && $args['ref_field']) $k = $k.'['.Utils_RecordBrowserCommon::get_field_id($args['ref_field']).']';
					if (!$args['commondata']) {
						$w = DB::Concat(DB::qstr('%'),DB::qstr($vv),DB::qstr('%'));
						$op = '"';
					} else {
						$w = $vv;
						$op = '';
					}
                    $search_res = Utils_RecordBrowserCommon::merge_crits($search_res, array('~'.$op.$k =>$w));
                }
            }
            $search_res = Utils_RecordBrowserCommon::merge_crits($search_res, $leftovers);
        }

        if (!$pdf) $order = $gb->get_order();
        $crits = array_merge($crits, $search_res);
        if ($this->browse_mode == 'favorites')
            $crits[':Fav'] = true;
        if ($this->browse_mode == 'watchdog')
            $crits[':Sub'] = true;
        if ($this->browse_mode == 'recent') {
            $crits[':Recent'] = true;
            $order = array(':Visited_on'=>'DESC');
        }

        if ($admin && !$pdf) {
            $order = array(':Edited_on'=>'DESC');
            $form = $this->init_module('Libs/QuickForm', null, $this->tab.'_admin_filter');
            $form->addElement('select', 'show_records', __('Show records'), array(0=>'['.__('All').']',1=>'['.__('All active').']',2=>'['.__('All deactivated').']'), array('onchange'=>$form->get_submit_form_js()));
            $f = $this->get_module_variable('admin_filter', 0);
            $form->setDefaults(array('show_records'=>$f));
            $admin_filter = $form->exportValue('show_records');
            $this->set_module_variable('admin_filter', $admin_filter);
            switch($admin_filter) {
                case 0: Utils_RecordBrowserCommon::$admin_filter = '';
                    break;
                case 1: Utils_RecordBrowserCommon::$admin_filter = 'active=1 AND ';
                    break;
                case 2: Utils_RecordBrowserCommon::$admin_filter = 'active=0 AND ';
                    break;
            }
            $form->display_as_row();
        }
        if (isset($this->force_order)) $order = $this->force_order;
        if (!$order) $order = array();

        $this->amount_of_records = Utils_RecordBrowserCommon::get_records_count($this->tab, $crits, $admin, $order);

        if ($limit === null && !$this->disabled['pagination'])
            $limit = $gb->get_limit($this->amount_of_records);

		if (!$this->disabled['pdf'] && !$pdf && $this->get_access('print')) {
            $limited_print_records = 200;
            $limited_print = ($this->amount_of_records >= $limited_print_records);
            $print_limit = $limited_print ? $limit : null;
            $key = md5(serialize($this->tab).serialize($crits).serialize($cols).serialize($order).serialize($admin).serialize($print_limit));
            $_SESSION['client']['utils_recordbrowser'][$key] = array(
                'tab'=>$this->tab,
                'crits'=>$crits,
                'cols'=>$cols,
开发者ID:62BRAINS,项目名称:EPESI,代码行数:67,代码来源:RecordBrowser_0.php


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