/**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id = NULL)
 {
     $currUser = Auth::user();
     $oCategories = Category::all();
     $oCity = Cities::all();
     $oVacancy = null;
     if ($id > 0) {
         $oVacancy = Vacancy::find($id);
     }
     foreach ($oCategories as $item) {
         $aCategories[$item->id] = $item->name;
     }
     if (Auth::user()->is_admin == 0) {
         $aCompanies = Companies::where('user_id', '=', $currUser->id)->get();
     } else {
         $aCompanies = Companies::all();
     }
     foreach ($aCompanies as $item) {
         $aCompany[$item->id] = $item->name;
     }
     $oQuery = Regions::join('country', 'country.id', '=', 'country_id')->select('regions.id as id', 'regions.name', 'country.name as country_name', 'country.id as country_id');
     if ($oRegions = $oQuery->get()) {
     }
     foreach ($oRegions as $item) {
         $aRegions[$item->country_name] = array();
         $aCity = Cities::where('region_id', '=', $item->id)->get();
         foreach ($aCity as $city) {
             $aRegions[$item->name][$city->id] = $city->name;
         }
     }
     if ($currUser->is_admin == 0 && (empty($oVacancy) === false && $oVacancy->user_id != $currUser->id)) {
         return Redirect::route('vacancy-list', array('user_id' => $currUser->id));
     }
     return View::make('/vacancy/edit', array('currUser' => $currUser, 'aCategories' => $aCategories, 'aCompany' => $aCompany, 'aRegions' => $aRegions, 'oVacancy' => $oVacancy, 'id' => $id));
 }
Ejemplo n.º 2
0
 public function actionConsignup_step5()
 {
     $this->pageTitle = 'Handyman.com - Sign up step 1';
     $this->cities = Cities::model()->findAll(array('order' => 'RAND()', 'limit' => 10));
     $param['projects'] = Projecttypes::model()->findAll(array('order' => 'Name ASC'));
     $this->render('consignup-step5', $param);
 }
Ejemplo n.º 3
0
 public function actionIndex()
 {
     $this->pageTitle = 'Handyman - Login';
     $this->cities = Cities::model()->findAll(array('order' => 'RAND()', 'limit' => 10));
     $param['projects'] = Projecttypes::model()->findAll(array('order' => 'Name ASC'));
     $this->render('login', $param);
 }
Ejemplo n.º 4
0
 public function getDelete($id)
 {
     $Cities = Cities::find($id);
     $Cities->delete();
     Session::flash('message', 'The records are deleted successfully');
     return Redirect::to('cities');
 }
Ejemplo n.º 5
0
 public function actionCitiesByCountry()
 {
     $list = Cities::model()->findAll("countries_id=?", array($_POST["Users"]["countries_id"]));
     foreach ($list as $data) {
         echo "<option value=\"{$data->id}\">{$data->name}</option>";
     }
 }
Ejemplo n.º 6
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Cities the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Cities::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     DB::table('cities')->delete();
     Cities::create(array('id' => 1, 'name' => 'Boryspil', 'description' => 'Kiev region.', 'region_id' => 1));
     Cities::create(array('id' => 2, 'name' => 'Merefa', 'description' => 'Kharkov region.', 'region_id' => 2));
     Cities::create(array('id' => 3, 'name' => 'Izmail', 'description' => 'Odessa region.', 'region_id' => 3));
     $this->command->info('Cities table seeded!');
 }
Ejemplo n.º 8
0
 static function getCities($regionId, $countryId = "IN")
 {
     $cities = Cities::where('country', '=', $countryId)->where('region', '=', $regionId)->lists('name', 'ID');
     $queries = DB::getQueryLog();
     /* print_R($queries);
     		
     		dd($cities); */
     return $cities;
 }
