本文整理汇总了PHP中Utils_RecordBrowserCommon::merge_crits方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils_RecordBrowserCommon::merge_crits方法的具体用法?PHP Utils_RecordBrowserCommon::merge_crits怎么用?PHP Utils_RecordBrowserCommon::merge_crits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils_RecordBrowserCommon
的用法示例。
在下文中一共展示了Utils_RecordBrowserCommon::merge_crits方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recordpicker_fs
public function recordpicker_fs($crits, $cols, $order, $filters, $path)
{
self::$browsed_records = array();
$this->init();
$theme = $this->init_module(Base_Theme::module_name());
Base_ThemeCommon::load_css($this->get_type(), 'Browsing_records');
$this->set_module_variable('rp_fs_path', $path);
$selected = Module::static_get_module_variable($path, 'selected', array());
$theme->assign('filters', $this->show_filters($filters));
$theme->assign('disabled', '');
$this->crits = Utils_RecordBrowserCommon::merge_crits($this->crits, $crits);
$theme->assign('table', $this->show_data($this->crits, $cols, $order, false, true));
if ($this->amount_of_records >= 10000) {
$theme->assign('disabled', '_disabled');
$theme->assign('select_all', array('js' => '', 'label' => __('Select all')));
$theme->assign('deselect_all', array('js' => '', 'label' => __('Deselect all')));
} else {
load_js('modules/Utils/RecordBrowser/RecordPickerFS/select_all.js');
$theme->assign('select_all', array('js' => 'RecordPicker_select_all(1,\'' . $this->get_path() . '\',\'' . __('Processing...') . '\');', 'label' => __('Select all')));
$theme->assign('deselect_all', array('js' => 'RecordPicker_select_all(0,\'' . $this->get_path() . '\',\'' . __('Processing...') . '\');', 'label' => __('Deselect all')));
}
load_js('modules/Utils/RecordBrowser/rpicker_fs.js');
if (isset(self::$browsed_records['records'])) {
foreach (self::$browsed_records['records'] as $id => $i) {
eval_js('rpicker_fs_init(' . $id . ',' . (isset($selected[$id]) && $selected[$id] ? 1 : 0) . ',\'' . $this->get_path() . '\')');
}
}
/*
$rpicker_ind = $this->get_module_variable('rpicker_ind');
$init_func = 'init_all_rpicker_'.$element.' = function(id, cstring){';
foreach($rpicker_ind as $v)
$init_func .= 'rpicker_init(\''.$element.'\','.$v.');';
$init_func .= '}';
eval_js($init_func.';init_all_rpicker_'.$element.'();');*/
$theme->display('Record_picker');
}
示例2: edit_permissions_rule
//.........这里部分代码省略.........
else {
$current_or[$i] += $j;
$j = 0;
$i++;
}
} else {
$first = false;
}
$sub_value = null;
if (!isset($r[$k]) && $k[strlen($k)-1]==']') {
$sub_value = $v;
list($k, $v) = explode('[', trim($k, ']'));
}
$defaults['crits_'.$i.'_'.$j.'_field'] = $k;
$defaults['crits_'.$i.'_'.$j.'_op'] = $operator;
$js .= '$("crits_'.$i.'_'.$j.'_value").value = "'.$v.'";';
if ($sub_value!==null) $sub_values['crits_'.$i.'_'.$j.'_sub_value'] = $sub_value;
}
$current_or[$i] += $j;
$current_and += $i;
$i = 0;
$tmp = DB::GetAll('SELECT * FROM '.$this->tab.'_access_clearance AS acs WHERE rule_id=%d', array($id));
foreach ($tmp as $t) {
$defaults['clearance_'.$i] = $t['clearance'];
$i++;
}
$current_clearance += $i-1;
$tmp = DB::GetAll('SELECT * FROM '.$this->tab.'_access_fields AS acs WHERE rule_id=%d', array($id));
foreach ($tmp as $t) {
unset($defaults['field_'.$t['block_field']]);
}
}
for ($i=0; $i<$counts['ands']; $i++)
for ($j=0; $j<$counts['ors']; $j++)
$js .= 'utils_recordbrowser__update_field_sub_values('.$i.', '.$j.');';
foreach ($sub_values as $k=>$v)
$js .= '$("'.$k.'").value = "'.$v.'";';
$form->setDefaults($defaults);
if ($form->validate()) {
$vals = $form->exportValues();
$action = $vals['action'];
$clearance = array();
for ($i=0; $i<$counts['clearance']; $i++)
if ($vals['clearance_'.$i]) $clearance[] = $vals['clearance_'.$i];
$crits = array();
for ($i=0; $i<$counts['ands']; $i++) {
$or = '(';
for ($j=0; $j<$counts['ors']; $j++) {
if ($vals['crits_'.$i.'_'.$j.'_field'] && $vals['crits_'.$i.'_'.$j.'_op']) {
if (!isset($operators[$vals['crits_'.$i.'_'.$j.'_op']])) trigger_error('Fatal error',E_USER_ERROR);
if (!isset($all_fields[$vals['crits_'.$i.'_'.$j.'_field']])) trigger_error('Fatal error',E_USER_ERROR);
$op = $vals['crits_'.$i.'_'.$j.'_op'];
if ($op=='=') $op = '';
if (isset($vals['crits_'.$i.'_'.$j.'_sub_value'])) {
$vals['crits_'.$i.'_'.$j.'_field'] = $vals['crits_'.$i.'_'.$j.'_field'].'['.$vals['crits_'.$i.'_'.$j.'_value'].']';
$vals['crits_'.$i.'_'.$j.'_value'] = $vals['crits_'.$i.'_'.$j.'_sub_value'];
}
$next = array($or.$op.$vals['crits_'.$i.'_'.$j.'_field'] => $vals['crits_'.$i.'_'.$j.'_value']);
$crits = Utils_RecordBrowserCommon::merge_crits($crits, $next);
}
$or = '|';
}
}
$blocked_fields = array();
foreach ($fields_permissions as $k=>$v) {
if (isset($vals['field_'.$k])) continue;
$blocked_fields[] = $k;
}
if ($id===null || $clone)
Utils_RecordBrowserCommon::add_access($this->tab, $action, $clearance, $crits, $blocked_fields);
else
Utils_RecordBrowserCommon::update_access($this->tab, $id, $action, $clearance, $crits, $blocked_fields);
return false;
}
eval_js($js);
eval_js('utils_recordbrowser__init_clearance('.$current_clearance.', '.$counts['clearance'].')');
eval_js('utils_recordbrowser__init_crits_and('.$current_and.', '.$counts['ands'].')');
for ($i=0; $i<$counts['ands']; $i++)
eval_js('utils_recordbrowser__init_crits_or('.$i.', '.$current_or[$i].', '.$counts['ors'].')');
eval_js('utils_recordbrowser__crits_initialized = true;');
$form->assign_theme('form', $theme);
$theme->assign('fields', $fields_permissions);
$theme->assign('counts', $counts);
$theme->display('edit_permissions');
Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
Base_ActionBarCommon::add('delete', __('Cancel'), $this->create_back_href());
return true;
}
示例3: QFfield_contact
public static function QFfield_contact(&$form, $field, $label, $mode, $default, $desc, $rb_obj = null)
{
$cont = array();
$param = explode(';', $desc['param']);
if ($mode == 'add' || $mode == 'edit') {
$adv_crits = null;
if (!isset($param[1]) || $param[1] == '::') {
$callback = array('CRM_ContactsCommon', 'contact_format_default');
} else {
$callback = explode('::', $param[1]);
}
if (isset($param[2]) && $param[2] != '::') {
$crit_callback = explode('::', $param[2]);
if ($crit_callback[0] == 'ChainedSelect') {
$crits = null;
} elseif (is_callable($crit_callback)) {
$crits = call_user_func($crit_callback, false);
$adv_crits = call_user_func($crit_callback, true);
if ($adv_crits === $crits) {
$adv_crits = null;
}
} else {
$crits = array();
$adv_crits = null;
}
} else {
$crits = array();
}
if ($crits === true) {
$crits = $adv_crits;
}
if ($desc['type'] != 'multiselect' && (!isset($crit_callback) || $crit_callback[0] != 'ChainedSelect')) {
$cont[''] = '---';
}
$limit = false;
if ($crits !== null) {
$amount = Utils_RecordBrowserCommon::get_records_count('contact', $crits);
$base_crits = $crits;
if ($amount > Utils_RecordBrowserCommon::$options_limit) {
$limit = Utils_RecordBrowserCommon::$options_limit;
if ($desc['type'] == 'select') {
$present = false;
foreach ($crits as $k => $v) {
if (strstr($k, ':Recent')) {
$present = true;
break;
}
}
if (!$present) {
$base_crits = Utils_RecordBrowserCommon::merge_crits($base_crits, array(':Recent' => true));
}
}
}
$contacts = self::get_contacts($base_crits, array(), array(), $limit);
if (!is_array($default)) {
if ($default != '') {
$default = array($default);
} else {
$default = array();
}
}
$ext_rec = array_flip($default);
foreach ($contacts as $v) {
$cont[$v['id']] = call_user_func($callback, $v, true);
unset($ext_rec[$v['id']]);
}
foreach ($ext_rec as $k => $v) {
$c = CRM_ContactsCommon::get_contact($k);
if ($c === null) {
continue;
}
$cont[$k] = call_user_func($callback, $c, true);
}
uasort($cont, array('CRM_ContactsCommon', 'compare_names'));
}
$label = Utils_RecordBrowserCommon::get_field_tooltip($label, $desc['type'], 'contact', $crits);
if ($desc['type'] == 'select') {
if (is_numeric($limit)) {
unset($cont['']);
$form->addElement('autoselect', $field, $label, $cont, array(array('CRM_ContactsCommon', 'autoselect_contact_suggestbox'), array($crits, $callback)), $callback, array('id' => $field));
} else {
$form->addElement($desc['type'], $field, $label, $cont, array('id' => $field));
}
} else {
if ($adv_crits !== null || is_numeric($limit)) {
$form->addElement('automulti', $field, $label, array('CRM_ContactsCommon', 'autoselect_contact_suggestbox'), array($adv_crits !== null ? $adv_crits : $crits, $callback), $callback);
} else {
$form->addElement($desc['type'], $field, $label, $cont, array('id' => $field));
}
}
$form->setDefaults(array($field => $default));
if (isset($param[2]) && $param[2] != '::') {
if ($crit_callback[0] == 'ChainedSelect') {
if ($form->exportValue($field)) {
$default = $form->exportValue($field);
}
self::contacts_chainedselect_crits($default, $desc, $callback, $crit_callback[1]);
}
}
} else {
//.........这里部分代码省略.........