예제 #1
0
 private function getCredentialFromOnDemandSpecialization($details)
 {
     $credential = new Credential();
     $credential->setName($details['elements'][0]['name']);
     $credential->setPricePeriod(Credential::CREDENTIAL_PRICE_PERIOD_TOTAL);
     $credential->setPrice(0);
     $credential->setSlug($details['elements'][0]['slug'] . '-specialization');
     $credential->setInitiative($this->initiative);
     $credential->setUrl(sprintf(self::SPECIALIZATION_ONDEMAND_PAGE_URL, $details['elements'][0]['slug']));
     $credential->setOneLiner($details['elements'][0]['metadata']['subheader']);
     if (isset($details['elements'][0]['metadata']['headline'])) {
         $credential->setSubTitle($details['elements'][0]['metadata']['headline']);
     } else {
         echo $details['elements'][0]['tagline'] . "\n";
         $credential->setSubTitle($details['elements'][0]['tagline']);
     }
     // Add the institutions
     foreach ($details['linked']['partners.v1'] as $university) {
         $ins = $this->dbHelper->getInstitutionBySlug($university['shortName']);
         if ($ins) {
             $credential->addInstitution($ins);
         } else {
             $this->out("University Not Found - " . $university['name']);
         }
     }
     // Add the courses
     foreach ($details['linked']['courses.v1'] as $topic) {
         $course = $this->dbHelper->getCourseByShortName('coursera_' . $topic['slug']);
         if ($course) {
             $credential->addCourse($course);
         } else {
             $this->out("Course Not Found - " . $topic['name']);
         }
     }
     // Build the description
     $description = $details['elements'][0]['description'];
     $incentives = $details['elements'][0]['metadata']['incentives'];
     $learningObjectives = '';
     foreach ($details['elements'][0]['metadata']['learningObjectives'] as $objective) {
         $learningObjectives .= "<li>{$objective}</li>";
     }
     $recommendedBackground = '';
     foreach ($details['elements'][0]['metadata']['recommendedBackground'] as $background) {
         $recommendedBackground .= "<li>{$background}</li>";
     }
     $credential->setDescription("<p>{$description}</p>" . "<h3 class='table-tab-content__title'>Incentives & Benefits</h3><p>{$incentives}</p>" . "<h3 class='table-tab-content__title'>What You'll Learn</h3>" . "<p><ul>{$learningObjectives}</ul></p>" . "<h3 class='table-tab-content__title'>Recommended Background</h3>" . "<p><ul>{$recommendedBackground}</ul></p>");
     return $credential;
 }
예제 #2
0
 public function getCredential($xseries)
 {
     $credential = new Credential();
     $credential->setName($xseries['title']);
     $credential->setPricePeriod(Credential::CREDENTIAL_PRICE_PERIOD_TOTAL);
     $credential->setPrice(0);
     $credential->setSlug(UniversalHelper::getSlug($credential->getName()) . '-xseries');
     $credential->setInitiative($this->initiative);
     $credential->setUrl($xseries['url']);
     $credential->setOneLiner($xseries['field_xseries_subtitle']);
     $credential->setSubTitle($xseries['field_xseries_subtitle_short']);
     $credential->setDescription($xseries['body']['value'] . $xseries['field_xseries_overview']['value']);
     return $credential;
 }
예제 #3
0
 public function getCredentialFromNanodegree($nanodegree)
 {
     $credential = new Credential();
     $credential->setName($nanodegree['title']);
     $credential->setPricePeriod(Credential::CREDENTIAL_PRICE_PERIOD_MONTHLY);
     $credential->setPrice(200);
     $credential->setSlug($nanodegree['slug']);
     $credential->setInitiative($this->initiative);
     $credential->setUrl($nanodegree['homepage']);
     $credential->setOneLiner($nanodegree['short_summary']);
     $credential->setSubTitle($nanodegree['subtitle']);
     $credential->setWorkloadMax(10);
     $credential->setWorkloadMin(10);
     $credential->setWorkloadType(Credential::CREDENTIAL_WORKLOAD_TYPE_HOURS_PER_WEEK);
     $credential->setDurationMax($nanodegree['expected_duration']);
     $credential->setDurationMin($nanodegree['expected_duration']);
     // Collect the description
     $summary = $nanodegree['summary'];
     $expectedLearning = $nanodegree['expected_learning'];
     $requiredKnowledge = $nanodegree['required_knowledge'];
     $credential->setDescription("<p>{$summary}</p>" . "<h3 class='table-tab-content__title'>Why Take This Nanodegree?</h3>" . "<p>{$expectedLearning}</p>" . "<h3 class='table-tab-content__title'>Required Knowledge</h3>" . "<p>{$requiredKnowledge}</p>");
     return $credential;
 }