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


PHP registry::get方法代码示例

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


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

示例1: add

 public function add()
 {
     if (isset($_POST['save_user_btn'])) {
         $row = [];
         if ($_GET['id']) {
             $row['id'] = $_GET['id'];
         } else {
             $row['create_date'] = date('Y-m-d H:i:s');
         }
         $row['email'] = $_POST['email'];
         $row['user_name'] = $_POST['user_name'];
         $row['user_surname'] = $_POST['user_surname'];
         $row['user_group_id'] = $_POST['user_group_id'];
         if ($_POST['user_password']) {
             $row['user_password'] = md5($_POST['user_password']);
         }
         $this->model('backend_users')->insert($row);
         if ($_POST['user_password']) {
             $this->logOut();
             $this->auth(registry::get('user')['email'], md5($_POST['user_password']));
             registry::remove('user');
             $this->checkAuth();
         }
         header('Location: ' . SITE_DIR . 'users/');
         exit;
     }
     $this->render('user_groups', $this->model('user_groups')->getAll());
     if ($_GET['id']) {
         $this->render('user', $this->model('backend_users')->getById($_GET['id']));
     }
     $this->view('users' . DS . 'add');
 }
开发者ID:novichkovv,项目名称:tvoydom,代码行数:32,代码来源:users_controller.php

示例2: unites_ajax

 public function unites_ajax()
 {
     switch ($_REQUEST['action']) {
         case "save_taste":
             $taste = $_POST['taste'];
             $taste['id'] = $this->model('tastes')->insert($taste);
             $taste['status'] = 1;
             echo json_encode($taste);
             exit;
             break;
         case "save_unit":
             $rows = [];
             $date = date('Y-m-d H:i:s');
             for ($i = 0; $i < $_POST['quantity']; $i++) {
                 $rows[$i] = $_POST['unit'];
                 $rows[$i]['create_date'] = $date;
                 $rows[$i]['creator'] = registry::get('user')['id'];
             }
             $this->model('stock_units')->insertRows($rows);
             echo json_encode(array('status' => 1));
             exit;
             break;
         case "get_unites":
             $params = [];
             $params['table'] = 'stock_units u';
             $params['join']['tastes'] = array('as' => 't', 'on' => 't.id = u.taste_id', 'left' => true);
             $params['join']['products'] = array('as' => 'p', 'on' => 'p.id = u.product_id');
             $params['select'] = array('p.product_name', 'IF(t.taste_name, t.taste_name, " - ")', 'IF(t.expiration_date, t.expiration_date, " - ")');
             exit;
             break;
     }
 }
开发者ID:novichkovv,项目名称:tvoydom,代码行数:32,代码来源:stock_controller.php

示例3: __construct

 /**
  * Construct
  *
  * @param registry $registry
  * @param int $currency_id Current currency_id id
  */
 public function __construct($registry, $currency_id)
 {
     $this->_db = $registry->get('db');
     try {
         $statement = $this->_db->prepare('SELECT * FROM `currency`');
         $statement->execute();
     } catch (PDOException $e) {
         if ($this->db->inTransaction()) {
             $this->db->rollBack();
         }
         trigger_error($e->getMessage());
     }
     if ($statement->rowCount()) {
         foreach ($statement->fetchAll() as $currency) {
             $this->_currencies[$currency->currency_id] = array('currency_id' => $currency->currency_id, 'code' => $currency->code, 'rate' => $currency->rate, 'symbol' => $currency->symbol, 'name' => $currency->name);
             if ($currency->currency_id == $currency_id) {
                 $this->_currency_id = $currency->currency_id;
                 $this->_currency_code = $currency->code;
                 $this->_currency_rate = $currency->rate;
                 $this->_currency_name = $currency->name;
                 $this->_currency_symbol = $currency->symbol;
             }
         }
     }
 }
开发者ID:rmcdermott,项目名称:bitsybay,代码行数:31,代码来源:currency.php

示例4: render

 protected function render($key, $value)
 {
     $common_vars = registry::get('common_vars');
     if (!$common_vars) {
         $common_vars = [];
     }
     $common_vars[$key] = $value;
     registry::set('common_vars', $common_vars);
 }
开发者ID:novichkovv,项目名称:tvoydom,代码行数:9,代码来源:common_controller.php

