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


PHP View::instance方法代码示例

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


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

示例1: getView

 public static function getView($view, $data = array())
 {
     if (self::$instance == null) {
         self::$instance = new View();
     }
     self::$instance->render($view, $data);
 }
开发者ID:alexandre-le-borgne,项目名称:-PHP-DUT-S3-Projet,代码行数:7,代码来源:View.php

示例2: p_signup

 public function p_signup()
 {
     # Check if data was entered
     if ($_POST['first_name'] == "" || $_POST['last_name'] == "" || $_POST['password'] == "") {
         # Send back to signup with appropriate error
         Router::redirect("/users/signup/Please enter all requested information");
     }
     # Check if email address is of the right form
     if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
         # Send back to signup with appropriate error
         Router::redirect("/users/signup/Please enter a valid email address");
     }
     # Check if passwords match
     if ($_POST['password'] != $_POST['password_check']) {
         # Send back to signup with appropriate error
         Router::redirect("/users/signup/Passwords do not match");
     }
     # Remove the password check from the array
     unset($_POST['password_check']);
     # Encrypt the password
     $_POST['password'] = sha1(PASSWORD_SALT . $_POST['password']);
     # More data we want stored with the user
     $_POST['created'] = Time::now();
     $_POST['modified'] = Time::now();
     $_POST['token'] = sha1(TOKEN_SALT . $_POST['email'] . Utils::generate_random_string());
     # Insert this user into the database
     $user_id = DB::instance(DB_NAME)->insert("users", $_POST);
     # Send the user to the signup success page
     $this->template->content = View::instance('v_users_signup_success');
     $this->template->title = "Success!";
     echo $this->template;
 }
开发者ID:nvarney,项目名称:dwa_prod,代码行数:32,代码来源:c_users.php

示例3: edit

 public function edit()
 {
     if (isset($_POST['update'])) {
         if ($_POST['fields_name'] == '') {
             message(App::$lang['Fields name error']);
         }
         $field['name'] = $_POST['fields_name'] != '' ? '\'' . App::$forum_db->escape($_POST['fields_name']) . '\'' : NULL;
         $field['desc'] = $_POST['fields_desc'] != '' ? '\'' . App::$forum_db->escape($_POST['fields_desc']) . '\'' : NULL;
         $field['url'] = $_POST['fields_url'] != '' ? '\'' . App::$forum_db->escape($_POST['fields_url']) . '\'' : '\'\'';
         if (!isset($_POST['fields_in_vt']) || $_POST['fields_in_vt'] != '1') {
             $field['vt'] = '0';
         } else {
             $field['vt'] = '1';
         }
         $this->_fields->set_fields_by_uid($field, $this->uid);
         if ($_POST['field'] != $_POST['fields_name']) {
             $this->_fields->change_field('users', $_POST['field'], $_POST['fields_name']);
         }
         K_Fields_Module_Cache::fields();
         App::$forum_flash->add_info(App::$lang['Fields updated']);
         redirect(forum_link(App::$forum_url['admin_fields_id'], array($this->uid)), App::$lang['Fields updated']);
     } elseif (isset($_POST['delete'])) {
         $this->_fields->delete_field($this->uid);
         K_Fields_Module_Cache::fields();
         App::$forum_flash->add_info(App::$lang['Fields removed']);
         redirect(forum_link(App::$forum_url['admin_fields'], array($this->uid)), App::$lang['Fields removed']);
     } else {
         View::$instance = View::factory(FORUM_ROOT . 'extensions/k_fields/view/field_edit', array('records' => $this->_fields->get_fields_by_uid($this->uid)));
     }
 }
开发者ID:xSTRIGx,项目名称:PunBB.Extensions,代码行数:30,代码来源:fields.php

示例4: class1

 public function class1()
 {
     $this->template->content = View::instance("v_javascript_class1");
     $client_files = array("/js/class1.js");
     $this->template->client_files = Utils::load_client_files($client_files);
     echo $this->template;
 }
开发者ID:nvarney,项目名称:dwa,代码行数:7,代码来源:c_javascriptOld.php

示例5: post_clientsList

 public function post_clientsList()
 {
     try {
         $chat = $this->orm->chat();
         $chat->select('id_chat, id_client_user, id_support_user, subject');
         $chat->select('TIMESTAMPDIFF(MINUTE, created, NOW()) AS waiting_minutes');
         $chat->select('LEFT(SEC_TO_TIME(TIMESTAMPDIFF(SECOND, created, NOW())), 5) AS waiting_time');
         $chat->where('closed IS NULL');
         $chat->and('(id_support_user IS NULL')->or('id_support_user', $_SESSION['support_user']['id_user'])->where(')');
         $supportStatus = $this->orm->param[array('name' => 'STATUS')]['value'];
         $waitingTooMuch = $this->orm->param[array('name' => 'WAITING_TOO_MUCH')]['value'];
         $clients = array();
         $userOccupied = false;
         foreach ($chat as $row) {
             $clients[] = array('id_chat' => $row['id_chat'], 'id_support_user' => $row['id_support_user'], 'subject' => $row['subject'], 'waiting_too_much' => $row['waiting_minutes'] > $waitingTooMuch, 'waiting_time' => $row['waiting_time'], 'client_user_name' => $row->client_user['name'], 'client_user_sex' => str_replace(array('M', 'F'), array('male', 'female'), $row->client_user['sex']), 'client_user_email' => $row->client_user['email']);
             if ($row['id_support_user']) {
                 $userOccupied = true;
             }
         }
         $view = View::instance();
         $view->clients = $clients;
         $view->supportStatus = $supportStatus;
         $view->userOccupied = $userOccupied;
         $view->render('partial/clients-list');
     } catch (Exception $e) {
         print '
             <tr>
                 <td colspan="6">
                     <div class="result-error">Error occurred</div>
                 </td>
             </tr>
         ';
     }
 }
