本文整理汇总了PHP中Utils_RecordBrowserCommon::crits_to_words方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils_RecordBrowserCommon::crits_to_words方法的具体用法?PHP Utils_RecordBrowserCommon::crits_to_words怎么用?PHP Utils_RecordBrowserCommon::crits_to_words使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils_RecordBrowserCommon
的用法示例。
在下文中一共展示了Utils_RecordBrowserCommon::crits_to_words方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: manage_permissions
public function manage_permissions() {
$this->help('Permissions Editor','permissions');
$this->init();
$gb = $this->init_module('Utils/GenericBrowser','permissions_'.$this->tab, 'permissions_'.$this->tab);
$gb->set_table_columns(array(
array('name'=>__('Access type'), 'width'=>'100px'),
array('name'=>__('Clearance required'), 'width'=>'30'),
array('name'=>__('Applies to records'), 'width'=>'60'),
array('name'=>__('Fields'), 'width'=>'100px')
));
$ret = DB::Execute('SELECT * FROM '.$this->tab.'_access AS acs ORDER BY action DESC');
$tmp = DB::GetAll('SELECT * FROM '.$this->tab.'_access_clearance AS acs');
$clearance = array();
foreach ($tmp as $t) $clearance[$t['rule_id']][] = $t['clearance'];
$tmp = DB::GetAll('SELECT * FROM '.$this->tab.'_access_fields AS acs');
$fields = array();
foreach ($tmp as $t) $fields[$t['rule_id']][] = $t['block_field'];
$all_clearances = array_flip(Base_AclCommon::get_clearance(true));
$all_fields = array();
foreach ($this->table_rows as $v)
$all_fields[$v['id']] = $v['name'];
$actions = $this->get_permission_actions();
$rules = array();
while ($row = $ret->FetchRow()) {
if (!isset($clearance[$row['id']])) $clearance[$row['id']] = array();
if (!isset($fields[$row['id']])) $fields[$row['id']] = array();
$action = $actions[$row['action']];
$crits = Utils_RecordBrowserCommon::parse_access_crits($row['crits'], true);
$crits = Utils_RecordBrowserCommon::crits_to_words($this->tab, $crits, false);
$crits_text = '';
foreach ($crits as $c) {
switch ($c) {
case 'and': $crits_text .= '<span class="joint">'.__('and').'</span><br>'; break;
case 'or': $crits_text .= '<span class="joint">'.__('or').'</span> '; break;
default: $crits_text .= $c.' ';
}
}
foreach ($fields[$row['id']] as $k=>$v)
if (isset($all_fields[$v]))
$fields[$row['id']][$k] = $all_fields[$v];
else
unset($fields[$row['id']][$k]);
foreach ($clearance[$row['id']] as $k=>$v)
if (isset($all_clearances[$v])) $clearance[$row['id']][$k] = $all_clearances[$v];
else unset($clearance[$row['id']][$k]);
$c_all_fields = count($all_fields);
$c_fields = count($fields[$row['id']]);
$props = $c_all_fields?($c_all_fields-$c_fields)/$c_all_fields:0;
$color = dechex(255-68*$props).dechex(187+68*$props).'BB';
$fields_value = ($c_all_fields-$c_fields).' / '.$c_all_fields;
if ($props!=1) $fields_value = Utils_TooltipCommon::create($fields_value, '<b>'.__('Excluded fields').':</b><hr>'.implode('<br>',$fields[$row['id']]), false);
$rules[$row['action']][$row['id']] = array(
$action,
'<span class="Utils_RecordBrowser__permissions_crits">'.implode(' <span class="joint">'.__('and').'</span><br>',$clearance[$row['id']]).'</span>',
array('value'=>'<span class="Utils_RecordBrowser__permissions_crits">'.$crits_text.'</span>', 'overflow_box'=>false),
array('style'=>'background-color:#'.$color, 'value'=>$fields_value)
);
}
foreach ($actions as $a=>$l)
if (isset($rules[$a]))
foreach ($rules[$a] as $id=>$vals) {
$gb_row = $gb->get_new_row();
$gb_row->add_data_array($vals);
if (Base_AdminCommon::get_access('Utils_RecordBrowser', 'permissions')==2) {
$gb_row->add_action($this->create_callback_href(array($this, 'edit_permissions_rule'), array($id)), 'edit', 'Edit');
$gb_row->add_action($this->create_callback_href(array($this, 'edit_permissions_rule'), array($id, true)), 'copy', __('Clone rule'), Base_ThemeCommon::get_template_file('Utils/Attachment','copy_small.png'));
$gb_row->add_action($this->create_confirm_callback_href(__('Are you sure you want to delete this rule?'), array($this, 'delete_permissions_rule'), array($id)), 'delete', 'Delete');
}
}
if (Base_AdminCommon::get_access('Utils_RecordBrowser', 'permissions')==2)
Base_ActionBarCommon::add('add',__('Add new rule'), $this->create_callback_href(array($this, 'edit_permissions_rule'), array(null)));
Base_ThemeCommon::load_css('Utils_RecordBrowser', 'edit_permissions');
$this->display_module($gb);
eval_js('utils_recordbrowser__crits_initialized = false;');
}
示例2: __
$limit_info = '';
if (is_array($limit)) {
$offset = $limit['offset'];
$per_page = $limit['numrows'];
$start = $offset + 1;
$end = $offset + $per_page;
$total = Utils_RecordBrowserCommon::get_records_count($tab, $crits, $admin, $order);
if ($end > $total)
$end = $total;
$limit_info = __('Records %s to %s of %s', array($start, $end, $total)) . "\n";
}
$tcpdf = Libs_TCPDFCommon::new_pdf();
$filters = implode(' ',Utils_RecordBrowserCommon::crits_to_words($tab, $crits));
$filters = strip_tags($filters);
$filters = str_replace(' ', ' ', $filters);
$filters = str_replace(' and ', "\n", $filters);
$filters = str_replace(' is equal to', ':', $filters);
$subject = $limit_info . $filters;
Libs_TCPDFCommon::prepare_header($tcpdf, _V(DB::GetOne('SELECT caption FROM recordbrowser_table_properties WHERE tab=%s', array($tab))), $subject, false);
Libs_TCPDFCommon::add_page($tcpdf);
Libs_TCPDFCommon::SetFont($tcpdf, Libs_TCPDFCommon::$default_font, '', 6);
$html = Libs_TCPDFCommon::stripHTML(str_replace(array('<br>',' '),array('<br/>',' '),$html));
Libs_TCPDFCommon::writeHTML($tcpdf, $html, false);
$buffer = Libs_TCPDFCommon::output($tcpdf);
示例3: ob_start
$rb->disable_pagination();
ob_start();
$rb->show_data($crits, $cols, $order, $admin, false, true, $limit);
$html = ob_get_clean();
$limit_info = '';
if (is_array($limit)) {
$offset = $limit['offset'];
$per_page = $limit['numrows'];
$start = $offset + 1;
$end = $offset + $per_page;
$total = Utils_RecordBrowserCommon::get_records_count($tab, $crits, $admin, $order);
if ($end > $total) {
$end = $total;
}
$limit_info = __('Records %s to %s of %s', array($start, $end, $total)) . "\n";
}
$tcpdf = Libs_TCPDFCommon::new_pdf();
$filters = Utils_RecordBrowserCommon::crits_to_words($tab, $crits, false);
$filters = str_replace(' and ', "\n", $filters);
$filters = str_replace(' is equal to', ':', $filters);
$subject = $limit_info . $filters;
Libs_TCPDFCommon::prepare_header($tcpdf, _V(DB::GetOne('SELECT caption FROM recordbrowser_table_properties WHERE tab=%s', array($tab))), $subject, false);
Libs_TCPDFCommon::add_page($tcpdf);
Libs_TCPDFCommon::SetFont($tcpdf, Libs_TCPDFCommon::$default_font, '', 6);
$html = Libs_TCPDFCommon::stripHTML(str_replace(array('<br>', ' '), array('<br/>', ' '), $html));
Libs_TCPDFCommon::writeHTML($tcpdf, $html, false);
$buffer = Libs_TCPDFCommon::output($tcpdf);
header('Content-Type: application/pdf');
header('Content-Length: ' . strlen($buffer));
header('Content-disposition: inline; filename="recordset_' . $tab . '.pdf"');
print $buffer;