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


PHP Utils_RecordBrowserCommon::init方法代码示例

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


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

示例1: format_values

 protected function format_values($tab, $record_id)
 {
     $rb_obj = new RBO_RecordsetAccessor($tab);
     $record = $rb_obj->get_record($record_id);
     if (!$record) {
         return array();
     }
     $access = Utils_RecordBrowserCommon::get_access($tab, 'view', $record);
     if (!$access) {
         return array();
     }
     // use RB object instance for better display callback compatibility
     // some of them uses Utils_RecordBrowser::$rb_obj instance
     $rb = ModuleManager::new_instance('Utils_RecordBrowser', null, 'rb');
     $rb->construct($tab);
     $rb->init($tab);
     $fields = Utils_RecordBrowserCommon::init($tab);
     $printable_data = array();
     foreach ($fields as $f) {
         if ($access[$f['id']]) {
             $printable_data[] = array('label' => _V($f['name']), 'value' => $record->get_val($f['id'], true));
         }
     }
     // fill rows - it's easier here than in template
     if ($this->fill_empty_rows()) {
         while (count($printable_data) % $this->cols() != 0) {
             $printable_data[] = array('label' => '', 'value' => '');
         }
     }
     return $printable_data;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:31,代码来源:RecordPrinter.php

示例2: __construct

 function __construct($tab, $tab_alias = 'rest', $admin_mode = false)
 {
     $this->tab = $tab;
     $this->fields = Utils_RecordBrowserCommon::init($tab);
     $this->fields_by_id = Utils_RecordBrowserCommon::$hash;
     $this->tab_alias = $tab_alias;
     $this->admin_mode = $admin_mode;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:8,代码来源:QueryBuilder.php

示例3: mobile_rb_edit

 public static function mobile_rb_edit($tab, $id)
 {
     if ($id === false) {
         $rec = array();
     } else {
         $rec = self::get_record($tab, $id);
     }
     $cols = Utils_RecordBrowserCommon::init($tab);
     $defaults = array();
     if ($id === false) {
         $mode = 'add';
         $access = array();
         $defaults = self::record_processing($tab, $defaults, 'adding');
     } else {
         $mode = 'edit';
         $access = Utils_RecordBrowserCommon::get_access($tab, 'view', $rec);
         if (is_array($access)) {
             foreach ($access as $k => $v) {
                 if (!$v) {
                     unset($rec[$k]);
                 }
             }
         }
         $defaults = $rec = self::record_processing($tab, $rec, 'editing');
     }
     $QFfield_callback_table = array();
     $ret = DB::Execute('SELECT * FROM ' . $tab . '_callback WHERE freezed=0');
     while ($row = $ret->FetchRow()) {
         $QFfield_callback_table[$row['field']] = $row['callback'];
     }
     $defaults = array_merge($defaults, $_SESSION['rb_' . $tab . '_defaults']);
     $qf = new HTML_QuickForm('rb_edit', 'post', 'mobile.php?' . http_build_query($_GET));
     foreach ($cols as $field => $args) {
         if (isset($access[$args['id']]) && !$access[$args['id']]) {
             continue;
         }
         if (isset($rec[$args['id']])) {
             $val = $rec[$args['id']];
         } elseif (isset($defaults[$args['id']])) {
             $val = $defaults[$args['id']];
         } else {
             $val = null;
         }
         $label = _V($args['name']);
         // TRSL
         if (isset($QFfield_callback_table[$field])) {
             $mobile_rb = new Utils_RecordBrowserMobile($tab, $rec);
             self::call_QFfield_callback($QFfield_callback_table[$field], $qf, $args['id'], $label, $mode, $val, $args, $mobile_rb, null);
             if ($mode == 'edit') {
                 unset($defaults[$args['id']]);
             }
             continue;
         }
         switch ($args['type']) {
             case 'calculated':
                 $qf->addElement('static', $args['id'], $label);
                 if (!is_array($rec)) {
                     $values = $defaults;
                 } else {
                     $values = $rec;
                     if (is_array($defaults)) {
                         $values = $values + $defaults;
                     }
                 }
                 if (!isset($values[$args['id']])) {
                     $values[$args['id']] = '';
                 }
                 $val = Utils_RecordBrowserCommon::get_val($tab, $field, $values, true, $args);
                 if ($val !== null) {
                     $qf->setDefaults(array($args['id'] => $val));
                 }
                 break;
             case 'integer':
             case 'float':
                 $qf->addElement('text', $args['id'], $label);
                 if ($args['type'] == 'integer') {
                     $qf->addRule($args['id'], __('Only integer numbers are allowed.'), 'regex', '/^[0-9]*$/');
                 } else {
                     $qf->addRule($args['id'], __('Only numbers are allowed.'), 'numeric');
                 }
                 if ($val !== null) {
                     $qf->setDefaults(array($args['id'] => $val));
                 }
                 break;
             case 'checkbox':
                 $qf->addElement('checkbox', $args['id'], $label, '');
                 if ($val !== null) {
                     $qf->setDefaults(array($args['id'] => $val));
                 }
                 break;
             case 'currency':
                 $qf->addElement('currency', $args['id'], $label);
                 if ($val !== null) {
                     $qf->setDefaults(array($args['id'] => $val));
                 }
                 break;
             case 'text':
                 $qf->addElement('text', $args['id'], $label, array('maxlength' => $args['param']));
                 $qf->addRule($args['id'], __('Maximum length for this field is %s characters.', array($args['param'])), 'maxlength', $args['param']);
                 if ($val !== null) {
//.........这里部分代码省略.........
开发者ID:cretzu89,项目名称:EPESI,代码行数:101,代码来源:RecordBrowserCommon_0.php

示例4: init

    public function init($admin=false, $force=false) {
        if($this->tab=='__RECORDSETS__' || preg_match('/,/',$this->tab)) $params=array('','',0,0,0);
        else $params = DB::GetRow('SELECT caption, icon, recent, favorites, full_history FROM recordbrowser_table_properties WHERE tab=%s', array($this->tab));
        if ($params==false) trigger_error('There is no such recordSet as '.$this->tab.'.', E_USER_ERROR);
        list($this->caption,$this->icon,$this->recent,$this->favorites,$this->full_history) = $params;
        $this->favorites &= !$this->disabled['fav'];
        $this->watchdog = Utils_WatchdogCommon::category_exists($this->tab) && !$this->disabled['watchdog'];
        $this->clipboard_pattern = Utils_RecordBrowserCommon::get_clipboard_pattern($this->tab);

        //If Caption or icon not specified assign default values
        if ($this->caption=='') $this->caption='Record Browser';
        if ($this->icon=='') $this->icon = Base_ThemeCommon::get_template_file('Base_ActionBar','icons/settings.png');
        else $this->icon = Base_ThemeCommon::get_template_file($this->icon);

        $this->table_rows = Utils_RecordBrowserCommon::init($this->tab, $admin, $force);
        $this->requires = array();
        $this->display_callback_table = array();
        $this->QFfield_callback_table = array();
        if($this->tab=='__RECORDSETS__' || preg_match('/,/',$this->tab)) return;
        $ret = DB::Execute('SELECT * FROM '.$this->tab.'_callback');
        while ($row = $ret->FetchRow())
            if ($row['freezed']==1) $this->display_callback_table[$row['field']] = explode('::',$row['callback']);
            else $this->QFfield_callback_table[$row['field']] = explode('::',$row['callback']);
    }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:24,代码来源:RecordBrowser_0.php

示例5: __construct

 function __construct($tab)
 {
     $this->tab = $tab;
     $this->fields = Utils_RecordBrowserCommon::init($tab);
     $this->fields_by_id = Utils_RecordBrowserCommon::$hash;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:6,代码来源:CritsValidator.php

示例6: define

$admin = $_REQUEST['admin'];
$path = $_REQUEST['path'];
define('CID', $cid);
define('READ_ONLY_SESSION', true);
require_once '../../../include.php';
$crits = Module::static_get_module_variable($path, 'crits_stuff', null);
$order = Module::static_get_module_variable($path, 'order_stuff', null);
if ($crits === null || $order === null) {
    $crits = $order = array();
}
ModuleManager::load_modules();
if (!Utils_RecordBrowserCommon::get_access($tab, 'export') && !Base_AclCommon::i_am_admin()) {
    die('Access denied');
}
set_time_limit(0);
$tab_info = Utils_RecordBrowserCommon::init($tab);
$records = Utils_RecordBrowserCommon::get_records($tab, $crits, array(), $order, array(), $admin);
header('Content-Type: text/csv');
//header('Content-Length: '.strlen($buffer));
header('Content-disposition: attachement; filename="' . $tab . '_export_' . date('Y_m_d__H_i_s') . '.csv"');
if (headers_sent()) {
    die('Some data has already been output to browser, can\'t send the file');
}
$cols = array(__('Record ID'), __('Created on'), __('Created by'), __('Edited on'), __('Edited by'));
foreach ($tab_info as $v) {
    if (!$v['export']) {
        continue;
    }
    $cols[] = _V($v['name']);
    if ($v['style'] == 'currency') {
        $cols[] = _V($v['name']) . ' - ' . __('Currency');
开发者ID:cretzu89,项目名称:EPESI,代码行数:31,代码来源:csv_export.php

示例7: ob_start

<?php

ob_start();
define('CID', false);
require_once '../../../include.php';
ModuleManager::load_modules();
if (isset($_GET['tbName']) && $_GET['tbName'] != "" && (isset($_GET['tbCaption']) && $_GET['tbCaption'] != "")) {
    $tbName = $_GET['tbName'];
    $tbCaption = $_GET['tbCaption'];
    $arrayFields = Utils_RecordBrowserCommon::init($tbName);
    foreach ($arrayFields as $key => $value) {
        print "<option value=" . $tbName . ":" . $value['id'] . ">" . $tbCaption . " - " . $value['name'] . "</option>";
    }
}
$content = ob_get_contents();
ob_end_clean();
require_once 'libs/minify/HTTP/Encoder.php';
$he = new HTTP_Encoder(array('content' => $content));
if (MINIFY_ENCODE) {
    $he->encode();
}
$he->sendAll();
exit;
开发者ID:62BRAINS,项目名称:EPESI,代码行数:23,代码来源:getfields.php

示例8: defined

 * @package epesi-utils
 * @subpackage RecordBrowser
 */
//!!! $table,$crits and sort variables are passed globally
defined("_VALID_ACCESS") || die;
//init
$ret = DB::GetRow('SELECT caption, recent, favorites FROM recordbrowser_table_properties WHERE tab=%s', array($table));
if (isset($_GET['search']) && $_GET['search'] !== "Search" && $_GET['search'] !== "") {
    $type = 'all';
} else {
    $type = isset($_GET['type']) ? $_GET['type'] : Base_User_SettingsCommon::get('Utils_RecordBrowser', $table . '_default_view');
}
$order_num = isset($_GET['order']) && isset($_GET['order_dir']) ? $_GET['order'] : -1;
$order = false;
//cols
$cols = Utils_RecordBrowserCommon::init($table);
$cols_out = array();
foreach ($cols as $k => $col) {
    if (!$col['visible'] && (!isset($info[$col['id']]) || !$info[$col['id']])) {
        continue;
    }
    if (isset($info[$col['id']]) && !$info[$col['id']]) {
        continue;
    }
    if (count($cols_out) == $order_num) {
        $order = $col['id'];
    }
    $col['name'] = _V($col['name']);
    if ($type != 'recent') {
        $cols_out[] = array('name' => $col['name'], 'order' => $col['id'], 'record' => $col, 'key' => $k);
    } else {
开发者ID:cretzu89,项目名称:EPESI,代码行数:31,代码来源:mobile.php

示例9: map_rb_field_to_query_builder_filters

 public static function map_rb_field_to_query_builder_filters($tab, $f, $in_depth = true, $prefix = '', $sufix = '', $label_prefix = '')
 {
     $filters = array();
     $type = null;
     $values = null;
     $input = null;
     $opts = array();
     $opts['id'] = $prefix . $f['id'] . $sufix;
     $opts['field'] = $opts['id'];
     $opts['label'] = $label_prefix . _V($f['name']);
     if ($tab == 'contact' && $f['id'] == 'login' || $tab == 'rc_accounts' && $f['id'] == 'epesi_user') {
         $type = 'boolean';
         // just for valid operators
         $input = 'select';
         $values = array('' => '[' . __('Empty') . ']', 'USER_ID' => __('User Login'));
     } else {
         switch ($f['type']) {
             case 'text':
                 $type = 'string';
                 break;
             case 'multiselect':
             case 'select':
                 $param = explode(';', $f['param']);
                 $ref = explode('::', $param[0]);
                 $tabs = $ref[0];
                 if ($tabs == '__RECORDSETS__') {
                     $single_tab = false;
                 } else {
                     $tabs = explode(',', $tabs);
                     $single_tab = count($tabs) == 1;
                 }
                 $type = 'boolean';
                 $input = 'select';
                 $values = self::permissions_get_field_values($tab, $f, $in_depth);
                 if ($in_depth && $single_tab) {
                     $one_tab = reset($tabs);
                     if (Utils_RecordBrowserCommon::check_table_name($one_tab, false, false)) {
                         $fields = Utils_RecordBrowserCommon::init($one_tab);
                         foreach ($fields as $k => $v) {
                             if ($v['type'] == 'calculated' || $v['type'] == 'hidden') {
                             } else {
                                 $new_label_prefix = _V($f['name']) . ' ' . __('is set to record where') . ' ';
                                 $sub_filter = self::map_rb_field_to_query_builder_filters($tab, $v, false, $f['id'] . '[', ']', $new_label_prefix);
                                 if ($sub_filter) {
                                     $sub_filter = reset($sub_filter);
                                     $sub_filter['optgroup'] = $new_label_prefix;
                                     $filters[] = $sub_filter;
                                 }
                             }
                         }
                     }
                 }
                 break;
             case 'commondata':
                 $type = 'boolean';
                 $input = 'select';
                 $array_id = is_array($f['param']) ? $f['param']['array_id'] : $f['ref_table'];
                 $values = array('' => '[' . __('Empty') . ']');
                 if (strpos($array_id, '::') === false) {
                     $values = $values + Utils_CommonDataCommon::get_translated_array($array_id, is_array($f['param']) ? $f['param']['order_by_key'] : false);
                 }
                 break;
             case 'integer':
                 $type = 'integer';
                 break;
             case 'float':
                 $type = 'double';
                 break;
             case 'timestamp':
                 $type = 'datetime';
             case 'date':
                 if (!$type) {
                     $type = 'date';
                 }
                 // absolute value filter
                 $opts['plugin'] = 'datepicker';
                 $opts['plugin_config'] = array('dateFormat' => 'yy-mm-dd');
                 // relative value filter
                 $filt2 = $opts;
                 $filt2['id'] .= '_relative';
                 $filt2['label'] .= ' (' . __('relative') . ')';
                 $filt2['type'] = 'date';
                 $filt2['input'] = 'select';
                 $filt2['values'] = self::permissions_get_field_values($tab, $f);
                 $filters[] = $filt2;
                 break;
             case 'time':
                 $type = 'time';
                 break;
             case 'long text':
                 $type = 'string';
                 $input = 'textarea';
                 break;
             case 'hidden':
                 break;
             case 'calculated':
                 break;
             case 'checkbox':
                 $type = 'boolean';
                 break;
//.........这里部分代码省略.........
开发者ID:cretzu89,项目名称:EPESI,代码行数:101,代码来源:QueryBuilderIntegration.php

示例10: QFfield_identifierfields

 public static function QFfield_identifierfields(&$form, $field, $label, $mode, $default, $desc, $rb_obj)
 {
     //print "<br>MODE on QFfield_recordfields == ". $mode;
     if ($mode == 'add') {
         $recordset_form = $form->addElement('multiselect', $field, $label, null);
         $recordset_form->on_add_js('call_js_add_result(\'add\');');
         $recordset_form->on_remove_js('call_js_remove_fields();');
     } else {
         if ($mode == 'edit' || $mode == 'view') {
             $arrayAllValues = array();
             $dataField = self::getRecordsetsOnly($default);
             foreach ($dataField as $tbName) {
                 $arrayFields = Utils_RecordBrowserCommon::init($tbName);
                 foreach ($arrayFields as $key => $value) {
                     $arrayAllValues[$tbName . ":" . $value['id']] = Utils_RecordBrowserCommon::get_caption($tbName) . " - " . $value['name'];
                 }
             }
             $recordset_form = $form->addElement('multiselect', $field, $label, $arrayAllValues);
             $recordset_form->on_add_js('call_js_add_result(\'edit\');');
             $recordset_form->on_remove_js('call_js_remove_fields();');
             $form->setDefaults(array($field => self::parse_array($default)));
             eval_js('changeAddedRecordset(\'search_field_for_identifier__to\')');
         }
     }
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:25,代码来源:QuickSearchCommon_0.php


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