本文整理汇总了PHP中View::set_global方法的典型用法代码示例。如果您正苦于以下问题:PHP View::set_global方法的具体用法?PHP View::set_global怎么用?PHP View::set_global使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::set_global方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
$main_view = new View('main');
$main_view->set_global('username', $this->username);
$main_view->set_global('role_id', $this->role_id);
$main_view->render(TRUE);
}
示例2: _setLayoutVars
protected function _setLayoutVars()
{
$this->layout->set('months', $this->_getMonths());
$this->layout->set('days', $this->_getDays());
$this->layout->set_global('active_month', "{$this->_year}/{$this->_month}");
$this->layout->set_global('active_day', $this->_day);
$this->layout->set_global('active_report', "{$this->_day}.php");
$this->layout->set_global('log_level', $this->_level);
}
示例3: action_register
public function action_register()
{
$employee = \Model_Employee::query()->where(['user_id' => \Auth::get_user()->id, 'seller_id' => \Session::get('seller')->id])->get_one();
$store = false;
if ($employee) {
$store = \Model_Store::query()->where(['seller_id' => \Session::get('seller')->id, 'manager_id' => $employee->id])->get_one();
}
$create_flag = false;
if (\Input::method() == 'POST') {
$data = \Input::post();
if (!$employee) {
$employee = \Model_Employee::forge();
}
$employee->set(['user_id' => \Auth::get_user()->id, 'seller_id' => \Session::get('seller')->id, 'no' => time(), 'work_tel' => $data['work_tel'], 'work_phone' => $data['work_phone']]);
if ($employee->save()) {
if (!$store) {
$create_flag = true;
$store = \Model_Store::forge();
}
$store->set(['manager_id' => $employee->id, 'seller_id' => \Session::get('seller')->id, 'no' => time(), 'name' => $data['name'], 'tel' => $data['tel'], 'phone' => $data['phone']]);
if ($store->save()) {
if ($create_flag) {
//发送发货模板消息
$params = ['first' => ['value' => '您推荐的一个会员已成功申请店铺!', 'color' => '#D02090'], 'keyword1' => ['value' => \Auth::get_user()->username, 'color' => '#D02090'], 'keyword2' => ['value' => $data['work_phone'], 'color' => '#D02090'], 'keyword3' => ['value' => date('Y年m月d日 H时i分s秒'), 'color' => '#D02090'], 'remark' => ['value' => '', 'color' => '#D02090']];
$this->sendMsgTemplate('x8ykw2fHARq6QYKFWUJZjU3M6beYxoimtKJNWQWF4XQ', $params, 'http://ticket.wangxiaolei.cn');
}
}
}
}
$params = ['employee' => $employee, 'store' => $store, 'people' => \Model_People::query()->where('parent_id', \Auth::get_user()->id)->get_one()];
\View::set_global($params);
$this->template->content = \View::forge("{$this->theme}/register");
}
示例4: __construct
public function __construct($request, $response)
{
$this->info = new AdminInfo();
$this->translator = FrontHelper::getTranslation();
View::set_global('translator', $this->translator);
parent::__construct($request, $response);
}
示例5: before
public function before()
{
if (!User::current()) {
$this->redirect('/login');
}
$url = str_replace('.', '_', URL::base() . $this->request->uri());
if (isset($_GET[$url])) {
unset($_GET[$url]);
}
if (isset($_GET[$url . '/'])) {
unset($_GET[$url . '/']);
}
if (Group::current('is_admin') || Group::current('show_all_jobs') && Group::current('allow_finance')) {
Pager::$counts[] = 2500;
}
if (Arr::get($_GET, 'limit') && in_array($_GET['limit'], Pager::$counts)) {
DB::update('users')->set(array('list_items' => intval($_GET['limit'])))->where('id', '=', User::current('id'))->execute();
die(json_encode(array('success' => 'true')));
}
if (Arr::get($_GET, 'dismiss')) {
DB::delete('notifications')->where('user_id', '=', User::current('id'))->and_where('id', '=', intval($_GET['dismiss']))->execute();
die(json_encode(array('success' => 'true')));
}
if (!Group::current('allow_assign')) {
Enums::$statuses[Enums::STATUS_UNALLOC] = 'Not active';
}
View::set_global('notifications', DB::select()->from('notifications')->where('user_id', '=', User::current('id'))->order_by('id', 'desc')->execute());
}
示例6: before
public function before()
{
parent::before();
//Visits
$visited = \Cookie::get('visited', false);
if (!$visited) {
\Dashboard::log_visitor();
\Cookie::set("visited", true, time() + 86400);
}
// Cart
\Config::load('cart', true);
$cartManager = new \Cart\Manager(\Config::get('cart'));
\CartManager::init($cartManager);
\CartManager::context('Cart');
// Set Visitors group default
\Product\Model_Attribute::set_user_group(3);
\Theme::instance()->active('frontend');
\Theme::instance()->set_template($this->template);
// Set a global variable so views can use it
$seo = array('meta_title' => '', 'meta_description' => '', 'meta_keywords' => '', 'canonical_links' => '', 'meta_robots_index' => 1, 'meta_robots_follow' => 1);
\View::set_global('seo', $seo, false);
\View::set_global('theme', \Theme::instance(), false);
\View::set_global('logged', $this->check_logged(), false);
\View::set_global('guest', $this->check_guest(), false);
\View::set_global('logged_type', $this->check_logged_type(), false);
}
示例7: getFeatureForm
public function getFeatureForm()
{
$feature = Input::instance()->post('Feature');
if ($feature['ftr_package_id'] != 0) {
$packageobj = Doctrine::getTable('package')->find($feature['ftr_package_id']);
if ($packageobj) {
try {
if (!($package = Package_Catalog::getInstalledPackage($packageobj->name))) {
echo 'Package not ' . $packageobj->name . ' found.';
exit;
}
$formfile = $package['directory'] . '/views/' . $packageobj->name . '/' . $feature['ftr_name'] . '.php';
if (!file_exists($formfile)) {
exit;
} else {
$featureFormView = new View($packageobj->name . '/' . $feature['ftr_name']);
$featureFormView->set_global('Feature', (object) $feature);
echo $featureFormView->render(TRUE);
}
} catch (Package_Catalog_Exception $e) {
echo 'Package not ' . $packageobj->name . ' found.';
}
}
}
exit;
}
示例8: before
public function before()
{
parent::before();
// if user not connected and not on the login, 404 or session_up pages then redirect to login page
if (Request::active()->action != 'login' && !Sentry::check() && Request::active()->action != '404' && Request::active()->action != 'session_up') {
Session::set(array('redirect' => Request::active()->route->translation));
Response::redirect('login');
}
$this->current_user = self::current_user();
View::set_global('current_user', self::current_user());
if (Sentry::check()) {
// logout if banned
if (Sentry::attempts($this->current_user->username)->get() == Sentry::attempts()->get_limit()) {
Session::set_flash('Your account has been blocked');
Sentry::logout();
Response::redirect('login');
}
}
View::set_global('site_title', 'IKON Backend');
View::set_global('separator', '/');
foreach (Model_Forms::find('all') as $k => $form) {
$this->tables[$k]['cleanName'] = $form->cleanName;
$this->tables[$k]['url'] = $form->url;
$this->tables[$k]['table'] = $form->table;
}
View::set_global('tables', $this->tables);
}
示例9: template_set_global_vars
protected function template_set_global_vars()
{
parent::template_set_global_vars();
if ($this->request->current()->is_initial()) {
View::set_global('MAIN_SITE', $this->site_main());
}
}
示例10: action_index
/**
* The index action
*
* @access public
* @return void
*/
public function action_index()
{
$settings = \Config::load('autoresponder.db');
// $autoResponder = Model_Setting::find(array('where' => array(array('meta_key', '=', 'auto-responders'))));
if (\Input::post()) {
$input = \Input::post();
if (!\Input::is_ajax()) {
$val = Model_Setting::validate('create');
if (!$val->run()) {
if ($val->error() != array()) {
// show validation errors
\Messages::error('<strong>There was an error while trying to create settings</strong>');
foreach ($val->error() as $e) {
\Messages::error($e->get_message());
}
}
} else {
try {
\Config::save('autoresponder.db', array('logo_url' => $input['logo_url'], 'company_name' => $input['company_name'], 'address' => $input['address'], 'website' => $input['website'], 'phone' => $input['phone'], 'email_address' => $input['email_address'], 'sender_email_address' => $input['sender_email_address'], 'contact_us_email_address' => $input['contact_us_email_address'], 'instagram_account_name' => $input['instagram_account_name'], 'facebook_account_name' => $input['facebook_account_name']));
// $setting->save();
\Messages::success('Settings successfully created.');
\Response::redirect('admin/settings');
} catch (\Database_Exception $e) {
// show validation errors
\Messages::error('<strong>There was an error while trying to create settings.</strong>');
// Uncomment lines below to show database errors
$errors = $e->getMessage();
\Messages::error($errors);
}
}
}
}
\View::set_global('title', 'Settings');
\Theme::instance()->set_partial('content', $this->view_dir . 'index')->set('settings', $settings, false);
}
示例11: getDispositionForm
public function getDispositionForm()
{
$faxprof = Input::instance()->post('faxprofile');
$faxdisp = Doctrine::getTable('FaxDisposition')->find($faxprof['fxp_fxd_id']);
if ($faxdisp) {
$packageobj = Doctrine::getTable('package')->find($faxdisp['fxd_package_id']);
if ($packageobj) {
try {
if (!($package = Package_Catalog::getInstalledPackage($packageobj->name))) {
echo 'Package not ' . $packageobj->name . ' found.';
exit;
}
$formfile = $package['directory'] . '/views/' . $packageobj->name . '/' . $faxdisp['fxd_name'] . '.php';
kohana::Log('debug', 'Looking for view ' . $formfile);
if (file_exists($formfile)) {
$featureFormView = new View($packageobj->name . '/' . $faxdisp['fxd_name']);
kohana::Log('debug', 'View file found.');
if (isset($faxprof['fxp_id']) && !empty($faxprof['fxp_id']) && $faxprof['fxp_id'] != '') {
$faxprofobj = Doctrine::getTable('FaxProfile')->find($faxprof['fxp_id']);
} else {
$faxprofobj = new FaxProfile();
}
$featureFormView->set_global('faxprofile', $faxprofobj);
echo $featureFormView->render(TRUE);
} else {
kohana::Log('debug', 'View file not found.');
}
} catch (Package_Catalog_Exception $e) {
echo 'Package not ' . $packageobj->name . ' found.';
}
}
}
exit;
}
示例12: action_profile
public function action_profile($id = 0)
{
$params = ['title' => '用户信息面板——用户管理', 'action_name' => '用户信息面板'];
$params['people'] = \Model_People::find($id);
\View::set_global($params);
$this->template->content = \View::forge("{$this->theme}/user/profile");
}
示例13: before
public function before()
{
parent::before();
View::set_global('base', URL::base(TRUE, FALSE));
$this->__JS__ = 'public/static/template/admin/';
$this->__CSS__ = 'public/static/template/admin/';
}
示例14: action_tags
public function action_tags()
{
$widgets = array();
$tagName = urldecode($this->request->param('id'));
$materials = new Model_Material('groups');
$materialList = $materials->getMidFromTags($tagName);
if (!$materialList) {
throw new HTTP_Exception_404();
}
//Описание ингридиента
$tagUrl = $materials->str2url($tagName);
$ingridientId = $materials->getMaterialIdByUrl($tagUrl);
if ($ingridientId) {
$widgets[] = Request::factory('widgets/material/index/' . $ingridientId)->execute();
}
$this->styles = array('/css/search.css');
$old_styles = $this->template->styles;
array_unique($this->styles);
$new_styles = array_merge($this->styles, $old_styles);
$this->template->styles = $new_styles;
$this->template->title = $tagName . '';
$this->template->page_title = $tagName;
$this->template->keywords = $tagName . '' . $tagName;
$this->template->description = '' . $tagName;
$materialsString = implode('/', $materialList);
View::set_global('categoryName', '');
$widgets[] = Request::factory('widgets/catalog/index/' . $materialsString . '/tags')->execute();
$this->template->styles[] = 'css/catalog.css';
$this->template->block_center = $widgets;
}
示例15: action_view
/**
* 拍品详情
*
* @param int $id 拍品ID
*/
public function action_view($id = 0)
{
$params = ['title' => '精选拍品'];
$params['item'] = \Model_Lot::find($id);
\View::set_global($params);
$this->template->content = \View::forge("{$this->theme}/lot/view");
}