本文整理汇总了PHP中tpl::o方法的典型用法代码示例。如果您正苦于以下问题:PHP tpl::o方法的具体用法?PHP tpl::o怎么用?PHP tpl::o使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tpl
的用法示例。
在下文中一共展示了tpl::o方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Отображение списка логов
* @param string $type тип логов
* @param string $sort сортировка
* @return null
*/
protected function show($type = null, $sort = null)
{
tpl::o()->assign('curtype', $type);
$orderby = '';
if ($sort) {
$sort = explode(",", $sort);
$c = count($sort);
for ($i = 0; $i < $c; $i += 2) {
if (!$this->orderby[$sort[$i]]) {
continue;
}
$orderby .= ($orderby ? ', ' : '') . "`" . $this->orderby[$sort[$i]] . "` " . ($sort[$i + 1] ? "asc" : "desc");
}
}
if (!$orderby) {
$orderby = 'l.`time` DESC';
}
$count = db::o()->p($type)->count_rows("logs", $type ? 'type=?' : "");
list($pages, $limit) = display::o()->pages($count, config::o()->v('table_perpage'), 'switch_logs_page', 'page', 5, true);
$r = db::o()->p($type)->query('SELECT l.*, u.username, u.group, u2.username AS tusername, u2.group AS tgroup
FROM logs AS l LEFT JOIN users AS u ON u.id=l.byuid LEFT JOIN users AS u2 ON u2.id=l.touid
' . ($type ? ' WHERE l.type=?' : "") . '
' . ($orderby ? ' ORDER BY ' . $orderby : "") . '
' . ($limit ? ' LIMIT ' . $limit : ""));
tpl::o()->assign('res', db::o()->fetch2array($r));
tpl::o()->assign('log_types', $this->types);
tpl::o()->assign('pages', $pages);
tpl::o()->display('admin/logs/index.tpl');
}
示例2: show
/**
* Отображение списка обратной связи
* @param string $sort сортировка
* @param string $type тип
* @return null
*/
protected function show($sort = null, $type = '')
{
$orderby = '';
if ($sort) {
$sort = explode(",", $sort);
$c = count($sort);
for ($i = 0; $i < $c; $i += 2) {
if (!$this->orderby[$sort[$i]]) {
continue;
}
$orderby .= ($orderby ? ', ' : '') . "`" . $this->orderby[$sort[$i]] . "` " . ($sort[$i + 1] ? "asc" : "desc");
}
}
if (!$orderby) {
$orderby = 'f.`time` DESC';
}
$where = $type ? 'f.type=?' : "";
$count = db::o()->p($type)->as_table('f')->count_rows("feedback", $where);
list($pages, $limit) = display::o()->pages($count, config::o()->v('table_perpage'), 'switch_feedback_page', 'page', 5, true);
$r = db::o()->p($type)->query('SELECT f.*, u.username, u.group
FROM feedback AS f LEFT JOIN users AS u ON u.id=f.uid
' . ($where ? ' WHERE ' . $where : "") . '
' . ($orderby ? ' ORDER BY ' . $orderby : "") . '
' . ($limit ? ' LIMIT ' . $limit : ""));
tpl::o()->assign('res', db::o()->fetch2array($r));
tpl::o()->assign('pages', $pages);
tpl::o()->assign('type', $type);
tpl::o()->display('admin/feedback/index.tpl');
}
示例3: show
/**
* Функция отображения доп. полей
* @return null
*/
protected function show()
{
$r = db::o()->query('SELECT * FROM users_fields');
tpl::o()->assign('res', db::o()->fetch2array($r));
tpl::o()->register_modifier('cut_type_descr', array($this, 'cut_type_descr'));
tpl::o()->display('admin/userfields/index.tpl');
}
示例4: show_online
/**
* Вывод списка online-пользователей
* @return null
*/
public function show_online()
{
$i = (int) config::o()->v('online_interval');
if (!$i) {
$i = 15;
}
$time = time() - $i;
$res = db::o()->p($time)->query('SELECT userdata FROM sessions
WHERE time > ? GROUP BY IF(uid>0,uid,ip)');
$res = db::o()->fetch2array($res);
tpl::o()->assign("res", $res);
$c = count($res);
$mo = stats::o()->read("max_online");
if (!intval($mo) || $mo < $c) {
$mo = $c;
stats::o()->write("max_online", $c);
stats::o()->write("max_online_time", time());
}
$mot = stats::o()->read("max_online_time");
tpl::o()->assign("record_total", $mo);
tpl::o()->assign("record_time", $mot);
/* @var $user user */
$user = plugins::o()->get_module("user");
lang::o()->get("profile");
tpl::o()->register_modifier("gau", array($user, "get_age"));
tpl::o()->assign("bdl", $this->bd_list());
tpl::o()->display("blocks/contents/online.tpl");
}
示例5: show
/**
* Функция отображения типов файлов
* @return null
*/
protected function show()
{
$r = db::o()->query('SELECT * FROM allowed_ft');
tpl::o()->assign('res', db::o()->fetch2array($r));
tpl::o()->register_modifier('aftbasic', array($this, 'is_basic'));
tpl::o()->display('admin/allowedft/index.tpl');
}
示例6: edit
/**
* Редактирование пользователя
* @param int $id ID пользователя
* @return null
*/
protected function edit($id)
{
$id = (int) $id;
lang::o()->get("registration");
lang::o()->get("usercp");
lang::o()->get('admin/groups');
/* @var $etc etc */
$etc = n("etc");
users::o()->set_tmpvars($etc->select_user($id));
if (users::o()->v('confirmed') != 3) {
tpl::o()->assign('unco', true);
}
tpl::o()->assign('inusercp', true);
/* @var $usercp usercp */
$usercp = plugins::o()->get_module('usercp');
/* @var $groups groups_man */
$groups = plugins::o()->get_module('groups', 1);
ob_start();
$group = users::o()->get_group(users::o()->v('old_group') ? users::o()->v('old_group') : users::o()->v('group'));
users::o()->alter_perms($group);
$groups->add($group, false, true);
$c = ob_get_contents();
ob_end_clean();
tpl::o()->assign('perms', $c);
$usercp->show_index();
users::o()->remove_tmpvars();
}
示例7: add
/**
* Добавление/редактирование бота
* @param int $id ID бота
* @return null
*/
protected function add($id = null)
{
$id = (int) $id;
if ($id) {
$r = db::o()->p($id)->query('SELECT * FROM bots WHERE id=? LIMIT 1');
tpl::o()->assign("row", db::o()->fetch_assoc($r));
}
tpl::o()->assign("id", $id);
tpl::o()->display('admin/bots/add.tpl');
}
示例8: init
/**
* Инициализация чата
* @return null
*/
public function init()
{
if (!users::o()->perm('chat')) {
return;
}
if (!config::o()->mstate('chat')) {
return;
}
lang::o()->get("blocks/chat");
tpl::o()->display('chat/index.tpl');
}
示例9: users_init
/**
* Инициализация юзерей
* @return null
*/
function users_init()
{
users::o()->init();
if (!defined("DELAYED_SINIT")) {
users::o()->write_session();
}
tpl::o()->assign('groups', users::o()->get_group());
tpl::o()->assign('curlang', users::o()->get_lang());
tpl::o()->assign('curtheme', users::o()->get_theme());
tpl::o()->assign('curtheme_color', users::o()->get_theme(true));
tpl::o()->assign('curuser', users::o()->v('username'));
tpl::o()->assign('curgroup', users::o()->v('group'));
}
示例10: init
/**
* Инициализация блока новостей
* @return null
*/
public function init()
{
if (!config::o()->mstate('news')) {
return;
}
lang::o()->get('news');
$l = (int) config::o()->v('news_max');
$a = db::o()->cname('news')->query('SELECT n.*, u.username, u.group FROM news AS n
LEFT JOIN users AS u ON u.id=n.poster_id
ORDER BY n.posted_time DESC' . ($l ? ' LIMIT ' . $l : ""));
tpl::o()->assign('rows', $a);
tpl::o()->display('news/index.tpl');
}
示例11: init
/**
* Инициализация блока контента
* @return null
*/
public function init()
{
lang::o()->get("content");
if (!users::o()->perm('content')) {
return;
}
/* @var $content content */
$content = plugins::o()->get_module("content");
if (!is_callable(array($content, "show"))) {
return;
}
tpl::o()->assign('content_in_block', true);
$content->show();
}
示例12: init
/**
* Стат. страницы
* @return null
*/
public function init()
{
$url = $_GET['page'];
$r = db::o()->p($url)->query('SELECT * FROM static WHERE url=? LIMIT 1');
$row = db::o()->fetch_assoc($r);
if (!$row) {
furl::o()->location('');
}
$this->title = $row['title'];
tpl::o()->assign('title', $row['title']);
tpl::o()->assign('content', $row['content']);
tpl::o()->assign('type', $row['type']);
tpl::o()->display('static.tpl');
}
示例13: init
/**
* Инициализация блока календаря
* @return null
*/
public function init()
{
$day_of_week = implode(',', array_map(array(db::o(), 'esc'), array_map('trim', explode(",", lang::o()->v('calendar_day_of_week')))));
$months = input::$months;
$monthes = array();
// lol'd
foreach ($months as $month) {
$monthes[] = db::o()->esc(lang::o()->v('month_' . $month));
}
$content = $this->count_content();
tpl::o()->assign("content_count", $content);
tpl::o()->assign('day_of_week', $day_of_week);
tpl::o()->assign("months", implode(",", $monthes));
tpl::o()->display("blocks/contents/calendar.tpl");
}
示例14: init
/**
* Инициализация блока-торрентов
* @return null
*/
public function init()
{
if (!config::o()->v('torrents_on')) {
return;
}
lang::o()->get("blocks/content");
if (!users::o()->perm('content')) {
return;
}
$curcats = $this->settings['cats'];
if (!$curcats) {
return;
}
print "Torrents block inited";
$this->get_children($curcats);
tpl::o()->assign('curcats', array_reverse($curcats));
}
示例15: add
/**
* Добавление новости
* @param int $id ID новости
* @return null
* @throws EngineException
*/
protected function add($id)
{
$id = (int) $id;
if ($id) {
$row = db::o()->p($id)->query('SELECT * FROM news WHERE id=? LIMIT 1');
$row = db::o()->fetch_assoc($row);
if ($row) {
if (users::o()->v('id') == $row['poster_id']) {
users::o()->check_perms('edit_news');
} else {
users::o()->check_perms('edit_news', '2');
}
} else {
throw new EngineException('news_are_not_exists');
}
tpl::o()->assign('row', $row);
}
tpl::o()->display('news/add.tpl');
}