Exemplo n.º 1
0
 function FillEditParams()
 {
     $request = Project::getRequest();
     $info = array();
     $info['year_list'] = array();
     for ($i = date('Y') - 100; $i < date('Y') - 8; $i++) {
         $info['year_list'][$i] = array('id' => $i, 'value' => $i);
     }
     $info['month_list'] = array();
     for ($i = 0; $i < 12; $i++) {
         $info['month_list'][$i] = array('id' => $i, 'value' => iconv("cp1251", "UTF-8", strftime("%B", mktime(0, 0, 0, $i, 1, 2008))));
     }
     $info['day_list'] = array();
     for ($i = 1; $i < 31; $i++) {
         $info['day_list'][] = array('id' => $i, 'value' => $i);
     }
     $country_model = new CountryModel();
     $info['country_list'] = $country_model->loadAll();
     $info['change_country_param'] = AjaxRequest::getJsonParam("User", "ChangeCountry", array('#id#'));
     if ($request->country) {
         $state_model = new StateModel();
         $info['state_list'] = $state_model->loadByCountry($request->country);
         $info['change_state_param'] = AjaxRequest::getJsonParam("User", "ChangeState", array('#id#'));
     }
     if ($request->state) {
         $city_model = new CityModel();
         $info['city_list'] = $city_model->loadByState($request->state);
     }
     //foreach ($info['country_list'] as &$item) {
     //	$item['change_country_param'] = AjaxRequest::getJsonParam("User", "ChangeCountry", array($item['id']));
     //}
     $this->_view->set($info);
 }
Exemplo n.º 2
0
 /**
  * Action: Вызов вкладки "Найди знакомых" (Основная)
  * Action: SearchUserMainAction - метод описывающий работу конкретного действия, 
  * зарегистрированного в таблице ACTION
  * 
  * Имя формируется строго: ИмяДействияAction. ИмяДействия_Action - уже не верно!
  */
 public function SearchUserMainAction()
 {
     $v_request = Project::getRequest();
     $v_session = Project::getSession();
     $data = array();
     //	  $this->_BaseSiteData($data);
     //    $this -> BaseSiteData();
     //    $data['tab_list'] = TabController::getSearchUserTabs(true, false);
     $data['action'] = 'SearchUserMain';
     // Номер выводимой страницы, определяется адресом bookmarks_list/0/1/2/ ...bookmarks_list/0/0/2/
     // где bookmarks_list/{id_категории}/{id_тега}/{номер страницы}/
     $v_n_page = $v_request->getKeyByNumber(0);
     //$v_str_find = ($v_request->inp_hide == 'find') ? $v_request->inp_find : null;
     $data['p_search_sex'] = $v_request->select_search_sex;
     $data['p_search_age_from'] = $v_request->inp_search_age_from;
     $data['p_search_age_to'] = $v_request->inp_search_age_to;
     $data['p_search_counrty'] = $v_request->select_search_counrty;
     $data['p_search_login'] = $v_request->inp_search_login;
     $data['p_search_with_photo'] = $v_request->chk_search_with_photo;
     $data['p_search_state'] = $v_request->select_search_state;
     $data['p_search_city'] = $v_request->select_search_city;
     $v_country_model = new CountryModel();
     $data['list_country'] = $v_country_model->loadAll();
     if ($v_request->btn_search != null) {
         $v_session->add('p_search_sex', $data['p_search_sex']);
         $v_session->add('p_search_age_from', $data['p_search_age_from']);
         $v_session->add('p_search_age_to', $data['p_search_age_to']);
         $v_session->add('p_search_counrty', $data['p_search_counrty']);
         $v_session->add('p_search_login', $data['p_search_login']);
         $v_session->add('p_search_with_photo', $data['p_search_with_photo']);
         $v_session->add('p_session_save', true);
     } else {
         $data['p_search_sex'] = $v_session->getKey('p_search_sex', null);
         $data['p_search_age_from'] = $v_session->getKey('p_search_age_from', null);
         $data['p_search_age_to'] = $v_session->getKey('p_search_age_to', null);
         $data['p_search_counrty'] = $v_session->getKey('p_search_counrty', null);
         $data['p_search_login'] = $v_session->getKey('p_search_login', null);
         $data['p_search_with_photo'] = $v_session->getKey('p_search_with_photo', null);
     }
     if ($v_session->getKey('p_session_save', null) == true) {
         $this->_getData($data, 'SearchUserMain', $v_n_page, null);
     }
     $this->_view->assign('counter_users', $this->counter_users);
     if ($data['p_search_state']) {
         $state_model = new StateModel();
         $state_list = $state_model->loadByCountry($data['p_search_counrty']);
         $this->_view->assign('change_state_param', AjaxRequest::getJsonParam("SearchUser", "ChangeStates", array('#id#')));
         $this->_view->assign('state_list', $state_list);
     }
     if ($data['p_search_city']) {
         $state_model = new CityModel();
         $city_list = $state_model->loadByState($data['p_search_state']);
         $this->_view->assign('city_list', $city_list);
     }
     $this->_view->assign('tab_list', TabController::getSearchUserTabs(true, false));
     // Show tabs
     $this->_view->SearchUser_Main($data);
     $this->_view->parse();
 }
