当前位置: 首页>>代码示例>>PHP>>正文


PHP App::view方法代码示例

本文整理汇总了PHP中App::view方法的典型用法代码示例。如果您正苦于以下问题:PHP App::view方法的具体用法?PHP App::view怎么用?PHP App::view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App的用法示例。


在下文中一共展示了App::view方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: edit

 /**
  * Создание категории
  */
 public function edit($id)
 {
     if (!User::isAdmin()) {
         App::abort('403');
     }
     if (!($category = Category::find_by_id($id))) {
         App::abort('default', 'Категория не найдена!');
     }
     if (Request::isMethod('post')) {
         $category->token = Request::input('token', true);
         $category->parent_id = Request::input('parent_id');
         $category->name = Request::input('name');
         $category->slug = Request::input('slug');
         $category->description = Request::input('description');
         $category->sort = Request::input('sort');
         if ($category->save()) {
             App::setFlash('success', 'Категория успешно изменена!');
             App::redirect('/category');
         } else {
             App::setFlash('danger', $category->getErrors());
             App::setInput($_POST);
         }
     }
     $categories = Category::getAll();
     App::view('categories.edit', compact('category', 'categories'));
 }
开发者ID:visavi,项目名称:rotorcms,代码行数:29,代码来源:CategoryController.php

示例2: abort

 /**
  * Метод вывода страницы с ошибками
  * @param  integer $code    код ошибки
  * @param  string  $message текст ошибки
  * @return string  сформированная страница с ошибкой
  */
 public static function abort($code, $message = '')
 {
     if ($code == 403) {
         header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
     }
     if ($code == 404) {
         header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
     }
     exit(App::view('errors.' . $code, compact('message')));
 }
开发者ID:visavi,项目名称:rotorcms,代码行数:16,代码来源:App.php

示例3: display

 /**
  * Handles exception/error and display them in a beautiful way
  *
  * @param array $trace
  */
 private function display(array $trace)
 {
     ob_end_clean();
     ob_start();
     $this->code = self::trace($this->line, $this->file);
     include 'templates/header.php';
     include 'templates/content.php';
     if (!empty($trace)) {
         foreach ($trace as $e) {
             $e = (object) $e;
             $this->message = '';
             $this->file = $e->file;
             $this->line = $e->line;
             $this->code = $this->trace($this->line, $this->file);
             $this->counter++;
             include 'templates/content.php';
         }
     }
     include 'templates/footer.php';
     ob_end_flush();
     \App::view()->setLayout(false);
     exit;
 }
开发者ID:eskrano,项目名称:mobicms,代码行数:28,代码来源:Handler.php

示例4: _m

                App::view()->errormsg = _m('Distributive inconsistency!');
            } else {
                App::view()->ok = _m('List of files corresponds to the distributive');
            }
            break;
        case 2:
            // Сканируем на соответствие ранее созданному снимку
            $scanner->scan(true);
            if (count($scanner->whiteList) == 0) {
                App::view()->errormsg = _m('Snapshot image is not created');
            } else {
                if (count($scanner->modifiedFiles) || count($scanner->missingFiles) || count($scanner->newFiles)) {
                    App::view()->modifiedFiles = $scanner->modifiedFiles;
                    App::view()->missingFiles = $scanner->missingFiles;
                    App::view()->extraFiles = $scanner->newFiles;
                    App::view()->errormsg = _m('Snapshot inconsistency');
                } else {
                    App::view()->ok = _m('All files are consistent with previously made image');
                }
            }
            break;
        case 3:
            // Создаем снимок файлов
            $scanner->snap();
            App::view()->ok = _m('Snapshot successfully created');
            break;
    }
}
App::view()->form = $form->display();
App::view()->setTemplate('scanner.php');
开发者ID:professor93,项目名称:mobicms,代码行数:30,代码来源:scanner.php

