本文整理汇总了PHP中Tools::import方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::import方法的具体用法?PHP Tools::import怎么用?PHP Tools::import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools
的用法示例。
在下文中一共展示了Tools::import方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
//全局载入的class文件
Tools::import('Object_UserInfo');
$this->_utilMsg = $this->_getGlobalData('Util_Msg', 'object');
$this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
}
示例2: _getGlobalData
/**
* 获取全局变量,注:如果获取对象不存在,将注册对象,以后在次获取都将会是同一对象,单例模式.
* @param key $key
* @param string $type 注册全局类型,可以是object,cache(默认),room,user
* @return object,cache,string,int
*/
protected static function _getGlobalData($key, $type = 'cache')
{
$type = strtolower($type);
if (!isset(self::$_global[$type][$key])) {
//如果没有的话...
switch ($type) {
case 'object':
Tools::import($key);
self::$_global[$type][$key] = new $key();
break;
case 'room':
//房间对象 $key为数据库里的Id
self::$_global[$type][$key] = self::_includeFile(ROOMS_DIR . "/{$key}.serialize.php");
self::$_global[$type][$key] = unserialize(self::$_global[$type][$key]);
break;
case 'user':
//用户对象 $key为用户名
self::$_global[$type][$key] = self::_includeFile(USERS_DIR . "/{$key}/Info.serialize.php");
self::$_global[$type][$key] = unserialize(self::$_global[$type][$key]);
break;
default:
self::$_global[$type][$key] = self::_includeFile(CACHE_DIR . "/{$key}.cache.php");
}
}
return self::$_global[$type][$key];
}
示例3: getMail
/**
* 返回邮件列表
* @param array $limit
* @param int $type
*/
public function getMail($limit, $where)
{
$this->_loadCore('Help_Page');
$this->_loadCore('Help_SqlSearch');
$this->_modelUserMail = $this->_getGlobalData('Model_UserMail', 'object');
$helpSqlSearch = new Help_SqlSearch();
$helpSqlSearch->set_tableName($this->_modelUserMail->tName());
$helpSqlSearch->set_conditions("user_id={$this->_id}");
if ($where !== null) {
foreach ($where as $key => $value) {
$helpSqlSearch->set_conditions("{$key}='{$value}'");
}
}
$helpSqlSearch->set_orderBy('create_time desc');
$helpSqlSearch->setPageLimit($limit[0], $limit[1]);
$conditions = $helpSqlSearch->get_conditions();
$sql = $helpSqlSearch->createSql();
$dataList = $this->_modelUserMail->select($sql);
if (count($dataList)) {
Tools::import('Util_FontColor');
foreach ($dataList as &$list) {
$list['word_is_read'] = Util_FontColor::getMailRead($list['is_read']);
if ($list['href']) {
$list['title'] = "<a href='javascript:void(0)' is_read='{$list['is_read']}' url='{$list['href']}' cur_id='{$list['Id']}' onclick='readMail(\$(this))'>{$list['title']}</a>";
} else {
$list['title'] = "<a href='javascript:void(0)' is_read='{$list['is_read']}' cur_id='{$list['Id']}' onclick='readMail(\$(this))'>{$list['title']}</a>";
}
}
$helpPage = new Help_Page(array('total' => $this->_modelUserMail->findCount($conditions), 'perpage' => $limit[1]));
$pageBox = $helpPage->show();
return array('data' => $dataList, 'pageBox' => $pageBox);
} else {
return false;
}
}
示例4: __construct
public function __construct()
{
parent::__construct();
Tools::import('Model.User');
Tools::import('Util.Msg');
$this->_mUser = new Model_User();
$this->_uMsg = Util_Msg::returnInstance();
}
示例5: _checkOrderCondition
/**
* 检测是否满足点单条件
*/
private function _checkOrderCondition()
{
Tools::import('Model.User');
$user = new Model_User();
if (!$user->isSelectTable()) {
Tools::alertMsg($this->_uMsg->errorPrompt[011], Tools::url('Default', 'Index'));
}
}
示例6: _dispatch
/**
* 事件纷发
*/
private function _dispatch()
{
Tools::import($this->_account[$this->_curUnion]['class']);
$obj = new $this->_account[$this->_curUnion]['class']();
$action = $this->_curAction;
$msg = $obj->{$action}();
$this->_returnAjaxJson($msg);
}
示例7: __construct
public function __construct()
{
$this->_createView();
$this->_createUrl();
Tools::import('Model_Act');
$this->_modelAct = new Model_Act();
Tools::import('Util_Msg');
$this->_utilMsg = new Util_Msg();
$this->_loadCore('Help_SqlSearch');
$this->_helpSqlSearch = new Help_SqlSearch();
}
示例8: createAct
/**
* 生成act文件
*/
public function createAct()
{
Tools::import('Model_Act');
$modelAct = new Model_Act();
$dataList = $modelAct->findAll();
$actArr = array();
foreach ($dataList as $value) {
$actArr[$value['value']] = $value['allow'];
}
return $this->_addCache($actArr, $this->_cacheFile);
}
示例9: returnInstance
public static function returnInstance()
{
switch ($_SESSION['lang']) {
case 'en':
Tools::import('Lang.EnLanguage');
return Lang_EnLanguage::instance();
break;
case 'lv':
Tools::import('Lang.LvLanguage');
return Lang_LvLanguage::instance();
break;
case 'cn':
Tools::import('Lang.CnLanguage');
return Lang_CnLanguage::instance();
break;
default:
Tools::import('Lang.CnLanguage');
return Lang_CnLanguage::instance();
break;
}
}
示例10: actionPayLibao
/**
* 充值礼包管理
*/
public function actionPayLibao()
{
switch ($_GET['doaction']) {
case 'add':
//增加
if ($this->_isPost()) {
$_POST['ToolId'] = $_POST['Tool'];
$_POST['ToolIdName'] = $_POST['ToolName'];
$_POST['ToolIdImg'] = $_POST['ToolImg'];
unset($_POST['Tool'], $_POST['ToolName'], $_POST['ToolImg']);
$sendParams = Tools::getFilterRequestParam();
$this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object');
$this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
$this->_utilFRGInterface->setGet(array('c' => 'Card', 'a' => 'PackageAdd', 'doaction' => 'Save'));
$this->_utilFRGInterface->setPost($sendParams);
$data = $this->_utilFRGInterface->callInterface();
if ($data) {
if ($data['msgno'] == 1) {
$this->_utilMsg->showMsg($data['message'], 1, Tools::url(CONTROL, ACTION, array('zp' => self::PACKAGE, 'server_id' => $_POST['server_id'])));
} else {
$this->_utilMsg->showMsg($data['message'], -2, 2);
}
} else {
$this->_utilMsg->showMsg($data['message'], -2);
}
} else {
$this->_createServerList();
// $this->_utilFRGInterface=$this->_getGlobalData('Util_FRGInterface','object');
// $this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
// $this->_utilFRGInterface->setGet(array('c'=>'Card','a'=>'PackageAdd'));
// $data=$this->_utilFRGInterface->callInterface();
$this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object');
$this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
//初始化连接url地址
$this->_utilFRGInterface->setGet(array('c' => 'Reward', 'a' => 'Add'));
$data = $this->_utilFRGInterface->callInterface();
if ($data) {
Tools::import('Util_FRGTools');
$this->_utilFRGTools = new Util_FRGTools($data['data']['ObjData'], $data['data']['ToolData'], $data['data']['ObjProp']);
$this->_view->assign('objData', json_encode($data['data']['ObjData']));
$this->_view->assign('toolData', json_encode($data['data']['ToolData']));
$this->_view->assign('effData', json_encode($this->_utilFRGTools->get_effData()));
$this->_view->assign('systemTime', $data['data']['SYSTEM_TIME']);
}
$this->_utilMsg->createPackageNavBar();
$this->_view->set_tpl(array('body' => 'HaiDao/HaiDaoMaster/PayLibaoAdd.html'));
$this->_view->display();
}
break;
case 'edit':
//编辑
if ($this->_isPost()) {
$_POST['ToolId'] = $_POST['Tool'];
$_POST['ToolIdName'] = $_POST['ToolName'];
$_POST['ToolIdImg'] = $_POST['ToolImg'];
unset($_POST['Tool'], $_POST['ToolName'], $_POST['ToolImg']);
$sendParams = Tools::getFilterRequestParam();
$this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object');
$this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
$this->_utilFRGInterface->setGet(array('c' => 'Card', 'a' => 'PackageAdd', 'doaction' => 'Save'));
$this->_utilFRGInterface->setPost($sendParams);
$data = $this->_utilFRGInterface->callInterface();
if ($data) {
if ($data['msgno'] == 1) {
$this->_utilMsg->showMsg($data['message'], 1, Tools::url(CONTROL, ACTION, array('zp' => self::PACKAGE, 'server_id' => $_POST['server_id'])));
} else {
$this->_utilMsg->showMsg($data['message'], -2, 2);
}
} else {
$this->_utilMsg->showMsg(Tools::getLang('CONNECT_SERVER_ERROR', 'Common'), -2);
}
} else {
$this->_createServerList();
$this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object');
$this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
$this->_utilFRGInterface->setGet(array('c' => 'Card', 'a' => 'PackageAdd', 'Id' => $_GET['Id']));
$data = $this->_utilFRGInterface->callInterface();
if ($data) {
Tools::import('Util_FRGTools');
$this->_utilFrgTools = new Util_FRGTools($data['data']['ObjData'], $data['data']['ToolData'], $data['data']['ObjProp']);
$this->_view->assign('objData', json_encode($this->_utilFrgTools->get_objData()));
$this->_view->assign('toolData', json_encode($this->_utilFrgTools->get_toolData()));
$this->_view->assign('effData', json_encode($this->_utilFrgTools->get_effData()));
$this->_view->assign('data', $data['data']['Reward']);
$this->_utilFrgTools->setEditResult($data['data']['Reward']);
$dataResult = $this->_utilFrgTools->getEditResult();
$this->_view->assign('chageCond', $dataResult['chageCond']);
$this->_view->assign('chageEffect', $dataResult['chageEffect']);
$this->_view->assign('chageTool', $dataResult['chageTool']);
$this->_view->assign('num', $this->_utilFrgTools->getEditNum());
$this->_view->assign('systemTime', $data['data']['SYSTEM_TIME']);
$this->_view->assign('timesDetail', $data['data']['Reward']['TimesDetail']);
}
$this->_utilMsg->createPackageNavBar();
$this->_view->set_tpl(array('body' => 'HaiDao/HaiDaoMaster/PayLibaoEdit.html'));
$this->_view->assign('systemTime', $data['data']['SYSTEM_TIME']);
$this->_view->display();
//.........这里部分代码省略.........
示例11: __construct
<?php
Tools::import('Control_BaseGm');
class Control_Game extends BaseGm
{
private $_modelGame;
public function __construct()
{
$this->_createView();
$this->_modelGame = $this->_getGlobalData('Model_Game', 'object');
}
public function actionGameList()
{
//<<表单参数
$page = $_GET['page'];
$Id = $_GET['Id'];
$name = $_GET['name'];
$ename = $_GET['ename'];
$uwan_game_id = $_GET['uwan_game_id'];
$is_list = $_GET['is_list'];
//>>表单参数
$data = $this->_modelGame->gameList($page, $Id, $name, $ename, $uwan_game_id, $is_list);
$this->_view->assign('dataList', $data['list']);
$this->_loadCore('Help_Page');
//载入分页工具
$helpPage = new Help_Page(array('total' => $data['page']['total'], 'perpage' => $data['page']['pageSize']));
$this->_view->assign('pageBox', $helpPage->show());
$isList = array('' => '-全部-', 1 => '使用公共模块', 0 => '使用独立模板');
$this->_view->assign('is_list', $isList);
$this->_view->display();
}
示例12: __construct
public function __construct()
{
Tools::import('Object_OrderManage');
}
示例13: actionHourDetail
/**
* 按小时统计详细_ajax
*/
public function actionHourDetail()
{
Tools::import('Util_Stats');
$utilStats = new Util_Stats(Util_Stats::STATS_OPERATOR);
$key = $_POST['detail_key'];
$time = array();
$time['start'] = strtotime($_POST['start_date']);
$time['end'] = strtotime($_POST['end_date']);
$utilStats->setStatsTime($time);
$utilStats->setOperator(array('game_type_id' => $_POST['game_type_id'], 'operator' => $_POST['operator_id']));
$utilStats->setHour($key);
$dataList = $utilStats->stats();
$this->_view->assign('dataList', $dataList);
$tableTitle = $utilStats->getTableTitle($_POST['game_type_id']);
$tableTitle['time'] = $time;
$this->_view->assign('tableTitle', $tableTitle);
$this->_view->display('Stats/StatsOperator/OperatorDetail');
}
示例14: __construct
public function __construct()
{
$this->_modelRooms = $this->_getGlobalData('Model_Rooms', 'object');
Tools::import('Object_Room');
}
示例15: getUserMail
/**
* 返回用户邮件对象,单例模式
* @return Object_UserMail
*/
public function getUserMail()
{
if (!$this->_mail) {
Tools::import('Object_UserMail', 'object');
$this->_mail = $this->_includeFile(USERS_DIR . "/{$this->_userName}/Mail.serialize.php");
$this->_mail = unserialize($this->_mail);
}
return $this->_mail;
}