Exemplo n.º 3
0
 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;
 }
<?php

//namespace App;
require './models/country-model.php';
CountryModel::create(array("name" => "mexico", "codigo" => "MEX"));
Exemplo n.º 5
0
 public function index()
 {
     if (in_array(Auth::getCapability(), array(CAPABILITY_ADMINISTRATOR))) {
         Model::autoloadModel('country');
         $model = new CountryModel($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['countries'])) {
             $this->para->countries = $_POST['countries'];
         }
         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['countries_per_page'])) {
             $this->para->countries_per_page = $_POST['countries_per_page'];
         }
         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->countries)) {
             $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_COUNTRY_INDEX, TRUE);
         } else {
             $this->view->renderAdmin(RENDER_VIEW_COUNTRY_INDEX);
         }
     } else {
         $this->login();
     }
 }
Exemplo n.º 6
0
 /**
  *  Action: Открытие формы создания соц.позиции
  */
 public function SocialPosAddAction()
 {
     $v_request = Project::getRequest();
     $data = array();
     $data['action'] = 'SocialPosAdd';
     $v_current_userID = Project::getUser()->getDbUser()->id;
     // ID залогиненного пользователя
     $v_sp_model = new SocialModel();
     $data['arr_social_tree_criteria'] = $v_sp_model->loadTreeCriteria();
     $data['arr_categories'] = $v_sp_model->loadCategories();
     //$this->_BaseSiteData($data);
     if ($v_request->btn_submit == null) {
         // -- Открытие формы для создания
         $country_model = new CountryModel();
         $country_list = $country_model->loadAll();
         $this->_get_categories($data, $v_categoryID);
         $change_country_param = AjaxRequest::getJsonParam("Social", "ChangeCountry", array('#id#'));
         $this->_view->assign('country_list', $country_list);
         $this->_view->assign('change_country_param', $change_country_param);
         $this->_view->__set('product_places', $v_sp_model->getProductPlaces());
         $this->_view->assign('tab_list', TabController::getSocialTabs(false, false, false, true));
         // Show tabs
         $this->_view->Social_PosAdd($data);
         $this->_view->parse();
     } else {
         // -- Анализ данных и сохранение
         if ($v_request->inp_sp_name == "" or $v_request->inp_sp_comment == "") {
             // -- Данные неполные
             $data['inp_sp_name'] = $v_request->inp_sp_name;
             $data['inp_sp_comment'] = $v_request->inp_sp_comment;
             $this->_view->Social_PosAdd($data);
             $this->_view->addFlashMessage(FM::ERROR, 'Поля " * " должны быть заполнены');
             $this->_view->assign('tab_list', TabController::getSocialTabs(false, false, false, true));
             // Show tabs
             $this->_view->parse();
         } else {
             // -- Сохранение данных
             $v_model = new SocialModel();
             $v_model->social_tree_id = $v_request->inp_sp_category;
             $v_model->user_id = $v_current_userID;
             $v_model->name = $v_request->inp_sp_name;
             $v_model->creation_date = date("Y-m-d H:i:s");
             if ($v_request->type_prod) {
                 $v_model->id_product = $v_request->id_product;
             }
             if ($v_request->type_place) {
                 $country_model = new CountryModel();
                 $state_model = new StateModel();
                 $city_model = new CityModel();
                 $country = $country_model->getCountryNameById($v_request->country);
                 if ($country) {
                     $country .= ', ';
                 }
                 $state = $state_model->getStateNameById($v_request->select_social_state);
                 if ($state) {
                     $state .= ', ';
                 }
                 $city = $city_model->getCityNameById($v_request->select_social_city);
                 if ($city) {
                     $city .= ', ';
                 }
                 $street = $v_request->street;
                 if ($street) {
                     $street .= ', ';
                 }
                 $house = $v_request->house;
                 if ($house) {
                     $house .= ', ';
                 }
                 $address = urlencode($country . $state . $city . $street . $house);
                 //echo $address;
                 $Coords = file_get_contents('http://maps.google.com/maps/geo?q=' . $address . '&output=csv&key=ABQIAAAAIMN2iaCMFuGQ7iw1w3khQhRJcbERdBxj2ey4tItiMN02nh3_tBSPZ_cpbhowAtSVcVvvdpej4XMW1Q');
                 //home ABQIAAAAIMN2iaCMFuGQ7iw1w3khQhR-v9yHoD50evrZ-pbO1wgn-sHpRBTCwGDBW1h8fK3f31phKFZTanuxDA
                 //site ABQIAAAAIMN2iaCMFuGQ7iw1w3khQhRJcbERdBxj2ey4tItiMN02nh3_tBSPZ_cpbhowAtSVcVvvdpej4XMW1Q
                 list($status, $Zoom, $Xcoord, $Ycoord) = split(',', $Coords);
                 if ($status == 200) {
                     $v_model->Xcoord = $Xcoord;
                     $v_model->Ycoord = $Ycoord;
                     $v_model->Zoom = $Zoom;
                 }
             }
             $v_new_id = $v_model->save();
             // -- Сохранение коммента
             $v_comment_model = new SocialCommentModel();
             $v_comment_model->addComment(Project::getUser()->getDbUser()->id, 0, 0, $v_new_id, $v_request->inp_sp_comment, 0, 0);
             // -- Сохранения связи соц.позиции и критериев
             $this->_SetVote($v_new_id, $v_request->inp_num_criteria_1, $v_request->inp_select_1);
             $this->_SetVote($v_new_id, $v_request->inp_num_criteria_2, $v_request->inp_select_2);
             $this->_SetVote($v_new_id, $v_request->inp_num_criteria_3, $v_request->inp_select_3);
             // = Запись в таблицу локировки голосования
             $v_sp_votes_model = new SocialVotesModel();
             $v_sp_votes_model->social_pos_id = $v_new_id;
             $v_sp_votes_model->user_id = (int) Project::getUser()->getDbUser()->id;
             $v_sp_votes_model->ip = $_SERVER['REMOTE_ADDR'];
             $v_sp_votes_model->save();
             Project::getResponse()->redirect($v_request->createUrl('Social', 'SocialUserList'));
         }
     }
 }
