當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Versions::display_name方法代碼示例

本文整理匯總了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));
開發者ID:Selwyn-b,項目名稱:elefant,代碼行數:31,代碼來源:versions.php

示例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));
開發者ID:Selwyn-b,項目名稱:elefant,代碼行數:31,代碼來源:compare.php


注:本文中的Versions::display_name方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。