コード例 #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $this->skill->find($id)->delete();
     return Redirect::route('skills.index');
 }
コード例 #2
0
ファイル: admin.php プロジェクト: Robinwist/UXDTalentenTest
        }
        $app->render('skills/delete.html', $data);
    })->via('GET', 'POST')->name('skills_delete');
    $app->map('/new', function () use($app, $data) {
        if ($app->request->isPost()) {
            $edu_level = EducationLevel::find($app->request->post('educationlevel'));
            $skill = new Skill();
            $skill->name = $app->request->post('title');
            $skill->save();
            $data['new_skill'] = $skill;
        }
        $app->render('skills/new.html', $data);
    })->via('GET', 'POST')->name('skills_new');
    $app->map('/edit/:id', function ($id) use($app, $data) {
        $data['request_method'] = $app->request->getMethod();
        $skill = Skill::find($id);
        if ($app->request->isGet()) {
            $data['skill'] = $skill->toArray();
        } else {
            if ($app->request->isPost()) {
                $skill->name = $app->request->post('title');
                $skill->save();
                $data['new_skill'] = $skill->toArray();
            }
        }
        $app->render('skills/edit.html', $data);
    })->via('GET', 'POST')->name('skills_edit');
});
$app->group('/schools', function () use($app, $data) {
    $data['request_method'] = $app->request->getMethod();
    $app->get('/', function () use($app, $data) {
コード例 #3
0
     if (api_is_platform_admin() || api_is_drh()) {
         if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {
             $skill_id = $skill->edit($_REQUEST);
         } else {
             $skill_id = $skill->add($_REQUEST);
         }
     }
     echo $skill_id;
     break;
 case 'delete_skill':
     if (api_is_platform_admin() || api_is_drh()) {
         echo $skill->delete($_REQUEST['skill_id']);
     }
     break;
 case 'find_skills':
     $skills = $skill->find('all', array('where' => array('name LIKE %?% ' => $_REQUEST['tag'])));
     $return_skills = array();
     foreach ($skills as $skill) {
         $skill['caption'] = $skill['name'];
         $skill['value'] = $skill['id'];
         $return_skills[] = $skill;
     }
     echo json_encode($return_skills);
     break;
 case 'get_gradebooks':
     $gradebooks = $gradebook_list = $gradebook->get_all();
     $gradebook_list = array();
     //Only course gradebook with certificate
     if (!empty($gradebooks)) {
         foreach ($gradebooks as $gradebook) {
             if ($gradebook['parent_id'] == 0 && !empty($gradebook['certif_min_score']) && !empty($gradebook['document_id'])) {
コード例 #4
0
ファイル: LskillController.php プロジェクト: kakitsubun/sbg
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     return view('admin.lskill.show')->withLskill(Skill::find($id))->withCards(Card::where('lskill_id', $id));
 }
コード例 #5
0
ファイル: SkillTest.php プロジェクト: civilianemail/dnd
 function test_find()
 {
     //Arrange
     $name = "Acrobatics";
     $description = "stuff";
     $id = 1;
     $test_class = new Skill($name, $description, $id);
     $test_class->save();
     $name2 = "Athletics";
     $description2 = "other stuff";
     $id2 = 2;
     $test_class2 = new Skill($name2, $description2, $id2);
     $test_class2->save();
     //Act
     $result = Skill::find($test_class->getId());
     //Assert
     $this->assertEquals($test_class, $result);
 }
コード例 #6
0
        header('Location: ' . $returnURL);
    } else {
        header('Location: ' . $ROOT);
    }
} else {
    $new_user = true;
}
//Add new user to the database $_POST
if ($new_user && isset($_POST["name"])) {
    // Firts join to meetup if necessary
    $answers = array();
    if (isset($_POST['skills'])) {
        $service = new Skill();
        for ($i = 0; $i < sizeof($_POST['skills']); $i++) {
            $skill = $_POST['skills'][$i];
            $s = $service->find(array("name" => $skill));
            //TODO: FIX THIS and submit profile
            if (!isset($member->skills[$s["name"]])) {
                $member->skills[$s["name"]] = $s;
            }
            if ($i < sizeof($_POST['skills']) - 2) {
                $answers["answer_6865152"] .= $s["name"] . ", ";
            } elseif ($i == sizeof($_POST['skills']) - 2) {
                $answers["answer_6865152"] .= $s["name"] . " y ";
            } else {
                $answers["answer_6865152"] .= $s["name"] . ".";
            }
        }
    }
    if (isset($_POST['linkedin_url'])) {
        $answers["answer_8151456"] = $_POST['linkedin_url'];
コード例 #7
0
 public function loadFromMeetup($meetup_response = NULL)
 {
     global $meetup_group_id, $meetup_group_urlname, $meetup_api_key;
     $client = DMS\Service\Meetup\MeetupKeyAuthClient::factory(array('key' => $meetup_api_key));
     if (!$meetup_response) {
         $response = $client->getMember(array('id' => $this->meetup_id));
     } else {
         $response = $meetup_response;
     }
     $this->name = $response["name"];
     $this->meetup_id = $response["id"];
     $this->location = $response["city"] . ", " . $response["country"];
     $this->meetup_url = $response["link"];
     $this->lat = $response["lat"];
     $this->lon = $response["lon"];
     $this->name = $response["name"];
     if (isset($response["photo"])) {
         if (isset($response["photo"]["highres_link"])) {
             $this->photo_url = $response["photo"]["highres_link"];
         } elseif (isset($response["photo"]["photo_link"])) {
             $this->photo_url = $response["photo"]["photo_link"];
         } elseif (isset($response["photo"]["thumb_link"])) {
             $this->photo_url = $response["photo"]["thumb_link"];
         }
     } elseif (isset($response["photo_url"])) {
         $this->photo_url = $response["photo_url"];
     } else {
         $email = strtolower($this->meetup_id . "@gmail.com");
         $this->photo_url = "http://www.gravatar.com/avatar/" . md5($email);
     }
     if (isset($response["other_services"]) && is_array($response["other_services"])) {
         foreach ($response["other_services"] as $key => $service) {
             $s = $service["identifier"];
             switch ($key) {
                 case "twitter":
                     $this->twitter_url = $s;
                     break;
                 case "flickr":
                     $this->flickr_url = $s;
                     break;
                 case "facebook":
                     $this->facebook_url = $s;
                     break;
                 case "linkedin":
                     $this->linkedin_url = $s;
                     break;
             }
         }
     }
     $service = new Skill();
     if (isset($response["topics"]) && is_array($response["topics"])) {
         foreach ($response["topics"] as $topic) {
             $s = $service->find(array("meetup_skill_id" => $topic["id"]));
             if ($s) {
                 $this->skills[$s["id"]] = $s;
             } else {
                 $this->skills["new_" . $topic["id"]] = array("meetup_skill_id" => $topic["id"], "is_gis" => 0, "synonyms" => NULL, "name" => $topic["name"], "slug" => $topic["urlkey"]);
             }
         }
     }
     $options = array('group_urlname' => $meetup_group_urlname, 'group_id' => $meetup_group_id, 'member_id' => $this->meetup_id);
     $profiles = $client->getProfiles($options);
     if ($profiles->count() > 0) {
         // Find relevant skills in open answers and add them to the profile
         foreach ($profiles as $p) {
             $answers = "";
             foreach ($p["answers"] as $a) {
                 if (isset($a["answer"])) {
                     $answers .= $a["answer"] . " ";
                 }
             }
             $answers = strtolower($answers);
             $r = $service->extractRelevantSkills($answers);
             $this->merge_skills($r);
             //When user joined
             $this->joined = $this->parseEpoch($p["created"]);
             $this->last_visit = $this->parseEpoch($p["visited"]);
             if (isset($p["bio"])) {
                 $this->bio = $p["bio"];
             }
             if (isset($p["photo"])) {
                 if (isset($p["photo"]["highres_link"])) {
                     $this->photo_url = $p["photo"]["highres_link"];
                 } elseif (isset($p["photo"]["photo_link"])) {
                     $this->photo_url = $p["photo"]["photo_link"];
                 } elseif (isset($p["photo"]["thumb_link"])) {
                     $this->photo_url = $p["photo"]["thumb_link"];
                 }
             } elseif (isset($p["photo_url"])) {
                 $this->photo_url = $p["photo_url"];
             }
             if (isset($p["profile_url"])) {
                 $this->meetup_url = $p["profile_url"];
             }
             //TODO: check if other services
         }
     }
 }