示例5: ksort

    }
    ksort($tpl_list);
    return $tpl_list;
}
$themes = getThemesList();
$act = filter_input(INPUT_GET, 'act', FILTER_SANITIZE_STRING);
$mod = filter_input(INPUT_GET, 'mod', FILTER_SANITIZE_STRING);
if ($act == 'set' && isset($themes[$mod])) {
    $theme = $themes[$mod];
    $description = '<br/><dl class="description">' . '<dt class="wide"><img src="' . $themes[$mod]['thumbinal'] . '" alt=""/></dt>' . '<dd>' . '<div class="header">' . $theme['name'] . '</div>' . (!empty($theme['author']) ? '<strong>' . _m('Author') . '</strong>: ' . htmlspecialchars($theme['author']) : '') . (!empty($theme['author_url']) ? '<br/><strong>' . _m('Site') . '</strong>: ' . htmlspecialchars($theme['author_url']) : '') . (!empty($theme['author_email']) ? '<br/><strong>Email</strong>: ' . htmlspecialchars($theme['author_email']) : '') . (!empty($theme['description']) ? '<br/><strong>' . _m('Description') . '</strong>: ' . htmlspecialchars($theme['description']) : '') . '</dd></dl>';
    $form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
    $form->title(_m('Choose Skin'))->html($description)->divider()->element('submit', 'submit', ['value' => _m('Choose'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>');
    if ($form->process() === true) {
        //        $stmt = App::db()->prepare("UPDATE `" . TP . "usr__users` SET `avatar` = ? WHERE `id` = " . App::user()->id);
        //        $stmt->execute([$image]);
        //        $stmt = null;
        //
        //        @unlink(FILES_PATH . 'users' . DS . 'avatar' . DS . Users::$data['id'] . '.jpg');
        //        @unlink(FILES_PATH . 'users' . DS . 'avatar' . DS . Users::$data['id'] . '.gif');
        //
        //        $form->continueLink = App::cfg()->sys->homeurl . 'profile/' . App::user()->id . '/option/avatar/';
        //        $form->successMessage = _d('avatar_applied');
        //        $form->confirmation = true;
        //        App::view()->hideuser = true;
    }
    App::view()->form = $form->display();
    App::view()->setTemplate('option_theme_set.php');
} else {
    App::view()->tpl_list = $themes;
    App::view()->setTemplate('option_theme.php');
}
开发者ID:professor93,项目名称:mobicms,代码行数:31,代码来源:option_theme.php

示例6: defined

 * @license     LICENSE.md (see attached file)
 *
 * @module      IP WHOIS
 * @author      Oleg (AlkatraZ) Kasyanov <dev@mobicms.net>
 * @version     v.1.0.0 2015-02-01
 */
defined('MOBICMS') or die('Error: restricted access');
$form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
$form->infoMessages = false;
$query = App::router()->getQuery();
if (isset($query[0])) {
    $form->input['ip'] = $query[0];
    $form->isSubmitted = true;
    $form->isValid = true;
}
$form->title('IP WHOIS')->element('text', 'ip', ['label' => _s('IP address'), 'required' => true])->divider()->element('submit', 'submit', ['value' => _s('Search'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>');
//TODO: разобраться с обратной ссылкой
$form->validate('ip', 'ip');
if ($form->process() === true) {
    include_once __DIR__ . '/classes/WhoisClient.php';
    include_once __DIR__ . '/classes/Whois.php';
    include_once __DIR__ . '/classes/IpTools.php';
    $result = (new Whois())->lookup($form->output['ip']);
    $whois = nl2br(implode("\n", $result['rawdata']));
    // Выделяем цветом важные параметры
    $whois = strtr($whois, ['%' => '#', 'inetnum:' => '<span style="color: #c81237"><strong>inetnum:</strong></span>', 'netname:' => '<span style="color: #c81237"><strong>netname:</strong></span>', 'country:' => '<span style="color: #c81237"><strong>country:</strong></span>', 'route:' => '<span style="color: #c81237"><strong>route:</strong></span>', 'org-name:' => '<span style="color: #c81237"><strong>org-name:</strong></span>', 'descr:' => '<span style="color: #26a51d"><strong>descr:</strong></span>', 'address:' => '<span style="color: #26a51d"><strong>address:</strong></span>']);
    $form->divider()->html('<div class="alert alert-neytral"><small>' . $whois . '</small></div>');
}
App::view()->form = $form->display();
App::view()->setTemplate('index.php');
开发者ID:professor93,项目名称:mobicms,代码行数:30,代码来源:index.php

示例7: contact

 /**
  * Обратная связь
  */
 public function contact()
 {
     $request = Request::input('request');
     if (Request::isMethod('post')) {
         $email = Request::input('email');
         $name = Request::input('name');
         $message = Request::input('message');
         $captcha = Request::input('captcha');
         $errors = [];
         if (!App::isMail($email)) {
             $errors['email'] = 'Неверный формат адреса email';
         }
         if (!$name) {
             $errors['name'] = 'Небходимо заполнить имя отправителя';
         }
         if (!$message) {
             $errors['message'] = 'Необходимо заполнить текст сообщения';
         }
         if ($captcha != $_SESSION['captcha']) {
             $errors['captcha'] = 'Неверный проверочный код';
         }
         if (!$errors) {
             $message = nl2br(e($message));
             $to = [env('SITE_EMAIL') => env('SITE_ADMIN')];
             $subject = 'Новое письмо с сайта';
             $body = App::view('mailer.contact', compact('subject', 'message', 'request'), true);
             $headers['from'] = [$email => $name];
             // Отправка письма
             App::sendMail($to, $subject, $body, $headers);
             App::setFlash('success', 'Письмо успешно отправлено!');
             App::redirect('/');
         } else {
             App::setFlash('danger', $errors);
             App::setInput($_POST);
             App::redirect('/contact');
         }
     }
     App::view('pages.contact', compact('request'));
 }
开发者ID:visavi,项目名称:rotorcms,代码行数:42,代码来源:HomeController.php

示例8: defined

<?php

/*
 * mobiCMS Content Management System (http://mobicms.net)
 *
 * For copyright and license information, please see the LICENSE.md
 * Installing the system or redistributions of files must retain the above copyright notice.
 *
 * @link        http://mobicms.net mobiCMS Project
 * @copyright   Copyright (C) mobiCMS Community
 * @license     LICENSE.md (see attached file)
 */
defined('MOBICMS') or die('Error: restricted access');
$homeUrl = App::request()->getBaseUrl();
$form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
$form->title(_s('Leave the site?'))->element('checkbox', 'clear', ['label_inline' => _s('Remove authorization from all devices')])->divider(12)->element('submit', 'submit', ['value' => '   ' . _s('Exit') . '   ', 'class' => 'btn btn-primary btn-lg btn-block'])->html('<br/><a class="btn btn-default btn-lg btn-block" href="' . $homeUrl . '/profile/' . App::user()->get()->id . '/">' . _s('Back') . '</a>');
if ($form->process() === true) {
    App::user()->logout($form->output['clear']);
    App::redirect($homeUrl);
}
App::view()->form = $form->display();
App::view()->setTemplate('login.php');
开发者ID:professor93,项目名称:mobicms,代码行数:22,代码来源:logout.php

示例9: defined

<?php

/**
 * mobiCMS Content Management System (http://mobicms.net)
 *
 * For copyright and license information, please see the LICENSE.md
 * Installing the system or redistributions of files must retain the above copyright notice.
 *
 * @link        http://mobicms.net mobiCMS Project
 * @copyright   Copyright (C) mobiCMS Community
 * @license     LICENSE.md (see attached file)
 */
defined('MOBICMS') or die('Error: restricted access');
//TODO: переделать счетчик на тех, у кого уже регистрация подтверждена
App::view()->total = App::db()->query("SELECT COUNT(*) FROM `usr__users` ")->fetchColumn();
App::view()->list = App::db()->query("\n    SELECT *\n    FROM `usr__users`\n    ORDER BY `id` ASC" . App::db()->pagination())->fetchAll();
App::view()->setTemplate('user_list.php');
开发者ID:professor93,项目名称:mobicms,代码行数:17,代码来源:index.php

示例10: reply

 /**
  * Ответ на сообщение для администрации
  */
 public function reply($id)
 {
     if (!User::isAdmin()) {
         App::abort(403);
     }
     if (!($guest = Guestbook::find_by_id($id))) {
         App::abort('default', 'Сообщение не найдено!');
     }
     if (Request::isMethod('post')) {
         $guest->scenario = 'reply';
         $guest->token = Request::input('token', true);
         $guest->reply = Request::input('text');
         if ($guest->save()) {
             App::setFlash('success', 'Ответ успешно добавлен!');
             App::redirect('/guestbook');
         } else {
             App::setFlash('danger', $guest->getErrors());
             App::setInput($_POST);
         }
     }
     App::view('guestbook.reply', compact('guest'));
 }
开发者ID:visavi,项目名称:rotorcms,代码行数:25,代码来源:GuestbookController.php

示例11: defined

<?php

/**
 * mobiCMS Content Management System (http://mobicms.net)
 *
 * For copyright and license information, please see the LICENSE.md
 * Installing the system or redistributions of files must retain the above copyright notice.
 *
 * @link        http://mobicms.net mobiCMS Project
 * @copyright   Copyright (C) mobiCMS Community
 * @license     LICENSE.md (see attached file)
 */
defined('MOBICMS') or die('Error: restricted access');
App::view()->total = App::db()->query("SELECT COUNT(*) FROM `system__sessions` WHERE `user_id` = 0 AND `timestamp`  > " . (time() - 300))->fetchColumn();
if (App::view()->total) {
    App::view()->list = App::db()->query("\n        SELECT\n            `user_id` AS `id`,\n            `timestamp` AS `last_visit`,\n            `ip`,\n            `ip_via_proxy`,\n            `user_agent`,\n            `place`,\n            `views`,\n            `movings`\n        FROM\n            `system__sessions`\n        WHERE\n            `user_id` = 0 AND `timestamp`  > " . (time() - 300) . "\n        ORDER BY\n            `views` DESC" . App::db()->pagination())->fetchAll();
}
App::view()->setTemplate('guests.php');
开发者ID:eskrano,项目名称:mobicms,代码行数:18,代码来源:guests.php

示例12: _g

        $form->successMessage = _g('Avatar is installed');
        $form->confirmation = true;
        App::view()->hideuser = true;
    }
    App::view()->form = $form->display();
    App::view()->setTemplate('avatars_set.php');
} elseif (isset($query[1], $query[2], $catalog[$query[2]]) && $query[1] == 'list') {
    // Показываем список аватаров в выбранной категории
    $avatars = glob(ROOT_PATH . 'assets' . DS . 'avatars' . DS . $query[2] . DS . '*.{gif,jpg,png}', GLOB_BRACE);
    App::view()->total = count($avatars);
    App::view()->start = App::vars()->page * App::view()->pagesize - App::view()->pagesize;
    $end = App::vars()->page * App::view()->pagesize;
    if ($end > App::view()->total) {
        $end = App::view()->total;
    }
    if (App::view()->total) {
        App::view()->list = [];
        for ($i = App::view()->start; $i < $end; $i++) {
            App::view()->list[$i] = ['image' => $homeUrl . '/assets/avatars/' . urlencode($query[2]) . '/' . basename($avatars[$i]), 'link' => App::user()->isValid() ? '../../set/' . urlencode($query[2]) . '/' . urlencode(basename($avatars[$i])) : '#'];
        }
    }
    App::view()->cat = $query[2];
    App::view()->setTemplate('avatars_list.php');
} else {
    // Показываем каталог аватаров (список категорий)
    App::view()->list = [];
    foreach ($catalog as $key => $val) {
        App::view()->list[] = ['link' => $uri . 'list/' . urlencode($key) . '/', 'name' => $val, 'count' => count(glob(ROOT_PATH . 'assets' . DS . 'avatars' . DS . $key . DS . '*.{gif,jpg,png}', GLOB_BRACE))];
    }
    App::view()->setTemplate('avatars_index.php');
}
开发者ID:eskrano,项目名称:mobicms,代码行数:31,代码来源:avatars.php

示例13: defined

<?php

/*
 * mobiCMS Content Management System (http://mobicms.net)
 *
 * For copyright and license information, please see the LICENSE.md
 * Installing the system or redistributions of files must retain the above copyright notice.
 *
 * @link        http://mobicms.net mobiCMS Project
 * @copyright   Copyright (C) mobiCMS Community
 * @license     LICENSE.md (see attached file)
 */
defined('MOBICMS') or die('Error: restricted access');
// Показываем меню настроек
App::view()->setTemplate('option.php');
开发者ID:professor93,项目名称:mobicms,代码行数:15,代码来源:option.php

示例14: getView

 /**
  * 获取视图组件对象
  *
  * @return View\View
  */
 public function getView()
 {
     empty($this->view) and $this->view = $this->app->view();
     return $this->view;
 }
开发者ID:chaoyanjie,项目名称:MonkeyPHP,代码行数:10,代码来源:Controller.php

示例15: defined

<?php

/*
 * mobiCMS Content Management System (http://mobicms.net)
 *
 * For copyright and license information, please see the LICENSE.md
 * Installing the system or redistributions of files must retain the above copyright notice.
 *
 * @link        http://mobicms.net mobiCMS Project
 * @copyright   Copyright (C) mobiCMS Community
 * @license     LICENSE.md (see attached file)
 */
defined('MOBICMS') or die('Error: restricted access');
// Построение графика репутации
$reputation = !empty(App::profile()->reputation) ? unserialize(App::profile()->reputation) : ['a' => 0, 'b' => 0, 'c' => 0, 'd' => 0, 'e' => 0];
App::view()->reputation = [];
App::view()->reputation_total = array_sum($reputation);
foreach ($reputation as $key => $val) {
    App::view()->reputation[$key] = App::view()->reputation_total ? 100 / App::view()->reputation_total * $val : 0;
}
App::view()->setTemplate('profile.php');
开发者ID:professor93,项目名称:mobicms,代码行数:21,代码来源:profile.php


注:本文中的App::view方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。