Ejemplo n.º 9
0
 public function getIndex()
 {
     $hotel = Hotel::find(1);
     $regions = Regions::all();
     $country = Countries::where('region_id', '=', $hotel->city->province->country->region->id)->get();
     $province = Provinces::where('country_id', '=', $hotel->city->province->country->id)->get();
     $city = Cities::where('province_id', '=', $hotel->city->province->id)->get();
     $options = array('hotel' => $hotel, 'regions' => $regions, 'country' => $country, 'province' => $province, 'city' => $city);
     return View::make('home/dashboard', array())->nest('content', 'hotel/profile', $options);
 }
Ejemplo n.º 10
0
 public function actionProfile()
 {
     $this->pageTitle = 'Handyman.com - User Profile';
     $this->cities = Cities::model()->findAll(array('order' => 'RAND()', 'limit' => 10));
     $param['projects'] = Projecttypes::model()->findAll(array('order' => 'Name ASC'));
     $criteria = new CDbCriteria();
     $criteria->condition = "IsTop = '1'";
     $param['top'] = Projecttypes::model()->findAll($criteria);
     $this->render('profile', $param);
 }
Ejemplo n.º 11
0
 public function getselectcities($post)
 {
     $return = $htmlParams = array();
     $state_id = $post['state_id'];
     $criteria = new CDbCriteria();
     $criteria->condition = "StateId = '{$state_id}'";
     $htmlParams['cities'] = Cities::model()->findAll($criteria);
     $return['html'] = $this->renderPartial('cities', $htmlParams, true);
     $this->renderJSONcities($return, true);
 }
Ejemplo n.º 12
0
 public function postPublish()
 {
     $states = Input::get('notify');
     if ($states[0] == 'All') {
         $temp_states = Cities::distinct()->select('city_state')->get();
         unset($states);
         foreach ($temp_states as $state) {
             $states[] = $state->city_state;
         }
     }
     $users = DB::table('users')->OrwhereIn('state', $states)->select('uid', 'email', 'fname', 'username');
     $organizations = DB::table('other_users')->OrwhereIn('state', $states)->select('uid', 'email', 'fname', 'username');
     $combined = $users->union($organizations)->get();
     $msg = 'Report Published Successfully';
     $inputs = Input::except('notify');
     foreach (Input::all() as $key => $single_input) {
         if (empty($single_input) && (stristr($key, 'state') || stristr($key, 'city'))) {
             unset($inputs[$key]);
         }
     }
     $inputs['dob'] = GlobalFunc::set_date_format(Input::get('dob'));
     $inputs['missing_since'] = GlobalFunc::set_date_format(Input::get('missing_since'));
     if (!Input::hasFile('kid_image')) {
         unset($inputs['kid_image']);
     } else {
         $file = Input::file('kid_image');
         $destination_path = 'admin/images/upload/';
         $filename = str_random(15) . '.' . $file->getClientOriginalExtension();
         $file->move($destination_path, $filename);
         $inputs['kid_image'] = $destination_path . $filename;
     }
     if (Input::get('clicked') == 'Success') {
         $inputs['status'] = 9;
         $msg = 'Report Successfully Marked As Success';
     } else {
         $inputs['status'] = 1;
     }
     unset($inputs['clicked']);
     Missing::where('id', '=', Input::get('id'))->update($inputs);
     $title = 'New Report Published';
     $message = 'Hello';
     foreach ($combined as $email_chunk) {
         $insert = array('user_id' => $email_chunk->uid, 'message' => $message, 'title' => $title);
         Notifications::create($insert);
     }
     return Redirect::to('admin/missing/published')->with('success', $msg);
 }
