/** * 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 user-job-stats * php yii user-job-stats 2015/08/01 * php yii user-job-stats 2015/08/01 2015/08/30 */ public function actionIndex($from_time = '', $to_time = '', $dateInterval = 'P1D') { // UserJobStats::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', UserJobStats::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)); $roleList = UserJob::$roleAllows; foreach ($daterange as $key => $date) { // Update du lieu vao bang user_job_stats $currentDate = new MongoDate($date->getTimestamp()); $model = UserJobStats::find()->where(['date_time' => $currentDate])->one(); if (!$model) { $model = new UserJobStats(); $model->date_time = $currentDate; } // Tu danh sach ma loi, count xem trong ngay co bao nhieu tin nhan foreach ($roleList as $role) { $count = UserJob::find()->where(['create_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")))], 'role' => $role])->count('role'); $data[$role] = $count; } $model->data = $data; $model->save(); echo 'Tao bao cao thong ke Member ngay ' . $date->format("Y-m-d"); echo "\n"; } }
public function actionEditProfile() { $jobModel = UserJob::findOne(['_id' => Yii::$app->user->identity->_id]); $jobModel->scenario = "edit_recruiter"; $model = User::findOne(['_id' => Yii::$app->user->identity->_id]); $model->scenario = "edit_recruiter"; if ($model->load(Yii::$app->request->post()) && $jobModel->load(Yii::$app->request->post())) { $modelValidate = $model->validate(); $jobModelValidate = $jobModel->validate(); if ($modelValidate && $jobModelValidate) { if ($model->save(false)) { if ($jobModel->save(false)) { Yii::$app->getSession()->setFlash('flash', ['type' => 'success', 'title' => Yii::t('account', 'Message'), 'message' => Yii::t('account', 'Updated succesfully.'), 'duration' => 10000]); return $this->redirect(['view-profile']); } } } } Yii::$app->view->title = Yii::t($this->module->id, 'Edit Profile'); Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title; return $this->render('edit-profile', ['model' => $model, 'jobModel' => $jobModel]); }
echo \yii\helpers\Url::to(['/job/account/login', 'role' => $jobModel->role]); ?> " title="Login">Login</a> </h5> </div> <div class="row"> <div class="col-xs-12 col-sm-10 col-md-8 col-lg-8"> <?php $form = ActiveForm::begin(['id' => 'formDefault', 'layout' => 'horizontal', 'options' => ['enctype' => 'multipart/form-data'], 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-3', 'wrapper' => 'col-sm-9', 'error' => 'help-block m-b-none', 'hint' => 'col-sm-9']]]); ?> <?php echo $form->field($jobModel, 'role')->hiddenInput()->label(false); ?> <?php echo $form->field($jobModel, 'agent_type')->inline(true)->radioList(\app\modules\job\models\UserJob::getAgentTypeOptions()); ?> <?php echo $form->field($model, 'first_name')->textInput(['placeholder' => Yii::t('account', 'First Name')]); ?> <?php echo $form->field($model, 'last_name')->textInput(['placeholder' => Yii::t('account', 'Last Name')]); ?> <?php echo $form->field($jobModel, 'agent_company_name')->textInput(['placeholder' => Yii::t('account', 'Company Name')]); ?> <?php echo $form->field($jobModel, 'agent_position')->textInput(['placeholder' => Yii::t('account', 'Position')]); ?> <?php echo $form->field($jobModel, 'agent_office_location')->dropDownList(\app\modules\job\models\JobLocation::getOptions(), ['prompt' => '---']);
public static function getHighPotentialCandidate($agentId = null) { $dataProvider = null; //get agent functions $agent = UserJob::findOne(['role' => 'recruiter', '_id' => $agentId]); if ($agent) { //get seekers fit to agent $model = new UserJobSeekerResume(); $model->functions = $agent->agent_job_function; $model->industries = $agent->agent_job_industry; $dataProvider = $model->search(Yii::$app->request->getQueryParams()); } return $dataProvider; }
public function beforeAction($action) { // check logined & role UserJob::checkAccess('employer'); return parent::beforeAction($action); }
<?php use yii\bootstrap\Html; use app\components\GridView; use app\helpers\LetHelper; /* @var $this yii\web\View */ /* @var $dataProvider yii\data\ActiveDataProvider */ ?> <div class="wrapper wrapper-content animated fadeInRight"> <div class="row"> <div class="col-lg-12"> <?php echo GridView::widget(['panel' => ['heading' => Yii::t(Yii::$app->controller->module->id, 'UserJob'), 'tableOptions' => ['id' => 'listDefault']], 'pjax' => TRUE, 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\CheckboxColumn'], '_id', 'email', ['attribute' => 'role', 'filter' => \app\modules\job\models\UserJob::getRoleOptions()], ['class' => '\\kartik\\grid\\ActionColumn']], 'responsive' => true, 'hover' => true]); ?> </div> </div> </div>
</tr> <tr> <td>Position/Dept.</td> <td colspan="2"> <?php if (UserJob::canView()) { ?> <span><?php echo $userJob->agent_position; ?> </span> <?php } else { ?> <a href="<?php echo UserJob::getUpgradeUrl(); ?> ">Upgrade here to view this information </a> <?php } ?> </td> </tr> <tr> <td>Industry Coverage</td> <td colspan="2"> <?php echo Html::encode($userJob->getJobIndustryCoverageTitle()); ?> </td> </tr>
?> </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 Html::hiddenInput('save_type', 'save'); echo $form->field($model, 'role')->dropDownList(\app\modules\job\models\UserJob::getRoleOptions(), []); echo $form->field($model, 'title'); echo $form->field($model, 'status')->widget(SwitchInput::className(['type' => SwitchInput::RADIO])); echo $form->field($model, 'days'); echo $form->field($model, 'price'); echo $form->field($model, 'sort'); ActiveForm::end(); ?> </div> </div> </div> </div> </div>
public function getUserJobPosted() { return \app\modules\job\models\UserJob::findOne(['_id' => $this->created_by]); }
public function actionPublicProfile() { $displayName = Yii::$app->request->getQueryParam('display_name'); $user = User::find()->where(['display_name' => $displayName])->one(); if ($displayName and $user) { // Log view for user if (UserJob::checkRole('recruiter') or UserJob::checkRole('employer')) { $log = UserJobProfileViewLog::find()->where(['user_id' => $user->_id, 'view_by_user_id' => Yii::$app->user->id])->one(); if (!$log) { $log = new UserJobProfileViewLog(); $log->user_id = $user->_id; $log->view_by_user_id = Yii::$app->user->id; $log->hits = 1; $log->last_view_date = new \MongoDate(); } else { $log->hits = $log->hits + 1; $log->last_view_date = new \MongoDate(); } $log->save(); } Yii::$app->view->title = Yii::t($this->module->id, ucfirst($displayName) . "'s Profile"); Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title; return $this->render("public_profile_{$user->userJob->role}", ['user' => $user]); } else { return $this->goHome(); } }
/** * Finds the UserJob model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $_id * @return UserJob the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = UserJob::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
use yii\helpers\Html; use app\modules\job\models\UserJob; ?> <div class="block block-upgrade"> <div class="block-content"> <a href="<?php echo UserJob::getUpgradeUrl(); ?> " class="button button-long button-lg button-primary">Upgrade Your Account</a> </div> </div> <div class="block"> <div class="block-content"> <a class="button button-long button-lg button-primary" href="<?php echo UserJob::getPostJobUrl(); ?> "><?php echo Yii::t('job', 'Post Jobs'); ?> </a> </div> </div> <div class="block"> <div class="block-content"> <a href="#" class="special-hover-link-1">Make a Placement ?</a> </div> </div> <div class="block block-spotlight"> <div class="block-title"> <h3 class="title">Weekly Spotlight</h3>
<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' => '']]]); $tabs = [['label' => Yii::t('common', 'General information'), 'content' => $form->field($modelUser, 'display_name')->textInput() . $form->field($modelUser, 'email')->textInput() . $form->field($modelUser, 'password')->passwordInput() . $form->field($modelUser, 'phone')->textInput() . $form->field($modelUser, 'status')->widget(SwitchInput::classname(), ['containerOptions' => []]), 'active' => true]]; if ($modelUserJob->role == 'seeker') { $tabs[] = ['label' => Yii::t('common', 'Extra information'), 'content' => $form->field($modelUserJob, 'sex')->radioList($modelUserJob::getSexOptions()) . $form->field($modelUserJob, 'birthday')->widget(DateControl::classname(), ['type' => DateControl::FORMAT_DATE, 'ajaxConversion' => false, 'options' => ['pluginOptions' => ['startDate' => '01/01/1980', 'endDate' => '0d', 'autoclose' => true]]]) . $form->field($modelUserJob, 'seeker_nationality')->dropDownList(\app\modules\job\models\JobLocation::getOptions(), ['prompt' => '---']) . $form->field($modelUserJob, 'seeker_salary')->dropDownList(\app\modules\job\models\JobSalary::getOptions(), ['prompt' => 'In US Dollars'])]; } else { $tabs[] = ['label' => Yii::t('common', 'Extra information'), 'content' => $form->field($modelUserJob, 'recruiter_type')->dropDownList(\app\modules\job\models\UserJob::getAgentTypeOptions()) . $form->field($modelUserJob, 'recruiter_company_name') . $form->field($modelUserJob, 'recruiter_position') . $form->field($modelUserJob, 'recruiter_office_location')->dropDownList(\app\modules\job\models\JobLocation::getOptions(), ['prompt' => '---']) . $form->field($modelUserJob, 'recruiter_city_name') . $form->field($modelUserJob, 'recruiter_website') . $form->field($modelUserJob, 'recruiter_jobs_industry')->listBox(\app\modules\job\models\JobIndustry::getOptions()) . $form->field($modelUserJob, 'recruiter_summary')]; } $tabs[] = ['label' => Yii::t('common', 'VIP information'), 'content' => $form->field($modelUserJob, 'vip') . $form->field($modelUserJob, 'vip_from')->widget(DateControl::classname(), ['type' => DateControl::FORMAT_DATE, 'ajaxConversion' => false, 'options' => ['pluginOptions' => ['autoclose' => true]]]) . $form->field($modelUserJob, 'vip_to')->widget(DateControl::classname(), ['type' => DateControl::FORMAT_DATE, 'ajaxConversion' => false, 'options' => ['pluginOptions' => ['autoclose' => true]]])]; echo Html::hiddenInput('save_type', 'save'); echo yii\bootstrap\Tabs::widget(['items' => $tabs]); ActiveForm::end(); ?> <?php /* $form = ActiveForm::begin([ 'id' => 'formDefault', 'layout' => 'horizontal',
public function getUserJob() { return $this->hasOne(UserJob::className(), ['_id' => '_id']); }
echo \app\helpers\LetHelper::getAvatar(Yii::$app->user->id, \app\helpers\LetHelper::IMAGE, false, 48, ['class' => 'media-object', 'width' => '64', 'height' => '64']); ?> </a> </div> <div class="media-body"> <p class="media-heading">Logged in as <strong><?php echo Html::encode(Yii::$app->user->identity->email); ?> </strong></p> <ul class="list-inline list-separator"> <li><a href="<?php echo \app\modules\job\models\UserJob::getDashboardUrl(); ?> ">Dashboard</a></li> <li><a href="<?php echo \app\modules\job\models\UserJob::getProfileUrl(); ?> ">Profile</a></li> <li><a href="<?php echo Url::to(['/account/auth/logout']); ?> ">Logout</a></li> </ul> </div> </div> <?php } else { ?> <div> <?php $model = new \app\modules\account\models\User();
private function buildOverAllStatistics() { $result = []; $userJob = new UserJob(); foreach ($this->overall_statistics as $role => $count) { $result[] = $userJob->getRoleText($role) . ': ' . $count; } return $result; }
public function actionResume() { // Xu ly avatar $modelUser = User::findOne(Yii::$app->user->id); if ($modelUser == null) { throw new NotFoundHttpException('The requested page does not exist.'); } $modelUserJob = UserJob::findOne(Yii::$app->user->id); if ($modelUserJob == null) { throw new NotFoundHttpException('The requested page does not exist.'); } $model = UserJobSeekerResume::findOne(Yii::$app->user->id); if ($model == null) { $model = new UserJobSeekerResume(); $model->_id = Yii::$app->user->id; $model->nationality = $modelUserJob->seeker_nationality; $model->salary = $modelUserJob->seeker_salary; $model->candidate_id = UserJob::getNextSequence('seeker'); } $employments = UserJobSeekerEmployment::find()->where(['seeker_id' => Yii::$app->user->id])->indexBy('_id')->all(); if ($employments == null) { $employments = new UserJobSeekerEmployment(); $employments->seeker_id = $model->_id; } if ($model->load(Yii::$app->request->post()) && $modelUser->load(Yii::$app->request->post())) { // Sync data $model->phone_number = $modelUser->phone; // UserJobSeekerResume::search() có dùng đến phone_number nên cần đồng bộ chỗ này $modelValidate = $model->validate(); $modelUserValidate = $modelUser->validate(); if (!is_array($employments)) { $employments->load(Yii::$app->request->post()); $employmentsValidate = $employments->validate(); } else { $employmentsValidate = Model::loadMultiple($employments, Yii::$app->request->post()) && Model::validateMultiple($employments); } if ($employmentsValidate && $modelValidate && $modelUserValidate && $model->save(false) && $modelUser->save(false)) { $modelUserJob->seeker_nationality = $model->nationality; $modelUserJob->seeker_salary = $model->salary; $modelUserJob->save(); if (!is_array($employments)) { $employments->save(); //update latest company and position for seeker resume document $model->latest_company = $employments->company_name; $model->latest_position = $employments->position; $model->save(false); } else { if (isset($employmentsValidate) && $employmentsValidate == true) { $i = 1; $max = sizeof($employments); foreach ($employments as $employment) { $employment->save(false); if ($i == $max) { // is latest employment iformation //update latest company and position for seeker resume document $model->latest_company = $employment->company_name; $model->latest_position = $employment->position; $model->save(false); } $i++; } } } Yii::$app->getSession()->setFlash('flash', ['type' => 'success', 'title' => Yii::t('common', 'Message'), 'message' => Yii::t('common', 'Your information has been saved successfully.'), 'duration' => 10000]); return $this->refresh(); } } Yii::$app->view->title = Yii::t($this->module->id, 'Resume'); Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title; return $this->render('resume', ['model' => $model, 'modelUser' => $modelUser, 'employments' => $employments]); }
<p> <?php echo Html::a(Yii::t(Yii::$app->controller->module->id, 'Update'), ['update', 'id' => (string) $model->_id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Yii::t(Yii::$app->controller->module->id, 'Delete'), ['delete', 'id' => (string) $model->_id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t(Yii::$app->controller->module->id, 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> </p> </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(Yii::$app->controller->module->id, 'Infomation'); ?> </h5> </div> <div class="ibox-content"> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['_id', ['attribute' => 'role', 'value' => ArrayHelper::getValue(\app\modules\job\models\UserJob::getRoleOptions(), ArrayHelper::getValue($model, 'role'))], 'title', 'days', 'editor', 'creator', 'price', 'sort', 'status', ['attribute' => 'create_time', 'value' => Yii::$app->formatter->asDatetime($model->create_time->sec)], ['attribute' => 'update_time', 'value' => Yii::$app->formatter->asDatetime($model->update_time->sec)]]]); ?> </div> </div> </div> </div> </div>