Esempio n. 1
0
 /**
  * Define the application's command schedule.
  *
  * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     $schedule->command('inspire')->hourly();
     $schedule->call(function () {
         Log::info('attaching new verified skills started');
         $skills = Skill::whereNotNull('verified_skill_id')->get();
         foreach ($skills as $skill) {
             $jobs = Job::whereHas('skills', function ($query) use($skill) {
                 $query->where('skill_id', $skill->id);
             })->whereHas('verifiedSkills', function ($query) use($skill) {
                 $query->where('verified_skill_id', $skill->verified_skill_id);
             }, '<', 1)->get();
             foreach ($jobs as $job) {
                 $job->verifiedSkills()->attach($skill->verified_skill_id);
             }
         }
     })->daily();
     $schedule->call(function () {
         Log::info('HH parsing started');
         $hhGrabber = $this->app['App\\Helpers\\HeadHunterGrabber'];
         $job = $this->app['App\\Models\\Job'];
         $parser = new Parser([$hhGrabber], $job);
         $parser->parse();
     })->daily();
 }
 /**
  * Display a list of active talents
  *
  * @param UserRepository $userRepository
  * @return $this
  */
 public function index(UserRepository $userRepository)
 {
     $talents = $userRepository->findActiveTalents(Input::get('tag'), Input::get('describes'), Input::get('location'), null, 12, Input::get('professions'));
     $describes = Skill::lists('name', 'id')->all();
     $professions = Profession::lists('name', 'id')->all();
     return view('talent.index')->with('talents', $talents)->with('describes', $describes)->with('professions', $professions);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $skills = ['Designer', 'Developer', 'Engineer', 'Musician', 'Visual Artist', 'Filmmaker', 'Writer', 'Project Manager', 'Other'];
     foreach ($skills as $skillName) {
         $skill = Skill::create(['name' => $skillName]);
         $skill->save();
     }
 }
