本文整理汇总了PHP中Utils_RecordBrowserCommon::create_default_linked_label方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils_RecordBrowserCommon::create_default_linked_label方法的具体用法?PHP Utils_RecordBrowserCommon::create_default_linked_label怎么用?PHP Utils_RecordBrowserCommon::create_default_linked_label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils_RecordBrowserCommon
的用法示例。
在下文中一共展示了Utils_RecordBrowserCommon::create_default_linked_label方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: watchdog_label
public static function watchdog_label($tab, $cat, $rid, $events = array(), $label = null, $details = true)
{
$ret = array('category' => $cat);
if ($rid !== null) {
$r = self::get_record($tab, $rid);
if ($r === null) {
return null;
}
if (!self::get_access($tab, 'view', $r)) {
return null;
}
if (is_array($label)) {
$label = Utils_RecordBrowserCommon::record_link_open_tag_r($tab, $r) . call_user_func($label, $r, true) . Utils_RecordBrowserCommon::record_link_close_tag();
$label = self::create_default_record_tooltip_ajax($label, $tab, $rid);
} elseif ($label) {
$label = Utils_RecordBrowserCommon::create_linked_label_r($tab, $label, $r);
$label = self::create_default_record_tooltip_ajax($label, $tab, $rid);
} else {
$label = Utils_RecordBrowserCommon::create_default_linked_label($tab, $rid, false, false);
}
$ret['title'] = $label;
$ret['view_href'] = Utils_RecordBrowserCommon::create_record_href($tab, $rid);
$events_display = array();
$events = array_reverse($events);
$other_events = array();
$header = false;
foreach ($events as $v) {
if (count($events_display) > 20) {
$other_events[__('And more...')] = 1;
break;
}
$param = explode('_', $v);
switch ($param[0]) {
case 'C':
$what = 'Created';
$event_display = array('who' => Base_UserCommon::get_user_label($r['created_by'], true), 'when' => Base_RegionalSettingsCommon::time2reg($r['created_on']), 'what' => _V($what));
break;
case 'D':
if (!isset($what)) {
$what = 'Deleted';
}
case 'R':
if (!isset($what)) {
$what = 'Restored';
}
if (!isset($param[1])) {
$event_display = array('who' => '', 'when' => '', 'what' => _V($what));
break;
}
case 'E':
$event_display = self::get_edit_details_modify_record($tab, $r['id'], $param[1], $details);
if (isset($event_display['what']) && !empty($event_display['what'])) {
$header = true;
}
break;
case 'N':
$event_display = false;
switch ($param[1]) {
case '+':
$action = __('Note linked');
break;
case '-':
$action = __('Note unlinked');
break;
default:
if (!isset($other_events[$param[1]])) {
$other_events[$param[1]] = 0;
}
$other_events[$param[1]]++;
$event_display = null;
break;
}
if ($event_display === false) {
$date = isset($param[3]) ? Base_RegionalSettingsCommon::time2reg($param[3]) : '';
$who = isset($param[4]) ? Base_UserCommon::get_user_label($param[4], true) : '';
$action .= ' - ' . self::create_default_linked_label('utils_attachment', $param[2]);
$event_display = array('what' => $action, 'who' => $who, 'when' => $date);
}
break;
default:
$event_display = array('what' => _V($v));
}
if ($event_display) {
$events_display[] = $event_display;
}
}
foreach ($other_events as $k => $v) {
$events_display[] = array('what' => _V($k) . ($v > 1 ? ' [' . $v . ']' : ''));
}
if ($events_display) {
$theme = Base_ThemeCommon::init_smarty();
if ($header) {
$theme->assign('header', array(__('Field'), __('Old value'), __('New value')));
}
$theme->assign('events', $events_display);
$tpl = 'changes_list';
if (Utils_WatchdogCommon::email_mode()) {
$record_data = self::get_record_tooltip_data($tab, $rid);
$theme->assign('record', $record_data);
$tpl = 'changes_list_email';
//.........这里部分代码省略.........
示例2: create_default_linked_label
/**
* Create default linked label to record
* @param int $id Record's ID
* @param bool $nolink Do not create link
* @param bool $table_name Prepend table caption
* @return string html with link
*/
public function create_default_linked_label($id, $nolink = false, $table_name = true)
{
if (!is_numeric($id)) {
trigger_error('Create default linked label requires proper record id.');
}
return Utils_RecordBrowserCommon::create_default_linked_label($this->tab, $id, $nolink, $table_name);
}
示例3: check_field_definitions
public function check_field_definitions($data) {
$ret = array();
if ($this->admin_field_mode=='edit')
$type = $this->admin_field_type;
else
$type = $data['select_data_type'];
if ($type == 'text') {
$last = $this->admin_field_name?DB::GetOne('SELECT param FROM '.$this->tab.'_field WHERE field=%s', array($this->admin_field_name)):1;
if ($data['text_length']<$last) $ret['text_length'] = __('Must be a number greater or equal %d', array($last));
if ($data['text_length']>255) $ret['text_length'] = __('Must be a number no greater than %d', array(255));
if (!is_numeric($data['text_length'])) $ret['text_length'] = __('Must be a number');
if ($data['text_length']=='') $ret['text_length'] = __('Field required');
}
if ($type == 'select') {
if (!isset($data['data_source'])) $data['data_source'] = $this->admin_field['data_source'];
if (!isset($data['rset'])) $data['rset'] = $this->admin_field['rset'];
if (!is_array($data['rset'])) $data['rset'] = array_filter(explode('__SEP__', $data['rset'])); // data from multiselect field passed in raw format here
if ($data['data_source']=='commondata' && $data['commondata_table']=='') $ret['commondata_table'] = __('Field required');
if ($data['data_source']=='rset') {
if ($data['label_field']!='') {
$fs = explode(',', $data['label_field']);
foreach($data['rset'] as $rset)
$ret = $ret + $this->detranslate_field_names($rset, $fs);
}
}
if ($this->admin_field_mode=='edit' && $data['select_type']=='select' && $this->admin_field['select_type']=='multiselect') {
$count = DB::GetOne('SELECT COUNT(*) FROM '.$this->tab.'_data_1 WHERE f_'.Utils_RecordBrowserCommon::get_field_id($this->admin_field['field']).' '.DB::like().' %s', array('%_\_\__%'));
if ($count!=0) {
$ret['select_type'] = __('Cannot change type');
print('<span class="important_notice">'.__('Following records have more than one value stored in this field, making type change impossible:'));
$recs = DB::GetCol('SELECT id FROM '.$this->tab.'_data_1 WHERE f_'.Utils_RecordBrowserCommon::get_field_id($this->admin_field['field']).' '.DB::like().' %s', array('%_\_\__%'));
foreach ($recs as $r)
print('<br/>'.Utils_RecordBrowserCommon::create_default_linked_label($this->tab, $r, false, false));
print('</span>');
}
}
}
return empty($ret)?true:$ret;
}
示例4: check_email_unique
public static function check_email_unique($data)
{
if (!isset($data[self::$field])) {
return true;
}
$email = $data[self::$field];
if (!$email) {
return true;
}
$rec = self::get_record_by_email($email, self::$rset, self::$rid);
if ($rec == false) {
return true;
}
return array(self::$field => __('E-mail address duplicate found: %s', array(Utils_RecordBrowserCommon::create_default_linked_label($rec[0], $rec[1]))));
}
示例5: display_attached_to
public static function display_attached_to($row, $nolink = false, $a=null,$view=false) {
$locals = DB::GetCol('SELECT local FROM utils_attachment_local WHERE attachment=%d',array($row['id']));
$ret = array();
foreach ($locals as $local) {
$param = explode('/', $local);
if (count($param) == 2 && preg_match('/^[1-9][0-9]*$/', $param[1])) {
$ret[] = Utils_RecordBrowserCommon::create_default_linked_label($param[0],$param[1],$nolink);
}
}
return implode(', ',$ret);
}
示例6: display_record_id
public static function display_record_id($r, $nolink = false)
{
return Utils_RecordBrowserCommon::create_default_linked_label($r['recordset'], $r['record_id']);
}
示例7: display_attached_to
public static function display_attached_to($row, $nolink = false, $a = null, $view = false)
{
$locals = DB::GetCol('SELECT local FROM utils_attachment_local WHERE attachment=%d', array($row['id']));
$ret = array();
foreach ($locals as $local) {
$param = explode('/', $local);
if (count($param) == 2 && preg_match('/^[1-9][0-9]*$/', $param[1])) {
if (!Utils_RecordBrowserCommon::check_table_name($param[0], false, false)) {
DB::Execute('DELETE FROM utils_attachment_local WHERE local=%s', array($local));
continue;
}
$label = Utils_RecordBrowserCommon::create_default_linked_label($param[0], $param[1], true);
$link = Utils_RecordBrowserCommon::record_link_open_tag($param[0], $param[1], $nolink, 'view', array('switch_to_addon' => __('Notes'))) . $label . Utils_RecordBrowserCommon::record_link_close_tag();
$link = Utils_RecordBrowserCommon::create_default_record_tooltip_ajax($link, $param[0], $param[1]);
$ret[] = $link;
}
}
return implode(', ', $ret);
}
示例8: body
//.........这里部分代码省略.........
}
if (isset($filters['edit'])) {
if (!isset($filters['delete_restore'])) {
$e_where[] = ' ehd.field!=' . DB::qstr('id');
}
} else {
if (isset($filters['delete_restore'])) {
$e_where[] = ' ehd.field=' . DB::qstr('id');
}
}
if ($filters['start_date']) {
$date = DB::qstr(date('Y-m-d', strtotime($filters['start_date'])));
$af_where .= ' AND uaf.created_on >= ' . $date;
$c_where .= ($c_where ? ' AND' : '') . ' created_on >= ' . $date;
$e_where[] = ' edited_on >= ' . $date;
}
if ($filters['end_date']) {
$date = DB::qstr(date('Y-m-d 23:59:59', strtotime($filters['end_date'])));
$af_where .= ' AND uaf.created_on <= ' . $date;
$c_where .= ($c_where ? ' AND' : '') . ' created_on <= ' . $date;
$e_where[] = ' edited_on <= ' . $date;
}
if (!empty($e_where)) {
$e_where = ' WHERE' . implode(' AND', $e_where);
} else {
$e_where = '';
}
if ($c_where) {
$c_where = ' WHERE' . $c_where;
}
$postgre_cast_type = DB::is_postgresql() ? '::varchar' : '';
// **** files ****
if (isset($filters['file'])) {
$tables[] = 'SELECT uaf.id AS id,uaf.created_on AS edited_on,uaf.created_by AS edited_by, ual.local AS r_id, ' . DB::qstr('') . ' AS tab, ' . DB::qstr('file') . ' AS action FROM utils_attachment_file uaf INNER JOIN utils_attachment_data_1 ua ON uaf.attach_id=ua.id INNER JOIN utils_attachment_local ual ON ua.id=ual.attachment WHERE original!=' . DB::qstr('') . ' AND ' . $af_where;
}
// **** edit ****
if (isset($filters['edit']) || isset($filters['delete_restore'])) {
foreach ($rb_tabs as $k => $t) {
$tables[] = 'SELECT id, edited_on, edited_by, ' . $k . '_id' . $postgre_cast_type . ' as r_id, ' . DB::qstr($k) . ' as tab, ' . DB::qstr('edit') . ' as action FROM ' . $k . '_edit_history eh LEFT JOIN ' . $k . '_edit_history_data ehd ON ehd.edit_id=eh.id' . $e_where;
}
}
// **** create ****
if (isset($filters['new'])) {
foreach ($rb_tabs as $k => $t) {
$tables[] = 'SELECT 0 AS id, created_on AS edited_on, created_by AS edited_by, id' . $postgre_cast_type . ' as r_id, ' . DB::qstr($k) . ' as tab, ' . DB::qstr('create') . ' as action FROM ' . $k . '_data_1' . $c_where;
}
}
if (!empty($tables)) {
$tables = implode(' UNION ', $tables);
$limit = DB::GetOne('SELECT COUNT(*) FROM (' . $tables . ') AS tmp');
$limit = $gb->get_limit($limit);
$ret = DB::SelectLimit('SELECT * FROM (' . $tables . ') AS tmp ORDER BY edited_on DESC', $limit['numrows'], $limit['offset']);
while ($row = $ret->FetchRow()) {
$user = Base_UserCommon::get_user_label($row['edited_by']);
$action = '';
$link = '';
switch ($row['action']) {
case 'edit':
$details = DB::GetAssoc('SELECT field, old_value FROM ' . $row['tab'] . '_edit_history_data WHERE edit_id=%d', array($row['id']));
if (isset($details['id'])) {
$action = $details['id'] == 'DELETED' ? __('Deleted') : __('Restored');
} else {
$action = __('Edited');
$action = '<a ' . Utils_TooltipCommon::tooltip_leightbox_mode() . ' ' . Utils_TooltipCommon::ajax_open_tag_attrs(array('Utils_RecordBrowserCommon', 'get_edit_details_label'), array($row['tab'], $row['r_id'], $row['id']), 500) . '>' . $action . '</a>';
}
$r_id = $row['r_id'];
break;
case 'create':
$action = __('Created');
$r_id = $row['r_id'];
break;
case 'file':
$action = __('Attachment') . ': ';
$action .= $row['id'] == 0 ? __('New') : __('Updated');
$id = explode('/', $row['r_id']);
$row['tab'] = $id[0];
$r_id = $id[1];
break;
case 'note':
$action = __('Note') . ': ';
$action .= $row['id'] == 0 ? __('New') : __('Updated');
$id = explode('/', $row['r_id']);
$row['tab'] = $id[0];
$r_id = $id[1];
break;
}
if (!Utils_RecordBrowserCommon::get_access($row['tab'], 'view', Utils_RecordBrowserCommon::get_record($row['tab'], $r_id))) {
$link = __('Access restricted');
$action = strip_tags($action);
} else {
$link = Utils_TooltipCommon::create('<img src="' . Base_ThemeCommon::get_template_file('Utils_RecordBrowser', 'info.png') . '">', Utils_RecordBrowserCommon::get_html_record_info($row['tab'], $r_id), false);
$link .= ' ';
$link .= Utils_RecordBrowserCommon::create_default_linked_label($row['tab'], $r_id, false, false);
}
$gb->add_row(Base_RegionalSettingsCommon::time2reg($row['edited_on']), $user, $rb_tabs[$row['tab']], $link, $action);
}
}
Base_ThemeCommon::load_css('Utils_RecordBrowser', 'changes_list');
$this->display_module($gb);
}