コード例 #1
0
ファイル: TrendingJob.php プロジェクト: quynhvv/stepup
 public function run()
 {
     $model = new Job();
     //will get limit value from config later
     $limit = 5;
     $dataProvider = $model->search(Yii::$app->request->getQueryParams(), $limit);
     return $this->render('TrendingJob', ['model' => $model, 'dataProvider' => $dataProvider]);
 }
コード例 #2
0
ファイル: JobStatsController.php プロジェクト: quynhvv/stepup
 /**
  * Tong hop du lieu theo thoi gian
  *
  * @param string $from_time
  * @param string $to_time
  * @param string $dateInterval P1D: từng ngày | P1W: từng tuần | P1M: từng tháng
  * @throws \yii\mongodb\Exception
  *
  * Use: php yii job-stats
  *      php yii job-stats 2015/08/01
  *      php yii job-stats 2015/08/01 2015/08/30
  */
 public function actionIndex($from_time = '', $to_time = '', $dateInterval = 'P1D')
 {
     JobStats::deleteAll();
     //        if (empty($from_time) AND empty($to_time)) { // Chay ngay hom qua
     //            $from_time = date('Y/m/d 00:00:00', strtotime("-1 days"));
     //            $to_time = date('Y/m/d 23:59:59', strtotime("-1 days"));
     //        }
     if (empty($from_time) and empty($to_time)) {
         // Chay ngay hien tai
         $from_time = date('Y/m/d 00:00:00');
         $to_time = date('Y/m/d 23:59:59');
     } elseif (empty($from_time)) {
         // Chay tu dau den $to_time
         $from_time = date('Y/m/d 00:00:00', JobStats::find()->min('date_time')->sec);
         $to_time = date('Y/m/d 23:59:59', strtotime($to_time));
     } elseif (empty($to_time)) {
         // Chay tu $from_time den ngay hien tai
         $from_time = date('Y/m/d 00:00:00', strtotime($from_time));
         $to_time = date('Y/m/d 23:59:59');
     } else {
         // Chay trong khoang $from_time den $to_time
         $from_time = date('Y/m/d 00:00:00', strtotime($from_time));
         $to_time = date('Y/m/d 23:59:59', strtotime($to_time));
     }
     // Create range date
     $data = [];
     $interval = new DateInterval($dateInterval);
     $daterange = new DatePeriod(new DateTime($from_time), $interval, new DateTime($to_time));
     foreach ($daterange as $key => $date) {
         // Update du lieu vao bang job_stats
         $currentDate = new MongoDate($date->getTimestamp());
         $model = JobStats::find()->where(['date_time' => $currentDate])->one();
         if (!$model) {
             $model = new JobStats();
             $model->date_time = $currentDate;
         }
         // Tu danh sach ma loi, count xem trong ngay co bao nhieu tin nhan
         $count = Job::find()->where(['created_time' => ['$gte' => new MongoDate(strtotime($date->format("Y-m-d 00:00:00"))), '$lte' => new MongoDate(strtotime($date->format("Y-m-d 23:59:59")))]])->count('_id');
         $data['job'] = $count;
         $model->data = $data;
         $model->save();
         echo 'Tao bao cao thong ke Job ngay ' . $date->format("Y-m-d");
         echo "\n";
     }
 }