Ejemplo n.º 13
0
 public function actionGetGMWeather()
 {
     $cities = Cities::findAll(['country_id' => 0]);
     //$customers = Customer::findAll(['age' => 30, 'status' => 1]);
     // var_dump($cities); exit;
     foreach ($cities as $city) {
         echo $city->name;
         $ch = curl_init();
         $url = "{$city->weather_link}";
         curl_setopt($ch, CURLOPT_URL, $url);
         //curl_setopt($ch, CURLOPT_HEADER, 1); // читать заголовок
         //curl_setopt($ch, CURLOPT_NOBODY, 1); // читать ТОЛЬКО заголовок без тела
         $result = curl_exec($ch);
         curl_close($ch);
         // $content = file_get_contents($city->weather_link);
         $clearedDatas = $this->clearDatas($result, 'Атмосферное давление', ' ');
         // var_dump($clearedDatas); exit;
         $this->putDatasInTable($clearedDatas, $city);
     }
 }
Ejemplo n.º 14
0
 public function getCity($id)
 {
     $city = Cities::where('province_id', '=', $id)->get();
     $html = '<option></option>';
     foreach ($city as $c) {
         $html .= "<option value='" . $c->id . "'>" . $c->name . "</option>";
     }
     echo $html;
 }
Ejemplo n.º 15
0
                    <?php 
    }
    ?>

            <?php 
}
?>

            <form name = "addHotel" method = "post">  
                <h1 class="title-text">Добави хотел</h1>    
                    <p>
                        <label for = "city">Град</label>
                        <?php 
require '../classes/cities.php';
$cities = new Cities();
echo $cities->citySelector();
?>
                    </p> 
                    <p>
                        <label for="category">Звезди</label>
                        <select name="stars">
                            <option value="1">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                        </select>
                    </p> 
                    <p>
                        <label for="url">Линк към хотела</label>