开发者ID:sandroalvesperes,项目名称:chat,代码行数:34,代码来源:Support.php

示例6: p_fill_request_table

 public function p_fill_request_table($option)
 {
     //NOT USED. Old style that injects directly into the page
     # Set up view...
     $template = View::instance('v_requests_index_sub1');
     if ($option == 'all') {
         $q = 'SELECT request_id,constructName, program, date, projectSponsor, u.first_name,u.last_name
             FROM requests r
             INNER JOIN users u
             ON u.user_id = r.client_id;';
     } else {
         // only one other alternative at this point to 'all' for $option switch
         $q = 'SELECT request_id,constructName, program, date, projectSponsor, u.first_name,u.last_name
             FROM requests r
             INNER JOIN users u
             ON u.user_id = r.client_id
             where r.client_id =' . $this->user->user_id . ';';
     }
     # Run our query, store the results in the array $requests
     $requests = DB::instance(DB_NAME)->select_rows($q);
     # Pass data to the View
     $template->requests = $requests;
     # Render view...Whatever HTML we render is what JS will receive as a result of it's Ajax call
     echo $template;
 }
开发者ID:rtizard,项目名称:dwa,代码行数:25,代码来源:c_requests.php

示例7: self

 public static function &instance()
 {
     if (null === self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:hubs,项目名称:yuncms,代码行数:7,代码来源:View.php

示例8: index

 public function index()
 {
     #$this->template->content = View::instance('v_users_signup');
     $q = "SHOW TABLES";
     #$tableDump = DB::instance(DB_NAME)->select_rows($q);
     #array(3) {
     # [0]=> array(1) { ["Tables_in_rtizardc_p2_rtizard_com"]=> string(5) "posts" }
     # [1]=> array(1) { ["Tables_in_rtizardc_p2_rtizard_com"]=> string(5) "users" }
     # [2]=> array(1) { ["Tables_in_rtizardc_p2_rtizard_com"]=> string(11) "users_users" } }
     $tableDump = DB::instance(DB_NAME)->select_rows($q, "array");
     #array(3)
     #{ [0]=> array(2) { [0]=> string(5) "posts" ["Tables_in_rtizardc_p2_rtizard_com"]=> string(5) "posts" }
     #[1]=> array(2) { [0]=> string(5) "users" ["Tables_in_rtizardc_p2_rtizard_com"]=> string(5) "users" }
     #[2]=> array(2) { [0]=> string(11) "users_users" ["Tables_in_rtizardc_p2_rtizard_com"]=> string(11) "users_users" } }
     #$this->template->content = var_dump($tableDump);
     $i = 0;
     $tableArray = array();
     foreach ($tableDump as $row) {
         #echo $row[0].", ";
         $tableArray[$i] = $row[0];
         $i++;
     }
     $this->template->content = View::instance('v_data_index');
     $this->template->content->tableArray = $tableArray;
     #$this->template->content = var_dump($tableArray);
     $this->template->title = "Data";
     # Render template
     echo $this->template;
 }
开发者ID:rtizard,项目名称:dwa,代码行数:29,代码来源:c_data.php

示例9: view

 public function view()
 {
     if (FALSE === ($user_thanks = $this->thanks->get_user($this->uid))) {
         message(App::$lang_common['Bad request']);
     }
     App::$forum_page['form_action'] = forum_link(App::$forum_url['thanks_delete'], $this->uid);
     View::$instance = View::factory($this->view . 'view', array('heading' => sprintf(App::$lang['User thanks'], forum_htmlencode($user_thanks['username'])) . '&nbsp;&nbsp;<strong>' . $user_thanks['thanks'] . '</strong>'));
     $count = $this->thanks->count_by_user_id($this->uid);
     if ($count > 0) {
         App::paginate($count, App::$forum_user['disp_topics'], App::$forum_url['thanks_view'], array($this->uid));
         if (App::$forum_user['g_id'] == FORUM_ADMIN) {
             /*
              * Fix table layout described on: http://punbb.ru/post31786.html#p31786
              */
             App::$forum_loader->add_css('#brd-thanks table{table-layout:inherit;}', array('type' => 'inline'));
             $template = 'view_admin';
         } else {
             $template = 'view_user';
         }
         View::$instance->content = View::factory($this->view . $template, array('records' => $this->thanks->get_info($this->uid, App::$forum_user['g_id'], App::$forum_page['start_from'], App::$forum_page['finish_at'])));
     } else {
         View::$instance->content = View::factory($this->view . 'view_empty', array('lang' => App::$lang));
     }
     App::$forum_page['crumbs'][] = array(sprintf(App::$lang['User thanks'], forum_htmlencode($user_thanks['username'])), forum_link(App::$forum_url['thanks_view'], $this->uid));
 }
开发者ID:xSTRIGx,项目名称:PunBB.Extensions,代码行数:25,代码来源:thanks.php

示例10: getInstance

 /**
  * View Singleton Factory method.
  * 
  * @return the Singleton instance of <code>View</code>
  */
 public static function getInstance()
 {
     if (is_null(View::$instance)) {
         View::$instance = new View();
     }
     return View::$instance;
 }
开发者ID:xojunzheng,项目名称:puremvc-php-standard-framework,代码行数:12,代码来源:View.php

示例11: __construct

 public function __construct()
 {
     # Instantiate User obj
     $this->userObj = new User();
     # Authenticate / load user
     $this->user = $this->userObj->authenticate();
     # Set up templates
     $this->template = View::instance('_v_template');
     $this->email_template = View::instance('_v_email');
     # So we can use $user in views
     $this->template->set_global('user', $this->user);
     # Is this user connected to Twitter?
     if ($this->user) {
         # Ideally these constants should be in config.php but leaving here for demonstration purposes.
         define('CONSUMER_KEY', 'DaCTGU1jK93WxrZ5RKg');
         define('CONSUMER_SECRET', 'H9DS2HoWBv8PEseeg2bpQj9Ho9A0lq3GJgqEPRvfZ8');
         # Create object in user object to store twitter related data
         $this->user->twitter = new stdClass();
         # First, find out if they're already conected
         if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) {
             $this->user->twitter->connected = FALSE;
         } else {
             $this->user->twitter->connected = TRUE;
             # Get user access tokens out of the session.
             $access_token = $_SESSION['access_token'];
             # Create a TwitterOauth object with consumer/user tokens.
             $this->user->twitter->connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
         }
     }
 }
开发者ID:rebekahheacock,项目名称:dwa15-archive,代码行数:30,代码来源:c_base.php

示例12: newInstance

 public static function newInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:semul,项目名称:Osclass,代码行数:7,代码来源:View.php

示例13: executeRules

 /**
  * Description: The execution of the specified rules
  * @param       $status
  * @param       $params
  * @throws      ViewException
  * @internal    param $data
  */
 private static function executeRules($status, $params)
 {
     extract($params);
     $data = [];
     if ($status == 'on') {
         //get the params
         foreach ($on as $key => $val) {
             $data[$key] = $val;
         }
     } elseif ($status == 'off') {
         //get the params
         foreach ($off as $key => $val) {
             $data[$key] = $val;
         }
     }
     //if there is url, the redirection is performed
     if (isset($data['url'])) {
         URL::redirect($data['url'], 5);
         if ($data['stop'] === true) {
             exit;
         }
     } elseif (isset($data['view'])) {
         //if there is a view parameter, will be loaded a view file
         View::instance($data['view'])->render();
         if ($data['stop'] === true) {
             exit;
         }
     }
 }
开发者ID:sew810i9,项目名称:Simple,代码行数:36,代码来源:Identity.php

示例14: render

 public function render($print = FALSE, $renderer = FALSE)
 {
     // Give helpers an entry to this view instance
     self::$instance = $this;
     if ($this->is_set('mustache_template') or stristr($this->kohana_filename, '.mus')) {
         if (isset($this->kohana_local_data['mustache_template']) and $this->kohana_local_data['mustache_template'] === FALSE) {
             return parent::render($print, $renderer);
         }
         $mustache_data = arr::merge(self::$kohana_global_data, $this->kohana_local_data);
         if (empty($this->kohana_local_data['mustache_partials'])) {
             $mustache_partials = array();
         } else {
             $mustache_partials = $this->kohana_local_data['mustache_partials'];
             unset($mustache_data['mustache_partials']);
         }
         $mustache = new Mustache();
         $output = $mustache->render(parent::render(FALSE), $mustache_data, $mustache_partials);
         $output = str_replace(array("\n", '  '), '', $output);
         if (!empty($this->kohana_local_data['mustache_escape_apostrophes'])) {
             $output = str_replace('\'', '\\\'', $output);
         }
         if ($print === TRUE) {
             // Display the output
             echo $output;
             return;
         }
         return $output;
     } else {
         return parent::render($print, $renderer);
     }
 }
开发者ID:swk,项目名称:bluebox,代码行数:31,代码来源:Bluebox_View.php

示例15: getInstance

 /**
  * Singleton constructor
  * @return static
  */
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new static();
     }
     return self::$instance;
 }
开发者ID:sisjosex,项目名称:phpadmin,代码行数:11,代码来源:view.php


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