Example #1
0
 public static function getService()
 {
     $data = self::find()->where(['guide_id' => User::getCurrentGuideId()])->asArray()->one();
     $data['service_car'] = ServiceCar::find()->where(['service_id' => $data['id']])->asArray()->all();
     $data['service_type'] = ServiceType::find()->select('rt_guide.vw_rt_guide_service_type.*, dict_type.name AS service_name')->leftJoin('rt_guide.vw_rt_dict_service_type AS dict_type', 'dict_type.id = rt_guide.vw_rt_guide_service_type.type_id')->where(['service_id' => $data['id']])->asArray()->all();
     return $data;
 }
Example #2
0
 public static function getGuideCountries($limit = false)
 {
     $select = self::find()->select(['distinct(country.id) as id', 'country.name as name', 'country.name_genitive as nameGenetive'])->leftJoin('dict.vw_dict_country as country', 'rt_guide.vw_rt_guide_user_geo.country = country.id')->where(['rt_guide.vw_rt_guide_user_geo.guide_id' => User::getCurrentGuideId()])->asArray();
     if ($limit) {
         $select->limit($limit);
     }
     return $select->all();
 }
Example #3
0
 public static function getExcursion($id)
 {
     $data = self::find()->where(['id' => $id, 'guide_id' => User::getCurrentGuideId()])->asArray()->all();
     if (!$data) {
         return false;
     }
     return $data[0];
 }
Example #4
0
 public function beforeAction($action)
 {
     // заглушка для предотвращения циклической ошибки
     if ($action instanceof ErrorAction) {
         return true;
     }
     if (!User::getCurrentGuide()) {
         throw new NotFoundHttpException();
     }
     return true;
 }
Example #5
0
 public function actionIndex()
 {
     $serviceData = Service::getService();
     $serviceAssocStyle = array('transfer' => array(0 => 1), 'service' => array(1 => 0, 2 => 5, 3 => 6, 4 => 2, 5 => 7, 6 => 3, 7 => 4));
     $serviceItems = array();
     if ($serviceData) {
         // первая услуга предоставление трансфера
         if ($serviceData['providing_shuttle']) {
             $serviceItems[] = array('type' => 'transfer', 'type_id' => 0, 'name' => 'Трансферы');
         }
         // остальные услуги
         if (isset($serviceData['service_type']) && $serviceData['service_type']) {
             foreach ($serviceData['service_type'] as $value) {
                 // не нужен гид-экскурсовод
                 if ($value['type_id'] != 1) {
                     $serviceItems[] = array('type' => 'service', 'type_id' => $value['type_id'], 'name' => $value['service_name']);
                 }
             }
         }
         $serviceItems = \app\helpers\Arr::getChunkArrayByNum($serviceItems, 3, false);
     }
     return $this->render('index', ['guide' => User::getCurrentGuide(), 'serviceData' => $serviceData, 'serviceAssocStyle' => $serviceAssocStyle, 'serviceItems' => $serviceItems]);
 }
Example #6
0
?>
 <?php 
foreach ($cities as $_c) {
    echo $_c['name'];
    ?>
, <?php 
}
echo $endCity['name'];
?>
</h3>
</div>

<div class="club-user-card">
    <p class="club-user-card-photo2">
        <a href="#"><img src="<?php 
echo \app\models\rt\guide\User::getAvaUrl(165, 165);
?>
" alt="" /></a>
    </p>
    <div class="club-user-card-info">
        <div class="club-user-card-about">
            <div class="club-user-card-about-loc">Специализация гида: самые мистические места Кипра</div>
        </div>
        <div><img src="/i/px.gif" height="15" alt="" /></div>
        <a href="javascript:void(0);" class="club-user-card-btn3 show-message-popup">Написать ему</a><br />
        <a href="javascript:void(0);" class="club-user-card-btn3 show-order-exc-popup">Забронировать экскурсию</a>
    </div>
</div>