Ejemplo n.º 16
0
 public function getLoadstates()
 {
     $data = Cities::distinct()->select('city_state')->get();
     echo json_encode($data);
 }
             $app->redirect(ADMIN_MANAGE);
         }
     });
 });
 /*
  * Cities group
  * Admin job cities routes
  */
 $app->group('/cities', function () use($app) {
     $app->get('/', 'validateUser', function () use($app) {
         $app->redirect(ADMIN_MANAGE);
     });
     // get category jobs
     $app->get('/:id(/:name(/:page))', 'validateUser', function ($id, $name = null, $page = 1) use($app) {
         $id = (int) $id;
         $cit = new Cities($id);
         $start = getPaginationStart($page);
         $count = $cit->countCityJobs();
         $number_of_pages = ceil($count / LIMIT);
         $city = $cit->findCity();
         $jobs = $cit->findCityJobs($start, LIMIT);
         if (isset($city) && $city) {
             $app->render(ADMIN_THEME . 'cities.php', array('city' => $city, 'jobs' => $jobs, 'id' => $id, 'number_of_pages' => $number_of_pages, 'current_page' => $page, 'page_name' => 'cities'));
         } else {
             $app->redirect(ADMIN_MANAGE);
         }
     });
 });
 /*
  * Pages group
  * Manage pages
Ejemplo n.º 18
0
        {
            parent::__construct();
            $this->_connMain->Execute("SET NAMES utf8");
        }
        public function getList()
        {
            $query = 'SELECT * 
FROM  `geo_cities` 
WHERE  `extraDetails` IS NULL
ORDER BY RAND()
LIMIT 0 , 30';
            $result = $this->fetchAll($query, array(), 0);
            return $result;
        }
    }
    $cities = new Cities();
    $list = $cities->getList();
} catch (Exception $e) {
}
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
</head>

<body>

<h1>Cities</h1>
<?php 
Ejemplo n.º 19
0
 public static function getCity()
 {
     $cities = Cities::model()->findAll();
     foreach ($cities as $city) {
         $array[$city->id] = $city->city_name;
     }
     return $array;
 }
Ejemplo n.º 20
0
$gMap->panControl = false;
$gMap->zoomControl = true;
$gMap->zoomControlOptions = array('style' => 'google.maps.ZoomControlStyle.SMALL');
$gMap->styles = 1;
$gMap->setWidth(100, '%');
$gMap->setHeight(390);
$mapTypeControlOptions = array();
// $gMap->mapTypeControlOptions= $mapTypeControlOptions;
$gMap->setCenter(58.0201, 55.954);
$icon = new EGMapMarkerImage("/img/map-icon.png");
$icon->setSize(28, 28);
$icon->setAnchor(14, 14);
$icon->setOrigin(0, 0);
// Create GMapInfoWindows
//$info_window_a = new EGMapInfoWindow('<div>Москва</div>');
$cities = Cities::model()->findAll();
if ($cities) {
    foreach ($cities as $city) {
        $info_box = new EGMapInfoBox('<div class="infoBox"><div class="infoBoxInner"><span>' . $city->city . '</span></div></div>');
        // set the properties
        $info_box->pixelOffset = new EGMapSize('-55', '15');
        $info_box->maxWidth = 0;
        $info_box->boxStyle = array('width' => '"186px"', 'height' => '"107px"');
        $info_box->closeBoxUrl = '""';
        //$info_box->closeBoxMargin = '"10px 2px 2px 2px"';
        $info_box->infoBoxClearance = new EGMapSize(1, 1);
        $info_box->enableEventPropagation = '"floatPane"';
        // Create marker
        if ($city->lat && $city->lng) {
            $marker = new EGMapMarker($city->lat, $city->lng, array('title' => $city->city, 'icon' => $icon));
            //$marker->addHtmlInfoWindow($info_window_a);
Ejemplo n.º 21
0
 public function getLoadcities($state)
 {
     $data = Cities::wherecity_state($state)->get();
     echo json_encode($data);
 }
Ejemplo n.º 22
0
 public function getCities($order = 'Name ASC', $limit = null)
 {
     if ($limit) {
         return Cities::model()->findAll(array('order' => $order, 'limit' => $limit));
     } else {
         return Cities::model()->findAll(array('order' => $order));
     }
 }
Ejemplo n.º 23
0
 public function getCitiesByName($city_id)
 {
     $name = "";
     $details = Cities::model()->findByAttributes(array('StateId' => $state_id));
     if (count($details) > 0) {
         $name = $details->Name;
     }
     return $name;
 }
Ejemplo n.º 24
0
 /**
  * Form for POST doDelete the specified resource.
  *
  * @return Response
  */
 public function doDelete()
 {
     $aData = Input::all();
     if (isset($aData['id'])) {
         $city = Cities::find($aData['id']);
         $city->delete();
         return Redirect::route('city-list')->with('message', 'Город успешно удален');
     }
     return Redirect::route('city-list')->with('message', 'Произошла ошибка удаления');
 }
Ejemplo n.º 25
0
 public function actionHome_owner()
 {
     if (!Yii::app()->user->isGuest) {
         if (Yii::app()->user->role == 'homeowner') {
             $this->pageTitle = 'Handyman.com - Home owner Dashboard';
             $this->cities = Cities::model()->findAll(array('order' => 'RAND()', 'limit' => 10));
             $user_id = Yii::app()->user->id;
             $criteria = new CDbCriteria();
             $criteria->condition = "homeowner_id = '{$user_id}'";
             $count = Projects::model()->count($criteria);
             $pages = new CPagination($count);
             // results per page
             $pages->pageSize = 2;
             $pages->applyLimit($criteria);
             $param['projects'] = Projects::model()->findAll($criteria);
             $param['test'] = 'homeOwner';
             $param['pages'] = $pages;
             $this->render('home-owner', $param);
         } else {
             $this->redirect(Yii::app()->homeUrl);
         }
     } else {
         $this->redirect(Yii::app()->homeUrl);
     }
 }
