public function index() { $order = $this->_param("order"); if ($order) { $order = explode("|", $order); } foreach (array_keys($this->data['all_columns']) as $v) { $value = trim(htmlspecialchars($this->_get($v))); if (!$value) { continue; } $filter[$v] = array('like', '%' . $value . '%'); } // hack, 在全部的搜索中filter错了 $status = $this->_get('status'); if ('all' == $status) { unset($filter['status']); } $count = D('Projects')->getProjectsCount($filter); list($pagesize, $page_num, $pagestring) = pagestring($count, 20); $projects = D('Projects')->getProjects($filter, $page_num, $pagesize, $order); $this->data['projects'] = $projects; $this->data['pagestring'] = $pagestring; $this->assign($this->data); D('AdminVisits')->saveVisit('project_list', $page_num); $this->display('index'); }
public function index() { $this->skey = $skey = I('skey'); $stag_id = I('stag_id'); if (!$skey && !$stag_id) { redirect('/'); } $pages = array(); if ($skey) { $pages = D('Search')->searchContent($skey, 'page'); $search_result = $pages; // $search_result = array_sort($search_result, 'create_time', 'desc'); $count = count($search_result); list($pagesize, $page_num, $pagestring) = pagestring($count, 10); $search_result = array_slice($search_result, ($page_num - 1) * $pagesize, $pagesize); $data['replace'] = "<font color='red'>{$skey}</font>"; $data['pagestring'] = $pagestring; } elseif ($stag_id) { $ids = M('TagMapping')->where(array('tag_id' => $stag_id))->getField('object_id', true); $filter['id'] = array('in', $ids); $pages = D('Content')->getPages($filter, 0, 0); $count = count($pages); $search_result = $pages; } $data['skey'] = $skey; $data['stag_id'] = $stag_id; $data['search_result'] = $search_result; $data['all_count'] = intval($count); $this->assign($data); $this->display('search/index'); }
public function index() { $type = $this->type; $order = $this->_param("order"); if ($order) { $tmp = explode('|', $order); if ($this->all_columns[$tmp[0]]['order']) { $tmp[0] = $this->all_columns[$tmp[0]]['order']; } $order = implode(' ', $tmp); } $filter = array(); foreach (array_keys($this->all_columns) as $v) { $value = trim(htmlspecialchars($this->_get($v))); if (!$value) { continue; } $filter[$v] = array('like', '%' . $value . '%'); } $count = D(ucfirst($type) . 'Attachments')->where($filter)->count(); list($pagesize, $page_num, $this->pagestring) = pagestring($count, 20); $this->attachments = D("Attachments")->getModuleAttachments($type, $filter, $page_num, $pagesize, $order); // var_dump($attachments); $this->display(); }
public function lists() { $filter['status'] = '1'; $count = D('Message')->where($filter)->count(); list($pagesize, $page_num, $pagestring) = pagestring($count, 10); $this->pagestring = $pagestring; $this->messages = D('Message')->page($page_num, $pagesize)->where($filter)->order('id desc')->select(); $this->display(); }
function user_list() { $this->admin_allowed(); $group_id = $this->_param("group_id"); if ($group_id) { $group_ids = $group_id; $this->assign("group_id", $group_id); } else { $groups = D("UserGroups")->getTeamGroups($this->login_user['team_id']); $group_ids = Utility::GetColumn($groups); } $users = D("Users")->getGroupUsers($group_ids); $count = count($users); list($pagesize, $page_num, $pagestring) = pagestring($count, 20); $users = D("Users")->getGroupUsers($group_ids, $page_num, $pagesize); $this->assign("users", $users); $this->assign("pagestring", $pagestring); $all_team_groups = D("UserGroups")->getTeamGroups($this->login_user['team_id']); $this->assign("groups", $all_team_groups); $this->display(); }
public function index() { $data['module_maps'] = array('contact_list' => '联系人列表', 'contact_detail' => '联系人详情', 'organization_list' => '机构列表', 'organization_detail' => '机构详情', 'event_list' => '活动列表', 'event_detail' => '活动详情', 'home' => '首页', 'mail_index' => '邮件首页', 'sms_index' => '短信首页'); $raw_users = D("Users")->getGroupUsers($this->login_user['manage_group_ids']); foreach ($raw_users as $u) { $users[$u['id']] = $u['realname']; } $data['all_columns'] = array('user_id' => array('display_name' => '用户', 'type' => 'select', 'options' => $users), 'module' => array('display_name' => '操作模块', 'type' => 'select', 'options' => $data['module_maps']), 'module_id' => array('display_name' => '关联ID'), 'ipaddress' => array('display_name' => 'IP Address'), 'extra_data' => array('display_name' => '关联数据')); $data['list_views'] = array('user_id', 'module', 'module_id', 'extra_data', 'ipaddress'); foreach ($data['list_views'] as $v) { $value = trim(htmlspecialchars($this->_get($v))); if (!$value) { continue; } $filter[$v] = array('like', '%' . $value . '%'); } $filter['user_group_id'] = array('in', $this->login_user['manage_group_ids']); list($pagesize, $page_num, $pagestring) = pagestring(D('AdminVisits')->where($filter)->count(), 20); $data['visits'] = D('AdminVisits')->getVisits($filter, $page_num, $pagesize); $data['pagestring'] = $pagestring; $this->assign($data); $this->display(); }
public function index() { $data['module_maps'] = array('project' => '资助项目', 'project_status_change' => '资助项目状态变更', 'project_manager_change' => '资助项目官员更换', 'project_grant_record' => '资助项目拨款记录', 'partner' => '机构', 'contact_note' => '联系人备注', 'partner_note' => '活动备注', 'contact_attachment' => '联系人附件', 'partner_attachment' => '活动附件'); $raw_users = D("Users")->getGroupUsers($this->login_user['manage_group_ids']); foreach ($raw_users as $u) { $users[$u['id']] = $u['realname']; } $data['all_columns'] = array('user_id' => array('display_name' => '用户', 'type' => 'select', 'options' => $users), 'module' => array('display_name' => '操作模块', 'type' => 'select', 'options' => $data['module_maps']), 'operation' => array('display_name' => '操作'), 'module_id' => array('display_name' => '关联ID'), 'module_name' => array('display_name' => '关联数据')); $data['list_views'] = array('user_id', 'module', 'module_id', 'module_name', 'operation'); foreach ($data['list_views'] as $v) { $value = trim(htmlspecialchars($this->_get($v))); if (!$value) { continue; } $filter[$v] = array('like', '%' . $value . '%'); } $filter['user_group_id'] = array('in', $this->login_user['manage_group_ids']); list($pagesize, $page_num, $pagestring) = pagestring(D('AdminLogs')->where($filter)->count(), 20); $data['visits'] = D('AdminLogs')->getAdminLogs($filter, $page_num, $pagesize); $data['pagestring'] = $pagestring; $this->assign($data); $this->display(); }
public function index() { $filter = null; $order = $this->_param("order"); if ($order) { $order = str_replace("|", ' ', $order); } foreach (array_keys($this->data['all_columns']) as $v) { $value = trim(htmlspecialchars($this->_get($v))); if (!$value) { continue; } $filter[$v] = array('like', '%' . $value . '%'); } $count = D('Schools')->getSchoolsCount($filter); list($pagesize, $page_num, $pagestring) = pagestring($count, 20); $schools = D('Schools')->getSchools($filter, $page_num, $pagesize, $order); $this->data['schools'] = $schools; $this->data['pagestring'] = $pagestring; $this->data['school_user_count'] = D('Schools')->getSchoolUserCount(Utility::GetColumn($schools, 'id')); $this->assign($this->data); D('AdminVisits')->saveVisit('school_list', $page_num); $this->display(); }
<?php /** * 我的抽奖列表 * @author abei <*****@*****.**> */ require_once dirname(dirname(__FILE__)) . '/app.php'; need_login(); $sql = "SELECT count(a.id) FROM `activity` a,`activity_record` ar WHERE ar.user_id = " . $login_user_id . " AND ar.activity_id = a.id GROUP BY ar.activity_id"; $list = DB::GetQueryResult($sql, false); list($pagesize, $offset, $pagestring) = pagestring(count($list), 10); $sql = "SELECT a.title,a.id,a.begin_time,a.end_time,a.state FROM `activity` a,`activity_record` ar WHERE ar.user_id = " . $login_user_id . " AND ar.activity_id = a.id GROUP BY ar.activity_id LIMIT {$offset},{$pagesize}"; $itemList = DB::GetQueryResult($sql, false); $pagetitle = '我的活动'; include template('account_activity_index');
<?php require_once dirname(dirname(__FILE__)) . '/app.php'; need_login(true); $condition = array('user_id' => $login_user_id, 'team_id > 0'); $selector = strval($_GET['s']); if ($selector == 'unpay') { $condition['state'] = 'unpay'; $suffix = '_unpay'; } else { $condition['state'] = 'pay'; } $count = Table::Count('order', $condition); list($pagesize, $offset, $pagestring) = pagestring($count, 10, true); $orders = DB::LimitQuery('order', array('condition' => $condition, 'order' => 'ORDER BY id DESC, team_id DESC', 'size' => $pagesize, 'offset' => $offset)); $team_ids = Utility::GetColumn($orders, 'team_id'); $teams = Table::Fetch('team', $team_ids); foreach ($teams as $tid => $one) { team_state($one); $teams[$tid] = $one; } $pagetitle = '我的订单'; include template("wap_myorder{$suffix}");
$cbtime = $team['begin_time']; } else { //$cbtime = $daytime-86400*7; } $ocbday = date('Y-m-d H:i:s', $cbtime); $condition[] = "consume_time >= '{$cbtime}'"; } if ($ceday) { $cetime = strtotime($ceday); $oceday = date('Y-m-d H:i:s', $cetime); $condition[] = "consume_time <= '{$cetime}'"; } else { $cetime = $daytime; $oceday = $ceday = date('Y-m-d H:i:s', $cetime); $condition[] = "consume_time <= '{$daytime}'"; } $condition['consume'] = 'Y'; $condition['doer_id'] = $partner_id; $condition['team_id'] = $search_team_id; $count = Table::Count('coupon', $condition); /* filter */ $sql = "SELECT \r\r\n\tFROM_UNIXTIME(consume_time, '%Y-%m-%d') ts, \r\r\n\tFROM_UNIXTIME(consume_time, '%w') we, \r\r\n\tcount(id) ids \r\r\n\tFROM coupon \r\r\n\tWHERE \t\t\r\r\n\t\t`consume_time` >= {$cbtime} \r\r\n\t\tAND `consume_time` < {$cetime} \r\r\n\t\tAND `team_id` = {$search_team_id} \t\t\r\r\n\t\tAND `doer_id` = {$partner_id} \r\r\n\t\tAND `consume` = 'Y' \r\r\n\t\tAND {$sql_verifytype_str} \r\r\n\tGROUP BY ts"; $coupons = DB::GetQueryResult($sql, false); $coupons_count = count($coupons); list($pagesize, $offset, $pagestring) = pagestring($coupons_count, 100); $sql .= ' LIMIT ' . $offset . ',' . $pagesize; $coupons = DB::GetQueryResult($sql, false); $current_store = Table::Fetch('store', $login_partner['store_id']); // 该店员店铺所运行的项目 $teams = DB::LimitQuery('team', array('condition' => array('store_ids LIKE "%@' . $login_partner['store_id'] . '@%"'))); include template('biz_coupon_consume_doer');
public function index() { $filter = null; $status = $filter['status'] = intval($this->_get('status')); $order = $this->_param("order"); if ($order) { $order = str_replace("|", ' ', $order); } foreach (array_keys($this->data['all_columns']) as $v) { $value = trim(htmlspecialchars($this->_get($v))); if (!$value) { continue; } $filter["user_info." . $v] = array('like', '%' . $value . '%'); } $count = D('UserInfo')->getUserInfoCount($filter); list($pagesize, $page_num, $this->pagestring) = pagestring($count, 20); $this->users = D('UserInfo')->getUserInfos($filter, $page_num, $pagesize, $order); $this->assign($this->data); D('AdminVisits')->saveVisit('userinfo_list', $page_num); $this->display('index'); }
if ($_POST['recipients'] && $_POST['invitation_content']) { $emails = $_POST['recipients']; ($name = $_POST['real_name']) || ($name = $login_user['username']); $content = $_POST['invitation_content']; mail_invitation($emails, $content, $name); Session::Set('notice', '邀请发送成功'); redirect(WEB_ROOT . '/account/invite.php'); } $condition = array('user_id' => $login_user_id, 'credit > 0', 'pay' => 'Y'); $money = Table::Count('invite', $condition, 'credit'); $count = Table::Count('invite', $condition); $team = current_team($city['id']); $condition = array('city_id' => array(0, abs(intval($city['id']))), 'team_type' => 'normal', "begin_time <= '{$daytime}'", "end_time > '{$daytime}'", "audit" => 1); $tcount = Table::Count('team', $condition); if ($tcount > 1) { list($pagesize, $offset, $pagestring) = pagestring($tcount, 6); $teams = DB::LimitQuery('team', array('condition' => $condition, 'order' => 'ORDER BY sort_order DESC, begin_time DESC, id DESC', 'size' => $pagesize, 'offset' => $offset)); foreach ($teams as $id => $one) { team_state($one); if (!$one['close_time']) { $one['picclass'] = 'isopen'; } if ($one['state'] == 'soldout') { $one['picclass'] = 'soldout'; } $one['discount_price'] = $one['market_price'] - $one['team_price']; $left = array(); if ($one['end_time'] < $one['begin_time']) { $one['end_time'] = $one['begin_time']; } $diff_time = $left_time = $one['end_time'] - $now;
function get_contents_by_userid($id) { $id = intval($id); $filter['update_user_id|create_user_id'] = $id; // $filter['category_id'] = 200; $this->current_user = D('User')->field('password', true)->where('id = %d', $filter['update_user_id|create_user_id'])->find(); $filter['status'] = 2; $filter['parent_id'] = array('gt', 0); $filter['model_id'] = 1; //累积监测 $this->monitor_total = D('Content')->listCount($filter); list($pagesize, $page_num, $pagestring) = pagestring($this->monitor_total); $this->pagestring = $pagestring; $this->contents = D('Content')->getPages($filter, 0, 0, 'update_time desc', true, false, true); //监测点 $filter['status'] = array('lt', 10); $filter['category_id'] = array('gt', 0); $filter['parent_id'] = array('gt', 0); $filter['create_user_id'] = $id; $this->monitor_parent_ids = D('Content')->distinct(true)->field('parent_id, category_id')->where($filter)->select(); $this->display('article:user_article_lists'); }
function current_partner_sum_money($partner_id, $size = 20) { $today = strtotime(date('Y-m-d')); $condition = array('partner_id' => $partner_id, "end_time < {$today}", "now_number >= min_number"); if ($size != 0) { $count = Table::Count('team', $condition); list($pagesize, $offset, $pagestring) = pagestring($count, 20); $teams = DB::LimitQuery('team', array('condition' => $condition, 'order' => 'ORDER BY id DESC', 'offset' => $offset, 'size' => $pagesize)); } else { $teams = DB::LimitQuery('team', array('condition' => $condition, 'order' => 'ORDER BY id DESC')); } foreach ($teams as $id => $one) { $onlinepay = Table::Count('order', array('state' => 'pay', 'team_id' => $one['id']), 'money'); $creditpay = Table::Count('order', array('state' => 'pay', 'team_id' => $one['id']), 'credit'); $buycount = Table::Count('order', array('state' => 'pay', 'team_id' => $one['id']), 'quantity'); /*$c1 = array( 'team_id'=> $$one['id'], ); $orders = DB::LimitQuery('order', array( 'condition' => $c1, ));*/ $sumonlinepay += $onlinepay; $sumcreditpay += $creditpay; } return $sumonlinepay + $sumcreditpay; }
if ($ceday) { $cetime = strtotime($ceday); $condition[] = "create_time <= '{$cetime}'"; } if ($pbday) { $pbtime = strtotime($pbday); $condition[] = "pay_time >= '{$pbtime}'"; } if ($peday) { $petime = strtotime($peday); $condition[] = "pay_time <= '{$petime}'"; } /* end fiter */ $count = Table::Count('order', $condition); list($pagesize, $offset, $pagestring) = pagestring($count, 20); $orders = DB::LimitQuery('order', array( 'condition' => $condition, 'order' => 'ORDER BY id DESC', 'size' => $pagesize, 'offset' => $offset, )); $pay_ids = Utility::GetColumn($orders, 'pay_id'); $pays = Table::Fetch('pay', $pay_ids); $user_ids = Utility::GetColumn($orders, 'user_id'); $users = Table::Fetch('user', $user_ids); $team_ids = Utility::GetColumn($orders, 'team_id');
if ($category['id']) { $child = D('Category')->getChildrenId($category['id'], true); } else { $child = D('Category')->getField('id', true); } if (false) { $filter['weight'] = false; } if ($_GET['stid']) { $filter['tag_id'] = $_GET['stid']; } if (false) { $count = D('Content')->getPagesByTypeId($child, 0, 0, $filter, true); } if (false) { list($pagesize, $page_num, $pagestring) = pagestring($count, 10); } if (false) { $pages = D('Content')->getPagesByTypeId($child, $page_num, $pagesize, $filter, false, false, true); } else { $pages = D('Content')->getPagesByTypeId($child, 1, 10, $filter, false, false, true, false); } if (false) { var_dump($pages); } if (is_array($pages)) { $i = 0; $__LIST__ = $pages; if (count($__LIST__) == 0) { echo ""; } else {
public function list_contents() { $filter['create_user_id'] = UID; $filter['status'] = intval(I('status')); $filter['parent_id'] = array('gt', 0); $count = D('Content')->listCount($filter); list($pagesize, $page_num, $pagestring) = pagestring($count); $this->pagestring = $pagestring; $this->articles = D('Content')->getPages($filter, $pagesize, $page_num, 'update_time desc', true, false, true); Cookie('__forward__', $_SERVER['REQUEST_URI']); $this->display('article/article_lists'); }