Esempio n. 4
0
 /**
  * Ищет навык в БД или создает новый
  *
  * @param $skillName
  * @param $is_original
  * @return Skill
  */
 public static function getOrCreateSkillByName($skillName, $is_original)
 {
     //ищем скилл с таким же именем
     $skill = self::where('name', $skillName)->first();
     //если не нашли - добавляем ( только ключевые)
     if (!$skill && $is_original) {
         $skill = Skill::create(['name' => $skillName]);
     }
     return $skill;
 }
 /**
  * Show the form for creating a user profile.
  *
  * @return $this
  */
 public function edit()
 {
     $describes = Skill::orderBy('name')->lists('name', 'id')->all();
     // We want other to be at the bottom
     $other = array_search('Other', $describes);
     unset($describes[$other]);
     $describes[$other] = 'Other';
     $skills = Tag::orderBy('name')->lists('name', 'id')->all();
     $professions = Profession::orderBy('name')->lists('name', 'id')->all();
     $professions[] = 'Other';
     return view('profile.edit')->with('user', Auth::user())->with('describes', $describes)->with('skills', $skills)->with('route', Route::currentRouteName())->with('professions', $professions);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $tags = Tag::all();
     $skills = Skill::all();
     for ($i = 0; $i < 50; $i++) {
         $user = User::register($faker->unique()->userName, $faker->unique()->email, bcrypt('password'), 'talent');
         $this->userRepository->save($user);
         $profileData = ['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'location' => $faker->city, 'describe' => $faker->numberBetween(1, count($skills) - 1), 'about' => $faker->sentence(), 'facebook' => $faker->userName, 'linked_in' => $faker->userName, 'twitter' => $faker->userName, 'meetup' => $faker->userName, 'published' => $faker->boolean()];
         $userSkills = '';
         foreach (range(1, rand(2, 4)) as $x) {
             $id = rand(1, count($tags) - 1);
             $userSkills .= $tags[$id]->name . ",";
         }
         $profileData['skills'] = $userSkills;
         $this->dispatcher->dispatch(new UpdateProfile($user, $profileData));
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $slugify = Slugify::create();
     $users = User::all();
     $tags = Tag::all();
     $skills = Skill::all();
     foreach ($users as $user) {
         foreach (range(1, rand(2, 3)) as $i) {
             $name = $faker->name;
             $startup = Startup::create(['name' => $name, 'description' => $faker->text, 'url' => $slugify->slugify($name), 'user_id' => $user->id, 'published' => true]);
             $this->repository->save($startup);
             $startupTags = [];
             foreach (range(1, rand(2, 4)) as $i) {
                 $id = rand(1, count($tags) - 1);
                 $startupTags[] = $id;
             }
             $needs = [];
             $commitments = ['full-time', 'part-time'];
             foreach (range(1, rand(2, 3)) as $i) {
                 $roleId = rand(1, count($skills) - 1);
                 $needTags = [];
                 foreach (range(1, rand(2, 3)) as $i) {
                     $id = rand(1, count($tags) - 1);
                     $needTags[] = $id;
                 }
                 $needs[] = array('role' => $roleId, 'quantity' => rand(1, 10), 'skills' => implode(',', $needTags), 'commitment' => $commitments[rand(0, 1)], 'desc' => $faker->text);
                 $this->repository->updateNeeds($startup, $needs);
             }
             $startup->tags()->attach($startupTags);
             foreach (range(1, rand(2, 3)) as $i) {
                 $id = rand(1, count($users) - 1);
                 if ($startup->owner->id !== $id) {
                     $this->repository->addMemberRequest($users[$id], $startup, false);
                     if (rand(0, 1)) {
                         $this->repository->approveMemberRequest($users[$id], $startup, false);
                     }
                 }
             }
         }
     }
 }
 /**
  * @param $startup
  * @return $this
  */
 public function edit($startup)
 {
     $startup = Startup::where('url', '=', $startup)->firstOrFail();
     $tags = Tag::lists('name', 'id')->all();
     $stages = Stage::lists('name', 'id')->all();
     $needs = Skill::lists('name', 'id')->all();
     return view('startups.edit')->with('startup', $startup)->with('tags', $tags)->with('stages', $stages)->with('needs', $needs);
 }
Esempio n. 9
0
                <p>
                    <?php 
$skill_id = Yii::$app->request->get('skill_id');
if ($skill_id) {
    echo Html::a('Tạo quiz', ['create', 'skill_id' => $skill_id], ['class' => 'btn btn-success']);
} else {
    echo Html::a('Tạo quiz', ['create'], ['class' => 'btn btn-success']);
}
?>
                </p>
            </div>
        </header>
        <div class="body">
            <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['id', ['attribute' => 'skill_id', 'content' => function ($data) {
    $skillName = Skill::findOne($data->skill_id)->title;
    return $skillName ? $skillName : '<span style="color:red">Không tìm danh mục</span>';
}, 'format' => 'raw'], ['attribute' => 'question', 'content' => function ($data) {
    return Html::a($data->question, ['view', 'id' => $data->id]);
}], 'answer', ['attribute' => 'difficulty', 'content' => function ($data) {
    switch ($data->difficulty) {
        case '0':
            return '<span class="btn-success label">Dễ</span>';
            break;
        case '1':
            return '<span class="btn-warning label">Trung bình</span>';
            break;
        default:
            return '<span class="btn-danger label">Khó</span>';
            break;
    }
Esempio n. 10
0
{
    return strcmp($a->parents, $b->parents);
}
usort($skills, "cmp");
$data = Recursive::sortArrayDropDown($skills);
?>

<div class="row-fluid">

    <?php 
$form = ActiveForm::begin(['options' => ['class' => 'form-horizontal']]);
?>

    <?php 
$skill_id = Yii::$app->request->get('skill_id');
if ($skill_id && Skill::findOne($skill_id)) {
    echo $form->field($model, 'skill_id')->hiddenInput(['value' => $skill_id])->label(false);
} else {
    echo $form->field($model, 'skill_id', ['template' => '{label}<div class="controls">{input}{error}{hint}</div>'])->dropdownList($data, ['prompt' => '-- Chọn kỹ năng --', 'class' => 'span6']);
}
?>

    <?php 
echo $form->field($model, 'question', ['template' => '{label}<div class="controls">{input}{error}{hint}</div>'])->textarea(['class' => 'span6']);
?>

    <?php 
echo $form->field($model, 'answer', ['template' => '{label}<div class="controls">{input}{error}{hint}</div>'])->dropdownList(['A' => 'A', 'B' => 'B', 'C' => 'C', 'D' => 'D'], ['class' => 'span6', 'prompt' => '-- Chọn đáp án --']);
?>

    <?php 
Esempio n. 11
0
 public function actionIndex()
 {
     $skills = Skill::find()->all();
     return $this->render('index', ['skills' => $skills]);
 }
Esempio n. 12
0
?>
</h4>
            <div class="toolbar">
                <p>
                    <?php 
echo Html::a('Cập nhật', ['update', 'id' => $model->id, 'skill_id' => $model->skill_id], ['class' => 'btn btn-primary']);
?>
                    <?php 
echo Html::a('Xóa', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Bạn có chắc muốn xóa Quiz này?', 'method' => 'post']]);
?>
                </p>
            </div>
        </header>
        <div class="body">
            <?php 
$skillName = Skill::findOne($model->skill_id)->title;
if ($created_by = AdminUser::findOne($model->created_by)) {
    $created_by = $created_by->fullname != '' ? $created_by->fullname : $created_by->username;
}
if ($updated_by = AdminUser::findOne($model->updated_by)) {
    $updated_by = $updated_by->fullname != '' ? $updated_by->fullname : $updated_by->username;
}
switch ($model->difficulty) {
    case '0':
        $difficulty = '<span class="btn-success label">Dễ</span>';
        break;
    case '1':
        $difficulty = '<span class="btn-warning label">Trung bình</span>';
        break;
    default:
        $difficulty = '<span class="btn-danger label">Khó</span>';
Esempio n. 13
0
 /**
  * Связывает вакансию с навыками
  *
  * @param $job - модель вакансии
  * @param $skillName - навык
  * @param $is_original - навык является ключевым
  */
 public function attachSkill($skillName, $is_original)
 {
     $skill = Skill::getOrCreateSkillByName($skillName, $is_original);
     $this->skills()->attach($skill);
     if ($skill && $skill->verifiedSkill) {
         if (!$this->verifiedSkills()->find($skill->verifiedSkill->id)) {
             $this->verifiedSkills()->attach($skill->verifiedSkill);
         }
     }
 }
Esempio n. 14
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($society, $hid, $id)
 {
     if (Helpers::perm('admin', $society) or Helpers::perm('edit', $society)) {
         $data['society'] = $society;
         $data['individual'] = Individual::with('group', 'skill')->find($id);
         if (!$data['individual']->photo) {
             $data['individual']->photo = "/public/images/profile.png";
         }
         if (count($data['individual']->currentgroups) != 0) {
             foreach ($data['individual']->currentgroups as $group) {
                 $groupmembers[] = $group->id;
             }
             $data['groupmembers'] = $groupmembers;
         }
         $data['groups'] = Group::where('society_id', '=', $society)->orderBy('groupname')->get();
         if (count($data['individual']->skill) != 0) {
             foreach ($data['individual']->skill as $skill) {
                 $skillmembers[] = $skill->id;
             }
             $data['skillmembers'] = $skillmembers;
         }
         $data['household_id'] = $data['individual']->household_id;
         $data['skills'] = Skill::orderBy('skill')->get();
         $data['pgadmin'] = Society::find($society)->pgadmin;
         return View::make('individuals.edit', $data);
     } else {
         //
     }
 }
Esempio n. 15
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $skill = Skill::find($id);
     $skill->delete();
     return Redirect::to('/skills')->with('okmessage', 'Skill deleted');
 }
Esempio n. 16
0
 /**
  * Finds the Skill model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Skill the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Skill::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 17
0
echo Html::encode($this->title);
?>
</h4>
            <div class="toolbar">
                <p>
                    <?php 
echo Html::a('Tạo kỹ năng', ['create'], ['class' => 'btn btn-success']);
?>
                </p>
            </div>
        </header>
        <div class="body">
            <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['id', ['attribute' => 'title', 'content' => function ($data) {
    return Html::a($data->title, ['view', 'id' => $data->id]);
}], ['attribute' => 'cat_id', 'content' => function ($data) {
    $categoryName = Category::findOne($data->cat_id)->title;
    return $categoryName ? $categoryName : '<span style="color:red">Không tìm danh mục</span>';
}], ['attribute' => 'Số câu quiz', 'content' => function ($data) {
    $quizs = Quiz::findAll(['skill_id' => $data->id]);
    return '<a href="' . Url::toRoute(['quiz/index', 'skill_id' => $data->id]) . '">' . count($quizs) . '</a>';
}, 'format' => 'raw'], ['attribute' => 'state', 'content' => function ($data) {
    return Skill::findOne($data['id'])->state == 1 ? '<span class="label-success label label-default">Kích hoạt</span>' : '<span class="label-default label">Không kích hoạt</span>';
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {update} {delete}', 'header' => 'Thao tác', 'buttons' => ['delete' => function ($url, $model) {
    return '<a class="btn btn-danger" aria-label="Delete" data-confirm="Bạn có chắc muốn xóa danh mục này?" data-method="post" data-pjax="0" href="' . $url . '"><i class="icon icon-trash icon-white"></i></a>';
}]]]]);
?>
        </div>
    </div>
</div>