本文整理汇总了PHP中model::load方法的典型用法代码示例。如果您正苦于以下问题:PHP model::load方法的具体用法?PHP model::load怎么用?PHP model::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model
的用法示例。
在下文中一共展示了model::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: entry_app_feed_list
function entry_app_feed_list()
{
$feed_mod = model::load('feed');
$fields = array('feed_id', 'url', 'title', 'top_image', 'ups', 'downs', 'add_time', 'domain', 'user_id');
$feed_list = $feed_mod->select_feeds($fields, $_GET);
include TEMPLATES_PATH . 'app_feed_list.html';
}
示例2: entry_password_edit
function entry_password_edit()
{
$model = model::load('user');
$_POST['user_id'] = $this->user_id;
if (is_post() && $model->edit_password($_POST) === false) {
$this->assign['message'] = $model->message;
}
$this->display('password_edit');
}
示例3: entry_comment
function entry_comment()
{
$feed_mod = model::load('feed');
$feed_mod->init('comments');
if (is_post()) {
$feed_mod->edit($_POST);
}
$this->assign['comment'] = $feed_mod->get($_GET);
$this->display('comment_edit');
}
示例4: getPermission
/**
* Checks whether the user has the permission to perform a particular action.
*
* @param string $permission The permission to be tested
* @param integer $role_id The role for which the permission should be tested
*
* @return boolean
*/
public static function getPermission($permission, $role_id = null)
{
$role_id = $role_id === null ? $_SESSION["role_id"] : $role_id;
if ($role_id == 1) {
return true;
} else {
$model = model::load("system.permissions");
$data = $model->get(array("fields" => array("value"), "conditions" => "role_id = {$role_id} AND permission='{$permission}'"), Model::MODE_ASSOC, false, false);
return $data[0]["value"];
}
}
示例5: defaultGetPermission
public static function defaultGetPermission($permission, $role_id)
{
$role_id = $role_id === null ? $_SESSION["role_id"] : $role_id;
if ($role_id == 1) {
return true;
} else {
$model = model::load("system.permissions");
$data = $model->get(array("fields" => array("value"), "filter" => "role_id =? AND permission=?", "bind" => array($role_id, $permission)), Model::MODE_ASSOC, false, false);
return $data[0]["value"];
}
}
示例6: entry_unsubscribe
function entry_unsubscribe()
{
$node_id = intval($_REQUEST['node_id']);
if ($node_id <= 0) {
return;
}
$node_mod = model::load('node');
$node_mod->init('user_node_relation');
$res = $node_mod->delete(array('node_id' => $node_id, 'user_id' => $this->user_id));
$node_mod->delete_select_cache(array('node_id'), array('user_id' => $this->user_id), null, 5000);
echo $res;
}
示例7: entry_register
function entry_register()
{
$model = model::load('user');
if (is_post()) {
if ($model->register($_POST)) {
header('Location: /');
} else {
$this->assign['message'] = $model->message;
$this->display('message');
exit;
}
}
$this->display('register');
}
示例8: __construct
public function __construct($path = null, $value = null)
{
if ($path != null) {
$info = Model::resolvePath($path);
if ($value == "") {
$value = $info["field"];
}
$this->model = model::load($info["model"]);
$field = $this->model->getFields(array($value));
$this->setLabel($field[0]["label"]);
$this->setDescription($field[0]["description"]);
$this->setName($info["field"]);
$this->addSearchField($value);
$this->storedField = $info["field"];
}
}
示例9: getPermission
public static function getPermission($permission, $role_id = null, $user_id = null)
{
if ($role_id === null) {
$user_id = $user_id == null ? $_SESSION['user_id'] : $user_id;
$userRoleModel = model::load("auth.users_roles");
$usersRolesData = $userRoleModel->get(array("filter" => "user_id =?", "bind" => array($user_id)), Model::MODE_ASSOC, false, false);
foreach ($usersRolesData as $rolesData) {
if (User::defaultGetPermission($permission, $rolesData['role_id'])) {
//if any of the permissions for that role exists return true to calling function
return true;
}
}
//return false to calling function, if none of the permissions returns true
return false;
} else {
return User::defaultGetPermission($permission, $role_id);
}
}
示例10: __construct
function __construct()
{
$this->session = new SessionStorageDb();
$this->session->setConf(DB_HOST . ':' . DB_PORT, DB_USER, DB_PASSWORD, DB_NAME);
session_set_save_handler($this->session, true);
session_start();
if (!$_SESSION['user_id']) {
$user_mod = model::load('user');
$user_mod->check_login();
}
$this->user_id = $_SESSION['user_id'];
$this->is_admin = isset($_SESSION['is_admin']) ? 1 : 0;
$sys_model = model::load('sys_config');
$sys_config = $sys_model->make_assoc($sys_model->select_cache(array($sys_model->pkey, 'v')), 'v');
$this->assign['sys_config'] = $sys_config;
//if($sys_config['rewrite'])
// define('REWRITE',1);
}
示例11: exit
<?php
if (tp('verif') == 1) {
model::load('synthese', 'editsynthese');
if (!editsyn(tp('titrfr'), tp('titren'), tp('titrar'), tp('contfr'), tp('conten'), tp('contar'), tp('id'), tp('dat'))) {
exit("0");
} else {
exit("1");
}
} else {
view::load('synthese', 'editsynthese');
}
示例12: DateTime
<?php
if (tp('verif') == 1) {
global $db;
//Check if id corespond nom
$datedebut = new DateTime(tp('date_debut'));
$datefin = new DateTime(tp('date_fin'));
if ($datedebut >= $datefin) {
exit("0");
}
model::load('recette', 'editlocation');
if (!editlocation(tp('id'), tp('nom'), tp('adresse'), tp('pjid'), tp('tel'), tp('email'), tp('villa'), tp('date_debut'), tp('date_fin'), tp('type_paiement'), tp('montant_location'), tp('agarantie_location'))) {
exit("1");
} else {
exit("2");
}
} else {
view::load('recette', 'editlocation');
}
示例13: session_autoclosed
public static function session_autoclosed()
{
global $db;
if (isset($_SESSION['ssid'])) {
$ssid = $_SESSION['ssid'];
$expired = $db->QuerySingleValue0("select expir from session where id='{$ssid}'");
if ($expired != NULL) {
Cookie::close_session_open();
model::load('login', 'login');
//Stop session
stop_session();
token::delimda();
$msg = "Vous êtes déconnecté automatiquement pour inactivité de 5 min {$expired} {$ssid} , redirection vers page login.... ";
exit(msgbox($msg, 0, './', 5));
}
}
}
示例14: tp
<?php
if (isset($_POST['verif']) && $_POST['verif'] == 1) {
//verif si il y a une image.
if (tp('photoid') != '') {
$img = tp('photoid');
} else {
$img = '';
}
model::load('page', 'editpage');
if (!editpage(tp('titrfr'), tp('titren'), tp('titrar'), tp('contfr'), tp('conten'), tp('contar'), tp('parent'), $img, tp('id'), tp('titrimgfr'), tp('titrimgar'), tp('ximg'), tp('yimg'))) {
exit("0");
} else {
exit("1");
}
} else {
view::load('page', 'editpage');
}
示例15: array
$router = false;
$fields = array();
if ($model = model::load(array('self' => array('reference' => $reference)), $route, $router)) {
$fields = $router->runner->backend_context['model']['fields'];
}
if (!$model && $parent !== false) {
if ($prev !== false && ($router->runner->model_context['orderBy'] === \Routerunner\Routerunner::BY_TREE || $router->runner->model_context['orderBy'] === \Routerunner\Routerunner::BY_TREE_DESC)) {
$SQL_SP = 'CALL `{PREFIX}tree_insert`(?, ?, ?, ?)';
\db::query($SQL_SP, array($reference, $parent, $prev, $lang));
} elseif ($order_no !== false && ($router->runner->model_context['orderBy'] === \Routerunner\Routerunner::BY_INDEX || $router->runner->model_context['orderBy'] === \Routerunner\Routerunner::BY_INDEX_DESC)) {
$SQL_SP = 'CALL `{PREFIX}order_insert`(?, ?, ?, ?)';
\db::query($SQL_SP, array($reference, $parent, $order_no, $lang));
}
$router = false;
\Routerunner\Routerunner::$static->config('mode', 'blank');
if ($model = model::load(array('self' => array('reference' => $reference)), $route, $router, true)) {
$fields = $router->runner->backend_context['model']['fields'];
}
\Routerunner\Routerunner::$static->config('mode', 'cms');
}
$SQL = <<<SQL
SELECT models.model_class, models.table_from, models.table_id FROM `{PREFIX}models` AS models
WHERE models.reference = :reference
SQL;
$update = array();
if ($result = \db::query($SQL, array(':reference' => $reference))) {
$model_data = array_shift($result);
$pk = false;
if (is_array($change)) {
$SQL = <<<SQL