public function Recovery() { BM::singleton()->getObject('temp')->buildFromTemplates('recovery.html'); page()->setTitle('Recovery'); BM::singleton()->getObject('temp')->parseExtras(); BM::singleton()->getObject('temp')->parseOutput(); print BM::singleton()->getObject('temp')->getPage()->getContent(); }
public function show_form() { BM::singleton()->getObject('temp')->buildFromTemplates('login.html'); page()->setTitle('Acceso'); BM::singleton()->getObject('temp')->parseExtras(); BM::singleton()->getObject('temp')->parseOutput(); print BM::singleton()->getObject('temp')->getPage()->getContent(); }
public function edit($id = null) { $pagina = page($this->dados['modulo'], 'form'); //se formulário for submetido if ($this->input->post()) { //setando os valores a serem enviado ao bd $data = setData($this->input->post()); $data['administrador_id'] = $this->administrador_id; //alteracao if ($data['veiculo_id'] > 0) { $this->veiculo->update($data['veiculo_id'], $data); } else { $data['veiculo_data'] = date('Y-m-d H:i:s'); $this->veiculo->insert($data); } redirect('veiculo'); } else { $this->load->model('computador_model'); $this->dados['computadores'] = $this->computador_model->getAll(array('computador_status' => 1), array('computador_nome', 'asc')); //alteracao if (!is_null($id)) { $this->dados['veiculo'] = $this->veiculo->getById($id); } //pagina do formulário $this->template->view($pagina, $this->dados); } }
function get_cms($param) { if (CMS_ENABLE) { $table_p = CMSDB::table('archives'); $table_t = CMSDB::table('arctype'); $table_c = CMSDB::table('addonarticle'); $table = CMSDB::table('feedback'); $turl = "/plus/list.php?tid="; $furl = "/plus/view.php?aid="; $curl = "/plus/feedback.php?aid="; $where_sql = " p.arcrank =0 "; $order_by = " p.id DESC "; $total_record = CMSDB::result_first("SELECT COUNT(*) FROM {$table_p} AS p WHERE {$where_sql} LIMIT 1000"); if ($total_record > 0) { if ($param['perpage']) { $page_arr = page($total_record, $param['perpage'], $param['page_url'], array('return' => 'array')); $limit_sql = $page_arr['limit']; } else { if ($param['limit']) { $limit_sql = ' LIMIT ' . $param['limit']; } } $query = CMSDB::query("SELECT p.id,p.typeid,p.title,p.writer,p.description,p.pubdate,t.typename,c.body FROM {$table_p} p LEFT JOIN {$table_t} t ON p.typeid = t.id LEFT JOIN {$table_c} c ON p.id = c.aid WHERE {$where_sql} ORDER BY {$order_by} {$limit_sql} "); $topic_list = array(); while ($value = CMSDB::fetch($query)) { if ($user_lists[$value['writer']]) { $p_m_user = $user_lists[$value['writer']]; } else { $p_user = $this->TopicLogic->GetMember($this->_getuid($value['writer']), "`uid`,`ucuid`,`nickname`,`face`,`level`,`signature`,`validate`,`validate_category`"); $p_m_user = empty($p_user) ? array() : jsg_member_make($p_user); $user_lists[$value['writer']] = $p_m_user; } $replytime = CMSDB::result_first("SELECT dtime FROM {$table} WHERE aid = '" . $value['id'] . "' order by id DESC LIMIT 1"); $topic_list[$value['id']]['pid'] = $value['id']; $topic_list[$value['id']]['replys'] = CMSDB::result_first("SELECT COUNT(*) FROM {$table} WHERE aid = '" . $value['id'] . "'"); $topic_list[$value['id']]['replytime'] = $replytime ? my_date_format2($replytime) : my_date_format2($value['pubdate']); $topic_list[$value['id']]['replyurl'] = CMS_API_URL . $curl . $value['id']; $topic_list[$value['id']]['dateline'] = my_date_format2($value['pubdate']); $topic_list[$value['id']]['content'] = $this->_format($value['description']); $topic_list[$value['id']]['content_full'] = $this->_format($value['body'], 'long'); $topic_list[$value['id']]['title'] = $this->_format($value['title']); $topic_list[$value['id']]['face'] = $p_m_user['face']; $topic_list[$value['id']]['level'] = $p_m_user['level']; $topic_list[$value['id']]['nickname'] = empty($p_m_user['nickname']) ? $value['writer'] : $p_m_user['nickname']; $topic_list[$value['id']]['cmsurl'] = CMS_API_URL . $furl . $value['id']; $topic_list[$value['id']]['username'] = $value['writer']; $topic_list[$value['id']]['longtext'] = $this->_format($value['body'], 'islong'); $topic_list[$value['id']]['typetitle'] = $value['typename']; $topic_list[$value['id']]['typeurl'] = CMS_API_URL . $turl . $value['typeid']; $topic_list[$value['id']]['uid'] = $p_m_user['uid']; $topic_list[$value['id']]['tid'] = $value['id']; $topic_list[$value['id']]['signature'] = $p_m_user['signature']; $topic_list[$value['id']]['validate_html'] = $p_m_user['validate_html']; } $info = array('list' => $topic_list, 'count' => $total_record, 'page' => $page_arr); return $info; } } return false; }
function GetAllComplaints($var, $gm) { global $tbl_list_complaint; if ($var["serverindex"] == null || $var["serverindex"] == "") { echo "<script src='/js/page.js'></script>\n"; echo "<script src='/js/checkbox.js'></script>\n"; form($var, $gm); checkbox(true, true); ReturnAndBack(); echo "</form>\n"; return eachServerFrame($var, $gm); } else { $serv_id = intval($var["serverindex"]); } global $page_main, $tbl_sys_msg; $query_string = "select ua.ua_nMsgType, us.us_sName, c.c_sName, ua.ua_sErrorMsg, ua.ua_dtTime, ua.ua_uErrorCode from tbl_user_advice ua, tbl_char c, tbl_char_static cs, tbl_user_static us where ua.cs_uId = c.cs_uId and c.cs_uId = cs.cs_uId and cs.us_uId = us.us_uId order by ua_dtTime desc"; page($var, $query_string, 58, "Game", $serv_id, $result, $page, $desc); echo "<table class='list_table'>\n"; echo "<tr><th class='type' style='width:60px;'>" . $page_main["category"] . "</th><th style='width:80px;'>" . $page_main["user_name"] . "</th><th style='width:80px;'>" . $page_main["role_name"] . "</th><th>" . $page_main["content"] . "</th><th style='width:40px;'>" . $tbl_sys_msg["status"] . "</th><th style='width:120px;'>" . $tbl_sys_msg["time"] . "</th></tr>\n"; while ($row = mysql_fetch_row($result)) { printf("<tr><td>%s</td><td><input type='checkbox' flag='user' value='%s' onclick='Checkbox(this)' />%s</td><td><input type='checkbox' flag='role' value='%s' onclick='Checkbox(this)' />%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", $tbl_list_complaint[$row[0]], $row[1], $row[1], $row[2], $row[2], $row[3], "-", $row[4]); } echo "</table>\n"; echo $page; return true; }
public function __construct($params = array()) { $defaults = array('page' => page(), 'headline' => 'Mentions'); if (is_a($params, 'Page')) { $params = array('page' => $params); } else { if (is_string($params)) { $params = array('headline' => $params); } } $this->options = array_merge($defaults, $params); $this->page = $this->options['page']; $this->root = $this->page->root() . DS . '.webmentions'; $this->headline = new Field($this->page, 'headline', $this->options['headline']); if (!is_dir($this->root)) { return; } $files = dir::read($this->root); // flip direction rsort($files); foreach ($files as $file) { // skip the pings cache if ($file == 'pings.json') { continue; } // register a new webmention try { $mention = new Mention($this->page, $this->root . DS . $file); $this->append($mention->id(), $mention); } catch (Exception $e) { } } }
function delete($table, $bid, $cid, $pageid, $TotalRows) { $objResponse = new xajaxResponse(); include 'settings/config.php'; include 'settings/tables.php'; include 'settings/template.php'; require_once 'lib/modify.php'; if ($table == $tbl_blog_comments) { $comment = new ModifyEntry(); $comment->table = $tbl_blog_comments; $comment->changes = " deleted = '1' "; $comment->condition = " id = '{$cid}' "; $comment->update(); unset($comment); } $TotalRows = $TotalRows - 1; $max_pages = ceil($TotalRows / $set[0]["perpage_comments"]); if ($pageid > $max_pages) { $pageid = $pageid - 1; } $p_name = "p_num_" . $bid; $objResponse->assign($p_name, "innerHTML", $TotalRows); if ($max_pages == 0) { $p_main = "p_comments_" . $bid; $p_out = "p_page_" . $bid; $p_out2 = "p_page2_" . $bid; $objResponse->remove($p_main); $objResponse->remove($p_out); $objResponse->remove($p_out2); } else { $objResponse->loadcommands(page($table, $bid, $pageid, $TotalRows)); } return $objResponse; }
public function __construct($field) { $this->field = $field; $defaults = array('page' => $field->page->id(), 'fetch' => 'children', 'value' => '{{uid}}', 'text' => '{{title}}', 'flip' => false, 'filters' => []); $query = array_merge($defaults, $field->query); $page = page($query['page']); $items = $this->items($page, $query['fetch']); foreach ($query['filters'] as $field => $value) { if (!is_string($field)) { continue; } $items = $items->filterBy($field, $value); } if ($query['flip']) { $items = $items->flip(); } foreach ($items as $item) { $value = $this->tpl($query['value'], $item); $text = $this->tpl($query['text'], $item); $this->options[$value] = $text; } // sorting if (!empty($this->field->sort)) { switch (strtolower($this->field->sort)) { case 'asc': asort($this->options); break; case 'desc': arsort($this->options); break; } } }
public function department() { $did = (int) $this->input->get('did'); $per_page_job = 8; //招聘职位 $per_page = 5; //员工 $p = (int) page_cur(); // 获取当前页码 $employee_table = 'yj_employee'; $employee_job = 'yj_job'; $data['p'] = $p; $data['employ'] = $this->join_us_m->get_department_employee($did, $per_page, $per_page * ($p - 1)); $data['job'] = $this->join_us_m->get_department_job($did, $per_page_job, $per_page_job * ($p - 1)); if ($this->join_us_m->get_depar_num($did, $employee_job) / $per_page_job > $this->join_us_m->get_depar_num($did, $employee_table) / $per_page) { $num = $this->join_us_m->get_depar_num($did, $employee_job); $data['page_html'] = page($num, $per_page_job); } else { $num = $this->join_us_m->get_depar_num($did, $employee_table); $data['page_html'] = page($num, $per_page); } $data['depart'] = $this->join_us_m->get_department($did); $data['topic'] = $this->join_us_m->get_topic(); $data['imgs'] = $this->home_pic_m->pic_info(5); $data['imgs_num'] = $this->home_pic_m->pic_num(5); $data['partners'] = $this->partners_m->get_all(); $this->load->view('join_us', $data); }
private function _index() { $where = array(); $shop_id = get('shop_id'); $shop_ids = getMyShopId(); if ($shop_id && in_array($shop_id, $shop_ids)) { $where[] = "shop_id ='{$shop_id}'"; } else { $where[] = 'shop_id in(' . implode(',', $shop_ids) . ')'; } $level_id = get('level_id'); if (!empty($level_id)) { $where[] = " level_id ='{$level_id}'"; } $kw = get('kw'); if (!empty($kw)) { $where[] = "(card like '%{$kw}%' OR \n\t\t\t\t\t\tname like '%{$kw}%' OR \n\t\t\t\t\t\tpinyin like '%{$kw}%' OR \n\t\t\t\t\t\tbirth like '%{$kw}%' OR \n\t\t\t\t\t\tphone like '%{$kw}%' OR \n\t\t\t\t\t\taddress like '%{$kw}%' OR \n\t\t\t\t\t\tmemo like '%{$kw}%')"; } $order = array(); $sort = get('sort'); if (is_array($sort)) { foreach ($sort as $key => $val) { $order[] = $key . ' ' . $val; } } $member_mod = m('Member'); $data = array(); $data['data'] = $member_mod->getList($where, $order, page()); $data['count'] = $member_mod->getCount($where); echo json_encode($data); }
/** * Tab list */ public function tabList() { $fields_all = D('Tab')->field_list(); $fields = array('id', 'title', 'ico', 'url', 'sort_order', 'date_modify'); $parent_id = intval($_GET['parent_id']); if (empty($parent_id)) { $parent_id = 0; } $map = array('parent_id' => $parent_id); $page = page(D('Tab')->getCount($map)); $list = D('Tab')->field($fields)->where($map)->order('sort_order')->limit($page->firstRow, $page->listRows)->select(); foreach ($list as $k => $v) { $list[$k]['action_list'] = array(array('type' => 'ls', 'url' => U('Tab/tabList', array('parent_id' => $v['id']))), array('type' => 'edit', 'url' => U('Tab/tabInfo', array('id' => $v['id']))), array('type' => 'del', 'url' => U('Tab/del', array('id' => $v['id'])))); } $btn_list = array(array('title' => '添加菜单', 'url' => U('Tab/tabInfo', array('parent_id' => $parent_id)), 'class' => 'primary'), array('title' => '批量删除', 'url' => U('Tab/del'), 'class' => 'danger', 'type' => 'form')); $fields[] = 'action_list'; $data = array('title' => '系统菜单列表', 'btn_list' => $btn_list, 'field_list' => $this->get_field_list($fields_all, $fields), 'field_info' => $list, 'page_list' => $page->show()); if (!empty($parent_id)) { $ids = D('Tab')->get_ids($parent_id); $ids = array_reverse($ids); foreach ($ids as $k => $v) { $title = D('Tab')->where('id=' . $v)->getField('title'); $bread_list[$k]['title'] = $title ? $title : '菜单列表'; $bread_list[$k]['url'] = U('Tab/tabList', array('parent_id' => $v)); } $title = D('Tab')->where('id=' . $parent_id)->getField('title'); $bread_list[] = array('title' => $title, 'url' => 'javascript:;', 'type' => 'current'); $data['bread_list'] = $bread_list; } $this->assign($data); $this->display('Public:list'); }
/** * * 系统用户首页 */ public function index() { $data = array(); if (checkRight('admin_list') === FALSE) { $this->showView('denied', $data); exit; } if ($this->input->get('msg')) { $data['msg'] = $this->input->get('msg'); } $this->load->model('MIS_Admin'); $keyword = ''; if ($this->input->get('keyword')) { $keyword = $this->input->get('keyword'); } $offset = 0; $pageUrl = ''; page(formatUrl('admin/index') . '?', $this->MIS_Admin->getCount($keyword), PER_COUNT, $offset, $pageUrl); $dataList = $this->MIS_Admin->getList($keyword, $offset, PER_COUNT); $data['pageUrl'] = $pageUrl; $data['adminList'] = $dataList; $data['keyword'] = $keyword; $this->load->model('MIS_Role'); $rolelist = $this->MIS_Role->getAll(); $role = array(); foreach ($rolelist as $v) { $role[$v['id']] = $v['role_name']; } $role[0] = '管理员'; $data['role'] = $role; $this->showView('adminList', $data); }
function ondefault() { $navtitle = "问答动态"; $type = 'atentto'; $recivetype = $this->get[2]; if ($recivetype) { $type = $recivetype; } if (!$this->user['uid']) { $type = 'all'; } $navtitletable = array('all' => '问答动态', 'my' => '我的动态', 'atentto' => '关注的动态'); $navtitle = $navtitletable[$type]; $page = max(1, intval($this->get[3])); $pagesize = $this->setting['list_default']; $startindex = ($page - 1) * $pagesize; $doinglist = $_ENV['doing']->list_by_type($type, $this->user['uid'], $startindex, $pagesize); $rownum = $_ENV['doing']->rownum_by_type($type, $this->user['uid']); $departstr = page($rownum, $pagesize, $page, "doing/default/{$type}"); if ($type == 'atentto') { $recommendsize = $rownum ? 3 : 6; $recommandusers = $_ENV['doing']->recommend_user($recommendsize); } include template('doing'); }
/** * 菜单列表 */ public function menuList() { $fields_all = D('WechatMenu')->field_list(); $fields = array('id', 'name', 'type', 'value', 'sort_order', 'date_modify'); $parent_id = intval($_GET['parent_id']); $map = array('user_id' => $_SESSION['uid'], 'parent_id' => $parent_id); $page = page(D('WechatMenu')->getCount($map)); $list = D('WechatMenu')->field($fields)->where($map)->order('sort_order desc')->limit($page->firstRow, $page->listRows)->select(); foreach ($list as $k => $v) { $list[$k]['action_list'] = array(array('url' => U('Menu/menuInfo', array('id' => $v['id'])), 'type' => 'edit'), array('url' => U('Menu/del', array('id' => $v['id'])), 'type' => 'del')); if (empty($parent_id)) { $list[$k]['action_list'] = array_merge(array(array('url' => U('Menu/menuList', array('parent_id' => $v['id'])), 'type' => 'ls')), $list[$k]['action_list']); } } $fields[] = 'action_list'; $btn_list = array(array('title' => '批量删除', 'url' => U('Menu/menuInfo'), 'class' => 'danger', 'type' => 'form'), array('title' => '添加菜单', 'url' => U('Menu/menuInfo', array('parent_id' => $parent_id)), 'class' => 'primary')); if (empty($parent_id)) { $btn_list = array_merge($btn_list, array(array('title' => '同步菜单', 'url' => U('Menu/createMenu'), 'class' => 'default'))); } $data = array('title' => '菜单设置', 'btn_list' => $btn_list, 'field_list' => $this->get_field_list($fields_all, $fields), 'field_info' => $list, 'page_list' => $page->show()); if (!empty($parent_id)) { $title = D('WechatMenu')->where('id=' . $parent_id)->getField('name'); $bread_list = array(array('title' => '菜单列表', 'url' => U('MenuList')), array('title' => $title, 'url' => 'javascript:;', 'type' => 'current')); $data['bread_list'] = $bread_list; } $this->assign($data); $this->display('Public:list'); }
function showMenu2($menu,$started=false) { $name=$menu[0]; $title=$menu[1]; $view=$menu[2]; $ar=$menu[3]; if($name==getInput("page")) $title=boldMenuItem($title); if($title!="") $c=anchor(page($name),$title);//,"menu_title"); if(is_array($ar)) { foreach($ar as $a) { if($c!="") $c.=" | "; $c.=showMenu2($a,true); } } if($started) return $c; else return $c;//table(tr($c),"full_width"); }
function index() { $per_page_num = min(500, max(20, (int) (isset($_GET['pn']) ? $_GET['pn'] : $_GET['per_page_num']))); $gets = array('mod' => 'recdtopic', 'pn' => $this->Get['pn'], 'per_page_num' => $this->Get['per_page_num'], 'keyword' => $this->Get['keyword'], 'nickname' => $this->Get['nickname']); $page_url = 'admin.php?' . url_implode($gets); $where_sql = ' 1 AND tr.tid>0 '; $keyword = trim($this->Get['keyword']); if ($keyword) { $_GET['highlight'] = $keyword; $where_sql .= " AND " . build_like_query('t.content,t.content2', $keyword) . " "; } $nickname = trim($this->Get['nickname']); if ($nickname) { $sql = "select `username`,`nickname` from `" . TABLE_PREFIX . "members` where `nickname`='{$nickname}' limit 0,1"; $query = $this->DatabaseHandler->Query($sql); $members = $query->GetRow(); $where_sql .= " AND `username`='{$members['username']}' "; } $count = DB::result_first("SELECT COUNT(*)\r\n\t\t\t\t\t\t\t\t FROM " . DB::table('topic') . " AS t\r\n\t\t\t\t\t\t\t\t LEFT JOIN " . DB::table('topic_recommend') . " AS tr\r\n\t\t\t\t\t\t\t\t ON t.tid=tr.tid\r\n\t\t\t\t\t\t\t\t WHERE {$where_sql}"); $topic_list = array(); if ($count) { $page_arr = page($count, $per_page_num, $page_url, array('return' => 'array')); $query = DB::query("SELECT t.*,tr.dateline AS recd_time,tr.expiration,tr.r_nickname\r\n\t\t\t\t\t\t\t\tFROM " . DB::table('topic') . " AS t\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('topic_recommend') . " AS tr\r\n\t\t\t\t\t\t\t\tON t.tid=tr.tid\r\n\t\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\t\tORDER BY tr.dateline DESC\r\n\t\t\t\t\t\t\t\t{$page_arr['limit']} "); while ($value = DB::fetch($query)) { $value['recd_time'] = my_date_format2($value['recd_time']); $topic_list[] = $value; } $topic_list = $this->TopicLogic->MakeAll($topic_list); } include template('admin/recdtopic'); }
function get_list($param) { $talk_list = array(); $lids = array(); $uids = array(); $guests = array(); $time = time(); extract($param); $limit_sql = ''; $order_sql = ''; $where_sql = ' WHERE 1=1 '; if ($where) { $where_sql .= ' AND ' . $where; } if ($order) { $order_sql .= $order; } if ($limit) { $limit_sql = ' LIMIT ' . $limit; } $total_record = DB::result_first("SELECT COUNT(*) FROM " . DB::table('talk') . " {$where_sql}"); if ($total_record > 0) { if ($param['perpage']) { $page_arr = page($total_record, $param['perpage'], $param['page_url'], array('return' => 'array')); $limit_sql = $page_arr['limit']; } else { if ($param['limit']) { $limit_sql = ' LIMIT ' . $param['limit']; } } $query = DB::query("SELECT * FROM " . DB::table('talk') . " {$where_sql} {$order_sql} {$limit_sql}"); while ($value = DB::fetch($query)) { if ($value['starttime'] > $time) { $value['status_css'] = 'ico_notyet'; $value['status'] = '未开始'; } elseif ($value['endtime'] < $time) { $value['status_css'] = 'ico_complete'; $value['status'] = '已完成'; } else { $value['status_css'] = 'ico_ongoing'; $value['status'] = '进行中'; } $value['datetime'] = date('Y-m-d H:i', $value['starttime']) . ' - ' . date('Y-m-d H:i', $value['endtime']); if (date('Y-m-d', $value['starttime']) != date('Y-m-d', $value['endtime'])) { $value['ldate'] = date('m-d H:i', $value['starttime']) . '—' . date('m-d H:i', $value['endtime']); } else { $value['ldate'] = date('Y-m-d H:i', $value['starttime']) . '-' . date('H:i', $value['endtime']); } $value['shortname'] = cut_str($value['talkname'], 18); $talk_list[$value['lid']] = $value; $lids[] = $value['lid']; } $guestall = $this->Getguest($lids); foreach ($talk_list as $key => $val) { $talk_list[$key] = array_merge($talk_list[$key], $guestall[$key]); } $info = array('list' => $talk_list, 'count' => $total_record, 'page' => $page_arr); return $info; } }
private function _index() { $where = array(); $shop_ids = getMyShopId(); $from_shop_id = get('from_shop_id'); if ($from_shop_id && in_array($from_shop_id, $shop_ids)) { $where[] = "from_shop_id ='{$from_shop_id}'"; } else { $where[] = 'from_shop_id in(' . implode(',', $shop_ids) . ')'; } $to_shop_id = get('to_shop_id'); if ($to_shop_id && in_array($to_shop_id, $shop_ids)) { $where[] = "to_shop_id ='{$to_shop_id}'"; } else { $where[] = 'to_shop_id in(' . implode(',', $shop_ids) . ')'; } $kw = get('kw'); if (!empty($kw)) { $where[] = "(sn LIKE '%{$kw}%' OR user_name LIKE '%{$kw}%' OR memo LIKE '%{$kw}%')"; } $order = array(); $sort = get('sort'); if (is_array($sort)) { foreach ($sort as $key => $val) { $order[] = $key . ' ' . $val; } } $goods_mod = m('StockAccount'); $data = array(); $data['data'] = $goods_mod->getList($where, $order, page()); $data['count'] = $goods_mod->getCount($where); echo json_encode($data); }
private function _index() { $where = array(); $shop_id = get('shop_id'); $shop_ids = getMyShopId(); if ($shop_id && in_array($shop_id, $shop_ids)) { $where[] = "shop_id ='{$shop_id}'"; } else { $where[] = 'shop_id in(' . implode(',', $shop_ids) . ')'; } $cate_id = get('cate_id'); if (!empty($cate_id)) { $where[] = "cate_id={$cate_id}"; } $kw = get('kw'); if (!empty($kw)) { $where[] = "(sku LIKE '%{$kw}%' OR \n name LIKE '%{$kw}%' OR \n pinyin LIKE '%{$kw}%' OR \n barcode LIKE '%{$kw}%')"; } $order = array(); $sort = get('sort'); if (is_array($sort)) { foreach ($sort as $key => $val) { $order[] = $key . ' ' . $val; } } $goods_mod = m('Stock'); $data = array(); $data['data'] = $goods_mod->getList($where, $order, page()); $data['count'] = $goods_mod->getCount($where); echo json_encode($data); }
private function _index() { $where = array(); $shop_id = get('shop_id'); $shop_ids = getMyShopId(); if ($shop_id && in_array($shop_id, $shop_ids)) { $where[] = "shop_id ='{$shop_id}'"; } else { $where[] = 'shop_id in(' . implode(',', $shop_ids) . ')'; } $kw = get('kw'); if (!empty($kw)) { $where[] = "(username LIKE '%{$kw}%' OR email LIKE '%{$kw}%' OR name LIKE '%{$kw}%' OR phone LIKE '%{$kw}%')"; } $order = array(); $sort = get('sort'); if (is_array($sort)) { foreach ($sort as $key => $val) { $order[] = $key . ' ' . $val; } } $user_mod = m('User'); $data = array(); $data['data'] = $user_mod->getList($where, $order, page()); $data['count'] = $user_mod->getCount($where); echo json_encode($data); }
public static function get() { $history = site()->user()->history(); if (empty($history) or !is_array($history)) { return array(); } $update = false; $result = array(); foreach ($history as $item) { $page = page($item); if (!$page) { $update = true; } else { $result[] = $page; } } if ($update) { $history = array_map(function ($item) { return $item->id(); }, $result); try { site()->user()->update(array('history' => $history)); } catch (Exception $e) { } } return $result; }
/** * Constructor * * Creates a new comment form instance. * * @param array $fields Collection of form fields. */ public function __construct($fields = array()) { // Ensure the session is started Session::start(); // Setup form container $this->addClass('form comment-form'); // Set default action endpoint $hash = page()->hash(); $this->method('post'); $this->action(url("/api/pages/{$hash}/comments/create")); // Provide default fields if none are given $this->fields = array(); if (empty($fields)) { $this->defaults(); } else { $this->fields($fields); } // Populate message collection from session $this->messages = new Messages(); if ($errors = Session::get('errors')) { $this->messages->add($errors); } // Collect field data $this->data = $this->input(); // Perform form validation on submit $this->on('submit', function ($form) { $form->validate(); }); }
function logout() { session_unset(); session_destroy(); require 'controler/welcome.php'; page(); }
private function _customer() { $where = array(); $shop_id = get('shop_id'); $shop_ids = getMyShopId(); if ($shop_id && in_array($shop_id, $shop_ids)) { $where[] = "shop_id ='{$shop_id}'"; } else { $where[] = 'shop_id in(' . implode(',', $shop_ids) . ')'; } $kw = get('kw'); if (!empty($kw)) { $where[] = "(name like '%{$kw}%' OR \n\t\t\t\t\t\tpinyin like '%{$kw}%' OR \n\t\t\t\t\t\tcontact like '%{$kw}%' OR \n\t\t\t\t\t\tphone like '%{$kw}%' OR \n\t\t\t\t\t\tmemo like '%{$kw}%')"; } $order = array(); $sort = get('sort'); if (is_array($sort)) { foreach ($sort as $key => $val) { $order[] = $key . ' ' . $val; } } $cus_mod = m('Customer'); $data = array(); $data['data'] = $cus_mod->getList($where, $order, page()); $data['count'] = $cus_mod->getCount($where); echo json_encode($data); }
public function edit($id = null) { $pagina = page($this->dados['modulo'], 'form'); //se formulário for submetido if ($this->input->post()) { //setando os valores a serem enviado ao bd $data = setData($this->input->post()); $data['administrador_id'] = $this->administrador_id; //alteracao if ($data['tipo_ocorrencia_id'] > 0) { $this->tipo_ocorrencia->update($data['tipo_ocorrencia_id'], $data); } else { $data['tipo_ocorrencia_data'] = date('Y-m-d H:i:s'); $this->tipo_ocorrencia->insert($data); } redirect('tipo_ocorrencia'); } else { //alteracao if (!is_null($id)) { $this->dados['tipo_ocorrencia'] = $this->tipo_ocorrencia->getById($id); } //pagina do formulário $this->template->view($pagina, $this->dados); } }
public function __construct($output, $assets) { $this->site = site(); $this->page = page(); $this->output = $output; $this->assets = $assets; }
public function __construct($parent) { $this->parent = is_a($parent, 'Page') ? $parent : page($parent); if (!$this->parent) { throw new Exception('Invalid page'); } }
function PmManage() { $per_page_num = min(500, max(20, (int) (isset($_GET['pn']) ? $_GET['pn'] : $_GET['per_page_num']))); $where_list = array(); $query_link = 'admin.php?mod=pm&code=pm_manage'; $username = trim($this->Get['username']); $keyword = trim($this->Get['keyword']); $tousername = trim($this->Get['tousername']); $where_list['inbox'] = " `folder` = 'inbox' "; if ($username) { $where_list['msgnickname'] = "`msgnickname`='{$username}'"; $query_link .= "&username="******"`tonickname`='{$tousername}'"; $query_link .= "&tousername="******"&keyword=" . urlencode($keyword); } $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' '; $sql = " select count(*) as `total_record` from `" . TABLE_PREFIX . "pms` {$where}"; $result = mysql_query($sql); $total_records = mysql_fetch_array($result); $total_record = $total_records[0]; $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'array'), '20 50 100 200,500'); $sql = " select *,m1.nickname as msgnickname,m2.nickname as tonickname from `" . TABLE_PREFIX . "pms` p\r\n\t\t\t\t left join `" . TABLE_PREFIX . "members` m1 on m1.uid = p.msgfromid\r\n\t\t\t\t left join `" . TABLE_PREFIX . "members` m2 on m2.uid = p.msgtoid\r\n\t\t\t\t {$where} order by `pmid` desc {$page_arr['limit']} "; $query = $this->DatabaseHandler->Query($sql); $pm_list = array(); while ($row = $query->GetRow()) { $pm_list[] = $row; } include template('admin/pm'); }
function GetCmpstByGM($var, $gm) { global $tbl_sys_msg, $page_main, $tbl_list_compensate; if ($var["serverindex"] == null || $var["serverindex"] == "") { $js_src = <<<_js_src <script type='text/javascript' src='/js/checkbox.js'></script> <script type='text/javascript' src='/js/page.js'></script> <script type='text/javascript'> function cancel(id) { \tdocument.form1.target = "_block" \tdocument.form1.action_name.value='124'; \tdocument.form1.id.value=id; \tdocument.form1.submit(); } </script> _js_src; echo $js_src . "\n"; echo "<script type='text/javascript' src='/js/log_info.js'></script>\n"; form($var, $gm); echo "<input type='hidden' name='flag' />\n"; echo "<input type='hidden' name='role_name' />\n"; echo "<input type='hidden' name='str' />\n"; echo "<input type='hidden' name='urs' />\n"; echo "<input type='hidden' name='id' />"; checkbox(false, true); ReturnAndBack(); $ret = eachServerFrame($var, $gm); ReturnAndBack(); echo "</form>\n"; return $ret; } $serv_id = intval($var["serverindex"]); $gm_name = mysql_escape_string($gm); $filter = ""; if ($var["flag"] != "" || $var["role_name"] != "") { $filter = " and"; if ($var["flag"] != "") { $filter .= " reason like '%#[" . $var["flag"] . "[%'"; } if ($var["flag"] != "" && $var["role_name"] != "") { $filter .= " and"; } if ($var["role_name"] != "") { $k = $var["role_name"]; $filter .= " (reason like '%[" . $k . ",%' or reason like '%," . $k . "]%' or reason like '%," . $k . ",%' or reason like '%[" . $k . "]%')"; } } $query = "select gca_uId, gm, action_id, reason, action_state from tbl_gm_compensate_action where server_id = '{$serv_id}' and gm = '{$gm_name}'" . $filter . " order by gca_uId desc"; page($var, $query, 123, "GMS", 0, $result, $page, $desc); echo "<table class='list_table'>\n"; echo "<tr><th style='width:60px;'>" . $page_main["user_name"] . "</th><th style='width:160px;'>" . $page_main["event_type"] . "</th><th>" . $tbl_sys_msg["desc"] . "</th><th style='width:60px;'>" . $tbl_sys_msg["act"] . "</th><th style='width:80px;'>" . $tbl_sys_msg["status"] . "</th></tr>\n"; while ($row = mysql_fetch_row($result)) { printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td class='server' title='" . $serv_id . "'>%s</td></tr>", $row[1], GetGMCommandLogAction($row[2]), LogInfo($row[3]), hasAuth(124, $gm) && $row[4] == 1 ? "<input type=button value='" . $tbl_sys_msg["cancel"] . "' onclick='cancel(" . $row[0] . ")'/>" : "", $tbl_list_compensate[$row[4]]); } echo "</table>\n"; echo $page; return true; }
public function import() { $where = array(); $shop_ids = getMyShopId(); $shop_id = get('shop_id'); if ($shop_id && in_array($shop_id, $shop_ids)) { $where[] = "shop_id ='{$shop_id}'"; } else { $where[] = 'shop_id in(' . implode(',', $shop_ids) . ')'; } $kw = get('kw'); if (!empty($kw)) { $where[] = "(sn LIKE '%{$kw}%' OR \n user_name LIKE '%{$kw}%' OR \n memo LIKE '%{$kw}%')"; } $order = array(); $sort = get('sort'); if (is_array($sort)) { foreach ($sort as $key => $val) { $order[] = $key . ' ' . $val; } } $trade_mod = m('Trade'); $arr = $trade_mod->getList($where, $order, page()); $data = ''; $data .= '<table cellspacing="0" style="width:100%;border-collapse:collapse;">'; $data .= '<tr>'; $data .= '<td>单号</td>'; $data .= '<td>编号</td>'; $data .= '<td>客户</td>'; $data .= '<td>联系人</td>'; $data .= '<td>应收</td>'; $data .= '<td>扣款</td>'; $data .= '<td>实收</td>'; $data .= '<td>优惠</td>'; $data .= '<td>欠款</td>'; $data .= '<td>店铺</td>'; $data .= '<td>操作员</td>'; $data .= '<td>时间</td>'; $data .= '<td>备注</td>'; $data .= '</tr>'; foreach ($arr as $val) { $data .= '<tr>'; $data .= "<td>{$val['sn']}</td>"; $data .= "<td>{$val['customer_sn']}</td>"; $data .= "<td>{$val['customer_name']}</td>"; $data .= "<td>{$val['customer_contact']}</td>"; $data .= "<td>{$val['ysje']}</td>"; $data .= "<td>{$val['khyc']}</td>"; $data .= "<td>{$val['ssje']}</td>"; $data .= "<td>{$val['yhje']}</td>"; $data .= "<td>{$val['qkje']}</td>"; $data .= "<td>{$val['shop_name']}</td>"; $data .= "<td>{$val['user_name']}</td>"; $data .= '<td>' . date('Y-m-d H:i:s', $val['create_time']) . '</td>'; $data .= "<td>{$val['memo']}</td>"; $data .= '</tr>'; } echo outXls($data, '综合统计'); }