public function morePlaces() { $places = json_decode(file_get_contents(storage_path() . '/demo-day.json'), true); $pages = $places['query']['pages']; foreach ($pages as $page) { $place = new Place(); if (isset($page['coordinates'])) { $coords = $page['coordinates'][0]; $place->latitude = $coords['lat']; $place->longitude = $coords['lon']; } if (isset($page['thumbnail'])) { $thumbnail = $page['thumbnail']; $place->img_src = $thumbnail['source']; $place->img_width = $thumbnail['width']; $place->img_height = $thumbnail['height']; } if (isset($page['extract'])) { $place->description = $page['extract']; } $place->title = $page['title']; $place->pageid = $page['pageid']; $place->link = "https://en.wikipedia.org/?curid={$place->pageid}"; $place->save(); } }
public function getPlaceByCity($citiesId, $placeType) { $placeList = $this->place->join('address', 'address.place_id', '=', 'place.id'); if (!empty($citiesId)) { $placeList->whereIn('address.city_id', $citiesId); } $placeList->where('place.place_type_id', '=', $placeType); return $placeList->get(['place.*']); }
/** * Creates a new City model. * If creation is successful, the browser will be redirected to the 'view' page. * * @return mixed */ public function actionCreate($regionId) { $region = $this->findRegion($regionId); $model = new Place(['region_id' => $region->id]); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
/** * 录入 * */ public function actionCreate() { parent::_acl(); $model = new Place(); if (isset($_POST['Place'])) { $acl = $this->_gets->getPost('acl'); $model->attributes = $_POST['Place']; if ($model->save()) { AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入内容,ID:' . $model->id)); $this->redirect(array('index')); } } $this->render('placeRecommend_create', array('model' => $model)); }
public function actionUpdatePlace() { $model = Place::model()->findByPk($_GET['id']); $imageList = $this->_gets->getParam('imageList'); $imageListSerialize = XUtils::imageListSerialize($imageList); if (isset($_POST['Place'])) { $model->attributes = $_POST['Place']; $model->pic_other = $imageListSerialize['dataSerialize']; $file = XUpload::upload($_FILES['attach'], array('thumb' => true, 'thumbSize' => array(192, 470))); $adr = XUpload::upload($_FILES['pic_adr'], array('thumb' => true, 'thumbSize' => array(498, 364))); if (is_array($file)) { $model->pic = $file['paththumbname']; @unlink($_POST['oAttach']); @unlink($_POST['oThumb']); } if (is_array($adr)) { $model->pic_adr = $adr['paththumbname']; @unlink($_POST['oAttach']); @unlink($_POST['oThumb']); } if ($model->validate() && $model->save()) { $this->redirect(array('/host/default/myplace')); } } if ($imageList) { $imageList = $imageListSerialize['data']; } elseif ($model->pic_other) { $imageList = unserialize($model->pic_other); } $this->render('addplace', array('model' => $model, 'imageList' => $imageList)); }
/** * / * @param [type] $id [description] * @return [type] [description] */ public function showPlace($id) { $result = Place::query($this->db, 'showPublished', $id); if ($result->isSuccessful()) { $this->renderArray['place'] = $result->getRecords(); } }
public function actionUpdatePlace() { $model = Place::model()->findByPk($_GET['id']); if (isset($_POST['Place'])) { $model->attributes = $_POST['Place']; $file = XUpload::upload($_FILES['attach'], array('thumb' => true, 'thumbSize' => array(192, 470))); $adr = XUpload::upload($_FILES['pic_adr'], array('thumb' => true, 'thumbSize' => array(498, 364))); $other = XUpload::upload($_FILES['pic_other'], array('thumb' => true, 'thumbSize' => array(900, 600))); if (is_array($file)) { $model->pic = $file['paththumbname']; @unlink($_POST['oAttach']); @unlink($_POST['oThumb']); } if (is_array($adr)) { $model->pic_adr = $adr['paththumbname']; @unlink($_POST['oAttach']); @unlink($_POST['oThumb']); } if (is_array($other)) { $model->pic_other = $other['paththumbname']; @unlink($_POST['oAttach']); @unlink($_POST['oThumb']); } if ($model->validate() && $model->save()) { $this->redirect(array('/host/default/myplace')); } } $this->render('addplace', array('model' => $model)); }
public function actionView($id) { $lesson = $this->loadModel($id); $userId = $this->_cookiesGet('userId'); $userType = $this->_cookiesGet('userType'); $this->_seoTitle = '课程 - ' . $lesson->name; //取报名人数 $actual_students_criteria = new CDbCriteria(); $actual_students = StudentLesson::model()->count($actual_students_criteria->addCondition("lesson_id =" . $id)); $lesson->actual_students = $actual_students; $teacher = Teacher::model()->findByPk($lesson->teacher_id); $place = Place::model()->findByPk($lesson->place_id); //教学环境图片显示 $imageList = $this->_gets->getParam('imageList'); $imageListSerialize = XUtils::imageListSerialize($imageList); //判断学员已收藏的课程 if ($userType === 'student') { $is_focus = StudentLesson::model()->findByAttributes(array('student_id' => $userId, 'lesson_id' => $id, 'is_collection' => 1)); } if ($imageList) { $imageList = $imageListSerialize['data']; } elseif ($place->pic_other) { $imageList = unserialize($place->pic_other); } $this->render('view', array('is_focus' => $is_focus, 'isJoin' => $this->isJoin($userId, $id, 1), 'userType' => $userType, 'lesson' => $lesson, 'place' => $place, 'teacher' => $teacher, 'imageList' => $imageList)); }
public static function GetByAssoc($values) { $item = new PlaceHotspot(); $item->ID = $values["hotspot_ID"]; $item->Title = $values["hotspot_Title"]; $item->Left = $values["hotspot_Left"]; $item->Top = $values["hotspot_Top"]; $item->Width = $values["hotspot_Width"]; $item->Height = $values["hotspot_Height"]; $item->TargetPlace = Place::GetByID($values["hotspot_TargetPlaceID"]); $item->TargetScript = $values["hotspot_TargetScript"]; $item->TargetURL = $values["hotspot_TargetURL"]; switch ($values["hotspot_TargetTypeID"]) { case 1: $item->TargetType = PlaceHotspotTargetType::URL; break; case 2: $item->TargetType = PlaceHotspotTargetType::Script; break; case 3: $item->TargetType = PlaceHotspotTargetType::Place; break; default: $item->TargetType = PlaceHotspotTargetType::Unknown; break; } return $item; }
public function handleRequest() { $arr = array('idusers' => $_SESSION['UID']); $content = Place::findMyPlaces($arr); $friend = Friend::find($arr); render('home', array('title' => "" . $_SESSION['UNAME'] . ' Welcome to the Places', 'content' => $content, 'friend' => $friend)); }
private function placeFrom($id) { if ($cityFr = Place::where('id', '=', $id)->first()) { return $cityFr->full_name; } else { return null; } }
public function uploadImage($placeId) { $place = Place::find($placeId); if (!$place) { return $this->errorNotFound('Place not found'); } exit('This would normally upload an image somewhere but that is hard.'); }
public function loadModel($id) { $model = Place::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function show($id) { $place = Place::find($id); if (!$place) { return $this->errorNotFound('Did you just invent an ID and try loading a place? Muppet.'); } return $this->respondWithItem($place, new PlaceTransformer()); }
/** * 首页 * */ public function actionIndex() { parent::_acl(); $model = new Place(); $criteria = new CDbCriteria(); $criteria->condition = $condition; $criteria->order = 't.id DESC'; //$criteria->with = array ( 'catalog' ); $count = $model->count($criteria); $pages = new CPagination($count); $pages->pageSize = 13; //$pageParams = XUtils::buildCondition( $_GET, array ( 'title' , 'catalogId','titleAlias' ) ); //$pages->params = is_array( $pageParams ) ? $pageParams : array (); $criteria->limit = $pages->pageSize; $criteria->offset = $pages->currentPage * $pages->pageSize; $result = $model->findAll($criteria); $this->render('place_index', array('datalist' => $result, 'pagebar' => $pages)); }
public function getSelectPlaces() { $placeModels = Place::find(); $places = [0 => 'Немає']; foreach ($placeModels as $place) { $places[$place->id] = $place->name; } return $places; }
/** * Extracts attribute contents FROM a parent tree object * * @param array $tree an array containing an array FROM which the * object data should be extracted * @param string $ver represents the version of the GEDCOM standard * data is being extracted from * * @return void * * @access public * @since Method available since Release 0.0.1 */ protected function parse_tree_detail($tree, $ver) { if (($i1 = parent::find_tag($tree, Rp_Tags::TYPE)) !== false) { $this->type = parent::parse_text($tree[$i1], Rp_Tags::TYPE); } if (($i1 = parent::find_tag($tree, Rp_Tags::DATE)) !== false) { $this->date = parent::parse_text($tree[$i1], Rp_Tags::DATE); } if (($i1 = parent::find_tag($tree, Rp_Tags::ADDRESS)) !== false) { $this->address->parse_tree(array($tree[$i1]), $ver); } if (($i1 = parent::find_tag($tree, Rp_Tags::PLACE)) !== false) { $this->place->parse_tree(array($tree[$i1]), $ver); } if (($i1 = parent::find_tag($tree, Rp_Tags::RELIGION)) !== false) { $this->religious_affiliation = parent::parse_text($tree[$i1], Rp_Tags::RELIGION); } if (($i1 = parent::find_tag($tree, Rp_Tags::AGENCY)) !== false) { $this->resp_agency = parent::parse_text($tree[$i1], Rp_Tags::AGENCY); } if (($i1 = parent::find_tag($tree, Rp_Tags::AGE)) !== false) { $this->age = parent::parse_text($tree[$i1], Rp_Tags::AGE); } if (($i1 = parent::find_tag($tree, Rp_Tags::RESTRICTION)) !== false) { $this->restriction = parent::parse_text($tree[$i1], Rp_Tags::RESTRICTION); } if (($i1 = parent::find_tag($tree, Rp_Tags::CAUSE)) !== false) { $this->cause = parent::parse_text($tree[$i1], Rp_Tags::CAUSE); } if (isset($this->place)) { $this->place->parse_tree($tree, $ver); } if (isset($this->address)) { $this->address->parse_tree($tree, $ver); } $off = 0; while (($i1 = parent::find_tag($tree, Rp_Tags::CITE, $off)) !== false) { $tmp = new RP_Citation(); $tmp->parse_tree(array($tree[$i1]), $ver); $this->citations[] = $tmp; $off = $i1 + 1; } $off = 0; while (($i1 = parent::find_tag($tree, Rp_Tags::MEDIA, $off)) !== false) { $tmp = new RP_Media_Link(); $tmp->parse_tree(array($tree[$i1]), $ver); $this->media_links[] = $tmp; $off = $i1 + 1; } $off = 0; while (($i1 = parent::find_tag($tree, Rp_Tags::NOTE, $off)) !== false) { $tmp = new RP_Note(); $tmp->parse_tree(array($tree[$i1]), $ver); $this->notes[] = $tmp; $off = $i1 + 1; } }
public function editar_empresa() { $inputs = Input::get('idedit'); $fk_lugar = Place::lists('lugar_nombre', 'id'); $empresa = Empresa::find($inputs); if ($empresa) { return View::make('empresa.createEmpresa', array('empresa' => $empresa, 'fk_lugar' => $fk_lugar)); } else { return Redirect::to('empresa'); } }
/** * * @param $pageId int * @return nothing * @author Tremor */ public function page($pageId = 0) { $this->data['active'] = __FUNCTION__; if (isset($pageId) && !empty($pageId) && is_numeric($pageId)) { $this->data['placeList'] = Place::lists('name', 'id'); $this->data['page'] = Page::find($pageId); return View::make('admin.page.one')->with($this->data); } else { $this->data['pageList'] = Page::orderBy('place_id')->orderBy('sort')->get(); return View::make('admin.page.list')->with($this->data); } }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker::create(); for ($i = 0; $i < 100; $i++) { $place = Place::create(['name' => $faker->name, 'lat' => $faker->latitude, 'lon' => $faker->longitude, 'address1' => $faker->streetAddress, 'city' => $faker->city, 'state' => $faker->stateAbbr, 'zip' => rand(10000, 30000), 'website' => $faker->url, 'phone' => $faker->phoneNumber]); foreach (User::all() as $user) { if (rand(0, 2) == 1) { $place->checkins()->create(['user_id' => $user->id]); } } } }
public function testPopulateWithPlace() { $point = new Point(); $point->setLat('-23.59243454'); $point->setLng('-46.68677054'); $city = new City(); $city->setCountry('BR'); $city->setState('SP'); $city->setName('São Paulo'); $category = new Category(); $category->setId('123'); $category->setName('Empresas de Internet'); $address = new Address(); $address->setStreet("Rua Funchal"); $address->setNumber(129); $address->setComplement('6o andar'); $address->setCity($city); $place = new Place(); $place->setId("M25GJ288"); $place->setName("Apontador.com - São Paulo"); $place->setDescription("Líder em geolocalização no Brasil e uma das 250 maiores empresas de internet do mundo, segundo o AlwaysOn, o Apontador (www.apontador.com) desenvolve e oferece serviços e ferramentas de busca e localização para facilitar o dia a dia dos usuários, além de mostrar a opinião do público para os locais cadastrados em seus sites. Com mais de 10 milhões de visitantes mensais, a empresa inclui o site líder em busca local Apontador (www.apontador.com.br) e o de mapas e rotas MapLink (www.maplink.com.br)."); $place->setIconUrl("http://localphoto.s3.amazonaws.com/C40372534F143O1437_9896391605729015_l.jpg"); $place->setPoint($point); $place->setCategory($category); $place->setAddress($address); $this->og->populate($place); $rootUrl = \ROOT_URL; $testMeta = <<<META \t<meta property="og:title" content="Apontador.com - São Paulo"/> \t<meta property="og:description" content="Líder em geolocalização no Brasil e uma das 250 maiores empresas de internet do mundo, segundo o AlwaysOn, o Apontador (www.apontador.com) desenvolve e oferece serviços e ferramentas de busca e localização para facilitar o dia a dia dos usuários, além de mostrar a opinião do público para os locais cadastrados em seus sites. Com mais de 10 milhões de visitantes mensais, a empresa inclui o site líder em busca local Apontador (www.apontador.com.br) e o de mapas e rotas MapLink (www.maplink.com.br)."/> \t<meta property="og:image" content="http://maplink.com.br/widget?v=4.1&lat=-23.59243454&lng=-46.68677054"/> \t<meta property="og:url" content="{$rootUrl}sp/s-o-paulo/empresas-de-internet/apontador-com-s-o-paulo/M25GJ288.html"/> \t<meta property="og:street-address" content="Rua Funchal, 129"/> \t<meta property="og:locality" content="São Paulo"/> \t<meta property="og:region" content="SP"/> \t<meta property="og:country-name" content="Brasil"/> \t<meta property="og:latitude" content="-23.59243454"/> \t<meta property="og:longitude" content="-46.68677054"/> \t<meta property="og:type" content="company"/> META; $this->assertEquals($testMeta, $this->og->getMeta()); $testArray = array('title' => 'Apontador.com - São Paulo', 'description' => 'Líder em geolocalização no Brasil e uma das 250 maiores empresas de internet do mundo, segundo o AlwaysOn, o Apontador (www.apontador.com) desenvolve e oferece serviços e ferramentas de busca e localização para facilitar o dia a dia dos usuários, além de mostrar a opinião do público para os locais cadastrados em seus sites. Com mais de 10 milhões de visitantes mensais, a empresa inclui o site líder em busca local Apontador (www.apontador.com.br) e o de mapas e rotas MapLink (www.maplink.com.br).', 'image' => 'http://maplink.apontador.com.br/widget?v=4.1&lat=-23.59243454&lng=-46.68677054', 'url' => ROOT_URL . 'sp/s-o-paulo/empresas-de-internet/apontador-com-s-o-paulo/M25GJ288.html', 'street-address' => 'Rua Funchal, 129', 'locality' => 'São Paulo', 'region' => 'SP', 'country-name' => 'Brasil', 'latitude' => '-23.59243454', 'longitude' => '-46.68677054', 'type' => 'company'); $this->assertEquals($testArray, $this->og->getArray()); }
public function actionView($id) { // require a place id as param // retrieve a place from db using the id $places = Place::model()->findAllByAttributes(array('id' => $id)); // organise place object into an array $rows = array(); foreach ($places as $place) { $rows[] = array('id' => $place->id, 'type' => $place->type, 'name' => $place->name, 'detail' => $place->detail, 'pic' => $place->pic, 'comments' => $this->getComments($place->id)); } // render view a place page with a place info $this->render('view', array('places' => $places)); }
public function editar_persona() { $fk_lugar = Place::lists('lugar_nombre', 'id'); $fk_profesion = Profesion::lists('profesion_nombre', 'id'); $fk_cargo = Cargo::lists('cargo_nombre', 'id'); $inputs = Input::get('idedit'); $persona = Person::find($inputs); $fk_persona_a_quien_autorizo = Person::where('persona_cid', '!=', $persona->persona_cid)->where('persona_es_autorizado', '=', false)->lists('persona_cid', 'id'); if ($persona) { return View::make('persona.createPersona', array('persona' => $persona, 'fk_lugar' => $fk_lugar, 'fk_profesion' => $fk_profesion, 'fk_cargo' => $fk_cargo, 'fk_persona_a_quien_autorizo' => $fk_persona_a_quien_autorizo)); } else { return Redirect::to('persona'); } }
public static function getSelfMapData($title, $xml) { $result = ''; $lat = (string) $xml->latitude; $lng = (string) $xml->longitude; if ($lat && $lng && Place::isValidLatitude($lat) && Place::isValidLongitude($lng)) { $titleString = (string) $title->getText(); $pieces = mb_split(",", $titleString, 2); $url = $title->getLocalURL(); $type = (string) $xml->type; $result = '<p n="' . StructuredData::escapeXml(trim($pieces[0])) . '" u="' . StructuredData::escapeXml($url) . '" a="' . $lat . '" o="' . $lng . '" t="' . $type . "\"/>"; } return $result; }
public function testPopulateWithPlace() { $point = new Point(); $point->setLat('-23.59243454'); $point->setLng('-46.68677054'); $city = new City(); $city->setCountry('BR'); $city->setState('SP'); $city->setName('São Paulo'); $category = new Category(); $category->setId('067'); $category->setName('Restaurante'); $address = new Address(); $address->setStreet("R. Min. Jesuino Cardoso"); $address->setNumber(473); $address->setCity($city); $place = new Place(); $place->setId("UCV34B2P"); $place->setName("Uziel Restaurante"); $place->setDescription("Se você procura um restaurante com variedade, qualidade com preço justo você encontra no Uziel restaurante!O preço do kilo é R\$ 26,90, mas você paga no máximo R\$ 15,90 por pesagem de refeições (excluindo sobremesas, bebidas e doces). Acima de 500 gramas você ainda ganha um refrescoUm bom vinho, gelatina e cafezinho são por nossa conta.Se precisar de internet você pode contar com nossa rede Wi-Fi.Nosso cardápio diário possui 5 tipos de carne todos os dias, feijoada completa e separada (feijão e carnes) às quartas, 6 tipos de massa nas quintas e 4 tipos de pizzas nassextas, além de opções de peixes todas as terças e sextas.Oferecemos convênio com descontos progressivos para empresas e um bolo com o sabor a escolha do aniversariante, caso agende com antecedência e traga mais de 10 pessoas para almoçar no seu aniversário.Aceitamos todos os cartões de crédito e vales refeição.Você pode receber nosso cardápio atualizado diariamente pelo twitter http://twitter.com/uzielrestaurant"); $place->setIconUrl("http://maplink.com.br/widget?v=4.1&lat=-23.5926083&lng=-46.6818329"); $place->setPoint($point); $place->setCategory($category); $place->setAddress($address); $this->abm->populate($place); $rootUrl = \ROOT_URL; $testMeta = <<<META \t<meta property="restaurant:title" content="Uziel Restaurante"/> \t<meta property="restaurant:description" content="Se você procura um restaurante com variedade, qualidade com preço justo você encontra no Uziel restaurante!O preço do kilo é R\$ 26,90, mas você paga no máximo R\$ 15,90 por pesagem de refeições (excluindo sobremesas, bebidas e doces). Acima de 500 gramas você ainda ganha um refrescoUm bom vinho, gelatina e cafezinho são por nossa conta.Se precisar de internet você pode contar com nossa rede Wi-Fi.Nosso cardápio diário possui 5 tipos de carne todos os dias, feijoada completa e separada (feijão e carnes) às quartas, 6 tipos de massa nas quintas e 4 tipos de pizzas nassextas, além de opções de peixes todas as terças e sextas.Oferecemos convênio com descontos progressivos para empresas e um bolo com o sabor a escolha do aniversariante, caso agende com antecedência e traga mais de 10 pessoas para almoçar no seu aniversário.Aceitamos todos os cartões de crédito e vales refeição.Você pode receber nosso cardápio atualizado diariamente pelo twitter http://twitter.com/uzielrestaurant"/> \t<meta property="restaurant:image" content="http://maplink.apontador.com.br/widget?v=4.1&lat=-23.59243454&lng=-46.68677054"/> \t<meta property="restaurant:url" content="{$rootUrl}sp/s-o-paulo/restaurante/uziel-restaurante/UCV34B2P.html"/> \t<meta property="restaurant:address" content="R. Min. Jesuino Cardoso, 473"/> \t<meta property="restaurant:city" content="São Paulo"/> \t<meta property="restaurant:state" content="SP"/> \t<meta property="restaurant:country-name" content="Brasil"/> \t<meta property="restaurant:type" content="restaurant"/> META; $this->assertEquals($testMeta, $this->abm->getMeta()); $testArray = array('title' => 'Uziel Restaurante', 'description' => 'Se você procura um restaurante com variedade, qualidade com preço justo você encontra no Uziel restaurante!O preço do kilo é R$ 26,90, mas você paga no máximo R$ 15,90 por pesagem de refeições (excluindo sobremesas, bebidas e doces). Acima de 500 gramas você ainda ganha um refrescoUm bom vinho, gelatina e cafezinho são por nossa conta.Se precisar de internet você pode contar com nossa rede Wi-Fi.Nosso cardápio diário possui 5 tipos de carne todos os dias, feijoada completa e separada (feijão e carnes) às quartas, 6 tipos de massa nas quintas e 4 tipos de pizzas nassextas, além de opções de peixes todas as terças e sextas.Oferecemos convênio com descontos progressivos para empresas e um bolo com o sabor a escolha do aniversariante, caso agende com antecedência e traga mais de 10 pessoas para almoçar no seu aniversário.Aceitamos todos os cartões de crédito e vales refeição.Você pode receber nosso cardápio atualizado diariamente pelo twitter http://twitter.com/uzielrestaurant', 'image' => 'http://maplink.apontador.com.br/widget?v=4.1&lat=-23.59243454&lng=-46.68677054', 'url' => ROOT_URL . 'sp/s-o-paulo/restaurante/uziel-restaurante/UCV34B2P.html', 'address' => 'R. Min. Jesuino Cardoso, 473', 'city' => 'São Paulo', 'state' => 'SP', 'country-name' => 'Brasil', 'type' => 'restaurant'); $this->assertEquals($testArray, $this->abm->getArray()); }
public function __construct() { $this->data['messages'] = View::make('block.messages')->with('messages', $this->getMessage())->render(); $this->data['setting'] = Setting::first(); $this->data['sliderList'] = Slider::orderBy('sort')->get(); $this->data['socialList'] = Social::orderBy('sort')->get(); $this->data['categoryList'] = Category::where('main', 0)->orderBy('sort')->get(); $this->data['groupList'] = Group::orderBy('sort')->get(); $this->data['buildOwn'] = Product::where('is_build', 1)->first(); $placeList = Place::all(); foreach ($placeList as $place) { $this->data['place'][$place->name] = $place->pageList()->orderBy('sort')->get(); } $this->data['seo'] = array('keywords' => 'Pepperino', 'title' => 'Pepperino', 'description' => 'Pepperino'); }
public function actionView($id) { $lesson = $this->loadModel($id); $userId = $this->_cookiesGet('userId'); $userType = $this->_cookiesGet('userType'); $this->_seoTitle = '课程 - ' . $lesson->name; //取报名人数 $actual_students_criteria = new CDbCriteria(); $actual_students = StudentLesson::model()->count($actual_students_criteria->addCondition("lesson_id =" . $id)); $lesson->actual_students = $actual_students; $teacher = Teacher::model()->findByPk($lesson->teacher_id); $place = Place::model()->findByPk($lesson->place_id); //判断学员已收藏的课程 if ($userType === 'student') { $is_focus = StudentLesson::model()->findByAttributes(array('student_id' => $userId, 'lesson_id' => $id, 'is_collection' => 1)); } $this->render('view', array('is_focus' => $is_focus, 'isJoin' => $this->isJoin($userId, $id, 1), 'userType' => $userType, 'lesson' => $lesson, 'place' => $place, 'teacher' => $teacher)); }
public function actionListName($type, $term) { $term = addcslashes($term, '%_'); $criteria = new CDbCriteria(); if (strlen($type) == 0) { // if not select a type, create criteria with only name LIKE $criteria->condition = "name LIKE :term"; $criteria->params = array(':term' => "%{$term}%"); } else { // if select a type, create criteria with name LIK and the selected type $criteria->condition = "name LIKE :term AND type=:type"; $criteria->params = array(':term' => "%{$term}%", ':type' => $type); } // get only 'name' from table $criteria->select = "name"; $places = Place::model()->findAll($criteria); $names = array(); foreach ($places as $place) { $names[] = $place->name; } echo json_encode($names); }
public function actionIndex() { $this->_seoTitle = '中国传统文化教育|东方美学|中式精致生活|我要去上课'; $placeCriteria = new CDbCriteria(); $teacherCriteria = new CDbCriteria(); $picCriteria = new CDbCriteria(); $placeCriteria->limit = '3'; $placeCriteria->order = 'id DESC'; $placeCriteria->addCondition('status = :status'); $placeCriteria->params[':status'] = 1; $teacherCriteria->limit = '8'; $teacherCriteria->order = 'id DESC'; $teacherCriteria->addCondition('status = :status'); $teacherCriteria->params[':status'] = 1; $picCriteria->limit = '4'; $picCriteria->order = 'id DESC'; $picCriteria->addCondition('check_status = :check_status'); $picCriteria->params[':check_status'] = 1; $lesson = Lesson::model()->findByAttributes(array('id' => '5')); $place = Place::model()->findAll($placeCriteria); $teacher = Teacher::model()->findAll($teacherCriteria); $pic = Lesson::model()->findAll($picCriteria); $this->render('index', array('place' => $place, 'teacher' => $teacher, 'lesson' => $lesson, 'pic' => $pic)); }
<link href="http://i1.hdfimg.com/css/css.css?1303386395" rel="stylesheet" type="text/css" /> <link href="http://i1.hdfimg.com/css/hospital_index2.css?2011" rel="stylesheet" type="text/css" /> <link href="http://i1.hdfimg.com/nav/nav.css?1303460346" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="http://i1.hdfimg.com/js/jquery-1.4.2.min.js"></script> </head> <body id='blue'> <?php $option['navType'] = 's_yiyuan'; $option['activeColor'] = 'active_blue'; $option['subtitle'] = GlobalTemplete::CURRENT_PAGE_LOOKING_FOR_DOCTOR; GlobalTemplete::getHeadNav('www', $option); ?> <center> <?php echo AdWord::getHtmlContentByHospital('hospital_ba', AdWord::OBJECT_0); echo Place::getPlaceContent('ads', 'disease_ads_one', 'ad_hospital_one'); ?> <div id="m_search_disable"></div> <div id="m_search_box"></div> <div id="m_body_html"> <div id="m_body_html_ctt" class="p_disease_index"> <div class="m_left_270"> <div class="m_box_blue"> <div class="bxhd"> <div class="lf"></div> <div class="rt"></div> </div> <div class="bxmd"> <div class="ct"> <div class="jeshi_tree"> <div id="el_tree_1000000" class="v">