本文整理汇总了PHP中Versions::display_name方法的典型用法代码示例。如果您正苦于以下问题:PHP Versions::display_name方法的具体用法?PHP Versions::display_name怎么用?PHP Versions::display_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Versions
的用法示例。
在下文中一共展示了Versions::display_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$obj = new $class($_GET['id']);
if ($obj->error) {
// deleted item
$obj->{$obj->key} = $_GET['id'];
$deleted = true;
}
} else {
$obj = $class;
}
$history = Versions::history($obj, $limit, $offset);
$count = Versions::history($obj, true);
} else {
$history = array();
$count = 0;
}
function admin_filter_user_name($id)
{
$u = new User($id);
if ($u->error) {
return __('Nobody');
}
return $u->name;
}
$name = Versions::display_name($_GET['type']);
$plural = Versions::plural_name($_GET['type']);
if (!empty($_GET['id'])) {
$page->title .= __('Versions of') . ' ' . Template::sanitize(__($name)) . ' / ' . Template::sanitize($_GET['id']);
} else {
$page->title = __('Versions') . ' - ' . Template::sanitize(__($plural));
}
echo $tpl->render('admin/versions', array('id' => !empty($_GET['id']) ? $_GET['id'] : false, 'type' => $_GET['type'], 'name' => $name, 'plural' => $plural, 'classes' => $classes, 'history' => $history, 'limit' => $limit, 'total' => $count, 'count' => count($history), 'url' => sprintf('/admin/versions?type=%s&id=%s&offset=%%d', $_GET['type'], $_GET['id']), 'deleted' => $deleted));
示例2: Versions
if (!isset($_GET['current'])) {
$this->redirect('/admin');
}
if (!in_array($_GET['current'], array('yes', 'no'))) {
$this->redirect('/admin');
}
$is_current = $_GET['current'] === 'yes' ? true : false;
$is_deleted = false;
$ver = new Versions($_GET['id']);
$old = $ver->restore();
$class = $ver->class;
$cur = new $class($ver->pkey);
if ($cur->error) {
// deleted item
$is_deleted = true;
foreach (json_decode($ver->serialized) as $key => $value) {
$cur->{$key} = $value;
}
}
$diff = Versions::diff($old, $cur);
$data = array();
$cur_orig = (array) $cur->orig();
$old_orig = (array) $old->orig();
foreach ($cur_orig as $key => $value) {
$data[$key] = array('cur' => $value, 'old' => $old_orig[$key], 'diff' => in_array($key, $diff) ? true : false);
}
if (is_subclass_of($cur, 'ExtendedModel')) {
unset($data[$cur->_extended_field]);
}
$page->title = __('Comparing') . ' ' . Template::sanitize(__(Versions::display_name($ver->class))) . ' / ' . $ver->pkey;
echo $tpl->render('admin/compare', array('fields' => $data, 'class' => $ver->class, 'pkey' => $ver->pkey, 'ts' => $ver->ts, 'is_current' => $is_current, 'is_deleted' => $is_deleted));