Ejemplo n.º 26
0
 public function actionFind()
 {
     $location = Yii::app()->Ini->getlocationbyip(Yii::app()->Ini->rip('ip'));
     $projects = Projecttypes::model()->findAll(array('order' => 'Name ASC'));
     $criteria = new CDbCriteria();
     $criteria->order = "question_id DESC";
     $criteria->limit = 5;
     $questions = Questions::model()->findAll($criteria);
     $states = States::model()->findAll(array('order' => 'Name ASC'));
     $city = Yii::app()->Ini->v('city');
     $project = Yii::app()->Ini->v('project');
     $zipcode = Yii::app()->Ini->v('zipcode');
     $match = Yii::app()->Ini->v('match');
     $homeowner_projects = $this->getHomeOwnerProjects();
     $pie = new SimplePie();
     $pie->set_feed_url('http://media.handyman.com/feed/');
     $pie->init();
     $pie->handle_content_type();
     if ($city) {
         $details = Cities::model()->findByAttributes(array('RewriteUrl' => $city . "/"));
         if (count($details) > 0) {
             $city_name = $details->Name;
         } else {
             $city_name = "";
         }
         $criteria = new CDbCriteria();
         $criteria->condition = "City like '%{$city_name}%'";
         $count = Contractors::model()->count($criteria);
         $pages = new CPagination($count);
         // results per page
         $pages->pageSize = 5;
         $pages->applyLimit($criteria);
         $models = Contractors::model()->findAll($criteria);
         $this->render('find_result', array('models' => $models, 'pages' => $pages, 'projects' => $projects, 'records' => $count, 'city_name' => $city_name, 'location' => $city_name . ",USA", 'questions' => $questions, 'homeowner_projects' => $homeowner_projects, 'feed' => $pie));
     } else {
         if ($project && $zipcode) {
             $details = Projecttypes::model()->findByAttributes(array('ProjectTypeId' => $project));
             if (count($details) > 0) {
                 $oid = $details->OID;
                 $city_name = $details->Name;
                 $home_advisor = Yii::app()->Ini->searchhomeadvisor($zipcode, $oid);
                 //$home_advisor = Yii::app()->Ini->searchhomeadvisor('11741','12005');
                 if ($home_advisor == false) {
                     $home_advisor_results = false;
                 } else {
                     $home_advisor_results = $home_advisor['serviceProvider'];
                 }
             }
             $criteria = new CDbCriteria();
             $criteria->condition = "ProjectTypeId='" . $project . "' AND Zip='" . $zipcode . "'";
             $count = Contractors::model()->count($criteria);
             $pages = new CPagination($count);
             // results per page
             $pages->pageSize = 5;
             $pages->applyLimit($criteria);
             $models = Contractors::model()->findAll($criteria);
             $this->render('match-result', array('pages' => $pages, 'result' => $models, 'home_advisors' => $home_advisor_results, 'projects' => $projects, 'states' => $states, 'location' => $location, 'city_name' => $city_name . ' In Zipcode ' . $zipcode, 'questions' => $questions, 'feed' => $pie));
         } else {
             if ($project) {
                 $details = Projecttypes::model()->findByAttributes(array('ProjectTypeId' => $project));
                 if (count($details) > 0) {
                     $city_name = $details->Name;
                 }
                 $criteria = new CDbCriteria();
                 $criteria->condition = "ProjectTypeId=" . $project;
                 $count = Contractors::model()->count($criteria);
                 $pages = new CPagination($count);
                 // results per page
                 $pages->pageSize = 5;
                 $pages->applyLimit($criteria);
                 $models = Contractors::model()->findAll($criteria);
                 $this->render('find_result', array('models' => $models, 'pages' => $pages, 'projects' => $projects, 'records' => $count, 'city_name' => $city_name, 'location' => $location, 'questions' => $questions, 'homeowner_projects' => $homeowner_projects, 'feed' => $pie));
             } else {
                 if ($zipcode) {
                     $criteria = new CDbCriteria();
                     $criteria->condition = "Zip='{$zipcode}'";
                     $count = Contractors::model()->count($criteria);
                     $pages = new CPagination($count);
                     // results per page
                     $pages->pageSize = 5;
                     $pages->applyLimit($criteria);
                     $models = Contractors::model()->findAll($criteria);
                     $this->render('find_result', array('models' => $models, 'pages' => $pages, 'projects' => $projects, 'records' => $count, 'city_name' => $zipcode, 'questions' => $questions, 'homeowner_projects' => $homeowner_projects, 'feed' => $pie));
                 } else {
                     if ($match) {
                         $proj = Projects::model()->findByPk($match);
                         if (count($proj) > 0) {
                             $proj_zipcode = $proj->zipcode;
                             $project_type_id = $proj->project_type_id;
                             $criteria = new CDbCriteria();
                             $criteria->condition = "ProjectTypeId='" . $project_type_id . "' AND Zip = '" . $proj_zipcode . "'";
                             $count = Contractors::model()->count($criteria);
                             $pages = new CPagination($count);
                             $result = Contractors::model()->findAll($criteria);
                             $projecttypes = ProjectTypes::model()->findByPK($project_type_id);
                             $proj_oid = $projecttypes->OID;
                             //$proj_zipcode = '11741';
                             //$proj_oid = '12070';
                             $home_advisor = Yii::app()->Ini->searchhomeadvisor($proj_zipcode, $proj_oid);
                             if ($home_advisor == false) {
                                 $home_advisor_results = false;
                             } else {
                                 $home_advisor_results = $home_advisor['serviceProvider'];
                             }
                             $this->render('match-result', array('pages' => $pages, 'result' => $result, 'home_advisors' => $home_advisor_results, 'projects' => $projects, 'states' => $states, 'location' => $location, 'city_name' => $this->getProjectTypeName($project_type_id) . ' In Zipcode ' . $proj_zipcode, 'questions' => $questions, 'feed' => $pie));
                         } else {
                             $this->render('find_form', array('projects' => $projects, 'states' => $states, 'location' => $location, 'questions' => $questions));
                         }
                     } else {
                         $this->render('find_form', array('projects' => $projects, 'states' => $states, 'location' => $location, 'questions' => $questions, 'feed' => $pie));
                     }
                 }
             }
         }
     }
 }
