public function createOccupation($name) { $occ = new Occupation(); $occ->setName($name); $occ->save(); return $occ; }
public function getMyprofile() { $id = Auth::user()->id; $alumni_id = null; $sql = "SELECT * FROM alumni WHERE account_id = ?"; $prof = DB::select($sql, array($id)); if ($prof != null) { $alumni_id = $prof[0]->id; } $sql2 = "SELECT * FROM degree WHERE alumni_id = ?"; $deg = DB::select($sql2, array($alumni_id)); $sql3 = "SELECT * FROM work_experience WHERE alumni_id = ?"; $wrk_exp = DB::select($sql3, array($alumni_id)); $sql4 = "SELECT * FROM certificate WHERE alumni_id = ?"; $certificate = DB::select($sql4, array($alumni_id)); // $sql5 = "SELECT * FROM alumni_tracer WHERE alumni_id = ?"; $sql5 = "SELECT at.*, sq.question, sc.choice\n\t\t\t\tFROM alumni_tracer AS at\n\t\t\t\tINNER JOIN survey_questions AS sq\n\t\t\t\tON sq.id = at.question_id\n\t\t\t\tINNER JOIN survey_choices AS sc\n\t\t\t\tON sc.id = at.choice_id\n\t\t\t\tWHERE at.alumni_id = ?\n\t\t\t\tORDER BY at.question_id"; $a_tracer = DB::select($sql5, array($alumni_id)); $dept = Department::all(); $region = Region::all(); $province = Province::all(); $occupation = Occupation::all(); $company = Company::all(); $deg_title = DegreeTitle::all(); $school = School::all(); $jobs = Job::all(); $field = Field::all(); $questions = DB::select("SELECT * FROM survey_questions"); $civil_status = DB::select("SELECT * FROM civil_status"); return View::make('user.profile')->with('company', $company)->with('field', $field)->with('occupation', $occupation)->with('work_exp', $wrk_exp)->with('degree', $deg)->with('a_tracer', $a_tracer)->with('certificate', $certificate)->with('school', $school)->with('deg_title', $deg_title)->with('profile', $prof)->with('dept', $dept)->with('region', $region)->with('province', $province)->with('civil_status', $civil_status)->with('questions', $questions)->with('jobs', $jobs); }
protected function prepareMailData() { $product = Tree::find($this->getPreparedItem('id_catalog')); $occupation = Occupation::find($this->getPreparedItem('id_occupation')); $this->setMessageSubject('Заявка на услугу: ' . $product->title_ru); $this->appendMessageBody("<html><body>"); $this->appendMessageBody("<p><b>Заявка на услугу:</b> " . $product->title_ru . "</p>"); $this->appendMessageBody("<p><b>Фамилия:</b> " . $this->getPreparedItem('last_name') . "</p>"); $this->appendMessageBody("<p><b>Имя:</b> " . $this->getPreparedItem('first_name') . "</p>"); $this->appendMessageBody("<p><b>Отчество:</b> " . $this->getPreparedItem('patronymic_name') . "</p>"); $this->appendMessageBody("<p><b>Занятость:</b> " . $occupation->title_ru . "</p>"); $this->appendMessageBody("<p><b>Email:</b> " . $this->getPreparedItem('email') . "</p>"); $this->appendMessageBody("<p><b>Контактный телефон:</b> " . $this->getPreparedItem('phone_number') . "</p>"); $this->appendMessageBody("<p><b>Паспорт:</b> " . $this->getPreparedItem('passport') . "</p>"); $this->appendMessageBody("<p><b>ИНН:</b> " . $this->getPreparedItem('inn') . "</p>"); $this->appendMessageBody("<p><b>Клиент банка:</b> " . ($this->getPreparedItem('is_bank_client') ? 'Да' : 'Нет') . "</p>"); if ($this->getPreparedItem('monthly_income')) { $this->appendMessageBody("<p><b>Ежемесячный доход:</b> " . $this->getPreparedItem('monthly_income') . "</p>"); } if ($this->getPreparedItem('credit_amount')) { $this->appendMessageBody("<p><b>Сумма кредита:</b> " . $this->getPreparedItem('credit_amount') . "</p>"); } if ($this->getPreparedItem('term')) { $this->appendMessageBody("<p><b>Срок кредита:</b> " . $this->getPreparedItem('term') . "</p>"); } if ($this->getPreparedItem('is_insurance_loss_job')) { $this->appendMessageBody("<p><b>Страховка от временной потери работы:</b> Да</p>"); } if ($this->getPreparedItem('is_insurance_accident')) { $this->appendMessageBody("<p><b>Страховка от несчастного случая:</b> Да</p>"); } $this->appendMessageBody("<html><body>"); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $report_dates = ReportDate::lists('petsa', 'id'); $dropout_graduate = DropoutGraduate::findOrFail($id); $sectors = Sector::all()->lists('name', 'id'); $subsectors = Subsector::findOrFail($dropout_graduate->occupation->subsector->id)->lists('name', 'id'); $occupations = Occupation::findOrFail($dropout_graduate->occupation->id)->lists('name', 'id'); return view('tviadmin.dropout_graduates.edit', compact('dropout_graduate', 'sectors', 'subsectors', 'occupations', 'report_dates')); }
public function init() { if (empty($_GET['language'])) { $_GET['language'] = 'ru'; } if (isset($_GET['alias'])) { $id = Occupation::model()->findBySql('select id from {{occupation}} where alias="' . $_GET['alias'] . '"'); if (count($id) > 0) { $_GET['id'] = $id->id; } } //print_r($_GET); Yii::app()->language = $_GET['language']; parent::init(); }
protected function prepareMailData() { $product = Tree::find($this->getPreparedItem('id_catalog')); $occupation = Occupation::find($this->getPreparedItem('id_occupation')); $this->setMessageSubject('Заявка на услугу: ' . $product->title_ru); $this->appendMessageBody("<html><body>"); $this->appendMessageBody("<p><b>Заявка на услугу:</b> " . $product->title_ru . "</p>"); $this->appendMessageBody("<p><b>Фамилия:</b> " . $this->getPreparedItem('last_name') . "</p>"); $this->appendMessageBody("<p><b>Имя:</b> " . $this->getPreparedItem('first_name') . "</p>"); $this->appendMessageBody("<p><b>Отчество:</b> " . $this->getPreparedItem('patronymic_name') . "</p>"); $this->appendMessageBody("<p><b>Занятость:</b> " . $occupation->title_ru . "</p>"); $this->appendMessageBody("<p><b>Email:</b> " . $this->getPreparedItem('email') . "</p>"); $this->appendMessageBody("<p><b>Контактный телефон:</b> " . $this->getPreparedItem('phone_number') . "</p>"); $this->appendMessageBody("<p><b>Паспорт:</b> " . $this->getPreparedItem('passport') . "</p>"); $this->appendMessageBody("<p><b>ИНН:</b> " . $this->getPreparedItem('inn') . "</p>"); $this->appendMessageBody("<p><b>Клиент банка:</b> " . ($this->getPreparedItem('is_bank_client') ? 'Да' : 'Нет') . "</p>"); if ($this->getPreparedItem('id_city')) { $city = City::find($this->getPreparedItem('id_city')); if (isset($city->title_ru)) { $this->appendMessageBody("<p><b>Город:</b> " . $city->title_ru . "</p>"); } } if ($this->getPreparedItem('id_shop')) { $shop = Shop::find($this->getPreparedItem('id_shop')); if (isset($shop->title_ru)) { $this->appendMessageBody("<p><b>Магазин:</b> " . $shop->title_ru . "</p>"); } } if ($this->getPreparedItem('id_product_type')) { $productType = Product::find($this->getPreparedItem('id_product_type')); if (isset($productType->title_ru)) { $this->appendMessageBody("<p><b>Тип товара:</b> " . $productType->title_ru . "</p>"); } } if ($this->getPreparedItem('product_price')) { $this->appendMessageBody("<p><b>Стоимость товара:</b> " . $this->getPreparedItem('product_price') . "</p>"); } if ($this->getPreparedItem('term')) { $this->appendMessageBody("<p><b>Срок кредита:</b> " . $this->getPreparedItem('term') . "</p>"); } if ($this->getPreparedItem('is_insurance_loss_job')) { $this->appendMessageBody("<p><b>Страховка от временной потери работы:</b> Да</p>"); } if ($this->getPreparedItem('is_insurance_accident')) { $this->appendMessageBody("<p><b>Страховка от несчастного случая:</b> Да</p>"); } $this->appendMessageBody("<html><body>"); }
public function display() { // get models require_once MVC_BASE_PATH . '/apps/greystone/models/Occupation.php'; require_once MVC_BASE_PATH . '/apps/greystone/models/Country.php'; // get occupation and country lists $occupations_result = Occupation::get_all_occupations(); $countries_result = Country::get_all_countries(); // spew the page $this->header_spew(); $this->body_top_spew(); $this->form_top_spew(); $this->name_spew(); $this->email_spew(); $this->email_visable_spew(); $this->occ_select_spew($occupations_result); $this->cntry_select_spew($countries_result); $this->gender_spew(); $this->age_spew(); $this->bottom_spew(); }
protected function prepareMailData() { $product = Tree::find($this->getPreparedItem('id_catalog')); $occupation = Occupation::find($this->getPreparedItem('id_occupation')); $this->setMessageSubject('Заявка на услугу: ' . $product->title_ru); $this->appendMessageBody("<html><body>"); $this->appendMessageBody("<p><b>Заявка на услугу:</b> " . $product->title_ru . "</p>"); $this->appendMessageBody("<p><b>Фамилия:</b> " . $this->getPreparedItem('last_name') . "</p>"); $this->appendMessageBody("<p><b>Имя:</b> " . $this->getPreparedItem('first_name') . "</p>"); $this->appendMessageBody("<p><b>Отчество:</b> " . $this->getPreparedItem('patronymic_name') . "</p>"); $this->appendMessageBody("<p><b>Занятость:</b> " . $occupation->title_ru . "</p>"); $this->appendMessageBody("<p><b>Email:</b> " . $this->getPreparedItem('email') . "</p>"); $this->appendMessageBody("<p><b>Контактный телефон:</b> " . $this->getPreparedItem('phone_number') . "</p>"); $this->appendMessageBody("<p><b>Паспорт:</b> " . $this->getPreparedItem('passport') . "</p>"); $this->appendMessageBody("<p><b>ИНН:</b> " . $this->getPreparedItem('inn') . "</p>"); $this->appendMessageBody("<p><b>Клиент банка:</b> " . ($this->getPreparedItem('is_bank_client') ? 'Да' : 'Нет') . "</p>"); if ($this->getPreparedItem('monthly_fee')) { $this->appendMessageBody("<p><b>Ежемесячная плата:</b> " . $this->getPreparedItem('monthly_fee') . "</p>"); } if ($this->getPreparedItem('left_to_repay_money')) { $this->appendMessageBody("<p><b>Осталось погашать:</b> " . $this->getPreparedItem('left_to_repay_money') . "</p>"); } if ($this->getPreparedItem('credit_type')) { if ($this->getPreparedItem('credit_type') == 'simple') { $type = 'Кредит'; } else { $type = 'Кредит на карте'; } $this->appendMessageBody("<p><b>Тип кредита:</b> " . $type . "</p>"); } if ($this->getPreparedItem('is_insurance_loss_job')) { $this->appendMessageBody("<p><b>Страховка от временной потери работы:</b> Да</p>"); } if ($this->getPreparedItem('is_insurance_accident')) { $this->appendMessageBody("<p><b>Страховка от несчастного случая:</b> Да</p>"); } $this->appendMessageBody("<html><body>"); }
echo '<a href="/id' . $data->id . '" class="cat-photo-img__link last"><img class="cat-photo-img" src="/img/zaglushka.png" alt="' . $data->name . ' - ' . Occupation::getName($data->occupation_id) . '"></a>'; } } else { if ($file->file != '') { //echo '<a href="/id'.$data->id.'" class="cat-photo-img__link"><img class="cat-photo-img" src="/users/'.$data->id.'/370_'.$img.'" alt="'.$data->name.' - '.Occupation::getName($data->occupation_id).'"></a>'; echo '<a href="' . $img_link . '" class="cat-photo-img__link"><img class="cat-photo-img" src="/users/' . $data->id . '/370_' . $img . '" alt="' . $data->name . ' - ' . Occupation::getName($data->occupation_id) . '"></a>'; } else { echo '<a href="/id' . $data->id . '" class="cat-photo-img__link"><img class="cat-photo-img" src="/img/zaglushka.png" alt="' . $data->name . ' - ' . Occupation::getName($data->occupation_id) . '"></a>'; } } $i++; } } } if ($i <= 4) { while ($i <= 4) { if ($i == 4) { echo '<a href="/id' . $data->id . '" class="cat-photo-img__link last"><img class="cat-photo-img" src="/img/zaglushka.png" alt="' . $data->name . ' - ' . Occupation::getName($data->occupation_id) . '"></a>'; } else { echo '<a href="/id' . $data->id . '" class="cat-photo-img__link"><img class="cat-photo-img" src="/img/zaglushka.png" alt="' . $data->name . ' - ' . Occupation::getName($data->occupation_id) . '"></a>'; } $i++; } } ?> </div> </section> <?php } } }
public function __defaultAction() { return Occupation::__construct(); }
echo CHtml::image('/users/' . $item->user->id . '/' . $item->user->photo, 'My photo'); } else { echo CHtml::image('/img/zaglushka.png', 'My photo'); } ?> </span> <!--div class="cabinet__people__item__rating"><i class="star__icon"></i>9,5</div--> <div class="cabinet__people__item__user-name"><?php echo $item->user->name; ?> </div> <div class="cabinet__people__item__user-city"><?php echo City::getName($item->user->city_id); ?> , <?php echo Occupation::getName($item->user->occupation_id); ?> </div> </a> </figure> </div> <script> $('.delete__hidden-yes').click(function(){ $('.delete__hidden').hide(); $.ajax({ url: '/my/favorites/delete/id/<?php echo $item->id; ?> ', type : "get", success: function (data, textStatus) {
<div class="container"> <ul class="header-menu-primary__dropdownmenu__container"> <li class="dropdownmenu__item"> <ul class="dropdownmenu__item__list"> <?php $data_cat = new Category(); $list = $data_cat->findAll(); $i = 1; foreach ($list as $k => $v) { //if($i%8==0) { // echo '</ul></li>'; // echo ' <li class="dropdownmenu__item"> // <ul class="dropdownmenu__item__list">'; //} echo '<li class="dropdownmenu__item__list__item"><h3 class="dropdownmenu__item__list__item__title">' . $v->name . '</h3></li>'; $model = new Occupation(); $list1 = $model->localized('ru')->findAll('cat_id=:cid', array(':cid' => $v->id)); $i = 1; foreach ($list1 as $k1 => $v1) { //echo '<li class="dropdownmenu__item__list__item"><a href="" class="dropdownmenu__item__list__item__link">Воздушные акробаты<span class="dropdown__link__col"> (25)</span></a></li>'; if ($v1->alias != '') { $alias = $v1->alias; } else { $alias = Settings::toLatin($v1->name); Occupation::model()->updateByPk($v1->id, array('alias' => $alias)); } if (Yii::app()->getRequest()->getParam('id') == $v1->id && Yii::app()->controller->id == 'cat') { echo '<li class="dropdownmenu__item__list__item"><a href="' . $this->createUrl('/cat/view', array('alias' => $alias)) . '" class="dropdownmenu__item__list__item__link dropdownmenu__item__list__item__link--current">' . $v1->name . '<span class="dropdown__link__col"> (' . Occupation::CalcUsers($v1->id) . ')</span></a></li>'; } else { echo '<li class="dropdownmenu__item__list__item"><a href="' . $this->createUrl('/cat/view', array('alias' => $alias)) . '" class="dropdownmenu__item__list__item__link">' . $v1->name . '<span class="dropdown__link__col"> (' . Occupation::CalcUsers($v1->id) . ')</span></a></li>'; }
<div class="wrapper parallax__wrap"> <div class="parallax__wrap--inner"> <div class="parallax__bg" data-stellar-background-ratio="0.6"> <div class="container"> <h1 class="header-parallax__title"><?php echo Occupation::getName(Yii::app()->getRequest()->getParam('id')); ?> </h1> </div> </div> </div> </div> <div class="wrapper wrapper--advanced-search"> <div class="container"> <button class="advanced-search__title">РАСШИРЕННЫЙ ПОИСК</button> <div class="advanced-search__hidden"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'users-form', 'enableAjaxValidation' => false, 'enableClientValidation' => false, 'clientOptions' => array('validateOnSubmit' => false, 'validateOnChange' => false))); ?> <div class="search__hidden__float-container search__hidden__float-container--w269"> <label for="city" class="search__hidden__input-label">Город</label> <?php if (isset(Yii::app()->request->cookies['city'])) { $active = Yii::app()->request->cookies['city']->value; } else { $active = ''; } echo CHtml::dropDownList('city', $active, CHtml::listData(City::model()->findAll(), 'id', 'name'), array('id' => 'city', 'empty' => 'Укажите город')); ?> </div> <div class="search__hidden__float-container search__hidden__float-container--w269">
public function getName($id) { $data = Occupation::model()->findByPk($id); if (count($data) > 0) { return $data->name; } else { return false; } }
<div class="accaunt__right-info"> <header class="accaunt__right__header"> <div class="accaunt__right__header__name col-8"> <h1><?php echo $model->name; ?> </h1> <div class="accaunt__status <?php echo $model->member_type; ?> "><?php echo $model->member_type; ?> </div> <span class="accaunt__role"><?php echo Occupation::getName($model->occupation_id); ?> </span> </div> <div class="accaunt__right__header__rate col-4"> <?php echo Users::getTimeAgo($model->date_registered); ?> <span><!--9,5--></span> </div> </header> <div class="col-4 accaunt-contacts"> <ul class="accaunt-contacts__list"> <?php if ($model->address != '') { ?>
$i++; } } if ($i < 4) { while ($i <= 4) { ?> <figure class="flo_figure" onclick="window.location.href='/user/<?php echo $data->id; ?> '"> <div class="img-container"> <img src="/img/zaglushka_other.jpg" alt="<?php echo $data->name; ?> - <?php echo Occupation::getName($data->occupation_id); ?> " /> </div> <!--div class="flo__price"><span></span></div--> </figure> <?php $i++; } } ?> </div> </section> <?php } }
?> <?php //echo $form->errorSummary($model_t); ?> <div class="default-input__container"> <div class="col-181"> <?php echo $form->labelEx($model_t, 'occupation', array('class' => 'default-input__label')); ?> </div> <div class="col-674"> <?php //echo $form->dropDownList($model_t,'occupation',CHtml::listData(City::model()->findAll(),'id','name'),array('class'=>'default__input','empty'=>'')); ?> <?php echo $form->dropDownList($model_t, 'occupation', CHtml::listData(Occupation::model()->findAll(), 'id', 'name'), array('empty' => '', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('/my/tenders/genresublist'), 'success' => 'function(html) { if(html!="") { jQuery("#genre_show").css("display", "block"); jQuery("#Tenders_genre").html(html); } else { jQuery("#genre_show").css("display", "none"); } }'), 'class' => 'default__input')); ?> <?php echo $form->error($model_t, 'occupation'); ?> </div>
<nav class="cabinet__first-menu"> <ul> <li><a href="#0">Входящие</a></li> <li><a href="#0">Отправленные</a></li> </ul> </nav> </div> <div class="cabinet-main"> <header class="cabinet__header"> <div class="cabinet__title clfx"> <div class="accaunt__right__header__name col-8"> <h1><?=Yii::app()->user->name;?></h1> <?php if(Yii::app()->user->member!=0):?> <div class="accaunt__status"><?=Yii::app()->user->member_type;?></div> <span class="accaunt__role"><?=Occupation::getName($user->occupation_id);?></span> <? endif; ?> </div> <div class="accaunt__right__header__rate col-4"> на сайте 2 дня </div> </div> <nav class="cabinet__second-menu"> <ul> <li><?=CHtml::link('Профиль','/index.php/profile/');?></li> <li><a href="#0">Избранное</a></li> <li><a href="#0">Мои тендеры</a></li> <li class="active"><?=CHtml::link('Сообщения','/index.php/messages/');?></li> <li><?=CHtml::link('Настройки','/index.php/profile/settings');?></li> </ul> </nav>
public function getName($id) { $data = Occupation::model()->findByPk($id); return $data->name; }
/** * 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 the ID of the model to be loaded */ public function loadModel($id) { $model = Occupation::model()->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
if (isset(Yii::app()->request->cookies['city'])) { $active = Yii::app()->request->cookies['city']->value; } else { $active = ''; } echo CHtml::dropDownList('city', $active, CHtml::listData(City::model()->findAll(), 'id', 'name'), array('id' => 'tender_city', 'empty' => 'Укажите ближайший город')); ?> </div> <!-- div class="search__hidden__float-container search__hidden__float-container--w210"> <label for="datepicker" class="search__hidden__input-label">Дата мероприятия</label> <input type="text" id="datepicker" name="" placeholder="Выберите дату" class="search__hidden__input search__hidden__input--datepicker" /> </div--> <div class="search__hidden__float-container search__hidden__float-container--w310"> <label for="genre" class="search__hidden__input-label">Услуга</label> <?php echo CHtml::dropDownList('occupation', '', CHtml::listData(Occupation::model()->findAll(), 'id', 'name'), array('id' => 'tender_genre', 'empty' => 'Выберите нужную услугу')); ?> </div> <div class="search__hidden__float-container search__hidden__float-container--w236"> <label for="minPrice" class="search__hidden__input-label search__hidden__input-label_pl10">Стоимость, грн</label> <div class="search__hidden__price-container"> <input type="text" name="price_from" id="minPrice" class="search__hidden__input" placeholder="от"> </div> <div class="search__hidden__price-container"> <input type="text" name="price_to" class="search__hidden__input" placeholder="до"> </div> </div> <!--div class="clfx"></div> <div class="radio-wrapper"> <div class="checkbox-name">Пол участника</div> <input class="radio" type="radio" name="lorem" id="radio-1">
<?php /* @var $this CatController */ $this->breadcrumbs = array('Услуги', Occupation::getName($id)); ?> <?php Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/min/jquery.stellar.min.js'); ?> <div id="listView"> <?php $this->widget('zii.widgets.CListView', array('dataProvider' => $dataProvider, 'itemView' => '_view_avto', 'ajaxUpdate' => false, 'template' => "{items}", 'emptyText' => Yii::t('category', 'No results found.'))); ?> </div> <?php if ($dataProvider->totalItemCount > $dataProvider->pagination->pageSize) { ?> <p id="loading" style="display:none"><img src="<?php echo Yii::app()->request->baseUrl; ?> /img/loading.gif" alt="" /></p> <div class="wrapper wrapper-see-more"> <a id="showMore" class="see-more" href="#">Смотреть еще</a> </div> <script type="text/javascript"> /*<![CDATA[*/ (function($)
}); View::composer('partials.popups.sitemap', function ($view) { $root = Collector::get('root'); $current = Collector::get('current'); $view->with('root', $root)->with('current', $current); }); View::composer('partials.popups.apply_form_text', function ($view) { $oferta = Cache::tags('j_tree')->rememberForever('oferta_' . App::getLocale(), function () { return Tree::where('slug', 'oferta')->first(); }); $view->with('oferta', $oferta); }); View::composer(['partials.popups.apply_form', 'partials.popups.new_partner', 'partials.popups.apply_form_deposit', 'partials.popups.apply_form_business'], function ($view) { $operatorCodes = explode(',', Settings::get('mobile_operators_codes')); $occupations = Cache::tags('occupations')->rememberForever('occupations_' . App::getLocale(), function () { return Occupation::active()->get(); }); $regions = Cache::tags('regions')->rememberForever('regions_' . App::getLocale(), function () { return Region::active()->get(); }); $cities = Cache::tags('cities')->rememberForever('cities_region_1_' . App::getLocale(), function () { return City::active()->byRegion(1)->get(); }); $view->with('occupations', $occupations)->with('operatorCodes', $operatorCodes)->with('regions', $regions)->with('cities', $cities); }); /* View::composer('partials.popups.new_partner', function($view) { $operatorCodes = explode(',', Settings::get('mobile_operators_codes')); $occupations = Occupation::active()->get(); $view->with('occupations', $occupations)->with('operatorCodes', $operatorCodes); });
public function actionIndex() { $urls = array(); // Actions $urls[] = $this->createUrl('actions/index'); $actions = Actions::model()->findAll('t.picture != "" AND t.date_end <= ' . date('Y-m-d')); if (count($actions) > 0) { foreach ($actions as $action) { $urls[] = $this->createUrl('actions/view', array('id' => $action->id)); } } // Tenders $urls[] = $this->createUrl('tenders/index'); $tenders = Tenders::model()->findAll('t.date_end <= ' . date('Y-m-d')); if (count($tenders) > 0) { foreach ($tenders as $tender) { $urls[] = $this->createUrl('tenders/view', array('id' => $tender->id)); } } // Freefoto $urls[] = $this->createUrl('freefoto/index'); // Static Pages $urls[] = $this->createUrl('page/hmagent'); $urls[] = $this->createUrl('page/advertisment'); $urls[] = $this->createUrl('page/help_us'); $urls[] = $this->createUrl('page/about'); $urls[] = $this->createUrl('page/accounts'); // News $urls[] = $this->createUrl('page/news'); $news = News::model()->findAll('t.title != "" AND t.intro_text != ""'); if (count($news) > 0) { foreach ($news as $item) { $urls[] = $this->createUrl('page/news', array('id' => $item->id)); } } // Categories $cats = Occupation::model()->localized('ru')->findAll(array('condition' => 't.name!="" AND t.active=1', 'order' => 't.cat_id ASC')); if (count($cats) > 0) { foreach ($cats as $cat) { $urls[] = $this->createUrl('/cat/view', array('id' => 'c' . $cat->id . '_' . Settings::toLatin($cat->name))); } } // Users $users = Users::model()->findAll('t.name!="" AND t.activate=1'); if (count($users) > 0) { foreach ($users as $user) { if ($user->filesCount >= 4 || $user->videosCount >= 4 || $user->floCount >= 4) { $urls[] = '/id' . $user->id; // Photo albums if ($user->occupation_id == 1) { $alb = Portfolio::model()->findAllByAttributes(array('uid' => $user->id, 'visible' => 1)); if (count($alb) > 0) { foreach ($alb as $item) { if ($item->filesCount > 0) { $urls[] = $this->createUrl('user/album', array('id' => $item->id)); } } } } // Video albums if ($user->occupation_id == 2) { $vid = Video::model()->findAllByAttributes(array('uid' => $user->id, 'visible' => 1)); if (count($vid) > 0) { foreach ($vid as $item) { if ($item->filesCount > 0) { $urls[] = $this->createUrl('user/videoalbum', array('id' => $item->id)); } } } } } } } // Photo albums $users_alb = Users::model()->findAll('t.name!="" AND t.activate=1 AND t.occupation_id=1'); if (count($users_alb) > 0) { foreach ($users_alb as $user_alb) { if ($user_alb->filesCount >= 4 || $user->videosCount >= 4 || $user->floCount >= 4) { $urls[] = '/id' . $user->id; } } } /*// Страницы $pages = Page::model()->findAll(array( 'condition' => 't.public = 1'; )); foreach ($posts as $page){ $urls[] = $this->createUrl('page/view', array('alias'=>$page->alias)); } // Новости $news = News::model()->findAll(array( 'condition' => 't.public = 1'; )); foreach ($news as $new){ $urls[] = $this->createUrl('news/view', array('id'=>$new->id)); } // Работы портфолио $works = Work::model()->findAll(array( 'condition' => 't.public = 1'; )); foreach ($works as $work){ $urls[] = $this->createUrl('work/view', array('id'=>$work->id)); } // Товары $products = Product::model()->findAll(array( 'condition' => 't.public = 1 AND t.count > 0'; )); foreach ($products as $product){ $urls[] = $this->createUrl('product/view', array('category'=>$product->category->alias, 'id'=>$product->id)); } // ...*/ $host = Yii::app()->request->hostInfo; echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL; echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; echo '<url> <loc>' . $host . '</loc> <changefreq>daily</changefreq> <priority>0.5</priority> </url>'; if (count($urls) > 0) { foreach ($urls as $url) { echo '<url> <loc>' . $host . $url . '</loc> <changefreq>daily</changefreq> <priority>0.5</priority> </url>'; } } echo '</urlset>'; Yii::app()->end(); }
<?php } ?> <!--div class="default-input__container"> <div class="col-275"> <?php echo $form->labelEx($model, 'occupation_id', array('class' => 'default-input__label')); ?> </div> <div class="col-384"> <?php //echo $form->textField($model,'url',array('class'=>'default__input','placeholder'=>'http://www.site.com')) ?> <?php echo $form->dropDownList($model, 'occupation_id', CHtml::listData(Occupation::model()->findAll(), 'id', 'name'), array('empty' => '- select -', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('profile/genresublist'), 'update' => '#Users_genre_id'), 'class' => 'default__input')); ?> <?php echo $form->error($model, 'occupation_id'); ?> </div> </div--> <div class="default-input__container"> <div class="col-275"> <?php echo $form->labelEx($model, 'genre_id', array('class' => 'default-input__label')); ?> </div> <div class="col-384"> <?php //echo $form->textField($model,'url',array('class'=>'default__input','placeholder'=>'http://www.site.com'));
$app->halt(401, 'no token'); } try { $user = User::with('occupations')->whereHas('token', function ($q) use($token_key) { $q->where('key', '=', $token_key); })->firstOrFail(); } catch (ModelNotFoundException $e) { $app->halt(401, 'Gebruiker niet gevonden'); } $talent_ids = array(); foreach ($user->talents as $talent) { if ($talent->pivot->picked) { array_push($talent_ids, $talent->id); } } $jobs = Occupation::with('educationLevel')->whereIn('talent_id', $talent_ids)->get(); echo $jobs->toJson(); }); $app->get('/user/schooladvice', function () use($app) { $app->response()->header('Content-Type', 'application/json'); $token_key = $app->request->headers->get('Authorization'); if (!$token_key) { $app->halt(401, 'no token'); } try { $user = User::with('educationLevel')->whereHas('token', function ($q) use($token_key) { $q->where('key', '=', $token_key); })->firstOrFail(); } catch (ModelNotFoundException $e) { $app->halt(401, 'Gebruiker niet gevonden'); }
<header class="cabinet__header"> <div class="cabinet__title clfx"> <div class="accaunt__right__header__name col-8"> <h1><?php echo Yii::app()->user->name; ?> </h1> <?php //if(Yii::app()->user->member!=0): ?> <div class="accaunt__status"><?php echo Yii::app()->user->member_type; ?> </div> <span class="accaunt__role"><?php echo Occupation::getName($user->occupation_id); ?> </span> <? //endif; ?> </div> <div class="accaunt__right__header__rate pt25 col-4"> <?php echo Users::getTimeAgo($user->date_registered); ?> </div> </div> <nav class="cabinet__second-menu"> <ul> <li class="active"><?php echo CHtml::link('Профиль', '/profile/'); ?>
/** * 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 Occupation the loaded model * @throws CHttpException */ public function loadModel($id, $ml = false) { if ($ml) { $model = Occupation::model()->multilang()->findByPk((int) $id); } else { $model = Occupation::model()->findByPk((int) $id); } if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
} } $app->render('occupations/new.html', $data); })->via('GET', 'POST')->name('occupations_new'); $app->map('/edit/:id', function ($id) use($app, $data) { $data['request_method'] = $app->request->getMethod(); if ($app->request->isGet()) { $data['occupation'] = Occupation::with('talent', 'educationLevel')->find($id); $data['education_levels'] = EducationLevel::NoSchoolAdvice()->get(); $data['talents'] = Talent::all(); } else { if ($app->request->isPost()) { $edu_level = EducationLevel::find($app->request->post('educationlevel')); $talent = Talent::find($app->request->post('talent')); parse_str(parse_url($app->request->post('yt-video'), PHP_URL_QUERY), $urlvars); $job = Occupation::find($id); $job->name = $app->request->post('title'); $job->description = $app->request->post('description'); $job->youtube = $urlvars['v']; $job->educationLevel()->associate($edu_level); $job->talent()->associate($talent); $job->save(); $data['new_occupation'] = $job; } } $app->render('occupations/edit.html', $data); })->via('GET', 'POST')->name('occupations_edit'); }); $app->group('/skills', function () use($app, $data) { $data['request_method'] = $app->request->getMethod(); $app->get('/', function () use($app, $data) {
public function actionSearch() { if (Yii::app()->request->isAjaxRequest && isset($_GET['q'])) { $name = $_GET['q']; $limit = 50; $criteria = new CDbCriteria(); $criteria->condition = "name LIKE :sterm and activate=1"; $criteria->params = array(":sterm" => "%{$name}%"); $criteria->limit = $limit; $userArray = Users::model()->findAll($criteria); $returnVal = ''; foreach ($userArray as $userAccount) { $returnVal .= '<li class="search-results__item"><a href="/id' . $userAccount->id . '" class="search-results__link">' . $userAccount->name . '<span class="small_search">' . Occupation::getName($userAccount->occupation_id) . ', ' . City::getName($userAccount->city_id) . '</span></a></li>'; } echo $returnVal; } }