Example #7
0
 public function actionAddorderexc()
 {
     Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     $data = ['status' => 'OK', 'message' => ''];
     $request = Yii::$app->request;
     $excId = $request->post('excId', false);
     $excursion = false;
     if (!$excId) {
         $countryId = $request->post('country', false);
         $cityId = $request->post('city', false);
         if (!$countryId || !$cityId) {
             $data['status'] = 'Err';
             $data['message'] = 'не переданы параметры экскурсии или страны и города!';
             return $data;
         }
     } else {
         $excursion = Excursion::getExcursion($excId);
         if (!$excursion) {
             $data['status'] = 'Err';
             $data['message'] = 'не найдена экскурсия!';
             return $data;
         }
     }
     $excDate = $request->post('excDate', false);
     $price = $request->post('price', false);
     $countBig = $request->post('countBig', false);
     $countSmall = $request->post('countSmall', false);
     $excComment = $request->post('excComment', false);
     $name = $request->post('name', false);
     $phone = $request->post('phone', false);
     $email = $request->post('email', false);
     if (!$excDate || !$excComment || !$name || !$phone || !$email) {
         $data['status'] = 'Err';
         $data['message'] = 'не заполнены обязательные поля!';
         return $data;
     }
     $validator = new \yii\validators\EmailValidator();
     if (!$validator->validate($email)) {
         $data['status'] = 'Err';
         $data['message'] = 'не корректный e-mail!';
         return $data;
     }
     if (!$excursion) {
         $country = Country::getCountry($countryId);
         if (!$country) {
             $data['status'] = 'Err';
             $data['message'] = 'страна не найдена!';
             return $data;
         }
         $city = City::getCity($cityId);
         if (!$city) {
             $data['status'] = 'Err';
             $data['message'] = 'город не найден!';
             return $data;
         }
         $text = $country['name'] . ', ' . $city['name'] . '<br />';
         $text .= 'Дата проведения экскурсии: ' . $excDate . '<br />';
         $text .= $countBig ? 'Количество взрослых: ' . $countBig . '<br />' : '';
         $text .= $countSmall ? 'Количество детей: ' . $countSmall . '<br />' : '';
         $text .= $price ? 'Цена до: ' . $price . '<br />' : '';
         $text .= '<br /><br />' . $excComment;
         $orderTbl = new AgencyOrder();
         $orderTbl->manager_id = User::getCurrentGuideId();
         $orderTbl->country_id = $countryId;
         $orderTbl->user_name = $name;
         $orderTbl->user_email = $email;
         $orderTbl->user_phone = $phone;
         $orderTbl->user_params = $text;
         $orderTbl->user_id = 0;
         $orderTbl->excursion_id = 0;
         $orderTbl->save();
     } else {
         $text = 'Дата проведения экскурсии: ' . $excDate . '<br />';
         if ($price) {
             $text .= 'Стоимость до: ' . $price . '<br />';
         }
         $text .= $countBig ? 'Количество взрослых: ' . $countBig . '<br />' : '';
         $text .= $countSmall ? 'Количество детей: ' . $countSmall . '<br />' : '';
         $text .= '<br /><br />' . $excComment;
         $orderTbl = new AgencyOrder();
         $orderTbl->manager_id = User::getCurrentGuideId();
         $orderTbl->country_id = $excursion['country_id'];
         $orderTbl->user_name = $name;
         $orderTbl->user_email = $email;
         $orderTbl->user_phone = $phone;
         $orderTbl->user_params = $text;
         $orderTbl->user_id = 0;
         $orderTbl->excursion_id = $excursion['id'];
         $orderTbl->save();
     }
     /**
      * @todo
      * добавить отправку заявки на e-mail
      */
     return $data;
 }
Example #8
0
 public function actionIndex()
 {
     return $this->render('index', ['guide' => User::getCurrentGuide(), 'excursions' => Excursion::getExcursions()]);
 }
Example #9
0
 public function actionIndex()
 {
     return $this->render('index', ['guide' => User::getCurrentGuide()]);
 }
Example #10
0
 public static function getPhotoUrl($albumId, $bodyId, $ext, $w = 194, $h = 194)
 {
     $folderName = \app\models\rt\guide\User::getPhotoFolder();
     return Yii::$app->params['rutravellerHost'] . '/icache/' . $folderName . "/al{$albumId}/{$bodyId}_{$w}x{$h}.{$ext}";
 }