当前位置: 首页>>代码示例>>PHP>>正文


PHP Skill::get方法代码示例

本文整理汇总了PHP中Skill::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Skill::get方法的具体用法?PHP Skill::get怎么用?PHP Skill::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Skill的用法示例。


在下文中一共展示了Skill::get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
     }
 }
开发者ID:AugustoAngeletti,项目名称:erepublik,代码行数:44,代码来源:User.php

示例2: array

         $action = 'filterBySkill';
     }
 }
 $courses = CourseManager::get_courses_list();
 $tableRows = array();
 $reportTitle = null;
 $objSkill = new Skill();
 $skills = $objSkill->get_all();
 switch ($action) {
     case 'filterByCourse':
         $course = api_get_course_info_by_id($selectedCourse);
         $reportTitle = sprintf(get_lang('AchievedSkillInCourseX'), $course['name']);
         $tableRows = $objSkill->listAchievedByCourse($selectedCourse);
         break;
     case 'filterBySkill':
         $skill = $objSkill->get($selectedSkill);
         $reportTitle = sprintf(get_lang('StudentsWhoAchievedTheSkillX'), $skill['name']);
         $students = UserManager::getUsersFollowedByUser($userId, STUDENT, false, false, false, null, null, null, null, null, null, DRH);
         $coursesFilter = array();
         foreach ($courses as $course) {
             $coursesFilter[] = $course['id'];
         }
         $tableRows = $objSkill->listUsersWhoAchieved($selectedSkill, $coursesFilter);
         break;
 }
 foreach ($tableRows as &$row) {
     $row['completeName'] = api_get_person_name($row['firstname'], $row['lastname']);
     $row['achievedAt'] = api_format_date($row['acquired_skill_at'], DATE_FORMAT_NUMBER);
     $row['courseImage'] = Display::return_icon('course.png', null, null, ICON_SIZE_MEDIUM, null, true);
     $imageSysPath = sprintf("%s%s/course-pic.png", api_get_path(SYS_COURSE_PATH), $row['c_directory']);
     if (file_exists($imageSysPath)) {
开发者ID:daffef,项目名称:chamilo-lms,代码行数:31,代码来源:my_skills_report.php

示例3: Skill

    $skillInfo['courses'][] = ['name' => $courseName, 'date_issued' => api_format_date($userSkillDate, DATE_TIME_FORMAT_LONG)];
    $assertionUrl = api_get_path(WEB_CODE_PATH) . "badge/assertion.php?";
    $assertionUrl .= http_build_query(array('user' => $user->getId(), 'skill' => $skill->getId(), 'course' => $userSkill->getCourseId(), 'session' => $userSkill->getSessionId()));
    $badgeAssertions[] = $assertionUrl;
}
$allowExport = api_get_user_id() == $user->getId();
if ($allowExport) {
    $backpack = 'https://backpack.openbadges.org/';
    $configBackpack = api_get_setting('gradebook.openbadges_backpack');
    if (strcmp($backpack, $configBackpack) !== 0) {
        $backpack = $configBackpack;
    }
    $htmlHeadXtra[] = '<script src="' . $backpack . 'issuer.js"></script>';
}
$objSkill = new Skill();
$skills = $objSkill->get($skillId);
$unbakedBadge = api_get_path(SYS_UPLOAD_PATH) . "badges/" . $skills['icon'];
$unbakedBadge = file_get_contents($unbakedBadge);
$badgeInfoError = false;
$personalBadge = "";
$png = new PNGImageBaker($unbakedBadge);
if ($png->checkChunks("tEXt", "openbadges")) {
    $bakedInfo = $png->addChunk("tEXt", "openbadges", $assertionUrl);
    $bakedBadge = UserManager::getUserPathById($userId, "system");
    $bakedBadge = $bakedBadge . 'badges';
    if (!file_exists($bakedBadge)) {
        mkdir($bakedBadge, api_get_permissions_for_new_directories(), true);
    }
    $skillRelUserId = $userSkills[0]->getId();
    if (!file_exists($bakedBadge . "/badge_" . $skillRelUserId)) {
        file_put_contents($bakedBadge . "/badge_" . $skillRelUserId . ".png", $bakedInfo);
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:31,代码来源:issued.php

示例4: get_children

 /**
  * @param int $skill_id
  * @param bool $load_user_data
  * @param bool $user_id
  * @return array
  */
 public function get_children($skill_id, $load_user_data = false, $user_id = false)
 {
     $skills = $this->find('all', array('where' => array('parent_id = ? ' => $skill_id)));
     $skill_obj = new Skill();
     $skill_rel_user = new SkillRelUser();
     if ($load_user_data) {
         $passed_skills = $skill_rel_user->get_user_skills($user_id);
         $done_skills = array();
         foreach ($passed_skills as $done_skill) {
             $done_skills[] = $done_skill['skill_id'];
         }
     }
     if (!empty($skills)) {
         foreach ($skills as &$skill) {
             $skill['data'] = $skill_obj->get($skill['skill_id']);
             if (isset($skill['data']) && !empty($skill['data'])) {
                 if (!empty($done_skills)) {
                     $skill['data']['passed'] = 0;
                     if (in_array($skill['skill_id'], $done_skills)) {
                         $skill['data']['passed'] = 1;
                     }
                 }
             } else {
                 $skill = null;
             }
         }
     }
     return $skills;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:35,代码来源:skill.lib.php

示例5: work

 /**
  * Generates units from user work and pays his salary
  * 
  * @return mixed (boolean/array)
  */
 public function work()
 {
     /*
     http://wiki.e-sim.org/index.php/Productivity_formula
     * P = 10 * (4+E) * N * C * R * Q   
     P - Productivity
     E - Economy skill level
     N - Employee multiplier (Number of employees already worked that day in the company.)
     	if employeesWorked <=10 Then N = 1.0 + (10-employeesWorked) * 0.05
     	elseif employeesWorked <=20 Then N = 1.0 - (employeesWorked-10) * 0.03
     	elseif employeesWorked <=30 Then N = 0.7 - (employeesWorked-20) * 0.02
     	else N=0.5;
     C
     	1 If home country controls capital
     	0.75 If not
     R
     	for manufacture companies:
     		1.25 If region's country owns the appropriate high raw. (eg: Iron for Weapons)
     		1 If region's country do not own the appropriate high raw.
     	for raw companies:
     		1.0 in high regions
     		0.75 in medium region.
     Q
     	1.0 for manufacture companies
     	for raw companies
     		1.0 for Q1 companies
     		1.2 for Q2 companies
     		1.4 for Q3 companies
     		1.6 for Q4 companies
     		1.8 for Q5 companies
     * 
     */
     $job = new Job();
     $job = $job->getByUid($this->uid);
     if (!$job) {
         throw new Exception("you don't have a job");
     }
     $skills = new Skill();
     $skills->get($this->uid);
     $E = $skills->economic;
     $employeesWorked = 1;
     //ToDO PENDING
     if ($employeesWorked <= 10) {
         $N = 1.0 + (10 - $employeesWorked) * 0.05;
     } elseif ($employeesWorked <= 20) {
         $N = 1.0 - ($employeesWorked - 10) * 0.03;
     } elseif ($employeesWorked <= 30) {
         $N = 0.7 - ($employeesWorked - 20) * 0.02;
     } else {
         $N = 0.5;
     }
     $company = new Company();
     $company->get($job->company);
     $region = new Region();
     $companyRegion = $region->get($company->region);
     //does the region have the resource that company produces?
     // also determine product quality
     if ($company->productType == Company::PRODUCT_TYPE_RESOURCE) {
         $R = $companyRegion->resourceAmount / 10;
         $Q = 1;
     } else {
         $product = new Product();
         $product->get($company->product);
         if ($companyRegion->resourceType == $product->resource) {
             $R = 1.25;
         } else {
             $R = 1;
         }
         $Q = 0.8 + 0.2 * $company->quality;
     }
     $country = new Country();
     $country = $country->get($companyRegion->country);
     $capitalRegion = $region->get($country->capitalRegionId);
     //is country capital owned by original owners?
     if ($capitalRegion->country == $capitalRegion->countryConqueror) {
         $C = 1;
     } else {
         $C = 0.75;
     }
     if ($companyRegion->resourceAmount > 0) {
         $productivity = 10 * (4 + $E) * $N * $C * $R * $Q;
     } else {
         $productivity = 10 * (4 + $E) * $N * $C * $Q;
     }
     $user = new User($this->uid);
     $user->updateXP('WORK');
     $skills->economic += 0.125;
     $skills->save();
     $company->pendingUnits += $productivity;
     //calculate produced units
     if ($company->productType == Company::PRODUCT_TYPE_RESOURCE) {
         $createdUnits = floor($company->pendingUnits);
         $company->pendingUnits -= $createdUnits;
         $added = $company->addStock($createdUnits, Company::PRODUCT_TYPE_PRODUCT);
         if ($added) {
//.........这里部分代码省略.........
开发者ID:AugustoAngeletti,项目名称:erepublik,代码行数:101,代码来源:Job.php

示例6: SkillProfile

            } else {
                echo 0;
            }
        }
        break;
    case 'save_profile':
        if (api_is_platform_admin() || api_is_drh()) {
            $skill_profile = new SkillProfile();
            $params = $_REQUEST;
            //$params['skills'] = isset($_SESSION['skills']) ? $_SESSION['skills'] : null;
            $params['skills'] = $params['skill_id'];
            $skill_data = $skill_profile->save($params);
            if (!empty($skill_data)) {
                echo 1;
            } else {
                echo 0;
            }
        }
        break;
    case 'skill_exists':
        $skill_data = $skill->get($_REQUEST['skill_id']);
        if (!empty($skill_data)) {
            echo 1;
        } else {
            echo 0;
        }
        break;
    default:
        echo '';
}
exit;
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:skill.ajax.php


注:本文中的Skill::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。