/**
 * Jobskee - open source job board
 *
 * @author      Elinore Tenorio <*****@*****.**>
 * @license     MIT
 * @url         http://www.jobskee.com
 */
/*
 * Load the configuration file
 */
require 'config.php';
/*
 * Load category and city values
 */
$categories = Categories::findCategories();
$cities = Cities::findCities();
/*
 * Load all existing controllers
 */
foreach (glob(CONTROLLER_PATH . "*.php") as $controller) {
    require_once $controller;
}
/*
 * Homepage
 * Front page controller
 */
$app->get('/(:page)', function ($page = null) use($app) {
    global $categories;
    if (isset($page) && $page != '') {
        $content = R::findOne('pages', ' url=:url ', array(':url' => $page));
        if ($content && $content->id) {
Ejemplo n.º 28
0
 public function getMenuCities($defaultCountry = 1)
 {
     $cities = Cities::model()->findAll("status=? AND countries_id=?", array(1, $defaultCountry));
     return CHtml::listData($cities, "id", "name");
 }
Ejemplo n.º 29
0
 public function actionSitemap()
 {
     header('Content-Type: application/xml');
     $cities = Cities::model()->findAll(array('order' => 'Name ASC'));
     $projects = Projecttypes::model()->findAll(array('order' => 'Name ASC'));
     $contractors = Contractors::model()->findAll(array('order' => 'Name ASC'));
     $this->renderPartial('sitemapxml', array('cities' => $cities, 'projects' => $projects, 'contractors' => $contractors));
 }
Ejemplo n.º 30
0
 public function showProvince($id_city)
 {
     $province = Cities::where('id', $id_city)->select('province_id')->first();
     $data = Provinces::find($province->province_id);
     return Response::json($data);
 }