本文整理汇总了PHP中Skill类的典型用法代码示例。如果您正苦于以下问题:PHP Skill类的具体用法?PHP Skill怎么用?PHP Skill使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Skill类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addskill
function addskill($_post)
{
$user->id = $this->getuser();
$profile = new Skill($user->id);
$result = $profile->create($_post);
return $result;
}
示例2: listSkills
public function listSkills()
{
$db = new Skill($this->_config);
$result = $db->getSkills();
$encodedResult = $this->utf8_converter($result);
$skills = json_encode($encodedResult);
echo $skills;
}
示例3: saveSkill
public function saveSkill(Skill $skill)
{
try {
$skill->save();
} catch (Exception $e) {
throw new DaoException($e->getMessage(), $e->getCode(), $e);
}
}
示例4: testAddSkill
public function testAddSkill()
{
$skill = new Skill();
$skill->setName('Gardening');
$skill->setDescription('Flower arts');
$this->skillDao->saveSkill($skill);
$savedSkill = TestDataService::fetchLastInsertedRecord('Skill', 'id');
$this->assertTrue($savedSkill instanceof Skill);
$this->assertEquals('Gardening', $savedSkill->getName());
$this->assertEquals('Flower arts', $savedSkill->getDescription());
}
示例5: getLevelProgression
public function getLevelProgression(Skill $s)
{
if ($s->hasXp()) {
$targetXp = self::$table[$s->level + 1];
$startXp = self::$table[$s->level];
$distance = $targetXp - $startXp;
$xpLeft = $targetXp - $s->xp;
return $distance / $xpLeft;
}
trigger_error('User is not ranked in this skill.');
return 0;
}
示例6: getSkillsArray
public static function getSkillsArray($rows)
{
$skills = array();
if (!empty($rows)) {
foreach ($rows as $row) {
$skill = new Skill($row);
$skill->setSkillId($row['skillId']);
array_push($skills, $skill);
}
}
return $skills;
}
示例7: test_addData_skillCheck
function test_addData_skillCheck()
{
Initial::addData();
$skill = Skill::getAll();
$result = new Skill("Acrobatics", "Balancing and tumbling", 1);
$this->assertEquals($skill[0], $result);
}
示例8: modify
/**
* Modify user
*/
public function modify($id)
{
$user = User::find($id);
$skills = Skill::findSkillsForUser($id);
if (!$user) {
return Redirect::route('members')->with('mError', 'Cet utilisateur est introuvable !');
}
return View::make('user.modify', array('user' => $user, 'skills' => $skills));
}
示例9: save_data
/**
* Save the imported data
* @param array List of users
* @return void
* @uses global variable $inserted_in_course, which returns the list of courses the user was inserted in
*/
function save_data($skills)
{
if (is_array($skills)) {
$parents = array();
foreach ($skills as $index => $skill) {
if (isset($parents[$skill['parent_id']])) {
$skill['parent_id'] = $parents[$skill['parent_id']];
} else {
$skill['parent_id'] = 1;
}
$skill['a'] = 'add';
$saved_id = $skill['id'];
$skill['id'] = null;
$oskill = new Skill();
$skill_id = $oskill->add($skill);
$parents[$saved_id] = $skill_id;
}
}
}
示例10: tearDown
protected function tearDown()
{
CharClass::deleteAll();
Character::deleteAll();
Race::deleteAll();
Skill::deleteAll();
Stat::deleteAll();
Description::deleteAll();
Background::deleteAll();
}
示例11: post
public function post($resourceVals, $data, $userId)
{
global $logger, $warnings_payload;
$userId = 5;
$skillId = $resourceVals['user-skills'];
if (isset($skillId)) {
$warnings_payload[] = 'POST call to /user-skills must not have ' . '/skillID appended i.e. POST /user-skills';
throw new UnsupportedResourceMethodException();
}
if ($data['name'] != null) {
$nameObj = $this->collapDAO->queryByName($data['name']);
if (empty($nameObj)) {
$skillObj = new Skill($data['name']);
$logger->debug("POSTed Skill Detail: " . $skillObj->toString());
$this->collapDAO->insert($skillObj);
$userSkillDetail = $skillObj->toArray();
if (isset($userSkillDetail['id'])) {
$userSkillObj = new UserSkill($userId, $userSkillDetail['id']);
$logger->debug("POSTed User Skill Detail: " . $userSkillObj->toString());
$this->collapDAO->insertUserSkill($userSkillObj);
$userSkillDetail = $userSkillObj->toArray();
}
} else {
$nameSkill = $nameObj[0]->toArray();
$userSkillObj = new UserSkill($userId, $nameSkill['id']);
$logger->debug("POSTed User Skill Detail: " . $userSkillObj->toString());
$this->collapDAO->insertUserSkill($userSkillObj);
$userSkillDetail = $userSkillObj->toArray();
}
} else {
$userSkillObj = new UserSkill($userId, $data['skill_id']);
$logger->debug("POSTed User Skill Detail: " . $userSkillObj->toString());
$this->collapDAO->insertUserSkill($userSkillObj);
$userSkillDetail = $userSkillObj->toArray();
}
if (!isset($userSkillDetail['id'])) {
return array('code' => '2011');
}
$this->userSkillDetail[] = $userSkillDetail;
return array('code' => '2001', 'data' => array('userSkillDetail' => $this->userSkillDetail));
}
示例12: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$opportunity = $this->opportunity->find($id);
$locations = Location::lists('location_name', 'id');
$group = Opportunity::find($id);
$skills = Skill::all();
$assigned = $group->skills->lists('id');
if (is_null($opportunity)) {
return Redirect::route('opportunities.index');
}
return View::make('opportunities.edit', compact('opportunity', 'locations', 'group', 'skills', 'assigned'));
}
示例13: find
static function find($search_id)
{
$found_skill = null;
$skills = Skill::getAll();
foreach ($skills as $skill) {
$skill_id = $skill->getId();
if ($skill_id == $search_id) {
$found_skill = $skill;
}
}
return $found_skill;
}
示例14: train
/**
* User goes gym and trains
*
* @return mixed (array/boolean)
*/
public function train()
{
/*
Session 1-4 100 strength gain per day
Session 5-14 50 strength gain per day
Session 15-34 25 strength gain per day
Session 35-64 10 strength gain per day
Session 65-124 5 strength gain per day
Session 125-199 2 strength gain per day
Session 200+ 1 strength gain per day
*/
$r = Service::getDB()->query("SELECT uid FROM `train_historial` WHERE uid = '" . $this->id . "'");
$trainedDays = sizeof($r);
if ($trainedDays < 5) {
$strengh = 100;
} elseif ($trainedDays < 15) {
$strengh = 50;
} elseif ($trainedDays < 35) {
$strengh = 25;
} elseif ($trainedDays < 65) {
$strengh = 10;
} elseif ($trainedDays < 125) {
$strengh = 5;
} elseif ($trainedDays < 200) {
$strengh = 2;
} else {
$strengh = 1;
}
$skill = new Skill();
$skill->get($this->id);
$skill->strengh += $strengh;
if ($skill->save()) {
Service::getDB()->insert('train_historial', array('uid' => $this->id, 'date' => $this->now()));
$trainedDays++;
return array('strengh' => $strengh, 'trainedDays' => $trainedDays);
} else {
return false;
}
}
示例15: envSkills
protected function envSkills()
{
$skill = new Skill();
$skill->skill_title = 'PHP';
$skill->percent = '70';
$skill->description_title = 'My Skills';
$skill->description = 'Are Sweet';
$skill->template_id = 1;
$skill->save();
$skill11 = new Skill();
$skill11->skill_title = 'Javascript';
$skill11->percent = '50';
$skill11->description_title = 'My Skills';
$skill11->description = 'Are Sweet';
$skill11->template_id = 1;
$skill11->save();
$skill12 = new Skill();
$skill12->skill_title = 'CSS';
$skill12->percent = '50';
$skill12->description_title = 'My Skills';
$skill12->description = 'Are Sweet';
$skill12->template_id = 1;
$skill12->save();
$skill2 = new Skill();
$skill2->skill_title = 'PHP';
$skill2->percent = '20';
$skill2->description_title = 'My Skills';
$skill2->description = 'Are Sweet';
$skill2->template_id = 2;
$skill2->save();
$skill3 = new Skill();
$skill3->skill_title = 'PHP';
$skill3->percent = '20';
$skill3->description_title = 'My Skills';
$skill3->description = 'Are Sweet';
$skill3->template_id = 3;
$skill3->save();
}