protected function build() { $this->select[] = " area_comment_information.* "; $this->select[] = " user_account_information.username AS user_account_username "; $this->select[] = " area_information.slug AS area_information_slug "; $this->select[] = " area_information.title AS area_information_title "; $this->joins[] = " LEFT JOIN area_information ON area_information.id = area_comment_information.area_id "; $this->joins[] = " LEFT JOIN user_account_information ON user_account_information.id = area_comment_information.user_account_id "; if ($this->area) { if ($this->includeChildrenAreas && $this->includeParentAreas) { $this->joins[] = " LEFT JOIN cached_area_has_parent AS cached_area_has_parent_1 ON " . "cached_area_has_parent_1.area_id = area_comment_information.area_id AND cached_area_has_parent_1.has_parent_area_id = :area_id "; $this->joins[] = " LEFT JOIN cached_area_has_parent AS cached_area_has_parent_2 ON " . "cached_area_has_parent_2.has_parent_area_id = area_comment_information.area_id AND cached_area_has_parent_2.area_id = :area_id "; $this->where[] = " ( area_comment_information.area_id = :area_id OR " . "cached_area_has_parent_1.has_parent_area_id = :area_id OR cached_area_has_parent_2.area_id = :area_id )"; } else { if ($this->includeChildrenAreas) { $this->joins[] = " LEFT JOIN cached_area_has_parent ON " . "cached_area_has_parent.area_id = area_comment_information.area_id AND cached_area_has_parent.has_parent_area_id = :area_id "; $this->where[] = " ( area_comment_information.area_id = :area_id OR cached_area_has_parent.has_parent_area_id = :area_id )"; } else { if ($this->includeParentAreas) { $this->joins[] = " LEFT JOIN cached_area_has_parent ON " . "cached_area_has_parent.has_parent_area_id = area_comment_information.area_id AND cached_area_has_parent.area_id = :area_id "; $this->where[] = " ( area_comment_information.area_id = :area_id OR cached_area_has_parent.area_id = :area_id )"; } else { $this->where[] = " area_comment_information.area_id = :area_id "; } } } $this->params['area_id'] = $this->area->getId(); } if (!$this->include_deleted) { $this->where[] = " area_comment_information.is_deleted = '0' "; } if (!$this->include_closed_by_admin) { $this->where[] = " area_comment_information.is_closed_by_admin = '0' "; } }
public function deleteData() { $model = new AreaModel(); try { $datos = $model->deleteArea(); $_SESSION['message'] = "Datos eliminados correctamente."; } catch (Exception $e) { $_SESSION['message'] = $e->getMessage(); } header("Location: index.php"); }
/** * 工长列表 */ public function foremanlist() { $cid = $_SESSION['cid']; //广告位 $admod = new AdModel(); $cid = $this->cid; $adlist = $admod->getad(2, $cid); $this->assign("adlist", $adlist); #城市 $Amod = new AreaModel(); $arealist = $Amod->getcity($cid); $this->assign("arealist", $arealist); import("ORG.Util.Page"); $M = new ForemanviewModel(); $where = "status=1 "; $areaid = $_GET['areaid']; if (!empty($areaid)) { $where .= " and q_id=" . $areaid; } $this->assign("areaid", $areaid); $where .= " and c_id=" . $cid; $totalRows = $M->getforemannum($where); $p = new Page($totalRows, 48); $list = $M->getforemanbywhere($where, $p->firstRow, $p->listRows); $this->assign("list", $list); $this->assign("page", $p->show()); #------------------------------列表结束 #设计师 $M1 = new ShejiviewModel(); $sjlist = $M1->getsheji($cid); $this->assign("sjlist", $sjlist); #施工动态 $M2 = new ShigongdtModel(); $sgdtlist = $M2->getsgdtbytime(); #var_dump($sgdtlist); $this->assign("sgdtlist", $sgdtlist); #经典案例 $M3 = new CaseModel(); $caselist = $M3->getjdcase($cid); $this->assign("caselist", $caselist); #var_dump($caselist); $this->display(); }
/** * 上级地区的名称 */ public function parent() { return $this->parentid ? AreaModel::find($this->parentid)->cityname : '0级'; }
/** */ public function setParentArea(AreaModel $parent_area) { $this->parent_area_id = $parent_area->getId(); }
public function setFromDataBaseRow($data) { $this->id = $data['id']; $this->site_id = $data['site_id']; $this->site_slug = isset($data['site_slug']) ? $data['site_slug'] : null; $this->slug = $data['slug']; $this->summary = $data['summary']; $this->description = $data['description']; $utc = new \DateTimeZone("UTC"); $this->start_at = new \DateTime($data['start_at'], $utc); $this->end_at = new \DateTime($data['end_at'], $utc); $this->created_at = new \DateTime($data['created_at'], $utc); $this->group_id = isset($data['group_id']) ? $data['group_id'] : null; $this->group_title = isset($data['group_title']) ? $data['group_title'] : null; $this->is_deleted = $data['is_deleted']; $this->is_cancelled = $data['is_cancelled']; $this->event_recur_set_id = $data['event_recur_set_id']; $this->country_id = $data['country_id']; $this->venue_id = $data['venue_id']; $this->area_id = $data['area_id']; $this->timezone = $data['timezone']; $this->import_id = $data['import_id']; $this->import_url_id = $data['import_url_id']; $this->url = $data['url']; $this->ticket_url = $data['ticket_url']; if (isset($data['venue_slug'])) { $this->venue = new VenueModel(); $this->venue->setTitle($data['venue_title']); $this->venue->setSlug($data['venue_slug']); $this->venue->setLat($data['venue_lat']); $this->venue->setLng($data['venue_lng']); $this->venue->setDescription($data['venue_description']); $this->venue->setAddress($data['venue_address']); $this->venue->setAddressCode($data['venue_address_code']); } if (isset($data['area_slug'])) { $this->area = new AreaModel(); $this->area->setId($data['area_information_id']); $this->area->setTitle($data['area_title']); $this->area->setSlug($data['area_slug']); } if (isset($data['country_two_char_code'])) { $this->country = new CountryModel(); $this->country->setTwoCharCode($data['country_two_char_code']); $this->country->setTitle($data['country_title']); } $this->user_is_plan_attending = isset($data['user_is_plan_attending']) ? (bool) $data['user_is_plan_attending'] : false; $this->user_is_plan_maybe_attending = isset($data['user_is_plan_maybe_attending']) ? (bool) $data['user_is_plan_maybe_attending'] : false; $this->is_virtual = (bool) $data['is_virtual']; $this->is_physical = (bool) $data['is_physical']; $this->is_duplicate_of_id = $data['is_duplicate_of_id']; $this->is_event_in_curated_list = isset($data['is_event_in_curated_list']) ? (bool) $data['is_event_in_curated_list'] : false; $this->in_curated_list_group_id = isset($data['in_curated_list_group_id']) ? $data['in_curated_list_group_id'] : null; $this->in_curated_list_group_slug = isset($data['in_curated_list_group_slug']) ? $data['in_curated_list_group_slug'] : null; $this->in_curated_list_group_title = isset($data['in_curated_list_group_title']) ? $data['in_curated_list_group_title'] : null; $this->media_event_slugs = isset($data['media_event_slugs']) ? $data['media_event_slugs'] : null; $this->media_group_slugs = isset($data['media_group_slugs']) ? $data['media_group_slugs'] : null; $this->media_venue_slugs = isset($data['media_venue_slugs']) ? $data['media_venue_slugs'] : null; if ($data['custom_fields'] && $data['custom_fields'] != '[]') { $obj = json_decode($data['custom_fields']); foreach (get_object_vars($obj) as $k => $v) { $this->custom_fields[$k] = $v; } } }
/** * 判断城市是否开启 */ protected function is_city($cid) { $areamod = new AreaModel(); $istrue = $areamod->getcitystatus($cid); return $istrue; }
/** * load文件并给与权限判断 */ protected static function loadList($p_where = null, $p_order = null, $p_pageIndex = null, $p_pageSize = null, &$p_countThis = -1, $isDetail = false) { $tmpResult = parent::loadList($p_where, $p_order, $p_pageIndex, $p_pageSize, $p_countThis, $isDetail); if (is_array($tmpResult) && array_key_exists('errorCode', $tmpResult)) { return $tmpResult; } switch ($auth = static::getAuthIfUserCanDoIt(Utility::getCurrentUserID(), $isDetail ? 'detail' : 'list', $tmpResult)) { case 'admin': //有管理权限 //有管理权限 case 'self': //作者 //作者 case 'normal': //正常用户 //正常用户 case 'draft': //未激活 //未激活 case 'pending': //待审禁言 //待审禁言 case 'disabled': //封号 //封号 case 'visitor': //游客 break; default: return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '您没有权限执行该操作'); break; } AreaModel::$authViewDisabled = static::$authViewDisabledList[$auth]; return $tmpResult; }