Exemplo n.º 7
0
 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();
 }
Exemplo n.º 8
0
        <form method="post" enctype="multipart/form-data" id="form">
            <div class="panel-body">
                <div class="group container-fluid">
                    <div class="row col-sm-6 pull-right">
                        <div class="form-group col-sm-13">
                            <label for="alias">Slug</label>
                            <input type="text" name="slug" value="<?php 
echo $item->slug;
?>
" class="form-control" id="slug" placeholder="Slug" required>
                        </div>
                        <div class="form-group col-sm-9">
                            <label for="country">Select Country</label>
                            <select name="country">
                                <?php 
foreach (CountryModel::all() as $i) {
    ?>
                                    <option value="<?php 
    echo $i->id;
    ?>
" <?php 
    echo $item->country_id == $i->id ? ' selected' : '';
    ?>
>
                                        <?php 
    echo $i->title();
    ?>
                                    </option>
                                <?php 
}
?>
 /**
  * @param mixed $country
  */
 public function setCountry(CountryModel $country)
 {
     $this->country_id = $country->getId();
 }
Exemplo n.º 10
0
$f3->route('GET /country/@id', function ($f3) {
    $cont = null;
    for ($i = 0; $i < count($f3->cmodel->listOfCountries); $i++) {
        if ($f3->cmodel->listOfCountries[$i]->getId() == $f3->get('PARAMS.id')) {
            $cont = $f3->cmodel->listOfCountries[$i];
            break;
        }
    }
    if ($cont == null) {
        echo "Country not foundt";
    } else {
        echo json_encode($cont);
    }
});
$f3->route('POST /country/@id', function ($f3, $params) {
    $cmodel = new CountryModel();
    //$tempCountry = new Country($f3->get('capital'),
    //                          $f3->get('carcode'),
    //                           $f3->get('datacode'),
    //                        $f3->get('gdp_agri'),
    //                      $f3->get('gdp_ind'),
    //                    $f3->get('gdp_serv'),
    //                  $f3->get('gdp_total'),
    //                $f3->get('goverment'),
    //              $f3->get('id'),
    //            $f3->get('indep_date'),
    //          $f3->get('infant_mortality'),
    //        $f3->get('inflation'),
    //      $f3->get('name'),
    //    $f3->get('population'),
    //  $f3->get('population_growth'),
Exemplo n.º 11
0
 public function getTest()
 {
     //        $this->layout = null;
     $chargerContainer = View::make('site/charge-steps/container')->with('content', View::make('site/charge-steps/step1', ['countries' => \CountryModel::getChargableCountries()]));
     $this->layout->content = View::make('site/home')->with('content', $chargerContainer);
 }