コード例 #3
0
ファイル: SeekerController.php プロジェクト: quynhvv/stepup
 /**
  * Displays a single Job model.
  * @param integer $id
  * @return mixed
  * @throws NotFoundHttpException
  */
 public function actionJobDetail($id)
 {
     $model = Job::findOne($id);
     if ($model === null) {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     //update hits
     $cookieName = "job_" . Yii::$app->user->getId() . "_{$id}";
     if (!Yii::$app->request->cookies->has($cookieName)) {
         //update hits
         $model->hits = ++$model->hits;
         $model->update();
         //make a cookie
         $cookies = Yii::$app->response->cookies;
         $cookies->add(new \yii\web\Cookie(['name' => $cookieName, 'value' => $model->hits, 'expire' => time() + 86400 * 1]));
     }
     Yii::$app->view->title = $model->title;
     Yii::$app->view->params['breadcrumbs'][] = ['label' => Yii::t($this->module->id, ucfirst($this->module->id)), 'url' => ['index']];
     return $this->render('job-detail', ['model' => $model]);
 }
コード例 #4
0
ファイル: _form-post-job.php プロジェクト: quynhvv/stepup
<?php

use app\components\ActiveForm;
use yii\helpers\Html;
?>

<?php 
$form = ActiveForm::begin(['id' => 'formDefault', 'method' => 'post', 'layout' => 'horizontal', 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-3', 'wrapper' => 'col-sm-9', 'error' => 'help-block m-b-none', 'hint' => '']]]);
?>

<p><a target="_blank" href="#">Job posting requirements</a></p>

<?php 
echo $form->field($model, 'code')->textInput(['placeholder' => Yii::t('job', 'Enter a name for your reference only')]);
echo $form->field($model, 'title')->textInput(['placeholder' => Yii::t('job', 'What type of position is this?')]);
echo $form->field($model, 'category_ids')->listBox(\app\modules\job\models\Job::getCategoryOptions(), ['multiple' => true]);
echo $form->field($model, 'country_id')->dropDownList(\app\modules\job\models\JobLocation::getOptions(), ['prompt' => Yii::t('job', '--- Select a location ---')]);
echo $form->field($model, 'city_name')->textInput();
?>

<div class="form-group field-job-annual_salary_from">
    <label for="job-annual_salary_from" class="control-label col-sm-3"><?php 
echo '<em class="required">*</em> ' . Yii::t('job', 'Annual Salary');
?>
</label>
    <div class="col-sm-9">
        <div class="row">
            <?php 
$annualSalary = \app\modules\job\models\JobSalary::getOptions();
?>
            <div class="col-xs-6">
コード例 #5
0
ファイル: JobtestController.php プロジェクト: quynhvv/stepup
 /**
  * Finds the Job model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $_id
  * @return Job the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Job::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #6
0
ファイル: view-job.php プロジェクト: quynhvv/stepup
<?php

use yii\bootstrap\Html;
use app\components\DetailView;
use app\helpers\ArrayHelper;
use app\modules\job\models\Job;
?>

<!-- MAIN -->
<main id="main" class="main-container">
    <!-- SECTION 1 -->
    <div class="section section-1">
        <div class="container">
            <div class="row jobs-posted">
                <div class="section-title section-title-style-2">
                    <h2 class="title"> <?php 
echo Yii::t('job', "Job Informations");
?>
 </h2>
                </div>
                <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['code', ['attribute' => 'country_id', 'value' => ArrayHelper::getValue(\app\modules\job\models\JobLocation::getOptions(), ArrayHelper::getValue($model, 'country_id'))], ['attribute' => 'category_ids', 'value' => $model->getCategoryNames(), 'format' => 'raw'], 'city_name', ['attribute' => 'annual_salary_from', 'value' => ArrayHelper::getValue(\app\modules\job\models\JobSalary::getOptions(), ArrayHelper::getValue($model, 'annual_salary_from'))], ['attribute' => 'annual_salary_to', 'value' => ArrayHelper::getValue(\app\modules\job\models\JobSalary::getOptions(), ArrayHelper::getValue($model, 'annual_salary_to'))], ['attribute' => 'functions', 'value' => $model->getFunctionNames(), 'format' => 'raw'], ['attribute' => 'work_type', 'value' => ArrayHelper::getValue(app\modules\job\models\JobWorkType::getOptions(), ArrayHelper::getValue($model, 'work_type'))], ['attribute' => 'industry', 'value' => $model->getIndustryNames(), 'format' => 'raw'], 'company_name', 'company_description:html', 'description:html', 'seo_url', 'seo_title', 'seo_desc', ['attribute' => 'created_time', 'format' => ['datetime', 'php:m/d/Y H:i:s'], 'value' => $model->created_time->sec], ['attribute' => 'updated_time', 'format' => ['datetime', 'php:m/d/Y H:i:s'], 'value' => $model->updated_time->sec], ['attribute' => 'satus', 'value' => ArrayHelper::getValue(Job::getStatusOptions(), ArrayHelper::getValue($model, 'status'))], 'hits']]);
?>
            </div>
        </div>
    </div>
    <!-- # SECTION 1 -->
</main>
<!-- # MAIN -->
コード例 #7
0
ファイル: register-agent.php プロジェクト: quynhvv/stepup
echo $form->field($jobModel, 'agent_city_name')->textInput(['placeholder' => Yii::t('account', 'City Name')]);
?>
                    <?php 
echo $form->field($jobModel, 'agent_website')->textInput(['placeholder' => Yii::t('account', 'Corporate Site')]);
?>
                    <?php 
echo $form->field($model, 'email')->textInput(['placeholder' => Yii::t('account', 'Email')]);
?>
                    <?php 
echo $form->field($model, 'password')->passwordInput(['placeholder' => Yii::t('account', 'Must be 6-20 characters in length.')]);
?>
                    <?php 
echo $form->field($model, 'phone')->textInput(['placeholder' => Yii::t('account', '(Ex: 65-6666-7777) with country code, please.')]);
?>
                    <?php 
echo $form->field($jobModel, 'agent_job_industry')->listBox(\app\modules\job\models\Job::getCategoryOptions(), ['multiple' => true])->hint(Yii::t('job', 'Please Use CTR to select multiple options. (Select up to 3)'));
?>
                    <?php 
echo $form->field($jobModel, 'agent_job_function')->listBox(\app\modules\job\models\JobFunction::getOptions(), ['multiple' => true])->hint(Yii::t('job', 'Please Use CTR to select multiple options. (Select up to 3)'));
?>
                    <?php 
echo $form->field($jobModel, 'agent_summary')->textarea();
?>
                    <?php 
$imageConfig = ['options' => ['accept' => 'uploads/*'], 'pluginOptions' => ['previewFileType' => 'image', 'showCaption' => FALSE, 'showRemove' => TRUE, 'showUpload' => FALSE, 'browseClass' => 'btn btn-primary btn-block', 'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ', 'browseLabel' => 'Select Photo', 'removeClass' => 'btn btn-danger', 'removeLabel' => "Delete", 'removeIcon' => '<i class="glyphicon glyphicon-trash"></i>', 'allowedFileExtensions' => ['jpg', 'gif', 'png', 'jpeg']]];
if (!empty($model->image)) {
    $imageConfig['pluginOptions']['initialPreview'] = [Html::img(\app\helpers\LetHelper::getFileUploaded($model->image), ['class' => 'file-preview-image'])];
}
echo $form->field($model, 'image')->widget(FileInput::classname(), $imageConfig);
?>
コード例 #8
0
ファイル: UserJob.php プロジェクト: quynhvv/stepup
 public static function getFavouriteJob($seekerId = null)
 {
     //get job ids favourites by current seeker
     $favourites = UserFavourite::findAll(['object_type' => 'job', 'created_by' => $seekerId]);
     $ids = array();
     if ($favourites) {
         foreach ($favourites as $favourite) {
             $ids[] = $favourite->object_id;
         }
     }
     //search candidate by ids
     $dataProvider = null;
     if ($ids) {
         $model = new Job();
         $model->setScenario('search');
         $params = Yii::$app->request->getQueryParams();
         $params['Job']['_ids'] = $ids;
         $dataProvider = $model->search($params, 20);
     }
     return $dataProvider;
 }
コード例 #9
0
ファイル: update_status.php プロジェクト: quynhvv/stepup
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row m-b-sm">
        <div class="col-lg-12">
            <div class="btn-group pull-right">
                <?php 
echo Html::button(Yii::t('common', 'Save'), ['class' => 'btn btn-primary', 'onclick' => '$("#formDefault").submit();']);
?>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><?php 
echo Yii::t('common', 'Information');
?>
</h5>
                </div>
                <div class="ibox-content">
                    <?php 
$form = ActiveForm::begin(['id' => 'formDefault', 'layout' => 'horizontal', 'options' => ['enctype' => 'multipart/form-data'], 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-2', 'wrapper' => 'col-sm-10', 'error' => 'help-block m-b-none', 'hint' => '']]]);
echo $form->field($model, 'status')->dropDownList(\app\modules\job\models\Job::getStatusOptions(), ['prompt' => Yii::t('job', '--- Select a Status ---')]);
ActiveForm::end();
?>
                </div>
            </div>
        </div>
    </div>
</div>
コード例 #10
0
ファイル: job-detail.php プロジェクト: quynhvv/stepup
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">Job Description</td>
                                        <td>
                                            <?php 
if (UserJob::canView()) {
    ?>
                                                <?php 
    echo $model->description;
    ?>
                                            <?php 
} else {
    ?>
                                                <div><?php 
    echo Job::subStrWords($model->description, 200);
    ?>
</div>
                                                <br/><strong><a href="<?php 
    echo UserJob::getUpgradeUrl();
    ?>
">... Want to know more? Upgrade to Premium!</a></strong> 
                                            <?php 
}
?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="text-center" colspan="3">
                                            <?php 
if (UserJob::canView()) {
コード例 #11
0
ファイル: list-job.php プロジェクト: quynhvv/stepup
use app\helpers\ArrayHelper;
use app\components\GridView;
?>

<!-- MAIN -->
<main id="main" class="main-container">
    <!-- SECTION 1 -->
    <div class="section section-1">
        <div class="container">
            <div class="row jobs-posted">
                <?php 
//Make custom heading
$heading = Yii::t(Yii::$app->controller->module->id, 'Manage Jobs') . ': ';
echo GridView::widget(['panel' => ['heading' => $heading, 'tableOptions' => ['id' => 'listDefault']], 'pjax' => true, 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-plus"></i>', ['post-job'], ['data-pjax' => 0, 'class' => 'btn btn-success', 'title' => Yii::t('job', 'Post New Job')]) . ' ' . Html::a('<i class="glyphicon glyphicon-repeat"></i>', [''], ['data-pjax' => 0, 'class' => 'btn btn-default', 'title' => Yii::t('kvgrid', 'Reset Grid')])]], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'code'], ['attribute' => 'title', 'label' => Yii::t('job', 'Position')], ['attribute' => 'company_name', 'label' => Yii::t('job', 'Company')], ['attribute' => 'status', 'value' => function ($model, $key, $index, $widget) {
    return ArrayHelper::getValue(\app\modules\job\models\Job::getStatusOptions(), ArrayHelper::getValue($model, 'status'));
}, 'contentOptions' => ['style' => 'min-width: 150px;'], 'filterType' => GridView::FILTER_SELECT2, 'filter' => \app\modules\job\models\Job::getStatusOptions(true)], ['attribute' => 'created_time', 'label' => Yii::t('job', 'Posted'), 'filterType' => GridView::FILTER_DATE_RANGE, 'format' => 'raw', 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'Y-m-d', 'separator' => ' to ', 'opens' => 'left'], 'presetDropdown' => true, 'hideInput' => true, 'convertFormat' => true], 'value' => function ($model, $key, $index, $widget) {
    return date('Y-m-d h:i:s', $model->created_time->sec);
}], ['attribute' => 'updated_time', 'label' => Yii::t('job', 'Updated'), 'filterType' => GridView::FILTER_DATE_RANGE, 'format' => 'raw', 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'Y-m-d', 'separator' => ' to ', 'opens' => 'left'], 'presetDropdown' => true, 'hideInput' => true, 'convertFormat' => true], 'value' => function ($model, $key, $index, $widget) {
    return date('Y-m-d h:i:s', $model->updated_time->sec);
}], ['class' => '\\kartik\\grid\\ActionColumn', 'buttons' => ['view' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ['view-job', 'id' => $model->_id], ['data-pjax' => '0', 'title' => Yii::t('yii', 'View')]);
}, 'update' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', ['update-job', 'id' => $model->_id], ['data-pjax' => '0', 'title' => Yii::t('yii', 'Update')]);
}, 'delete' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', ['delete-job', 'id' => $model->_id], ['data-pjax' => '0', 'title' => Yii::t('yii', 'Delete')]);
}]]], 'responsive' => true, 'hover' => true]);
?>
            </div>
        </div>
    </div>
    <!-- # SECTION 1 -->