hh
This commit is contained in:
@ -10,6 +10,7 @@ return [
|
||||
'id' => 'app-backend',
|
||||
'basePath' => dirname(__DIR__),
|
||||
'controllerNamespace' => 'backend\controllers',
|
||||
'language' => 'ru',
|
||||
'bootstrap' => ['log'],
|
||||
|
||||
'modules' => [
|
||||
@ -25,6 +26,9 @@ return [
|
||||
'company' => [
|
||||
'class' => 'backend\modules\company\Company',
|
||||
],
|
||||
'hh' => [
|
||||
'class' => 'backend\modules\hh\Hh',
|
||||
],
|
||||
],
|
||||
'components' => [
|
||||
'request' => [
|
||||
|
24
backend/modules/hh/Hh.php
Normal file
24
backend/modules/hh/Hh.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace backend\modules\hh;
|
||||
|
||||
/**
|
||||
* hh module definition class
|
||||
*/
|
||||
class Hh extends \yii\base\Module
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $controllerNamespace = 'backend\modules\hh\controllers';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
// custom initialization code goes here
|
||||
}
|
||||
}
|
20
backend/modules/hh/controllers/DefaultController.php
Normal file
20
backend/modules/hh/controllers/DefaultController.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace backend\modules\hh\controllers;
|
||||
|
||||
use yii\web\Controller;
|
||||
|
||||
/**
|
||||
* Default controller for the `hh` module
|
||||
*/
|
||||
class DefaultController extends Controller
|
||||
{
|
||||
/**
|
||||
* Renders the index view for the module
|
||||
* @return string
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
return $this->render('index');
|
||||
}
|
||||
}
|
154
backend/modules/hh/controllers/HhController.php
Normal file
154
backend/modules/hh/controllers/HhController.php
Normal file
@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
namespace backend\modules\hh\controllers;
|
||||
|
||||
use common\classes\Debug;
|
||||
use common\hhapi\core\service\HHService;
|
||||
use common\models\HhJob;
|
||||
use Yii;
|
||||
use backend\modules\hh\models\Hh;
|
||||
use backend\modules\hh\models\HhSearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
|
||||
/**
|
||||
* HhController implements the CRUD actions for Hh model.
|
||||
*/
|
||||
class HhController extends Controller
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['POST'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all Hh models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$searchModel = new HhSearch();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a single Hh model.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
public function actionView($id)
|
||||
{
|
||||
return $this->render('view', [
|
||||
'model' => $this->findModel($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Hh model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new Hh();
|
||||
|
||||
if ($model->load(Yii::$app->request->post())) {
|
||||
$hhId = explode('/', $model->url);
|
||||
$model->hh_id = $hhId[4];
|
||||
$model->dt_add = time();
|
||||
//$jobs = HHService::run()->company($model->hh_id)->getJobs();
|
||||
$company = HHService::run()->company($model->hh_id)->get();
|
||||
if (isset($company->name)) {
|
||||
$model->title = $company->name;
|
||||
$model->photo = $company->logo_urls->{240};
|
||||
}
|
||||
$model->save();
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
}
|
||||
|
||||
return $this->render('create', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing Hh model.
|
||||
* If update is successful, the browser will be redirected to the 'view' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
public function actionUpdate($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
}
|
||||
|
||||
return $this->render('update', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an existing Hh model.
|
||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$this->findModel($id)->delete();
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
public function actionGetJobs($id)
|
||||
{
|
||||
$model = \common\models\Hh::findOne($id);
|
||||
$jobs = HHService::run()->company($model->hh_id)->getJobs();
|
||||
$count = 0;
|
||||
foreach ((array)$jobs as $job) {
|
||||
if(HhJob::createFromHH($job)){
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
Yii::$app->session->setFlash('success', "Получено $count новых вакансий");
|
||||
return $this->redirect(['/hh/hh']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the Hh model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
* @param integer $id
|
||||
* @return Hh the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
protected function findModel($id)
|
||||
{
|
||||
if (($model = Hh::findOne($id)) !== null) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
131
backend/modules/hh/controllers/HhJobController.php
Normal file
131
backend/modules/hh/controllers/HhJobController.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
namespace backend\modules\hh\controllers;
|
||||
|
||||
use common\models\Hh;
|
||||
use Yii;
|
||||
use backend\modules\hh\models\HhJob;
|
||||
use backend\modules\hh\models\HhJobSearch;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
|
||||
/**
|
||||
* HhJobController implements the CRUD actions for HhJob model.
|
||||
*/
|
||||
class HhJobController extends Controller
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['POST'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all HhJob models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$searchModel = new HhJobSearch();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
$hhCompanies = ArrayHelper::map(Hh::find()->all(), 'hh_id', 'title');
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
'hhCompanies' => $hhCompanies,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a single HhJob model.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
public function actionView($id)
|
||||
{
|
||||
return $this->render('view', [
|
||||
'model' => $this->findModel($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new HhJob model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new HhJob();
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
}
|
||||
|
||||
return $this->render('create', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing HhJob model.
|
||||
* If update is successful, the browser will be redirected to the 'view' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
public function actionUpdate($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
}
|
||||
|
||||
return $this->render('update', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an existing HhJob model.
|
||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$this->findModel($id)->delete();
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the HhJob model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
* @param integer $id
|
||||
* @return HhJob the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
protected function findModel($id)
|
||||
{
|
||||
if (($model = HhJob::findOne($id)) !== null) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
15
backend/modules/hh/models/Hh.php
Normal file
15
backend/modules/hh/models/Hh.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: kirill
|
||||
* Date: 21.11.18
|
||||
* Time: 13:40
|
||||
*/
|
||||
|
||||
namespace backend\modules\hh\models;
|
||||
|
||||
|
||||
class Hh extends \common\models\Hh
|
||||
{
|
||||
|
||||
}
|
15
backend/modules/hh/models/HhJob.php
Normal file
15
backend/modules/hh/models/HhJob.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: kirill
|
||||
* Date: 21.11.18
|
||||
* Time: 15:22
|
||||
*/
|
||||
|
||||
namespace backend\modules\hh\models;
|
||||
|
||||
|
||||
class HhJob extends \common\models\HhJob
|
||||
{
|
||||
|
||||
}
|
77
backend/modules/hh/models/HhJobSearch.php
Normal file
77
backend/modules/hh/models/HhJobSearch.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace backend\modules\hh\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use backend\modules\hh\models\HhJob;
|
||||
|
||||
/**
|
||||
* HhJobSearch represents the model behind the search form of `backend\modules\hh\models\HhJob`.
|
||||
*/
|
||||
class HhJobSearch extends HhJob
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id', 'employer_id', 'hh_id', 'salary_from', 'salary_to', 'dt_add'], 'integer'],
|
||||
[['title', 'url', 'salary_currency', 'address'], 'safe'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function scenarios()
|
||||
{
|
||||
// bypass scenarios() implementation in the parent class
|
||||
return Model::scenarios();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates data provider instance with search query applied
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return ActiveDataProvider
|
||||
*/
|
||||
public function search($params)
|
||||
{
|
||||
$query = HhJob::find()->joinWith('hhcompany');
|
||||
|
||||
// add conditions that should always apply here
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
]);
|
||||
|
||||
$this->load($params);
|
||||
|
||||
if (!$this->validate()) {
|
||||
// uncomment the following line if you do not want to return any records when validation fails
|
||||
// $query->where('0=1');
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
// grid filtering conditions
|
||||
$query->andFilterWhere([
|
||||
'id' => $this->id,
|
||||
'employer_id' => $this->employer_id,
|
||||
'hh_id' => $this->hh_id,
|
||||
'salary_from' => $this->salary_from,
|
||||
'salary_to' => $this->salary_to,
|
||||
'dt_add' => $this->dt_add,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'title', $this->title])
|
||||
->andFilterWhere(['like', 'url', $this->url])
|
||||
->andFilterWhere(['like', 'salary_currency', $this->salary_currency])
|
||||
->andFilterWhere(['like', 'address', $this->address]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
}
|
73
backend/modules/hh/models/HhSearch.php
Normal file
73
backend/modules/hh/models/HhSearch.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace backend\modules\hh\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use backend\modules\hh\models\Hh;
|
||||
|
||||
/**
|
||||
* HhSearch represents the model behind the search form of `backend\modules\hh\models\Hh`.
|
||||
*/
|
||||
class HhSearch extends Hh
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id', 'hh_id', 'dt_add'], 'integer'],
|
||||
[['url', 'title', 'photo'], 'safe'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function scenarios()
|
||||
{
|
||||
// bypass scenarios() implementation in the parent class
|
||||
return Model::scenarios();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates data provider instance with search query applied
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return ActiveDataProvider
|
||||
*/
|
||||
public function search($params)
|
||||
{
|
||||
$query = Hh::find();
|
||||
|
||||
// add conditions that should always apply here
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
]);
|
||||
|
||||
$this->load($params);
|
||||
|
||||
if (!$this->validate()) {
|
||||
// uncomment the following line if you do not want to return any records when validation fails
|
||||
// $query->where('0=1');
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
// grid filtering conditions
|
||||
$query->andFilterWhere([
|
||||
'id' => $this->id,
|
||||
'hh_id' => $this->hh_id,
|
||||
'dt_add' => $this->dt_add,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'url', $this->url])
|
||||
->andFilterWhere(['like', 'title', $this->title])
|
||||
->andFilterWhere(['like', 'photo', $this->photo]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
}
|
12
backend/modules/hh/views/default/index.php
Normal file
12
backend/modules/hh/views/default/index.php
Normal file
@ -0,0 +1,12 @@
|
||||
<div class="hh-default-index">
|
||||
<h1><?= $this->context->action->uniqueId ?></h1>
|
||||
<p>
|
||||
This is the view content for action "<?= $this->context->action->id ?>".
|
||||
The action belongs to the controller "<?= get_class($this->context) ?>"
|
||||
in the "<?= $this->context->module->id ?>" module.
|
||||
</p>
|
||||
<p>
|
||||
You may customize this page by editing the following file:<br>
|
||||
<code><?= __FILE__ ?></code>
|
||||
</p>
|
||||
</div>
|
39
backend/modules/hh/views/hh-job/_form.php
Normal file
39
backend/modules/hh/views/hh-job/_form.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\hh\models\HhJob */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="hh-job-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'employer_id')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'hh_id')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'salary_from')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'salary_to')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'salary_currency')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'address')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'dt_add')->textInput() ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
45
backend/modules/hh/views/hh-job/_search.php
Normal file
45
backend/modules/hh/views/hh-job/_search.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\hh\models\HhJobSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="hh-job-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'id') ?>
|
||||
|
||||
<?= $form->field($model, 'employer_id') ?>
|
||||
|
||||
<?= $form->field($model, 'hh_id') ?>
|
||||
|
||||
<?= $form->field($model, 'title') ?>
|
||||
|
||||
<?= $form->field($model, 'url') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'salary_from') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'salary_to') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'salary_currency') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'address') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'dt_add') ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
21
backend/modules/hh/views/hh-job/create.php
Normal file
21
backend/modules/hh/views/hh-job/create.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\hh\models\HhJob */
|
||||
|
||||
$this->title = 'Create Hh Job';
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Hh Jobs', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="hh-job-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
55
backend/modules/hh/views/hh-job/index.php
Normal file
55
backend/modules/hh/views/hh-job/index.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\modules\hh\models\HhJobSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
/* @var $hhCompanies array */
|
||||
|
||||
$this->title = 'Вакансии';
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="hh-job-index">
|
||||
|
||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
//'id',
|
||||
[
|
||||
'attribute' => 'employer_id',
|
||||
'value' => function ($model) {
|
||||
return isset($model->hhcompany->title) ? $model->hhcompany->title : '';
|
||||
},
|
||||
'filter' => kartik\select2\Select2::widget([
|
||||
'model' => $searchModel,
|
||||
'attribute' => 'employer_id',
|
||||
'data' => $hhCompanies,
|
||||
'options' => ['placeholder' => 'Начните вводить...','class' => 'form-control'],
|
||||
'pluginOptions' => [
|
||||
'allowClear' => true
|
||||
],
|
||||
]),
|
||||
],
|
||||
//'hh_id',
|
||||
'title',
|
||||
'url:url',
|
||||
'salary_from',
|
||||
'salary_to',
|
||||
'salary_currency',
|
||||
'address',
|
||||
'dt_add:date',
|
||||
|
||||
[
|
||||
'class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view} {delete}'
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
</div>
|
21
backend/modules/hh/views/hh-job/update.php
Normal file
21
backend/modules/hh/views/hh-job/update.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\hh\models\HhJob */
|
||||
|
||||
$this->title = 'Update Hh Job: ' . $model->title;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Hh Jobs', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
|
||||
$this->params['breadcrumbs'][] = 'Update';
|
||||
?>
|
||||
<div class="hh-job-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
44
backend/modules/hh/views/hh-job/view.php
Normal file
44
backend/modules/hh/views/hh-job/view.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\hh\models\HhJob */
|
||||
|
||||
$this->title = $model->title;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Hh Jobs', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="hh-job-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => 'Are you sure you want to delete this item?',
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id',
|
||||
'employer_id',
|
||||
'hh_id',
|
||||
'title',
|
||||
'url:url',
|
||||
'salary_from',
|
||||
'salary_to',
|
||||
'salary_currency',
|
||||
'address',
|
||||
'dt_add',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
23
backend/modules/hh/views/hh/_form.php
Normal file
23
backend/modules/hh/views/hh/_form.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\hh\models\Hh */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="hh-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
37
backend/modules/hh/views/hh/_search.php
Normal file
37
backend/modules/hh/views/hh/_search.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\hh\models\HhSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="hh-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'id') ?>
|
||||
|
||||
<?= $form->field($model, 'hh_id') ?>
|
||||
|
||||
<?= $form->field($model, 'url') ?>
|
||||
|
||||
<?= $form->field($model, 'title') ?>
|
||||
|
||||
<?= $form->field($model, 'dt_add') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'photo') ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
19
backend/modules/hh/views/hh/create.php
Normal file
19
backend/modules/hh/views/hh/create.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\hh\models\Hh */
|
||||
|
||||
$this->title = 'Добавить';
|
||||
$this->params['breadcrumbs'][] = ['label' => 'hh.ru', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="hh-create">
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
52
backend/modules/hh/views/hh/index.php
Normal file
52
backend/modules/hh/views/hh/index.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\modules\hh\models\HhSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = 'hh.ru';
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="hh-index">
|
||||
|
||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
//'id',
|
||||
//'hh_id',
|
||||
'url:url',
|
||||
'title',
|
||||
'dt_add:date',
|
||||
'photo:image',
|
||||
[
|
||||
'class' => 'yii\grid\DataColumn',
|
||||
'format' => 'raw',
|
||||
'value' => function ($model) {
|
||||
return Html::a('Получить вакансии', \yii\helpers\Url::to([
|
||||
'/hh/hh/get-jobs',
|
||||
'id' => $model->id
|
||||
]), [
|
||||
'class' => 'btn btn-success'
|
||||
]);
|
||||
},
|
||||
],
|
||||
|
||||
[
|
||||
'class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view} {delete}'
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
</div>
|
21
backend/modules/hh/views/hh/update.php
Normal file
21
backend/modules/hh/views/hh/update.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\hh\models\Hh */
|
||||
|
||||
$this->title = 'Редактировать: ' . $model->title;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'hh.ru', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
|
||||
$this->params['breadcrumbs'][] = 'Редактировать';
|
||||
?>
|
||||
<div class="hh-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
39
backend/modules/hh/views/hh/view.php
Normal file
39
backend/modules/hh/views/hh/view.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\hh\models\Hh */
|
||||
|
||||
$this->title = $model->title;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'hh.ru', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
//\common\classes\Debug::dd(\common\hhapi\core\service\HHService::run()->company($model->hh_id)->get())
|
||||
?>
|
||||
<div class="hh-view">
|
||||
|
||||
<p>
|
||||
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => 'Are you sure you want to delete this item?',
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'title',
|
||||
'hh_id',
|
||||
'url:url',
|
||||
'dt_add:date',
|
||||
'photo:image',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
@ -30,6 +30,16 @@ use yii\widgets\ActiveForm;
|
||||
]
|
||||
); ?>
|
||||
|
||||
<?= $form->field($model, 'hh_id')->widget(Select2::class,
|
||||
[
|
||||
'data' => \yii\helpers\ArrayHelper::map(\common\models\Hh::find()->all(),'id', 'title'),
|
||||
'options' => ['placeholder' => '...','class' => 'form-control'],
|
||||
'pluginOptions' => [
|
||||
'allowClear' => true
|
||||
],
|
||||
]
|
||||
); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<?= $form->field($model, 'fields')->widget(MultipleInput::class, [
|
||||
|
@ -13,9 +13,8 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="project-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
|
||||
'class' => 'btn btn-danger',
|
||||
|
@ -18,6 +18,13 @@
|
||||
['label' => 'Профили', 'icon' => 'users', 'url' => ['/card/user-card']],
|
||||
['label' => 'Пректы', 'icon' => 'files-o', 'url' => ['/project/project']],
|
||||
['label' => 'Компании', 'icon' => 'files-o', 'url' => ['/company/company']],
|
||||
[
|
||||
'label' => 'Hh.ru', 'icon' => 'user-circle', 'url' => '#',
|
||||
'items' => [
|
||||
['label' => 'Компании', 'icon' => 'building', 'url' => ['/hh/hh']],
|
||||
['label' => 'Вакансии', 'icon' => 'user-md', 'url' => ['/hh/hh-job']],
|
||||
],
|
||||
]
|
||||
|
||||
/*['label' => 'Gii', 'icon' => 'file-code-o', 'url' => ['/gii']],
|
||||
['label' => 'Debug', 'icon' => 'dashboard', 'url' => ['/debug']],
|
||||
|
Reference in New Issue
Block a user