示例5: savePositions

 public function savePositions($positions)
 {
     $stm = $this->pdo->prepare('
     UPDATE modules_user_groups_relations SET x_position = :x_position, y_position = :y_position WHERE module_id = :module_id AND user_group_id = :user_group_id
     ');
     foreach ($positions as $module_id => $data) {
         $data['module_id'] = $module_id;
         $data['user_group_id'] = registry::get('user')['user_group_id'];
         $stm->execute($data);
     }
 }
开发者ID:novichkovv,项目名称:bartender,代码行数:11,代码来源:modules_model.php

示例6: model

 /**
  * @param string $model
  * @param null/string $table
  * @param null/string $db
  * @param null/string $user
  * @param null/string $password
  * @return model
  */
 protected function model($model, $table = null, $db = null, $user = null, $password = null)
 {
     $models = registry::get('models');
     if (!($m = $models[$model][$table])) {
         $model_file = ROOT_DIR . 'models' . DS . $model . '_model.php';
         if (file_exists($model_file)) {
             $model_class = $model . '_model';
             $m = new $model_class($table ? $table : $model, $db, $user, $password);
         } else {
             $m = new default_model($model);
         }
         $models[$model][$table] = $m;
         registry::remove('models');
         registry::set('models', $models);
     }
     return $m;
 }
开发者ID:novichkovv,项目名称:newddetox,代码行数:25,代码来源:base.php

示例7: catcher

 public function catcher($category)
 {
     $this->render('categories', $this->model('categories')->getCategories());
     $active_category = $this->model('categories')->getByField('category_key', $category);
     if ($active_category) {
         $limit = 10;
         $count = $this->model('products')->countCategoryProducts($active_category['id']);
         $count_pages = ceil($count / $limit);
         if ($_GET['page'] > 1 && is_numeric($_GET['page'])) {
             $lim = $limit . ', ' . ($count_pages * $limit > $count ? $count_pages * $limit : $count);
         } else {
             $lim = $limit;
         }
         $pages = [];
         for ($i = 1; $i <= $count_pages; $i++) {
             $params = $_GET;
             $params['page'] = $i;
             $url = SITE_DIR . registry::get('route') . '?' . http_build_query($params);
             $pages[$i] = $url;
         }
         $this->render('pages', $pages);
         if (isset($_GET['order'])) {
             switch ($_GET['order']) {
                 case "name":
                     $order = 'p.product_name' . (isset($_GET['desc']) ? ' DESC' : '');
                     break;
                 case "price":
                     $order = 'p.price' . (isset($_GET['desc']) ? ' DESC' : '');
                     break;
                 case "bestseller":
                     $order = 'p.bestseller' . (!isset($_GET['desc']) ? ' DESC' : '');
                     break;
             }
         }
         $this->render('products', $this->model('products')->getCategoryProducts($active_category['id'], $order, $lim));
         $this->render('bestsellers', $this->model('products')->getCategoryBestsellers($active_category['id'], 3));
         $this->render('active_category', $active_category);
         $this->view('catalog' . DS . 'index');
     } else {
         $this->view('common' . DS . '404');
     }
 }
开发者ID:novichkovv,项目名称:tvoydom,代码行数:42,代码来源:catalog_controller.php

示例8: index_ajax

 public function index_ajax()
 {
     switch ($_REQUEST['action']) {
         case "save_password":
             if ($_POST['password'] && $_POST['password'] == $_POST['repeat_password']) {
                 $row = array('id' => registry::get('user')['id'], 'user_password' => md5($_POST['password']));
                 if ($this->model('asanatt_users')->insert($row)) {
                     echo json_encode(array('status' => 1));
                     $this->logOut();
                     $this->auth(registry::get('user')['email'], md5($_POST['password']));
                     registry::remove('user');
                     $this->checkAuth();
                 } else {
                     echo json_encode(array('status' => 2));
                 }
             }
             exit;
             break;
     }
 }
开发者ID:novichkovv,项目名称:tvoydom,代码行数:20,代码来源:settings_controller.php

示例9: getRestChartsList

 public function getRestChartsList($url)
 {
     $stm = $this->pdo->prepare('
         SELECT
             chart_name,
             url,
             icon,
             color
         FROM
             asanatt_charts c
                 JOIN
             asanatt_charts_user_groups_relations r ON r.chart_id = c.id
         WHERE
             r.user_group_id = :user_group_id
                 AND
             c.url != :url
         ORDER BY c.position
     ');
     return $this->get_all($stm, array('user_group_id' => registry::get('user')['user_group_id'], 'url' => $url));
 }
开发者ID:novichkovv,项目名称:dashboard,代码行数:20,代码来源:asanatt_charts_model.php

示例10:

                            <div class="col-md-offset-1 col-md-4">
                                <div class="form-group">
                                    <label for="language">
                                        Language
                                    </label>
                                    <select id="language" class="form-control" name="settings[1][language]">
                                        <option value="rus" <?php 
if (registry::get('language') == 'rus') {
    echo 'selected';
}
?>
>
                                            Russian
                                        </option>
                                        <option value="eng" <?php 
if (registry::get('language') == 'eng') {
    echo 'selected';
}
?>
>
                                            English
                                        </option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-offset-1 col-md-4">
                                <input type="submit" class="btn btn-lg btn-info" value="Save">
                            </div>
                        </div>
开发者ID:novichkovv,项目名称:bartender,代码行数:31,代码来源:settings.php

示例11:

<!--<a id="navbar-home-btn" href="--><?php 
//echo SITE_DIR;
?>
<!--">-->
<!--    <i class="fa fa-home"></i>-->
<!--</a>-->
<div class="navbar-right">
    <ul class="nav navbar-nav">
        <li class="dropdown user user-menu">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                <i class="fa fa-user"></i>
                <span><?php 
echo registry::get('user')['user_name'];
?>
 <?php 
echo registry::get('user')['user_surname'];
?>
 <i class="caret"></i></span>
            </a>
            <ul class="dropdown-menu dropdown-custom dropdown-menu-right">
                <li class="dropdown-header text-center">Account</li>
                <li class="divider"></li>
                <li>
                    <a data-toggle="modal" href="<?php 
echo SITE_DIR;
?>
settings/">
                        <i class="fa fa-cog fa-fw pull-right"></i>
                        Settings
                    </a>
                </li>
开发者ID:novichkovv,项目名称:fit,代码行数:31,代码来源:header.php

示例12:

<?php

$module_name = 'registration';
$module_loader =& registry::get('TModuleLoader');
$module_loader->registerClassFile('TRegistration', 'modules/' . $module_name . '/registration.class');
开发者ID:romlg,项目名称:cms36,代码行数:5,代码来源:init.php

示例13: log

 /**
  * @param mixed $value
  */
 protected function log($value)
 {
     $log = registry::get('log');
     registry::remove('log');
     $log[] = print_r($value, 1);
     registry::set('log', $log);
 }
开发者ID:novichkovv,项目名称:bartender,代码行数:10,代码来源:model.php

示例14:

                </li>
                <li<?php 
if (registry::get('route') == 'about') {
    echo ' class="active"';
}
?>
>
                    <a href="<?php 
echo SITE_DIR;
?>
about/">
                        <div class="ct-textEffect"><span data-content="Новости">О нас</span></div>
                    </a>
                </li>
                <li<?php 
if (registry::get('route') == 'contacts') {
    echo ' class="active"';
}
?>
>
                    <a href="<?php 
echo SITE_DIR;
?>
contacts/">
                        <div class="ct-textEffect"><span data-content="Новости">Контакты</span></div>
                    </a>
                </li>
<!--                <li class="dropdown"><a href="rent-now.html"><div class="ct-textEffect"><span data-content="Rent Now">Rent Now</span></div></a>-->
<!--                    <ul class="dropdown-menu">-->
<!--                        <li><a href="rent-now.html"><span>Rent Now</span></a></li>-->
<!--                        <li><a href="rent-item.html"><span>Rent Item</span></a></li>-->
开发者ID:novichkovv,项目名称:bartender,代码行数:31,代码来源:header.php

示例15: array

    protected $_objects = array();
    function set($name, &$object)
    {
        $this->_objects[$name] =& $object;
    }
    function &get($name)
    {
        return $this->_objects[$name];
    }
}
// 2. use
// First we create our database and registry objects
$db = new databaseConnection();
$registry = new registry();
// Then we add the db object to the registry
// It will now be available anywhere the registry
// is also available!
$registry->add("database", $db);
// Now we create the objet that gets our username
// and checks for admin status
$user = new username($registry);
$admin = new admin($registry);
$username = $user->getUser(12);
$isAdmin = $admin->check($username);
echo "Username: " . $username . "<br />";
//output: Username: 12
echo "Is Admin? " . $isAdmin;
//output:  is Admin? boolean answer 0 or 1
// 3. further use
$databaseObj = $registry->get("database");
$databaseObj->query("SELECT username FROM users" . " WHERE id={$userId}");
开发者ID:KB-WEB-DEVELOPMENT,项目名称:Kami_Barut_PHP_projects,代码行数:31,代码来源:registry+pattern.php


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