本文整理汇总了PHP中hg_get_date函数的典型用法代码示例。如果您正苦于以下问题:PHP hg_get_date函数的具体用法?PHP hg_get_date怎么用?PHP hg_get_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hg_get_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public function show()
{
$modules = array();
$sql = 'SELECT n.*, a.host AS ahost, a.dir AS adir, a.name AS aname FROM ' . DB_PREFIX . 'node n LEFT JOIN ' . DB_PREFIX . 'applications a ON n.application_id = a.id ORDER BY order_id ASC';
$q = $this->db->query($sql);
while ($row = $this->db->fetch_array($q)) {
$row['create_time'] = hg_get_date($row['create_time']);
if (!$row['host']) {
$row['host'] = $row['ahost'];
}
if (!$row['dir']) {
$row['dir'] = $row['adir'];
}
$row['apifile'] = 'http://' . $row['host'] . '/' . $row['dir'] . $row['file_name'] . $row['file_type'];
$row['return_var'] = '<span title="初始化选中数据时,定义 $hg_' . $row['return_var'] . '_selected = (选中值,多个使用数组);变量">$hg_' . $row['return_var'] . '</span>';
$row['application_id'] = $row['aname'];
$modules[$row['id']] = $row;
}
$list_fields = array('id' => array('title' => 'ID', 'exper' => '$v[id]'), 'name' => array('title' => '名称', 'exper' => '$v[name]'), 'application_id' => array('title' => '所属系统', 'exper' => '$v[application_id]'), 'apifile' => array('title' => '接口文件', 'exper' => '$v[apifile]'), 'func_name' => array('title' => '方法名', 'exper' => '$v[func_name]'), 'return_var' => array('title' => '返回变量', 'exper' => '$v[return_var]'), 'create_time' => array('title' => '创建时间', 'exper' => '$v[create_time]'));
$op = array('form' => array('name' => '编辑', 'brief' => '', 'link' => '?a=form'), 'delete' => array('name' => '删除', 'brief' => '', 'attr' => ' onclick="return hg_ajax_post(this, \'删除\', 1);"', 'link' => '?a=delete'));
$batch_op = array('delete' => array('name' => '删除', 'brief' => '', 'attr' => ' onclick="return hg_ajax_batchpost(this, \'delete\', \'删除\', 1,\'\',\'\',\'ajax\');"'));
$str = 'var gBatchAction = new Array();gBatchAction[\'delete\'] = \'?a=delete\';';
hg_add_head_element('js-c', $str);
$this->tpl->addHeaderCode(hg_add_head_element('echo'));
$this->tpl->addVar('list_fields', $list_fields);
$this->tpl->addVar('op', $op);
$this->tpl->addVar('batch_op', $batch_op);
$this->tpl->addVar('close_search', true);
$this->tpl->addVar('primary_key', 'id');
$this->tpl->addVar('list', $modules);
$this->tpl->outTemplate('node');
}
示例2: show
public function show()
{
$modules = array();
$sql = 'SELECT * FROM ' . DB_PREFIX . 'source_config where 1 ORDER BY id ASC';
$q = $this->db->query($sql);
while ($row = $this->db->fetch_array($q)) {
$row['create_time'] = hg_get_date($row['create_time']);
$row['apifile'] = 'http://' . $row['host'] . '/' . $row['dir'];
$modules[$row['id']] = $row;
}
$list_fields = array('id' => array('title' => 'ID', 'exper' => '$v[id]'), 'name' => array('title' => '配置名称', 'exper' => '$v[name]'), 'apifile' => array('title' => '接口文件', 'exper' => '$v[apifile]'), 'create_time' => array('title' => '创建时间', 'exper' => '$v[create_time]'));
/*'func_name' => array('title' => '方法名', 'exper' => '$v[func_name]'),*/
$op = array('form' => array('name' => '配置', 'brief' => '', 'link' => '?a=form'), 'edit' => array('name' => '内容设置', 'brief' => '', 'link' => '?a=edit'), 'import' => array('name' => '导入', 'brief' => '', 'link' => '?a=import'), 'delete' => array('name' => '删除', 'brief' => '', 'attr' => ' onclick="return hg_ajax_post(this, \'删除\', 1);"', 'link' => '?a=delete'));
$batch_op = array('delete' => array('name' => '删除', 'brief' => '', 'attr' => ' onclick="return hg_ajax_batchpost(this, \'delete\', \'删除\', 1,\'\',\'\',\'ajax\');"'));
$str = 'var gBatchAction = new Array();gBatchAction[\'delete\'] = \'?a=delete\';';
hg_add_head_element('js-c', $str);
$this->tpl->addHeaderCode(hg_add_head_element('echo'));
$this->tpl->addVar('list_fields', $list_fields);
$this->tpl->addVar('op', $op);
$this->tpl->addVar('batch_op', $batch_op);
$this->tpl->addVar('close_search', true);
$this->tpl->addVar('primary_key', 'id');
$this->tpl->addVar('list', $modules);
$this->tpl->outTemplate('source_config');
}
示例3: show
public function show()
{
$sql = 'SELECT * FROM ' . DB_PREFIX . 'applications ORDER BY id desc';
$q = $this->db->query($sql);
$applications = array();
while ($row = $this->db->fetch_array($q)) {
$row['create_time'] = hg_get_date($row['create_time']);
$row['api'] = 'http://' . $row['host'] . '/' . $row['dir'];
$applications[$row['id']] = $row;
$applications_relate[$row['father_id']][] = $row['id'];
}
$list_fields = array('id' => array('title' => 'ID', 'exper' => '$v[id]'), 'name' => array('title' => '名称', 'exper' => '$v[name]'), 'softvar' => array('title' => '标识', 'exper' => '$v[softvar]'), 'api' => array('title' => '接口', 'exper' => '$v[api]'), 'create_time' => array('title' => '创建时间', 'exper' => '$v[create_time]'));
$op = array('form' => array('name' => '编辑', 'brief' => '', 'link' => '?a=form'), 'delete' => array('name' => '删除', 'brief' => '', 'attr' => ' onclick="return hg_ajax_post(this, \'删除\', 1);"', 'link' => '?a=delete'), 'see_module' => array('name' => '查看模块', 'brief' => '', 'link' => 'modules.php?a=show'), 'export_xml' => array('name' => '导出应用xml', 'brief' => '', 'link' => '?a=export_xml'), 'app_publish' => array('name' => '发布至应用商店', 'brief' => '', 'link' => '?a=app_publish'));
$batch_op = array('delete' => array('name' => '删除', 'brief' => '', 'attr' => ' onclick="return hg_ajax_batchpost(this, \'delete\', \'删除\', 1,\'\',\'\',\'ajax\');"'));
$str = 'var gBatchAction = new Array();gBatchAction[\'delete\'] = \'?a=delete\';';
hg_add_head_element('js-c', $str);
$this->tpl->addHeaderCode(hg_add_head_element('echo'));
$this->tpl->addVar('list_fields', $list_fields);
$this->tpl->addVar('op', $op);
$this->tpl->addVar('batch_op', $batch_op);
$this->tpl->addVar('close_search', true);
$this->tpl->addVar('primary_key', 'id');
$this->tpl->addVar('applications', $applications);
$this->tpl->addVar('applications_relate', $applications_relate);
$this->tpl->outTemplate('application');
}
示例4: show
public function show()
{
$show_server_node = array();
$server_cluster = $this->mServer_cluster;
if ($server_cluster) {
foreach ($server_cluster as $k => $v) {
$show_server_node[] = array('id' => $k, "name" => $v, "fid" => 0, "depth" => 0, 'input_k' => '_type', 'attr' => 'attr', 'is_last' => 1);
}
}
$modules = array();
$type = intval($this->input['_type']);
if ($type) {
$template = 'servers_list';
$cond = ' AND type=' . $type;
} else {
if (!$this->input['_type'] && $this->input['infrm']) {
$template = 'servers_list';
} else {
$template = 'servers';
}
}
$sql = 'SELECT * FROM ' . DB_PREFIX . 'servers WHERE 1' . $cond . ' ORDER BY id ASC';
$q = $this->db->query($sql);
while ($row = $this->db->fetch_array($q)) {
$row['create_time'] = hg_get_date($row['create_time']);
$servers[] = $row;
}
//$str = 'var gBatchAction = new Array();gBatchAction[\'delete\'] = \'?a=delete\';';
//hg_add_head_element('js-c',$str);
$this->tpl->addHeaderCode(hg_add_head_element('echo'));
$this->tpl->addVar('list_fields', $list_fields);
$this->tpl->addVar('op', $op);
$this->tpl->addVar('batch_op', $batch_op);
$this->tpl->addVar('all_m', $all_m);
$this->tpl->addVar('applications', $applications);
$this->tpl->addVar('close_search', true);
$this->tpl->addVar('primary_key', 'id');
$this->tpl->addVar('list', $servers);
$this->tpl->addVar('_selfurl', 'server.php?&infrm=1');
$this->tpl->addVar('show_server_node', $show_server_node);
$this->tpl->outTemplate($template);
}
示例5: show_notice
public function show_notice()
{
$gScriptName = SCRIPTNAME;
$n = intval($this->input['n']);
$pp = intval($this->input['pp']) ? intval($this->input['pp']) : 0;
$count = 50;
switch ($n) {
case 0:
$this->page_title = '消息';
include_once ROOT_PATH . 'lib/messages/messages.class.php';
$mMessages = new messages();
$msg_members = array();
$from_who = $mMessages->get_members($this->user['id'], '', $pp, $count);
$total = @array_shift($from_who);
//分页
$data['totalpages'] = $total;
$data['perpage'] = $count;
$data['curpage'] = $pp;
$data['onclick'] = ' onclick="javascript:document.location.href=re_back+\'?a=show_notice&pp=\'+(parseInt(this.title,10) - 1)+\'&n=0\';$(this).addClass(\'pages_current\');" ';
$showpages = hg_build_pagelinks($data);
ob_start();
include hg_load_template("user_msgs");
$html = ob_get_contents();
ob_end_clean();
break;
case 1:
$this->page_title = '通知';
include_once ROOT_PATH . 'lib/class/notify.class.php';
$mNotify = new notify();
$notice_arr = $un_notice = $notice = array();
$notice_arr = $mNotify->notify_get($this->user['id'], -1, $pp, $count);
//分页,这个通知要区分一下,已读的通知和未知的通知要分开
$notice_count = $mNotify->notify_count($this->user['id'], -1);
$total_count = $notice_count[0];
$total1 = array_sum($total_count);
$data['totalpages'] = $total1;
$data['perpage'] = $count;
$data['curpage'] = $pp;
$data['onclick'] = ' onclick="javascript:document.location.href=re_back+\'?a=show_notice&pp=\'+(parseInt(this.title,10) - 1)+\'&n=1\';$(this).addClass(\'pages_current\');" ';
$showpages = hg_build_pagelinks($data);
if ($notice_arr) {
$sp = '';
foreach ($notice_arr as $key => $n) {
if ($n['is_read'] == 0) {
if (in_array($n['type'], array(0, 1, 2, 3))) {
$un_notice[$n['type']]['idstr'] .= $sp . $n['id'];
$un_notice[$n['type']]['content'] = unserialize($n['content']);
} else {
$un_notice[$n['type']][$n['id']]['content'] = unserialize($n['content']);
$un_notice[$n['type']][$n['id']]['content']['notify_time'] = hg_get_date($n['notify_time']);
}
$a = $mNotify->notify_send_read($key, $this->user['id'], $n['type']);
//将本页未读通知插入到已读表中
$sp = ',';
} else {
if ($n['type'] > 3) {
$notice[$n['type']][$n['id']]['content'] = unserialize($n['content']);
$notice[$n['type']][$n['id']]['content']['notify_time'] = hg_get_date($n['notify_time']);
}
}
}
}
ob_start();
include hg_load_template("user_notices");
$html = ob_get_contents();
ob_end_clean();
break;
}
hg_add_head_element('js', RESOURCE_DIR . 'scripts/' . 'user.js');
include hg_load_template("user_show_n");
}
示例6: hg_build_link
{if $friends}
<ul class="status-item">
{foreach $friends as $k => $v}
<li class="clear" id="delete_{$v['id']}">
<div class="blog-content">
<div class="attention clear">
<p class="name"><a href="<?php
echo hg_build_link(SNS_UCENTER . 'user.php', array('user_id' => $v['id']));
?>
" >{$v['username']}</a>:<span><a>{$v['followers_count']}</a>粉丝</span></p>
<span style="color:gray;font-size:11px;"><?php
echo hg_get_date($v['follow_time']);
?>
</span>
</div>
<div class="close-concern">
<span style="float:left;width:18px;text-align:left;margin-right:5px;padding-right: 5px;display:block;"><a class="chat" href="javascript:void(0);" onclick="showMsgBox('<?php
echo $v['username'];
?>
','<?php
echo md5($v['id'] . $v['salt'] . $user_info['id'] . $user_info['salt']);
?>
')"> </a></span>
{if $is_my_page}
示例7: hg_get_date
,<?php
echo $this->user['id'];
?>
)"><?php
echo $this->lang['comment'];
?>
(<span id="comm_<?php
echo $value['id'];
?>
"><?php
echo $value['comment_count'];
?>
</span>)</a>
</span>
<strong><?php
echo hg_get_date($value['create_at']);
?>
</strong>
<strong class="overflow" style="max-width:230px"><?php
echo $this->lang['source'] . $value['source'];
?>
</strong>
<?php
if ($this->user['id']) {
?>
<a onclick="report_play(<?php
echo $value['id'];
?>
,<?php
echo $value['user']['id'];
?>
示例8: hg_get_date
$class = 'liBgDif';
} else {
$class = '';
}
?>
<li id="pm_<?php
echo $p_info['pid'];
?>
" class="<?php
echo $class;
?>
"><div class="eachMessage clearfix"><div class="left"><span class="user_name"><?php
echo $p_info['fromwho'];
?>
</span></div><div class="right"><?php
echo hg_get_date($p_info['stime']);
?>
</div><div style="color: rgb(125, 125, 125);" class="eachMessageCon"><?php
echo $p_info['content'];
?>
</div></div></li>
<?php
}
?>
</ul>
</div>
</div>
<div class="MBBottom">
<div class="MMessageBox">
<div class="GUserAvatar"><img src="<?php
echo $user_info['middle_avatar'];
示例9: show
public function show()
{
$count = intval($this->input['count']);
$count = $count ? $count : 20;
$extralink = '';
if ($this->input['count']) {
$extralink .= '&count=' . $this->input['count'];
}
if ($this->input['hgorder']) {
$extralink .= '&hgorder=' . $this->input['hgorder'];
}
if ($this->input['hgupdn']) {
$extralink .= '&hgupdn=' . $this->input['hgupdn'];
}
$condition = array();
if ($this->input['type']) {
$condition[] = ' type = ' . $this->input['type'];
$extralink .= '&type=' . $this->input['type'];
}
if ($this->user['group_type'] != 1) {
$condition[] = ' group_type != 1';
}
if ($condition) {
$conditions = ' WHERE ' . implode(',', $condition);
}
$page = intval($this->input['pp']);
$sql = 'SELECT count(*) AS total FROM ' . DB_PREFIX . 'log' . $conditions;
$total = $this->db->query_first($sql);
$total = intval($total['total']);
$data = array();
$data['totalpages'] = $total;
$data['perpage'] = $count;
$data['curpage'] = $page;
$data['pagelink'] = '?' . $extralink;
$pagelink = hg_build_pagelinks($data);
$sql = 'SELECT * FROM ' . DB_PREFIX . 'log' . $conditions . " ORDER BY id DESC LIMIT {$page},{$count}";
$q = $this->db->query($sql);
$admin = array();
while ($row = $this->db->fetch_array($q)) {
$row['create_time'] = hg_get_date($row['create_time']);
$admin[$row['id']] = $row;
}
$list_fields = array('id' => array('title' => 'ID', 'exper' => '$v[id]'), 'content' => array('title' => '日志', 'exper' => '$v[content]<br />$v[script_name]'), 'user_name' => array('title' => '操作人', 'exper' => '$v[user_name]'), 'ip' => array('title' => '操作IP', 'exper' => '$v[ip]'), 'create_time' => array('title' => '操作时间', 'exper' => '$v[create_time]'));
/*
'authorize' => array(
'name' =>'授权',
'brief' =>'权限管理',
'link' => '?a=sys_authorize'),
*/
$op = array('delete' => array('name' => '删除', 'brief' => '', 'attr' => ' onclick="return hg_ajax_post(this, \'删除\', 1);"', 'link' => '?a=delete'));
$batch_op = array('delete' => array('name' => '删除', 'brief' => '', 'attr' => ' onclick="return hg_ajax_batchpost(this, \'delete\', \'删除\', 1,\'\',\'\',\'ajax\');"'));
$str = 'var gBatchAction = new Array();gBatchAction[\'delete\'] = \'?a=delete\';';
hg_add_head_element('js-c', $str);
$this->tpl->addHeaderCode(hg_add_head_element('echo'));
$this->tpl->addVar('list_fields', $list_fields);
$this->tpl->addVar('pagelink', $pagelink);
$this->tpl->addVar('op', $op);
$this->tpl->addVar('batch_op', $batch_op);
$this->tpl->addVar('close_search', true);
$this->tpl->addVar('primary_key', 'id');
$this->tpl->addVar('list', $admin);
$this->tpl->outTemplate('log');
}
示例10: show
public function show()
{
//导航设置
$this->append_nav(array('name' => '权限控制', 'link' => '###'));
//查找应用下面模块
$curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']);
$curl->setSubmitType('get');
$curl->initPostData();
$curl->addRequestData('a', 'get_mod_info');
//$this->input['app_un_id'] = 'liv_mms';
if ($this->input['app_un_id']) {
$curl->addRequestData('app_en', $this->input['app_un_id']);
}
$return = $curl->request('get_app_info.php');
//file_put_contents('1.txt',var_export($return,1));
$return = $return[0];
$applications = array();
//默认模块id
$DefaultMid = urldecode($return[0]['module_en']);
$mod = urldecode($this->input['_type']);
if (is_array($return) && count($return) > 0) {
foreach ($return as $key => $val) {
foreach ($val as $k => $v) {
if ($k == 'module_en') {
$module[$v] = $val['module_name'];
if ($mod == $v) {
$this->append_nav(array('name' => $val['module_name'], 'link' => '?_type=' . $v));
}
}
if ($k == 'app_en') {
$applications[] = $val['app_name'];
}
}
}
}
$server_cluster = $module;
$show_server_node = array();
if ($server_cluster) {
foreach ($server_cluster as $k => $v) {
$show_server_node[] = array('id' => $k, "name" => $v, "fid" => 0, "depth" => 0, 'input_k' => '_type', 'attr' => 'attr', 'is_last' => 1);
}
}
$modules = array();
$kind = $this->input['kind'];
if ($mod) {
if (!$kind || $kind == 'group') {
$template = 'privilege_admin_group';
$this->append_nav(array('name' => '用户组', 'link' => '#'));
} else {
if ($kind == 'user') {
$template = 'privilege_admin_group';
$this->append_nav(array('name' => '用户', 'link' => '#'));
}
}
} else {
if (!$mod && $this->input['infrm']) {
$template = 'privilege_admin_group';
} else {
$template = 'privilege';
}
}
$this->tpl->addVar('_nav', $this->nav);
//用户组列表
if ($kind == 'group' || !$kind) {
//查询用户组信息
if ($this->user['group_type'] != 1) {
$condition = ' WHERE group_type != 1';
}
$sql = 'SELECT * FROM ' . DB_PREFIX . 'admin_group ' . $condition . ' ORDER BY id ASC';
$q = $this->db->query($sql);
$admin_group = array();
while ($row = $this->db->fetch_array($q)) {
$row['create_time'] = hg_get_date($row['create_time']);
$row['group_type'] = $this->settings['group_types'][$row['group_type']];
$admin_group[$row['id']] = $row;
}
$list_fields = array('id' => array('title' => 'ID', 'exper' => '$v[id]'), 'name' => array('title' => '用户组名称', 'exper' => '$v[name]'), 'brief' => array('title' => '描述', 'exper' => '$v[brief]'), 'group_type' => array('title' => '组类型', 'exper' => '$v[group_type]'), 'create_time' => array('title' => '创建时间', 'exper' => '$v[create_time]'));
$op = array('authorize' => array('name' => '功能授权', 'brief' => '权限管理', 'link' => '?a=sys_authorize&mod=' . $mod), 'authorize_node' => array('name' => '节点授权', 'brief' => '权限管理', 'link' => '?a=accredit_node&mod=' . $mod));
//print_r($this->nav);exit;
$str = 'var gBatchAction = new Array();gBatchAction[\'delete\'] = \'?a=delete\';';
hg_add_head_element('js-c', $str);
$this->tpl->addHeaderCode(hg_add_head_element('echo'));
$this->tpl->addVar('list_fields', $list_fields);
$this->tpl->addVar('op', $op);
$this->tpl->addVar('batch_op', $batch_op);
$this->tpl->addVar('close_search', true);
$this->tpl->addVar('primary_key', 'id');
$this->tpl->addVar('defaultmid', $DefaultMid);
$this->tpl->addVar('list', $admin_group);
$this->tpl->addVar('_selfurl', 'privilege.php?infrm=1');
$this->tpl->addVar('show_server_node', $show_server_node);
$this->tpl->outTemplate($template);
} else {
$count = intval($this->input['count']);
$count = $count ? $count : 20;
$extralink = '';
if ($this->input['count']) {
$extralink .= '&count=' . $this->input['count'];
}
if ($this->input['hgorder']) {
//.........这里部分代码省略.........
示例11: reply_comment
public function reply_comment()
{
$status_id = intval($this->input['status_id']);
$reply_id = intval($this->input['reply_id']);
$text = $this->input['text'];
$transmit_type = intval($this->input['transmit_type']);
$result = $this->mComment->reply_comment($reply_id, $status_id, $text);
if ($result && is_array($result)) {
$result['content'] = hg_verify($result['content']);
$result['comment_time'] = $result['comment_time'];
$result['create_at'] = hg_get_date($result['create_at']);
}
//同时转发到我的点滴
if ($transmit_type == 1) {
$status = new status();
$status->update($text, '点滴', $status_id);
}
$result = json_encode($result);
//echo "<pre>";
print_r($result);
}
示例12: is_array
{if is_array($value['reply'])}
<ul class="reply_list" id="rep_{$value['id']}">
{foreach $value['reply'] as $k=>$v}
<li id="com_{$v['id']}" class="clear">
<div class="comment-img"><a href="<?php
echo hg_build_link('user.php', array('user_id' => $v['user']['id']));
?>
"><img src="{$v['user']['middle_avatar']}"/></a></div>
<div class="comment-bar">
<a class="bar-left" href="<?php
echo hg_build_link('user.php', array('user_id' => $v['user']['id']));
?>
">{$v['user']['username']}</a>
<div class="bar-right">
<span><?php
echo hg_get_date($v['create_time']);
?>
</span>
{if $state != 2}
<a href="javascript:void(0);" onclick="del_comment({$v['id']},{$v['cid']},{$type});">删除</a>
{else}
<a href="javascript:void(0);" onclick="recover_comment({$v['id']},{$v['cid']},{$type});">恢复</a>
{/if}
</div>
</div>
<div class="comment-con"><?php
echo hg_show_face($value['content']);
?>
</div>
</li>
{/foreach}
示例13: show
public function show()
{
$modules_op = array();
$yesno = array(0 => '否', 1 => '是');
$this->cache->check_cache('applications');
$applications = $this->cache->cache['applications'];
$module_id = intval($this->input['id']);
if ($module_id) {
$where = ' WHERE module_id IN (0,' . $module_id . ')';
} else {
$where = ' WHERE module_id = 0';
}
$sql = 'SELECT m.*, a.host AS ahost, a.dir AS adir FROM ' . DB_PREFIX . 'modules m LEFT JOIN ' . DB_PREFIX . 'applications a ON m.application_id=a.id WHERE m.id=' . $module_id;
$modules = $this->db->query_first($sql);
if (!$modules['host']) {
$host = $modules['ahost'];
} else {
$host = $modules['host'];
}
if (!$modules['dir']) {
$dir = $modules['adir'];
} else {
$dir = $modules['dir'];
}
$sql = 'SELECT * FROM ' . DB_PREFIX . 'module_op ' . $where . ' ORDER BY order_id ASC';
$q = $this->db->query($sql);
while ($row = $this->db->fetch_array($q)) {
if (!$row['host']) {
$row['host'] = $host;
}
if (!$row['dir']) {
$row['dir'] = $dir;
}
if ($row['file_name']) {
$file_name = unserialize($row['file_name']);
if (!$file_name) {
$file_name = $row['file_name'];
} else {
$file_name = $file_name[$module_id];
}
$row['file_name'] = $file_name;
}
if ($row['template']) {
$template = unserialize($row['template']);
if (!$template) {
$template = $row['template'];
} else {
$template = $template[$module_id];
}
} else {
$template = $row['template'];
}
if (!$row['file_name']) {
if (!$row['template']) {
$row['file_name'] = $modules['file_name'] . '_update';
} else {
$row['file_name'] = $modules['file_name'];
}
}
$row['template'] = $template;
if ($row['callback']) {
$callback = unserialize($row['callback']);
if (!$callback) {
$callback = $row['callback'];
} else {
$callback = $callback[$module_id];
}
} else {
$callback = $row['callback'];
}
$row['callback'] = $callback;
if ($row['request_type']) {
$request_type = unserialize($row['request_type']);
if (!$request_type) {
$request_type = $row['request_type'];
} else {
$request_type = $request_type[$module_id];
}
} else {
$request_type = $row['request_type'];
}
$row['request_type'] = $request_type;
if ($row['direct_return']) {
$direct_return = unserialize($row['direct_return']);
if (!$direct_return) {
$direct_return = $row['direct_return'];
} else {
$direct_return = $direct_return[$module_id];
}
} else {
$direct_return = $row['direct_return'];
}
$row['direct_return'] = $direct_return;
$row['apifile'] = 'http://' . $row['host'] . '/' . $row['dir'] . $row['file_name'] . $row['file_type'];
$row['create_time'] = hg_get_date($row['create_time']);
$row['nameop'] = $row['name'] . '(' . $row['op'] . ')';
if ($template) {
$row['nameop'] .= '<br />Tpl:' . $template;
}
if ($callback) {
//.........这里部分代码省略.........
示例14: get_data
private function get_data()
{
$modules = array();
$yesno = array(0 => '否', 1 => '是');
$appid = intval($this->input['application_id']);
$appid = $appid ? $appid : intval($this->input['id']);
if ($appid) {
$cond = ' AND m.application_id=' . $appid;
}
$fatherid = intval($this->input['fatherid']);
if ($fatherid) {
$cond .= ' AND m.fatherid=' . $fatherid;
}
$sql = 'SELECT m.*, a.host AS ahost, a.dir AS adir, a.name AS aname FROM ' . DB_PREFIX . 'modules m LEFT JOIN ' . DB_PREFIX . 'applications a ON m.application_id = a.id WHERE 1' . $cond . ' ORDER BY m.order_id ASC';
$q = $this->db->query($sql);
$this->cache->check_cache('modules');
$all_modules = $this->cache->cache['modules'];
while ($row = $this->db->fetch_array($q)) {
$row['create_time'] = hg_get_date($row['create_time']);
if (!$row['host']) {
$row['host'] = $row['ahost'];
if (!$row['dir']) {
$row['dir'] = $row['adir'];
}
}
if ($row['file_name']) {
$row['apifile'] = 'http://' . $row['host'] . '/' . $row['dir'] . $row['file_name'] . $row['file_type'];
$t = array('apifile' => $row['apifile'], 'app_uniqueid' => $row['app_uniqueid'], 'mod_uniqueid' => $row['mod_uniqueid'], 'menu_pos' => $row['menu_pos']);
$modules[$row['id']] = $t;
}
}
if ($modules) {
$data = array();
foreach ($modules as $app) {
$specifytime = $this->mSettime[$app['app_uniqueid'] . '_specify'][$app['mod_uniqueid']];
$runtime = $this->mRuntime[$app['app_uniqueid']][$app['mod_uniqueid']];
if ($specifytime) {
if (!$runtime) {
$runtime = time() - 86400;
}
$nextruntime = strtotime(date('Y-m-d ' . $specifytime, $runtime)) + 86400;
if (time() < $nextruntime) {
continue;
}
} else {
$setruntime = $this->mSettime[$app['app_uniqueid']][$app['mod_uniqueid']];
if (!$setruntime) {
$setruntime = $this->mSettime['app'];
}
if (time() - $runtime < $setruntime) {
continue;
}
}
$this->mRuntime[$app['app_uniqueid']][$app['mod_uniqueid']] = time();
if ($app['app_uniqueid'] != 'news') {
//continue;
}
$condition = $this->mCondition[$app['app_uniqueid']][$app['mod_uniqueid']];
if ($condition) {
$datapara = array('a' => 'count', 'm2o_ckey' => CUSTOM_APPKEY, 'appid' => APPID, 'appkey' => APPKEY, 'access_token' => $this->input['access_token']);
foreach ($condition as $k => $c) {
$ttmp = array();
foreach ($c as $in => $val) {
$ttmp[$in] = $val;
}
$ttmp = array_merge($datapara, $ttmp);
$count = $this->curl($app['apifile'], $ttmp);
$count = $count['total'];
$data[$app['app_uniqueid']][$app['mod_uniqueid']][$k] = $count;
}
}
if ($key = $this->mState[$app['app_uniqueid']][$app['mod_uniqueid']]['key']) {
$states = $this->mState[$app['app_uniqueid']][$app['mod_uniqueid']]['state'];
$datapara = array('a' => 'count', 'm2o_ckey' => CUSTOM_APPKEY, 'appid' => APPID, 'appkey' => APPKEY, 'access_token' => $this->input['access_token']);
foreach ($states as $state) {
$datapara[$key] = $state;
$count = $this->curl($app['apifile'], $datapara);
$count = $count['total'];
$data[$app['app_uniqueid']][$app['mod_uniqueid']][$state] = $count;
}
} else {
$datapara = array('a' => 'count', 'm2o_ckey' => CUSTOM_APPKEY, 'appid' => APPID, 'appkey' => APPKEY, 'access_token' => $this->input['access_token']);
$count = $this->curl($app['apifile'], $datapara);
$count = $count['total'];
if ($count) {
$data[$app['app_uniqueid']][$app['mod_uniqueid']][0] = $count;
}
}
}
}
return $data;
}
示例15: show
public function show()
{
$modules = array();
$yesno = array(0 => '否', 1 => '是');
$appid = intval($this->input['application_id']);
$appid = $appid ? $appid : intval($this->input['id']);
if ($appid) {
$cond = ' AND m.application_id=' . $appid;
}
$fatherid = intval($this->input['fatherid']);
if ($fatherid) {
$cond .= ' AND m.fatherid=' . $fatherid;
}
$sql = 'SELECT m.*, a.host AS ahost, a.dir AS adir, a.name AS aname FROM ' . DB_PREFIX . 'modules m LEFT JOIN ' . DB_PREFIX . 'applications a ON m.application_id = a.id WHERE 1' . $cond . ' ORDER BY m.order_id ASC';
$q = $this->db->query($sql);
$this->cache->check_cache('modules');
$all_modules = $this->cache->cache['modules'];
while ($row = $this->db->fetch_array($q)) {
$row['create_time'] = hg_get_date($row['create_time']);
if (!$row['host']) {
$row['host'] = $row['ahost'];
if (!$row['dir']) {
$row['dir'] = $row['adir'];
}
}
if ($row['file_name']) {
$row['apifile'] = 'http://' . $row['host'] . '/' . $row['dir'] . $row['file_name'] . $row['file_type'];
}
$row['is_pages'] = $yesno[$row['is_pages']];
$row['application_id'] = $row['aname'];
$row['fatherid'] = $row['fatherid'] ? $all_modules[$row['fatherid']]['name'] : '无';
$modules[$row['id']] = $row;
}
$list_fields = array('id' => array('title' => 'ID', 'exper' => '$v[id]'), 'name' => array('title' => '名称', 'exper' => '$v[name]'), 'application_id' => array('title' => '所属系统', 'exper' => '$v[application_id]', 'width' => ' width="120"'), 'fatherid' => array('title' => '上级模块', 'exper' => '$v[fatherid]', 'width' => ' width="120"'), 'apifile' => array('title' => '接口文件', 'exper' => '$v[apifile]'), 'func_name' => array('title' => '方法名', 'exper' => '$v[func_name]'), 'template' => array('title' => '模板', 'exper' => '$v[template]'), 'is_pages' => array('title' => '分页', 'exper' => '$v[is_pages]'));
$op = array('view' => array('name' => '查看', 'brief' => '', 'link' => 'modules_op.php?'), 'form_set' => array('name' => '表单', 'brief' => '', 'link' => '?a=form_set'), 'form' => array('name' => '编辑', 'brief' => '', 'link' => '?a=form'), 'delete' => array('name' => '删除', 'brief' => '', 'attr' => ' onclick="return hg_ajax_post(this, \'删除\', 1);"', 'link' => '?a=delete'), 'pub_setting' => array('name' => '发布设置', 'brief' => '', 'link' => '?a=pub_setting'), 'app_design' => array('name' => '应用设计', 'brief' => '', 'link' => '?a=app_design'));
$batch_op = array('delete' => array('name' => '删除', 'brief' => '', 'attr' => ' onclick="return hg_ajax_batchpost(this, \'delete\', \'删除\', 1,\'\',\'\',\'ajax\');"'));
$this->cache->check_cache('applications');
$applications = array(0 => ' 全部 ');
foreach ($this->cache->cache['applications'] as $k => $v) {
$applications[$k] = $v['name'];
}
$all_m = array(0 => ' 全部 ');
foreach ($this->cache->cache['modules'] as $k => $v) {
if ($v['fatherid']) {
continue;
}
$all_m[$k] = $v['name'];
}
$str = 'var gBatchAction = new Array();gBatchAction[\'delete\'] = \'?a=delete\';';
hg_add_head_element('js-c', $str);
$this->tpl->addHeaderCode(hg_add_head_element('echo'));
$this->tpl->addVar('list_fields', $list_fields);
$this->tpl->addVar('op', $op);
$this->tpl->addVar('batch_op', $batch_op);
$this->tpl->addVar('all_m', $all_m);
$this->tpl->addVar('applications', $applications);
$this->tpl->addVar('close_search', true);
$this->tpl->addVar('primary_key', 'id');
$this->tpl->addVar('list', $modules);
$this->tpl->addVar('appid', $appid);
$this->tpl->outTemplate('modules');
}