public function MakeList() { $Regs = $this->fetchAssoc('admin_group', '*', "status<>'I'", "title"); foreach ($Regs as $Reg) { $ID = $Reg['group_id']; $Title = $Reg['title']; $Group = new GroupData($ID); $Profile = new ProfileData(); $Actions = '<img src="../../../skin/images/body/icons/pencil.png" id="edit_' . $ID . '" />'; $Actions .= '<img src="../../../skin/images/body/icons/cross.png" id="delete_' . $ID . '" />'; $List .= '<div id="group' . $ID . '" class="col-centered col-lg-3 col-sm-6 col-xs-12 animated fadeIn usergral"> <div class="userMainSection"> <div class="userimgdiv"><img src="' . $Reg['image'] . '" class="img-responsive userimg"></div> <div class="row usernamediv"> <span class="usernametxt"><span class="col-sm-12">' . $Title . '</span> <span class="col-lg-12 col-sm-12 col-xs-12">(' . count($Group->GetUsers()) . ' usuarios)</span><span class="col-lg-12 col-sm-12 col-xs-12">(' . count($Profile->GetCheckedProfiles($ID)) . ' perfiles)</span></span><br> </div> </div> <div id="usericosid" class="usericos"> <ul class="userButtons animated slideInUp"> <li class="btnmod animated fadeIn"><a href="edit.php?id=' . $ID . '" ><i class="fa fa-fw fa-pencil"></i></a></li> <li class="deleteElement btndel animated fadeIn" deleteElement="' . $ID . '" deleteParent="group' . $ID . '/grouplist' . $ID . '" deleteProcess="process.php" confirmText="¿Desea eliminar el grupo \'' . ucfirst($Title) . '\'?" successText="El grupo \'' . ucfirst($Title) . '\' ha sido eliminado correctamente"><i class="fa fa-fw fa-trash"></i></li> </ul> </div> </div>'; } return $List; }
static function insertFacebookUser($validUser) { $userId = DBConn::insert("INSERT INTO " . DBConn::prefix() . "users(name_first, name_last, email, facebook_id) " . "VALUES (:name_first, :name_last, :email, :facebook_id);", $validUser); if ($userId) { GroupData::addDefaultGroupToUser($userId); } return $userId; }
public function indexAction() { //http://www.xiguxigu.com/g/1 $gid = $this->param('gid'); $group = GroupData::getById($gid); if (!$group) { $url = ComTool::url("index"); ComTool::redirect($url); } //根据群组id获取群组支持的分类,一级和二级 $cats = CategoryData::groupCategorys($gid); $this->assign('cats', $cats); $this->assign('group', $group); $this->display(); }
public function indexAction() { $cid = intval($this->param('cid', 0)); if (!$cid) { $url = ComTool::url("index"); ComTool::redirect($url); } $category = CategoryData::getById($cid); if (!$category) { $url = ComTool::url("index"); ComTool::redirect($url); } $curTime = time(); $category['start_time'] = '09:00:00'; $category['end_time'] = '24:00:00'; $startTime = strtotime($category['start_time']); $endTime = strtotime($category['end_time']); $notStart = $curTime < $startTime ? true : false; //true为尚未开始 $isOver = $curTime > $endTime ? true : false; //true为已结束 $isOn = !$notStart && !$isOver; //过程中 $this->assign('notStart', $notStart); $this->assign('isOver', $isOver); $this->assign('isOn', $isOn); $group = GroupData::getById($category['group_id']); $store = StoreData::getById($category['store_id']); $goods = GoodsData::getsByCid($cid); $cart = array(); $cart = $this->getCart($cid); $this->assign('category', $category); $this->assign('group', $group); $this->assign('store', $store); $this->assign('goods', $goods); $this->assign('products', $cart['products']); $this->assign('totalPrice', $cart['totalPrice']); $this->display(); }
public function Fillgroups() { $Profile = $_POST['profile']; $Admin = $_POST['admin']; $Groups = new GroupData(); echo $Groups->GetGroups($Profile, $Admin); }
<?php include "../../includes/inc.main.php"; $Head->setTitle("Perfiles"); $Head->setHead(); //$Status = $_GET['status']? $_GET['status']: 'A'; $Group = new GroupData(); ?> <body> <?php include '../../includes/inc.nav.php'; ?> <!-- Nav --> <div id="wrapper"><!-- Wrapper --> <div class="container-fluid"> <div class="maintitle"><h4 class="maintitletxt">Listado de Grupos</h4></div> <div class="glasscontainer1 optionsdiv"> <span id="delselected" class="delselected animated slideInDown"><i class="fa fa-trash"></i> Eliminar seleccionados</span> <a href="new.php"><button class="mainbtn"><i class="fa fa-plus-square"></i> Agregar Grupo</button></a> </div> <!-- Filters / Search --> <div class="container-fluid"> <div id="filtersuser" class="row row-centered filterdiv"> <form class="form-inline filterformdiv" role="form"> <div class="col-lg-3 col-sm-3 col-xs-12 form-group inputsgral"> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-bookmark-o fa-fw"></i></span> <select class="form-control" name="category"> <option>Categoría...</option> <option>Camas</option> <option>Perros</option>
<?php include "../../includes/inc.main.php"; $ID = $_GET['id']; $Edit = new GroupData($ID); $Data = $Edit->GetData(); ValidateID($Data); foreach ($Edit->GetUsers() as $User) { $Users .= $Users ? ',' . $User['admin_id'] : $User['admin_id']; } foreach ($Edit->GetProfiles() as $Profile) { $Profiles .= $Profiles ? ',' . $Profile['profile_id'] : $Profile['profile_id']; } $Menues = $DB->fetchAssoc("relation_menu_group", "DISTINCT(menu_id)", "group_id=" . $ID); foreach ($Menues as $MenuData) { $MenuArray[] = $MenuData['menu_id']; } if (is_array($MenuArray)) { $Menues = implode(",", $MenuArray); } else { $Menues = 0; } $Head->setTitle($Menu->GetTitle()); $Head->setStyle('../../../vendors/select2/select2.min.css'); // Select Inputs With Tags $Head->setStyle('../../../vendors/bootstrap-switch/bootstrap-switch.css'); // Switch On Off $Head->setHead(); include '../../includes/inc.top.php'; ?> <?php
<?php include "../../includes/inc.main.php"; //$Head->setTitle("Nuevo Usuario"); $Group = new GroupData(); $Head->setTitle($Menu->GetTitle()); $Head->setStyle('../../../vendors/select2/select2.min.css'); // Select Inputs With Tags $Head->setStyle('../../../vendors/bootstrap-switch/bootstrap-switch.css'); // Switch On Off $Head->setHead(); include '../../includes/inc.top.php'; ?> <?php echo insertElement("hidden", "action", 'insert'); ?> <?php echo insertElement("hidden", "menues", ""); ?> <?php echo insertElement("hidden", "profiles", ""); ?> <?php echo insertElement("hidden", "users", ""); ?> <?php echo insertElement("hidden", "newimage", $Group->GetDefaultImg()); ?> <div class="box animated fadeIn"> <div class="box-header flex-justify-center"> <div class="col-lg-8 col-sm-12">
/** * 获取圈子信息 */ public function getgroupAction() { if (ComTool::isAjax()) { $ajax = $this->get('ajax'); $field = $this->get('f'); $id = intval($this->get('id', 0)); if (empty($id)) { ComTool::ajax(100001, 'empty id'); } $group = GroupData::getById($id); if (!$group) { ComTool::ajax(100001, 'wrong id'); } ComTool::ajax(100000, 'ok', $group[$field]); } }
if ($ActualUser) { $TotalRegs = $DB->numRows('admin_user', '*', "user = '******' AND user<> '" . $ActualUser . "'"); } else { $TotalRegs = $DB->numRows('admin_user', '*', "user = '******'"); } if ($TotalRegs > 0) { echo $TotalRegs; } die; break; ///////////////////////////////////// FILL GROUPS ///////////////////////////////////////////////// ///////////////////////////////////// FILL GROUPS ///////////////////////////////////////////////// case 'fillgroups': $Profile = $_POST['profile']; $Admin = $_POST['admin']; $Groups = new GroupData(); echo $Groups->GroupTree($Profile, $Admin); die; break; //////////////////////////////////// PAGER //////////////////////////////////////////////////////// //////////////////////////////////// PAGER //////////////////////////////////////////////////////// case 'pager': $Page = $_POST['page']; if ($Page) { $Pager = $_SESSION[$_POST['pagerid']]; $Pager->SetActualPage($Page); if ($_SESSION['inactive_status']) { echo utf8_encode($Admin->MakeListInactive($Pager->CalculateRegFrom(), $Pager->GetPageRegs(), $Pager->GetWhere())); } else { echo utf8_encode($Admin->MakeList($Pager->CalculateRegFrom(), $Pager->GetPageRegs(), $Pager->GetWhere())); }
<?php include "../../includes/inc.main.php"; $ID = $_GET['id']; $Edit = new GroupData($ID); $Profile = new ProfileData(); $MenuTree = new Menu(); $MenuTree->SetCheckedMenues($Edit->GetCheckedMenues()); $Data = $Edit->GetData(); $Title = "Modificar grupo '" . $Data['title'] . "'"; $Head->setTitle("Modificar Grupo"); $Head->setHead(); ?> <body> <div id="wrapper"> <?php include '../../includes/inc.nav.php'; ?> <!-- Nav --> <?php echo insertElement("hidden", "action", 'update'); ?> <?php echo insertElement("hidden", "id", $ID); ?> <?php echo insertElement("hidden", "oldimage", $Data['image']); ?> <?php echo insertElement("hidden", "groupimage"); ?>
static function deleteUser($userId) { $deleted = GroupData::deleteUserGroups($userId); return !$deleted ? false : DBConn::delete("DELETE FROM " . DBConn::prefix() . "users WHERE id = :id LIMIT 1;", array(':id' => $userId)); }
<?php include "../../includes/inc.main.php"; $Head->setTitle("Crear Grupo"); $Head->setHead(); $Group = new GroupData(); $Profile = new ProfileData(); $MenuTree = new Menu(); ?> <body> <div id="wrapper"> <?php include '../../includes/inc.nav.php'; ?> <!-- Nav --> <?php echo insertElement("hidden", "action", 'insert'); ?> <?php echo insertElement("hidden", "groupimage", ''); ?> <?php echo insertElement("hidden", "menues", ''); ?> <?php echo insertElement("hidden", "profiles", ''); ?> <div class="windowHead"><h3><i class="fa fa-plus-square" aria-hidden="true"></i> Crear Grupo</h3></div> <div class="container animated fadeIn additemdiv"> <div class="col-sm-12 form-box formitems"> <div class="row">
public function MakeRegs($Mode = "List") { $Rows = $this->GetRegs(); //echo $this->lastQuery(); foreach ($Rows as $Row) { $Row = new GroupData($Row['group_id']); $ID = $Row->ID; $AllProfiles = $Row->GetProfiles(); $Profiles = ''; foreach ($AllProfiles as $Profile) { $Profiles .= '<span class="label label-primary">' . $Profile['title'] . '</span> '; } if (!$Profiles) { $Profiles = 'Ninguno'; } $Actions = '<span class="roundItemActionsGroup"><a href="edit.php?id=' . $ID . '"><button type="button" class="btn btnBlue"><i class="fa fa-pencil"></i></button></a>'; if ($Row->Data['status'] == "A") { $Actions .= '<a class="deleteElement" process="../../library/processes/proc.common.php" id="delete_' . $ID . '"><button type="button" class="btn btnRed"><i class="fa fa-trash"></i></button></a>'; } else { $Actions .= '<a class="activateElement" process="../../library/processes/proc.common.php" id="activate_' . $ID . '"><button type="button" class="btn btnGreen"><i class="fa fa-check-circle"></i></button></a>'; } $Actions .= '</span>'; switch (strtolower($Mode)) { case "list": $RowBackground = $i % 2 == 0 ? '' : ' listRow2 '; $Regs .= '<div class="row listRow' . $RowBackground . '" id="row_' . $ID . '" title="' . $Row->Data['title'] . '"> <div class="col-lg-4 col-md-4 col-sm-10 col-xs-10"> <div class="listRowInner"> <img class="img-circle" src="' . $Row->Data['image'] . '" alt="' . $Row->Data['title'] . '"> <span class="smallTitle">Título</span> <span class="listTextStrong">' . $Row->Data['title'] . '</span> </div> </div> <div class="col-lg-6 col-md-6 col-sm-6 hideMobile990"> <div class="listRowInner"> <span class="smallTitle">Perfiles</span> <span class="listTextStrong"> ' . $Profiles . ' </span> </div> </div> <div class="col-lg-2 col-md-2 col-sm-2 hideMobile990"></div> <div class="listActions flex-justify-center Hidden"> <div>' . $Actions . '</div> </div> </div>'; break; case "grid": $Regs .= '<li id="grid_' . $ID . '" class="RoundItemSelect roundItemBig ' . $Restrict . '" title="' . $Row->Data['title'] . '"> <div class="flex-allCenter imgSelector"> <div class="imgSelectorInner"> <img src="' . $Row->Data['image'] . '" alt="' . $Row->Data['title'] . '" class="img-responsive"> <div class="imgSelectorContent"> <div class="roundItemBigActions"> ' . $Actions . ' <span class="roundItemCheckDiv"><a href="#"><button type="button" class="btn roundBtnIconGreen Hidden" name="button"><i class="fa fa-check"></i></button></a></span> </div> </div> </div> <div class="roundItemText"> <p><b>' . $Row->Data['title'] . '</b></p> </div> </div> </li>'; break; } } if (!$Regs) { $Regs .= '<div class="callout callout-info"><h4><i class="icon fa fa-info-circle"></i> No se encontraron grupos.</h4><p>Puede crear un nuevo grupo haciendo click <a href="new.php">aqui</a>.</p></div>'; } return $Regs; }
/** * 提交订单 */ public function goAction() { if (ComTool::isAjax()) { if (!$this->isLogin()) { ComTool::ajax(Cola::getConfig('_error.mustlogin'), '请先登录,即将跳转至登录页面'); } $mobile = trim($this->post('mobile')); ComTool::checkEmpty($mobile, '请填写常用手机号'); if (!ComTool::isMobile($mobile)) { ComTool::ajax(100001, '请填写正确的手机号'); } $receiver = $this->post('receiver', ''); ComTool::checkMaxLen($receiver, 16, "收货人姓名最多16位"); $addrDesc = $this->post('addr_desc', ''); ComTool::checkMaxLen($addrDesc, 32, "详细位置最多32位"); $message = trim($this->post('message', '')); ComTool::checkMaxLen($message, 100, "留言最多100字"); $curCategory = $this->post('cate', 0); $curCategory = intval(base64_decode($curCategory)); if (!isset($_SESSION['cart'][$curCategory])) { ComTool::ajax(100001, '购物车为空'); } $cart = $this->getCart($curCategory); if (!$cart) { ComTool::ajax(100001, '购物车为空'); } $groupName = $this->post('group', ''); if (!$groupName) { $category = CategoryData::getById($curCategory); $group = GroupData::getById($category['group_id']); $groupName = $group['name']; } else { $groupName = base64_decode($groupName); } $currUser = $this->getCurrentUser(); $data = array(); $orderId = ComTool::getOrderId(); $data['id'] = $orderId; $data['user_id'] = $currUser['id']; $data['category_id'] = $curCategory; $data['user_name'] = $receiver; $data['user_tel'] = $mobile; $data['user_addr'] = "{$groupName} {$addrDesc}"; $data['message'] = $message; $data['create_time'] = $data['update_time'] = time(); $data['create_date'] = date("Y-m-d"); $data['total_cost'] = $cart['totalPrice']; $data['status'] = '1'; $res = OrderData::add($data); if ($res === false) { ComTool::ajax(100001, '服务器忙,请重试'); } $sql = "insert into order_detail(order_id,good_id,good_name,amount,`price`,price_desc,`status`) values"; foreach ($cart['products'] as $product) { $sql .= "('{$orderId}','{$product['id']}','{$product['name']}','{$product['quantity']}','{$product['price']}','{$product['price']}({$product['price_num']}{$product['price_unit']})','1'),"; } $sql = trim($sql, ','); $res = OrderData::sql($sql); if ($res === false) { ComTool::ajax(100001, '服务器忙,请重试'); } //TODO 清除此分类购物车的session ComTool::ajax(100000, 'ok'); } }
$Insert = $DB->execQuery('insert', 'admin_group', 'title,image,status,creation_date', "'" . $Title . "','" . $Image . "','A',NOW()"); $ID = $DB->GetInsertId(); for ($i = 0; $i < count($Menues); $i++) { $Values .= $i == 0 ? $ID . "," . $Menues[$i] : "),(" . $ID . "," . $Menues[$i]; } $DB->execQuery('insert', 'relation_menu_group', 'group_id,menu_id', $Values); $Values = ""; for ($i = 0; $i < count($Profiles); $i++) { $Values .= $i == 0 ? $ID . "," . $Profiles[$i] : "),(" . $ID . "," . $Profiles[$i]; } $DB->execQuery('insert', 'relation_group_profile', 'group_id,profile_id', $Values); die; break; case 'update': $ID = $_POST['id']; $Edit = new GroupData($ID); $Temp = $_POST['groupimage']; $OldImg = $_POST['oldimage']; $NewImg = $OldImg; if ($Temp) { $Tmp = array_reverse(explode("/", $Temp)); $NewImg = "../../../skin/images/groups/" . $Tmp[0]; $Edit->MoveImage($NewImg, $Temp, $OldImg); } $Title = htmlentities(strtolower($_POST['title'])); $Menues = $_POST['menues'] ? explode(",", $_POST['menues']) : array(); $Profiles = $_POST['profiles'] ? explode(",", $_POST['profiles']) : array(); $Insert = $DB->execQuery('update', 'admin_group', "title='" . $Title . "',image='" . $NewImg . "'", "group_id=" . $ID); //echo $DB->lastQuery(); $DB->execQuery('delete', 'relation_menu_group', "group_id = " . $ID); $DB->execQuery('delete', 'relation_group_profile', "group_id = " . $ID);
<?php include '../../includes/inc.main.php'; $Group = new GroupData(); $Head->setTitle("Grupos"); $Head->setIcon($Menu->GetHTMLicon()); $Head->setSubTitle("Listado de Grupos"); $Head->setHead(); /* Header */ include '../../includes/inc.top.php'; /* Body Content */ // Search List Box $Group->ConfigureSearchRequest(); echo $Group->InsertSearchList(); // Help Modal //include('modal.help.php'); /* Footer */ $Foot->SetScript('../../js/script.searchlist.js'); include '../../includes/inc.bottom.php';
/** * 添加分类 */ public function cateAction() { if (ComTool::isAjax()) { $group = $this->post('group'); $store = $this->post('store'); $level = $this->post('level'); $parent = $this->post('parent'); $name = $this->post('name'); $ename = $this->post('ename'); $desc = $this->post('desc'); $limit = $this->post('limit'); $days = $this->post('day'); $start = $this->post('start'); $end = $this->post('end'); $orderway = $this->post('orderway'); $status = $this->post('status'); $deliver_desc = $this->post('deliver_desc'); $data = array(); $data['group_id'] = $group; $data['store_id'] = $store; $data['level'] = $level; $data['pid'] = $parent; $data['name'] = $name; $data['ename'] = $ename; $data['desc'] = $desc; $data['create_time'] = time(); $data['update_time'] = time(); $data['time_limit'] = $limit; $data['days'] = $days; $data['start_time'] = $start; $data['end_time'] = $end; $data['order_way'] = $orderway; $data['status'] = $status; $data['deliver_desc'] = $deliver_desc; $res = CategoryData::add($data); ComTool::result($res, '失败', '成功'); } $parentCats = CategoryData::getParents(); $allCats = CategoryData::getsAll(); $groups = GroupData::getsAll(); $stores = StoreData::getsAll(); $this->assign('parentCats', $parentCats); $this->assign('allCats', $allCats); $this->assign('groups', $groups); $this->assign('stores', $stores); $this->display(); }
/** * 我的圈子 */ public function groupAction() { $currUser = $this->getCurrentUser(); $myGroups = UserGroupData::getGroupsByUid($currUser['id']); if ($myGroups) { $gids = array(); foreach ($myGroups as $group) { $gids[] = $group['group_id']; } $gids = join(',', $gids); $groups = GroupData::dataByWhere("id in ({$gids})"); foreach ($myGroups as &$group) { $group['name'] = $groups[$group['group_id']]['name']; } } $_SESSION['groups'] = $myGroups; $this->assign('myGroups', $myGroups); $this->display(); }