/** * 设计师案例 */ public function index() { parent::_initalize(); $this->assign("systemConfig", $this->systemConfig); $this->assign("gzlist", $this->getgzh()); #设计师 $cmod = new CityModel(); $pro_list = $cmod->getcity(1); $this->assign("pro_list", $pro_list); $is_qx = $this->getqx($_SESSION['my_info']['role']); $this->assign("is_qx", $is_qx); if ($is_qx == 0) { $p_id = $_GET['province']; $c_id = $_GET['city']; } else { $p_id = $_SESSION['my_info']['proid']; $c_id = $_SESSION['my_info']['cityid']; } $keys = $_GET['keys']; $keys = $keys == "请输入关键字" ? "" : $keys; $uid = $_GET['uid']; $this->assign("keys", $keys); $this->assign("uid", $uid); $this->assign("p_id", $p_id); $this->assign("c_id", $c_id); $this->assign("cityname", $cmod->getname($c_id)); import("ORG.Util.Page"); $where = "cases.type=2 "; if (!empty($p_id)) { $where .= " and cases.p_id=" . $p_id; } if (!empty($c_id)) { $where .= " and cases.c_id=" . $c_id; } if (!empty($keys)) { $where .= " and cases.title like '%" . $keys . "%'"; } if (!empty($uid)) { $where .= " and cases.uid=" . $uid; } $M = D("SjcaseView"); $totalRows = $M->where($where)->count(); $p = new Page($totalRows, 10); $list = $M->where($where)->order("cases.addtime desc")->limit($p->firstRow . "," . $p->listRows)->select(); $this->assign("page", $p->show()); $inf = (include_once './Common/config2.php'); foreach ($list as $k => $v) { $list[$k]['is_jds'] = $v['is_jd'] == 1 ? "经典" : "普通"; $list[$k]['status_f'] = $v['status'] == 1 ? "已审核" : "未审核"; } $this->assign("list", $list); $this->assign("jd", $inf['zxjd']); $this->display(); }
public function delete($id) { $this->db->start_transaction(); # delete city related by state $city = new CityModel(); $city->delete_by_state($id); # remove the state itself $condition = array(StateModel::$primary_key => $id); $this->db->delete(StateModel::$table_name, $condition); $this->db->complete_transaction(); return $this->db->transaction_status(); }
/** * 视频列表 */ public function index() { parent::_initalize(); $this->assign("systemConfig", $this->systemConfig); $is_qx = $this->getqx($_SESSION['my_info']['role']); $where = "1"; if ($is_qx == 1) { $where .= " and p_id=" . $_SESSION['my_info']['proid']; $where .= " and c_id=" . $_SESSION['my_info']['cityid']; } else { $citymod = new CityModel(); $plist = $citymod->getprovince(1); $this->assign("plist", $plist); $p_id = $_GET['p_id']; $c_id = $_GET['c_id']; if (!empty($p_id)) { $where .= " and p_id=" . $p_id; } if (!empty($c_id)) { $where .= " and c_id=" . $c_id; } $this->assign("p_id", $p_id); $this->assign("c_id", $c_id); $this->assign("cname", $citymod->getname($c_id)); } $this->assign("is_qx", $is_qx); $keys = $_GET['keys']; $keys = $keys == "请输入关键字" ? "" : $keys; $uid = $_GET['uid']; if (!empty($keys)) { $where .= " and title like '%" . $keys . "%'"; } if (!empty($uid)) { $where .= " and uid=" . $uid; } $this->assign("uid", $uid); $this->assign("keys", $keys); $M = M("Shipin"); $cou = $M->where($where)->count(); import("ORG.Util.Page"); $p = new Page($cou, 10); $list = $M->where($where)->limit($p->firstRow . "," . $p->listRows)->order("addtime desc")->select(); $arr = array("未审核", "已审核"); foreach ($list as $k => $v) { $list[$k]['status_f'] = $arr[$v['status']]; } $this->assign("list", $list); $this->assign("page", $p->show()); $conf = (include './Common/config2.php'); $memtype = $conf['memtp']; $this->assign("tplist", $memtype); $this->display(); }
function afterLoad() { $ui_model = new UserInterestsModel(); //$this->interest = implode(", ", $ui_model -> getInterests($this -> id)); $country_model = new CountryModel(); $country_model->load($this->country_id); $this->country = $country_model->name; $state_model = new StateModel(); $state_model->load($this->state_id); $this->state = $state_model->name; $city_model = new CityModel(); $city_model->load($this->city_id); $this->city = $city_model->name; }
/** * 加盟列表 */ public function index() { parent::_initalize(); $this->assign("systemConfig", $this->systemConfig); $citymod = new CityModel(); $province = $_GET['province']; $city = $_GET['city']; $where = "1"; if ($this->getqx($_SESSION['my_info']['role']) == 0) { //非地区管理员 $pro_list = $citymod->getprovince(1); $this->assign("pro_list", $pro_list); if (!empty($province)) { $where .= " and Zixun.p_id=" . $province; } if (!empty($city)) { $where .= " and Zixun.c_id=" . $city; } $this->assign("is_qx", $this->getqx($_SESSION['my_info']['role'])); $this->assign("province", $province); $this->assign("city", $city); $cityname = $citymod->getname($city); $this->assign("cityname", $cityname); } else { $where .= " and p_id=" . $_SESSION['my_info']['proid']; $where .= " and c_id=" . $_SESSION['my_info']['cityid']; $this->assign("is_qx", $this->getqx($_SESSION['my_info']['role'])); } $keys = $_GET['keys']; $keys = $keys == "请输入关键字" ? "" : $keys; $uid = $_GET['uid']; if (!empty($keys)) { $where .= " and Zixun.name like '%" . $keys . "%'"; } $this->assign("keys", $keys); $M = D("ZixunView"); $cou = $M->where($where)->count(); import("ORG.Util.Page"); $p = new Page($cou, 10); $list = $M->where($where)->limit($p->firstRow . "," . $p->listRows)->order("Zixun.addtime desc")->select(); $arr = array("未审核", "已审核"); foreach ($list as $k => $v) { $list[$k]['status_f'] = $arr[$v['status']]; $list[$k]['addtime_f'] = date("Y-m-d", $v['addtime']); } $this->assign("list", $list); $this->assign("page", $p->show()); $this->display(); }
/** * 意见反馈列表 */ public function index() { parent::_initalize(); $this->assign("systemConfig", $this->systemConfig); @import("ORG.Util.Page"); $where = "1"; if ($is_qx == 0) { //非地区管理员 $p_id = $_GET['p_id']; $c_id = $_GET['c_id']; //省 $mcity = new CityModel(); $plist = $mcity->getprovince(1); $this->assign("plist", $plist); $this->assign("p_id", $p_id); $this->assign("c_id", $c_id); $this->assign("c_name", $mcity->getname($c_id)); } else { $p_id = $_SESSION['my_info']['proid']; $c_id = $_SESSION['my_info']['cityid']; } if (!empty($p_id)) { $where .= " and Yijian.p_id=" . $p_id; } if (!empty($c_id)) { $where .= " and Yijian.c_id=" . $c_id; } $keys = trim($_GET['keys']); $keys = $keys == "请输入关键字" ? "" : $keys; $where .= " and Yijian.content like '%" . $keys . "%'"; $this->assign("keys", $keys); $yjv = D("YijianView"); $totalRows = $yjv->where($where)->count(); $pm = new Page($totalRows, 10); $list = $yjv->where($where)->order("Yijian.addtime desc")->limit($pm->firstRow . "," . $pm->listRows)->select(); $islx = array("0" => "未联系", "1" => "已联系"); foreach ($list as $k => $v) { $list[$k]['addtimef'] = date("Y-m-d H:i:s", $v['addtime']); $list[$k]['islxf'] = $islx[$v['is_lx']]; } $this->assign("list", $list); $this->assign("page", $pm->show()); #echo $yjv->getLastSql(); #省 $this->display(); }
public function deleteAction() { if (!isset($_POST['city_id'])) { return json_encode(["error" => "city_id missing"]); } $city_id = $_POST['city_id']; CityModel::delete($this->pdo, $city_id); return json_encode(["message" => "Supprimé !", "city_id" => $city_id]); }
/** * 设计师 预约列表 */ public function gzyy() { parent::_initalize(); $this->assign("systemConfig", $this->systemConfig); $Mod = D("YuyueView"); import("ORG.Util.Page"); $where = "Yuyue.ytype=2"; $citymod = new CityModel(); if ($this->getqx($_SESSION['my_info']['role']) == 1) { $where .= " and Yuyue.p_id=" . $_SESSION['my_info']['proid']; $where .= " and Yuyue.c_id=" . $_SESSION['my_info']['cityid']; } else { $p_list = $citymod->getprovince(1); $this->assign("p_list", $p_list); $p_id = $_GET['p_id']; $c_id = $_GET['c_id']; if (!empty($p_id)) { $where .= " and Yuyue.p_id=" . $p_id; } if (!empty($c_id)) { $where .= " and Yuyue.c_id=" . $c_id; } $this->assign("c_id", $c_id); $this->assign("c_name", $citymod->getname($c_id)); $this->assign("p_id", $p_id); } $keys = $_GET['keys']; $keys = $keys == "请输入关键字" ? "" : $keys; if (!empty($keys)) { $where .= " and Yuyue.name like '%" . $keys . "%'"; } $this->assign("keys", $keys); $totalRows = $Mod->where($where)->count(); $p = new Page($totalRows, 10); $list = $Mod->where($where)->order("Yuyue.addtime desc")->limit($p->firstRow . "," . $p->listRows)->select(); $arr = array("未审核", "已审核"); foreach ($list as $k => $v) { $list[$k]['status_f'] = $arr[$v['status']]; } $this->assign("list", $list); $this->assign("page", $p->show()); $this->display(); }
public function AddEntityAction() { $request = Project::getRequest(); $this->setViewVars(); $this->setFormParams(); $geo_type = new GeoTypeModel(); $geo_type->load($this->session->geo_type_id); $this->_view->assign('geo_type_name', $geo_type->name); $city = new CityModel(); $city->load($this->session->city_id); $this->_view->assign('city_name', $city->name); $country = new CountryModel(); $country->load($this->session->country_id); $this->_view->assign('country_name', $country->name); $place = new GeoPlaceModel(); $place->loadById($this->session->geo_place_id); $this->_view->assign('place_name', $place->name); // Creating type if ($request->create_type) { $this->_view->clearFlashMessages(); if ($request->type_name) { // Creating type $obj = new GeoSubtypeModel(); $obj->name = htmlspecialchars($request->type_name); $obj->geo_type_id = $this->session->geo_type_id; $obj->save(); Project::getResponse()->redirect(Project::getRequest()->createUrl("Places", "Index")); } else { $this->_view->addFlashMessage(FM::ERROR, 'Введите название типа'); } } // Creating place if ($request->create_place) { $this->_view->clearFlashMessages(); if ($request->place_name) { // Creating type $obj = new GeoPlaceModel(); $obj->name = htmlspecialchars($request->place_name); $obj->geo_subtype_id = $this->session->geo_subtype_id; $obj->city_id = $this->session->city_id; $obj->user_id = $this->user->id; $obj->creation_date = date("Y-m-d H:i:s"); $obj->save(); Project::getResponse()->redirect(Project::getRequest()->createUrl("Places", "Index")); } else { $this->_view->addFlashMessage(FM::ERROR, 'Введите название места'); } } // Adding place to user if ($request->create_object_at_user) { $obj = new UsersGeoPlaceModel(); $obj->user_id = $this->user->id; $obj->geo_place_id = $this->session->geo_place_id; $obj->date_start = htmlspecialchars($request->year_begin); $obj->date_end = htmlspecialchars($request->year_end); $obj->surname = htmlspecialchars($request->surname); $obj->save(); Project::getResponse()->redirect(Project::getRequest()->createUrl("Places", "Index")); } // Editing place at user if ($request->edit_object_at_user) { $obj = new UsersGeoPlaceModel(); $obj->load($request->id); $obj->date_start = htmlspecialchars($request->year_begin); $obj->date_end = htmlspecialchars($request->year_end); $obj->surname = htmlspecialchars($request->surname); $obj->save(); Project::getResponse()->redirect(Project::getRequest()->createUrl("Places", "Index")); } $this->_view->ListPlaces(); $this->_view->parse(); }
/** * 查看详情 */ public function ins() { parent::_initalize(); $systemConfig = $this->systemConfig; $this->assign("systemConfig", $systemConfig); $aid = $_GET['aid']; $amod = new Admininfo1Model(); $inf = $amod->getinfo($aid, 1); $citymod = new CityModel(); $inf['province'] = $citymod->getproname($inf['cityid']); $inf['city'] = $citymod->getname($inf['cityid']); $this->assign("info", $inf); $this->display(); }
/** * 设置地区 */ public function setcitydq() { if (IS_POST) { $id = $_POST['id']; //省id $diqu = $_POST['diqu']; //获取市的id $m = new CityModel(); $pidstr = $m->getsqid($id); #修改地区 $res = $m->updatedq($pidstr, $diqu); if ($res) { $this->success("操作成功", U("Index/city")); } else { $this->error("操作失败"); } exit; } parent::_initalize(); $this->assign("systemConfig", $this->systemConfig); $id = $_GET['id']; $this->assign("id", $id); $cof = (include WEB_ROOT . 'Common/config2.php'); $this->assign("diqu", $cof['diqu']); $this->display(); }
/** * 编辑广告 */ public function editad() { if (IS_POST) { $id = $_POST['id']; $M = M("Adview"); $info = $M->where("id=" . $id)->find(); $title = trim($_POST['title']); $link = trim($_POST['link']); $weizhi = $_POST['weizhi']; $p_id = $_POST['p_id']; $c_id = $_POST['c_id']; if (empty($title)) { $this->error("名称不能为空!"); exit; } if (empty($weizhi)) { $this->error("请选择位置!"); exit; } if ($this->getqx($_SESSION['my_info']['role']) == 0) { //非地区管理员 if (empty($p_id)) { $this->error("请选省!"); exit; } if (empty($c_id)) { $this->error("请选市!"); exit; } } else { $p_id = $_SESSION['my_info']['proid']; $c_id = $_SESSION['my_info']['cityid']; if (empty($p_id)) { $this->error("该管理员没有选择省!"); exit; } if (empty($c_id)) { $this->error("该管理员没有选择市!"); exit; } } if (!empty($_FILES['img']['name'])) { $imgsrc = $this->upload("./Uploads/ad/"); if (empty($imgsrc[0]['savename'])) { $img = ""; } else { $img = "/Uploads/ad/" . $imgsrc[0]['savename']; } if (!empty($info['img'])) { unlink($info['img']); } } $data = array(); if (!empty($img)) { $data['img'] = $img; } if (!empty($link)) { $data['link'] = $link; } if (!empty($title)) { $data['title'] = $title; } if (!empty($weizhi)) { $data['weizhi'] = $weizhi; } if (!empty($p_id)) { $data['p_id'] = $p_id; } if (!empty($c_id)) { $data['c_id'] = $c_id; } $data['addtime'] = time(); $data['adduid'] = $_SESSION['my_info']['a_id']; $res = M("Ad")->where("id=" . $id)->save($data); if ($res) { $this->success("操作成功", U("Ad/adlist")); } else { $this->error("操作失败"); } exit; } parent::_initalize(); $this->assign("systemConfig", $this->systemConfig); $id = $_GET['id']; $M = M("Adview"); $info = $M->where("id=" . $id)->find(); //位置 $wzm = M("Adweizhi"); $wzlist = $wzm->where("1")->order("addtime desc")->select(); $this->assign("wzlist", $wzlist); //省 if ($this->getqx($_SESSION['my_info']['role']) == 0) { //非地区管理员 $mcity = new CityModel(); $plist = $mcity->getprovince(1); $this->assign("plist", $plist); $this->assign("c_id", $info['c_id']); $this->assign("c_name", $info['c_name']); } $this->assign("info", $info); $is_qx = $this->getqx($_SESSION['my_info']['role']); $this->assign("is_qx", $is_qx); $this->display("addad"); }
public function index() { if (in_array(Auth::getCapability(), array(CAPABILITY_ADMINISTRATOR))) { Model::autoloadModel('city'); $model = new CityModel($this->db); $this->para = new stdClass(); if (isset($_POST['type'])) { $this->para->type = $_POST['type']; } if (isset($_POST['orderby'])) { $this->para->orderby = $_POST['orderby']; } if (isset($_POST['order'])) { $this->para->order = $_POST['order']; } if (isset($_POST['page'])) { $this->para->page = $_POST['page']; } if (isset($_POST['s'])) { $this->para->s = $_POST['s']; } if (isset($_POST['paged'])) { $this->para->paged = $_POST['paged']; } if (isset($_POST['cities'])) { $this->para->cities = $_POST['cities']; } if (isset($_POST['action'])) { $this->para->action = $_POST['action']; } if (isset($_POST['action2'])) { $this->para->action2 = $_POST['action2']; } if (isset($_POST['description_show'])) { $this->para->description_show = $_POST['description_show']; } if (isset($_POST['slug_show'])) { $this->para->slug_show = $_POST['slug_show']; } if (isset($_POST['tours_show'])) { $this->para->tours_show = $_POST['tours_show']; } if (isset($_POST['cities_per_page'])) { $this->para->cities_per_page = $_POST['cities_per_page']; } if (isset($_POST['current_rating'])) { $this->para->current_rating = $_POST['current_rating']; } if (isset($_POST['vote_times'])) { $this->para->vote_times = $_POST['vote_times']; } if (isset($_POST['adv_setting'])) { $this->para->adv_setting = $_POST['adv_setting']; } if (isset($this->para->adv_setting) && $this->para->adv_setting == "adv_setting") { $model->changeAdvSetting($this->para); } if (isset($this->para->type) && in_array($this->para->type, array("action", "action2")) && isset($this->para->cities)) { $model->executeAction($this->para); } $model->search($this->view, $this->para); if (count((array) $this->para) > 0) { $this->view->ajax = TRUE; $this->view->renderAdmin(RENDER_VIEW_CITY_INDEX, TRUE); } else { $this->view->renderAdmin(RENDER_VIEW_CITY_INDEX); } } else { $this->login(); } }
/** * 编辑单页面 */ public function edit_webpage() { if (IS_POST) { $name = trim($_POST['name']); $ywname = trim($_POST['ywname']); $p_id = trim($_POST['p_id']); $c_id = trim($_POST['c_id']); $contents = trim($_POST['contents']); $id = $_POST['id']; $M = M("Webpages"); $data = array("name" => $name, "contents" => $contents, "ywname" => $ywname, "p_id" => $p_id, "c_id" => $c_id); $rs = $M->where("id=" . $id)->save($data); if ($rs) { $this->success("操作成功!", U("Webpages/index")); } else { $this->error("操作失败!"); } exit; } parent::_initalize(); $this->assign("systemConfig", $this->systemConfig); $id = $_GET['id']; $wmod = M("Webpages"); $info = $wmod->where("id=" . $id)->find(); $this->assign("info", $info); #-------------------------------------------------------------省start $is_qx = $this->getqx($_SESSION['my_info']['role']); if ($is_qx == 0) { #省 $citymod = new CityModel(); $plist = $citymod->getprovince(1); $this->assign("plist", $plist); } else { $p_id = $_SESSION['my_info']['proid']; $c_id = $_SESSION['my_info']['cityid']; } $p_id = $info['p_id']; $c_id = $info['c_id']; $c_name = $citymod->getname($c_id); $this->assign("p_id", $p_id); $this->assign("c_id", $c_id); $this->assign("c_name", $c_name); #-------------------------------------------------------------省end $this->display("add_webpage"); }
public function ChangeStatesAction() { $request = Project::getRequest(); $state_id = $request->getKeyByNumber(0); if ($state_id) { $info = array(); $state_model = new CityModel(); $info['city_list'] = $state_model->loadByState($state_id); $this->_view->ChangeState($info); $this->_view->ajax(); } else { $response = Project::getAjaxResponse(); $response->block('city_div', true, ''); $this->_view->ajax(); } }
public function indexAction() { $destinations = CityModel::getList($this->pdo); include "../view/home.php"; return; }
/** * 编辑 * 团购活动 */ public function edit_group() { if (IS_POST) { $title = trim($_POST['title']); $is_tj = $_POST['is_tj']; $p_id = $_POST['p_id']; $c_id = $_POST['c_id']; $q_id = $_POST['q_id']; $status = $_POST['status']; $starthdtime = $_POST['starthdtime']; $endhdtime = $_POST['endhdtime']; $address = trim($_POST['address']); $shuoming = trim($_POST['shuoming']); $chengchelx = str_replace("\n", ",", $chengchelx); $bmnum = trim($_POST['bmnum']); $id = $_POST['id']; if (!empty($starthdtime)) { $starthdtime1 = strtotime($starthdtime); } if (!empty($endhdtime)) { $endhdtime1 = strtotime($endhdtime); } if ($starthdtime1 > $endhdtime1) { $this->error("开始时间不能大于结束时间!"); exit; } $M = D("GroupView"); $info1 = $M->where("id=" . $id)->find(); $img = $this->upload(); if (!empty($img)) { foreach ($img as $k => $v) { if ($v['key'] == "mapimg") { unlink("." . $info1['mapimg']); $mapimg = "/Uploads/product/" . $v['savename']; } else { unlink("." . $info1['hdimg']); $hdimg = "/Uploads/product/" . $v['savename']; } } } $data = array(); if (!empty($title) && $title != $info1['title']) { $data['title'] = $title; } if ($is_tj != $info1['is_tj']) { $data['is_tj'] = $is_tj; } if ($p_id != $info1['p_id']) { $data['p_id'] = $p_id; } if ($c_id != $info1['c_id']) { $data['c_id'] = $c_id; } if ($q_id != $info1['q_id']) { $data['q_id'] = $q_id; } if ($starthdtime1 != $info1['starthdtime']) { $data['starthdtime'] = $starthdtime1; } if ($endhdtime1 != $info1['endhdtime']) { $data['endhdtime'] = $endhdtime1; } if ($address != $info1['address']) { $data['address'] = $address; } if ($shuoming != $info1['shuoming']) { $data['shuoming'] = $shuoming; } if ($chengchelx != $info1['chengchelx']) { $data['chengchelx'] = $chengchelx; } if (!empty($mapimg)) { $data['mapimg'] = $mapimg; } if (!empty($hdimg)) { $data['hdimg'] = $hdimg; } if (!empty($bmnum) && $bmnum != $info1['bmnum']) { $data['bmnum'] = $bmnum; } $data['addtime'] = time(); if ($status != $info1['status']) { $data['status'] = $status; } $rs = $M->where("id=" . $id)->save($data); if ($rs) { $this->success("操作成功!", U("Group/index")); } else { $this->error("操作失败!"); } exit; } parent::_initalize(); $this->assign("systemConfig", $this->systemConfig); $id = $_GET['id']; $M = D("GroupView"); $info = $M->where("Group1.id=" . $id)->find(); $info['chengchelx'] = str_replace(",", "\n", $info['chengchelx']); $is_qx = $this->getqx($_SESSION['my_info']['role']); $citymod = new CityModel(); if ($is_qx == 1) { #区管理员 $p_id = $_SESSION['my_info']['proid']; $c_id = $_SESSION['my_info']['cityid']; $qlist = $citymod->getcity($c_id); $this->assign("qlist", $qlist); } else { #省 $plist = $citymod->getprovince(1); $this->assign("plist", $plist); $this->assign("c_name", $info['c_name']); $this->assign("q_name", $info['q_name']); } $this->assign("starthdtime", date("Y-m-d H:i", $info['starthdtime'])); $this->assign("endhdtime", date("Y-m-d H:i", $info['endhdtime'])); $this->assign("info", $info); $this->assign("is_edit", 1); $this->assign("comname", $this->getgzh_ins($info['uid'])); $this->display("add_group"); }
/** * 获取地区 */ public function getqu() { header('Content-Type:application/json; charset=utf-8'); $cid = $_POST['cid']; $citymod = new CityModel(); $pro_list = $citymod->getqu($cid); if ($pro_list) { echo json_encode(array("status" => 1, "data" => $pro_list)); } else { echo json_encode(array("status" => 0, "data" => array())); } }
public function update() { if ($this->isLogged()) { $page = $this->getPage(); $this->load->model('VisitorModel'); $this->load->model('AddressModel'); $this->load->model('DistrictModel'); $this->load->model('CityModel'); $this->load->model('StateModel'); $address = new AddressModel(); $district = new DistrictModel(); $city = new CityModel(); $state = new StateModel(); $visitor = new VisitorModel(); // VARIÁVEIS VÃO RECEBER TODAS AS INFORMAÇÕES ENVIADAS PELO FORMULÁRIO PARA TRABALHAR DENTRO DO CONTROLADOR $vid = $this->input->get('id'); $vstatus = $this->input->get('status'); $vmaker = $this->input->get('maker'); $vname = mb_strtoupper($this->input->get('name')); $vcpf = $this->input->get('cpf'); $vrg = $this->input->get('rg'); $vphone = $this->input->get('phone'); $vstreet = mb_strtoupper($this->input->get('street')); $vnumber = $this->input->get('number'); $vcep = $this->input->get('cep'); $vdistrict = mb_strtoupper($this->input->get('district')); $vcity = mb_strtoupper($this->input->get('city')); $vuf = $this->input->get('uf'); // *********************************************************************************************************************** // // cityaux vai receber do banco uma cidade cuja qual o estado relacionado tenha uf igual a fornecida no formulario $cityaux = null; $districtaux = null; $addressaux = null; $cityaux = $city->surecity($vcity, $vuf); if (!$cityaux) { // se esta cidade não existir, ele deve salvar ela no banco de dados $citydata['idcity'] = null; $citydata['namecity'] = $vcity; $citydata['state'] = $vuf; if ($city->save($citydata)) { // caso salve corretamente, cityaux passa a receber essa nova cidade salva $cityaux = $city->lastinsert(); } else { // caso não salve a cidade, já fica impossibilitado o restante do código, não cadastranso o visitante return false; } } // districtaux vai receber do banco um bairro cujo qual a cidade relacionada é a mesma definida em cityaux $districtaux = $district->suredistrict($vdistrict, $cityaux['idcity']); if (!$districtaux) { // se este bairro não existir, deve ser criado $districtdata['iddistrict'] = NULL; $districtdata['namedistrict'] = $vdistrict; $districtdata['city'] = $cityaux['idcity']; if ($district->save($districtdata)) { // caso salvo corretamente, districtaux recebe o novo bairro salvo $districtaux = $district->lastinsert(); } else { // caso não salve o bairro, já fica impossibilitado o restante do código, não cadastranso o visitante return false; } } // COM CIDADE E BAIRRO DEFINIDAS, AGORA É HORA DE SALVAR O ENDEREÇO // PARA CADA NOVO USUÁRIO, UM NOVO ENDEREÇO DEVE SER SALVO $visitoraux = $visitor->search($vid); $addressaux = $address->search($visitoraux['address']); $addressdata['idaddress'] = $addressaux['idaddress']; $addressdata['street'] = $vstreet; $addressdata['number'] = $vnumber; $addressdata['cep'] = $vcep; $addressdata['district'] = $districtaux['iddistrict']; $address->update($addressdata); $visitordata['id'] = $vid; $visitordata['name'] = $vname; $visitordata['cpf'] = $vcpf; $visitordata['rg'] = $vrg; $visitordata['phone'] = $vphone; $visitordata['address'] = $addressaux['idaddress']; $visitordata['maker'] = $vmaker; $visitordata['status'] = $vstatus; if ($visitor->update($visitordata)) { if ($this->session->userdata('incourse') === TRUE) { $current = array("id" => 4, "page" => "user"); $page = array("current" => $current); $this->load->view('template/user/header', $page); $delivery = $visitor->searchforcpf($vcpf); $msg = array("visitors" => $delivery); $this->load->view('user/newloan', $msg); } else { $this->load->view('template/user/header', $page); $savesuccess = array("id" => "1", "class" => "success", "message" => "Cadastro atualizado com sucesso!"); $delivery = $visitor->searchforcpf($vcpf); $msg = array("visitors" => $delivery, "savesuccess" => $savesuccess); $this->load->view('user/visitor', $msg); } $this->load->view('template/public/footer'); } else { return false; } } }
/** * 优惠券列表 */ public function list_yhq() { parent::_initalize(); $this->assign('systemConfig', $this->systemConfig); import("ORG.Util.Page"); $M = M("Yhq"); $where = '1'; $is_qx = $this->getqx($_SESSION['my_info']['role']); if ($is_qx == 1) { $p_id = $_SESSION['my_info']['proid']; $c_id = $_SESSION['my_info']['cityid']; } else { $p_id = $_GET['p_id']; $c_id = $_GET['c_id']; $this->assign("p_id", $p_id); $this->assign("c_id", $c_id); $citymod = new CityModel(); $plist = $citymod->getprovince(1); $this->assign("plist", $plist); $this->assign("cname", $citymod->getname($c_id)); } $this->assign("is_qx", $is_qx); $startdate = $_GET['startdate']; $startdate1 = $_GET['startdate1']; $enddate = $_GET['enddate']; $enddate1 = $_GET['enddate1']; $this->assign("startdate", $startdate); $this->assign("startdate1", $startdate1); $this->assign("enddate", $enddate); $this->assign("enddate1", $enddate1); if (!empty($startdate)) { $starttime = strtotime($startdate); } if (!empty($startdate1)) { $starttime1 = strtotime($startdate1); } if (!empty($enddate)) { $endtime = strtotime($enddate); } if (!empty($enddate1)) { $endtime1 = strtotime($enddate1); } if ($starttime > $starttime1) { $this->error("开始时间第一个不能大于第二个"); exit; } if ($endtime > $endtime1) { $this->error("结束时间第一个不能大于第二个"); exit; } if (!empty($p_id)) { $where .= " and p_id=" . $p_id; } if (!empty($c_id)) { $where .= " and c_id=" . $c_id; } if (!empty($starttime) && !empty($starttime1)) { $where .= " and (startdate between '" . $starttime . "' and '" . $starttime1 . "' )"; } if (!empty($endtime) && !empty($endtime1)) { $where .= " and (enddate between '" . $endtime . "' and '" . $endtime1 . "' )"; } $totalRows = $M->where($where)->count(); $p = new Page($totalRows, 10); $list = $M->where($where)->order(" addtime desc ")->limit($p->firstRow . "," . $p->listRows)->select(); $arr = array("普通", '推荐'); $arr1 = array("未审核", "已审核"); foreach ($list as $k => $v) { $list[$k]['is_tj_f'] = $arr[$v['is_tj']]; $list[$k]['status_f'] = $arr1[$v['status']]; $list[$k]['startdate'] = date("Y-m-d H:i", $v['startdate']); $list[$k]['enddate'] = date("Y-m-d H:i", $v['enddate']); } $this->assign("list", $list); $this->assign("page", $p->show()); $this->display(); }
function ChangeStateAction() { $request = Project::getRequest(); $state_id = $request->getKeyByNumber(0); $info = array(); $state_model = new CityModel(); $info['city_list'] = $state_model->loadByState($state_id); $this->_view->ChangeState($info); $this->_view->ajax(); }
/** * 列表小区 */ public function listxq() { parent::_initalize(); $this->assign("systemConfig", $this->systemConfig); $where = "1"; $cmod = new CityModel(); if ($this->getqx($_SESSION['my_info']['role']) == 1) { //地区管理员 $p_id = $_SESSION['my_info']['proid']; $c_id = $_SESSION['my_info']['cityid']; $qlist = $cmod->getcity($c_id); $this->assign("qlist", $qlist); $this->assign("p_id", $p_id); $this->assign("c_id", $c_id); $this->assign("is_qx", 1); } else { $p_id = $_GET['p_id']; $c_id = $_GET['c_id']; $plist = $cmod->getcity(1); $this->assign("plist", $plist); $this->assign("p_id", $p_id); $this->assign("c_id", $c_id); $this->assign("c_name", $cmod->getname($c_id)); $this->assign("is_qx", 0); } $q_id = $_GET['q_id']; $this->assign("q_id", $q_id); $this->assign("q_name", $cmod->getname($q_id)); $keys = $_GET['keys']; $keys = $keys == "请输入关键字" ? "" : $keys; $this->assign("keys", $keys); @import("ORG.Util.Page"); $mod = D("XqView"); if (!empty($p_id)) { $where .= " and Xq.p_id=" . $p_id; } if (!empty($c_id)) { $where .= " and Xq.c_id=" . $c_id; } if (!empty($q_id)) { $where .= " and Xq.q_id=" . $q_id; } if (!empty($keys)) { $where .= " and Xq.name like '%" . $keys . "%'"; } $totalRows = $mod->where($where)->count(); $page = new Page($totalRows, 10); $list = $mod->where($where)->limit($page->firstRow . "," . $page->listRows)->order("Xq.addtime desc ")->select(); foreach ($list as $k => $v) { $list[$k]['addtimef'] = date("Y-m-d H:i:s", $v['addtime']); } $this->assign("list", $list); $this->assign("page", $page->show()); $this->display(); }
/** * 编辑友情链接 */ public function editfirendlink() { $m = M("Firendlink"); if (IS_POST) { $id = $_POST['id']; $name = trim($_POST['name']); if (empty($name)) { $this->error("名称不能为空!"); exit; } if ($_FILES['logo']['name'] != '') { $imginfo = $this->upload('./Uploads/fl/'); if (!empty($imginfo[0]['savename'])) { $logo = "/Uploads/fl/" . $imginfo[0]['savename']; } else { $logo = ""; } } $link = trim($_POST['link']); $orders = trim($_POST['orders']); $is_tj = $_POST['is_tj']; $p_id = $_POST['p_id']; $c_id = $_POST['c_id']; $data = array(); if (!empty($name)) { $data['name'] = $name; } if (!empty($logo)) { $data['logo'] = $logo; } if (!empty($link)) { $data['link'] = $link; } if (!empty($orders)) { $data['orders'] = $orders; } if (!empty($is_tj)) { $data['is_tj'] = $is_tj; } if (!empty($p_id)) { $data['p_id'] = $p_id; } if (!empty($c_id)) { $data['c_id'] = $c_id; } $res = $m->where("id=" . $id)->save($data); if ($res) { $this->success("操作成功!", U("Firendlink/index")); } else { $this->error("操作失败!"); } exit; } parent::_initalize(); $this->assign("systemConfig", $this->systemConfig); $id = $_GET['id']; $info = $m->where("id=" . $id)->find(); $this->assign("info", $info); if ($this->getqx($_SESSION['my_info']['role']) == 0) { #读取省 $mcity = new CityModel(); $plist = $mcity->getprovince(1); $this->assign("plist", $plist); $this->assign("c_id", $info['c_id']); $this->assign("c_name", $mcity->getname($info['c_id'])); } $this->assign("is_qx", $this->getqx($_SESSION['my_info']['role'])); $this->display("addfriendlink"); }
/** * validateUpdateInfo * * Validate para for update info of internalflight * * @param stdClass $para para for update info of internalflight */ public function validateUpdateInfo($para) { if ($para == null || !is_object($para)) { $_SESSION["fb_error"][] = ERROR_UPDATE_INFO_INTERNALFLIGHT; return false; } if (!(isset($para->post_title) && $para->post_title != "")) { $_SESSION["fb_error"][] = ERROR_INTERNALFLIGHT_TITLE_EMPTY; return false; } $post_name = strtolower(preg_replace('/\\s+/', '-', $para->post_title)); if (!(isset($post_name) && $post_name != "")) { $_SESSION["fb_error"][] = ERROR_INTERNALFLIGHT_TITLE_EMPTY; return false; } $para->post_name = $post_name; if (!(isset($para->city_id) && $para->city_id != "0")) { $_SESSION["fb_error"][] = ERROR_INTERNALFLIGHT_CITY_EMPTY; return false; } else { Model::autoloadModel("city"); $cityModel = new CityModel($this->db); $cityBO = $cityModel->get($para->city_id); if ($cityBO == NULL || !(isset($cityBO->taxonomy) && $cityBO->taxonomy == "city")) { $_SESSION["fb_error"][] = ERROR_INTERNALFLIGHT_CITY_NOT_EXIST; return false; } } if (!(isset($para->country_id) && $para->country_id != "0")) { $_SESSION["fb_error"][] = ERROR_COUNTRY_EMPTY; return false; } else { Model::autoloadModel("country"); $countryModel = new CityModel($this->db); $countryBO = $countryModel->get($para->country_id); if ($countryBO == NULL || !(isset($countryBO->taxonomy) && $countryBO->taxonomy == "country")) { $_SESSION["fb_error"][] = ERROR_COUNTRY_NOT_IMPOSSIBLE; return false; } } if (!(isset($para->post_content) && $para->post_content != "")) { $_SESSION["fb_error"][] = ERROR_INTERNALFLIGHT_CONTENT_EMPTY; return false; } if (isset($para->image)) { $validExts = array(".jpg", ".png", ".jpeg"); $fileExt = $para->image['name']; $fileExt = strtolower(substr($fileExt, strrpos($fileExt, "."))); if (!in_array($fileExt, $validExts)) { $_SESSION["fb_error"][] = ERROR_INTERNALFLIGHT_IMAGE_INVALID; return false; } } if (isset($para->tag_list) && $para->tag_list != NULL && $para->tag_list != "") { $tag_array = explode(",", $para->tag_list); $para->tag_array = $tag_array; } if (isset($para->current_rating) && $para->current_rating != "" && !is_numeric($para->current_rating)) { $_SESSION["fb_error"][] = ERROR_CURRENT_RATING_INVALID; return false; } if (isset($para->vote_times) && $para->vote_times != "" && !is_numeric($para->vote_times)) { $_SESSION["fb_error"][] = ERROR_VOTE_TIMES_INVALID; return false; } return true; }
/** * 列表 * 实体店幻灯片 */ public function liststhdp() { parent::_initalize(); $this->assign("systemConfig", $this->systemConfig); $hdM = D("ShitihdpView"); @import("ORG.Util.Page"); $where = "1"; $cmod = new CityModel(); if ($this->getqx($_SESSION['my_info']['role']) == 1) { //地区管理员 $p_id = $_SESSION['my_info']['proid']; $c_id = $_SESSION['my_info']['cityid']; $qlist = $cmod->getcity($c_id); //区 $this->assign("qlist", $qlist); $this->assign("is_qx", 1); } else { //非地区管理员 $plist = $cmod->getcity(1); //省 $this->assign("plist", $plist); $p_id = $_GET['p_id']; $c_id = $_GET['c_id']; $this->assign("is_qx", 0); } $q_id = $_GET['q_id']; $stid = $_GET['stid']; $stlist = M("Shiti")->field("id,name")->order("addtime desc")->select(); $this->assign("stlist", $stlist); if (!empty($p_id)) { $where .= " and Shiti.p_id=" . $p_id; } if (!empty($c_id)) { $where .= " and Shiti.c_id=" . $c_id; } if (!empty($q_id)) { $where .= " and Shiti.q_id=" . $q_id; } if (!empty($stid)) { $where .= " and Shitihdp.stid=" . $stid; } $cou = $hdM->where($where)->count(); $page = new Page($cou, 10); $list = $hdM->where($where)->order("Shitihdp.addtime desc")->limit($page->firstRow . "," . $page->listRows)->select(); $zt = array("0" => "隐藏", "1" => "显示"); foreach ($list as $k => $v) { $list[$k]['addtimef'] = date("Y-m-d H:i:s", $v['addtime']); $list[$k]['isdis'] = $zt[$v['is_display']]; } $this->assign("list", $list); $this->assign("p_id", $p_id); $this->assign("c_id", $c_id); $this->assign("c_name", $cmod->getname($c_id)); $this->assign("q_id", $q_id); $this->assign("q_name", $cmod->getname($q_id)); $this->assign("stid", $stid); $this->assign("page", $page->show()); $this->display(); }