本文整理汇总了PHP中Course::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::find方法的具体用法?PHP Course::find怎么用?PHP Course::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before_filter
/**
* common tasks for all actions
*/
function before_filter(&$action, &$args)
{
global $perm;
parent::before_filter($action, $args);
$course_id = $args[0];
$this->course_id = Request::option('cid', $course_id);
Navigation::activateItem('/course/admin/admission');
if (!get_object_type($this->course_id, array('sem')) || SeminarCategories::GetBySeminarId($this->course_id)->studygroup_mode || !$perm->have_studip_perm("tutor", $this->course_id)) {
throw new Trails_Exception(403);
}
$this->course = Course::find($this->course_id);
$this->user_id = $GLOBALS['user']->id;
PageLayout::setHelpKeyword("Basis.VeranstaltungenVerwaltenZugangsberechtigungen");
PageLayout::setTitle($this->course->getFullname() . " - " . _("Verwaltung von Zugangsberechtigungen"));
$lockrules = words('admission_turnout admission_type admission_endtime admission_binding passwort read_level write_level admission_prelim admission_prelim_txt admission_starttime admission_endtime_sem admission_disable_waitlist user_domain admission_binding admission_studiengang');
foreach ($lockrules as $rule) {
$this->is_locked[$rule] = LockRules::Check($this->course_id, $rule) ? 'disabled readonly' : '';
}
if (!SeminarCategories::GetByTypeId($this->course->status)->write_access_nobody) {
$this->is_locked['write_level'] = 'disabled readonly';
}
update_admission($this->course->id);
PageLayout::addSqueezePackage('admission');
URLHelper::addLinkParam('return_to_dialog', Request::get('return_to_dialog'));
}
示例2: before_filter
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
$course_id = Request::option('sem_id', $args[0]);
if (empty($course_id)) {
checkObject();
//wirft Exception, wenn $SessionSeminar leer ist
$course_id = $GLOBALS['SessionSeminar'];
}
$this->course = Course::find($course_id);
if (!$this->course) {
throw new Trails_Exception(400);
}
$this->send_from_search_page = Request::get('send_from_search_page');
if ($GLOBALS['SessionSeminar'] != $this->course->id && !(int) $this->course->visible && !($GLOBALS['perm']->have_perm(Config::get()->SEM_VISIBILITY_PERM) || $GLOBALS['perm']->have_studip_perm('user', $this->course->id))) {
throw new AccessDeniedException(_('Diese Veranstaltung ist versteckt. Hier gibt es nichts zu sehen.'));
}
if (!preg_match('/^(' . preg_quote($GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'], '/') . ')?([a-zA-Z0-9_-]+\\.php)([a-zA-Z0-9_?&=-]*)$/', $this->send_from_search_page)) {
$this->send_from_search_page = '';
}
if ($this->course->getSemClass()->offsetGet('studygroup_mode')) {
if ($GLOBALS['perm']->have_studip_perm('autor', $this->course->id)) {
// participants may see seminar_main
$link = URLHelper::getUrl('seminar_main.php', array('auswahl' => $this->course->id));
} else {
$link = URLHelper::getUrl('dispatch.php/course/studygroup/details/' . $this->course->id, array('send_from_search_page' => $this->send_from_search_page));
}
$this->redirect($link);
return;
}
}
示例3: getTabNavigation
function getTabNavigation($course_id)
{
$object_type = get_object_type($course_id, array('sem', 'inst'));
if ($object_type === 'sem') {
$course = Course::find($course_id);
$sem_class = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$course->status]['class']] ?: SemClass::getDefaultSemClass();
} else {
$institute = Institute::find($course_id);
$sem_class = SemClass::getDefaultInstituteClass($institute->type);
}
$navigation = new Navigation(_('Übersicht'));
$navigation->setImage(Icon::create('seminar', 'info_alt'));
$navigation->setActiveImage(Icon::create('seminar', 'info'));
if ($object_type !== 'sem') {
$navigation->addSubNavigation('info', new Navigation(_('Kurzinfo'), 'dispatch.php/institute/overview'));
$navigation->addSubNavigation('courses', new Navigation(_('Veranstaltungen'), 'show_bereich.php?level=s&id=' . $course_id));
$navigation->addSubNavigation('schedule', new Navigation(_('Veranstaltungs-Stundenplan'), 'dispatch.php/calendar/instschedule?cid=' . $course_id));
if ($GLOBALS['perm']->have_studip_perm('admin', $course_id)) {
$navigation->addSubNavigation('admin', new Navigation(_('Administration der Einrichtung'), 'dispatch.php/institute/basicdata/index?new_inst=TRUE'));
}
} else {
$navigation->addSubNavigation('info', new Navigation(_('Kurzinfo'), 'dispatch.php/course/overview'));
if (!$sem_class['studygroup_mode']) {
$navigation->addSubNavigation('details', new Navigation(_('Details'), 'dispatch.php/course/details/'));
}
if (!$course->admission_binding && in_array($GLOBALS['perm']->get_studip_perm($course_id), array('user', 'autor'))) {
$navigation->addSubNavigation('leave', new Navigation(_('Austragen aus der Veranstaltung'), 'dispatch.php/my_courses/decline/' . $course_id . '?cmd=suppose_to_kill'));
}
}
return array('main' => $navigation);
}
示例4: sandbox
public static function sandbox()
{
// Testaa koodiasi täällä
// echo 'Hello World!';
// View::make('helloworld.html');
$tali = Course::find(2);
$courses = Course::all();
Kint::dump($tali);
Kint::dump($courses);
}
示例5: edit
/**
* Displays course edit page.
*
* @param int $id Id of course to be edited.
*/
public static function edit($id)
{
$player = self::get_user_logged_in();
if (!$player) {
View::make('player/login.html', array('error' => 'Vain kirjautuneet käyttäjät voivat muokata ratoja.'));
} else {
$course = Course::find($id);
$holes = Hole::find_by_course($id);
View::make('course/edit.html', array('course' => $course, 'holes' => $holes));
}
}
示例6: suggestIssue
public function suggestIssue($course_id)
{
$course = Course::find($course_id);
$program = Program::find($course->program->id);
$year = date('y');
$month = date('m');
$counter = Issue::where('project_id', '=', Auth::user()->curr_project_id)->count();
$counter += 1;
$issue = substr($program->name, 0, 1) . $year . $month . str_pad($counter, 5, "0", STR_PAD_LEFT);
return Response::json(array('issue' => $issue));
}
示例7: show
/**
* Displays a listing of a user's list of all played rounds.
*
* @param int $id Id of player to be displayed.
*/
public static function show($id)
{
$player = Player::find($id);
$moderatorOf = Course::find_by_moderator($id);
$course = Course::find($player->course);
$scores = Score::find_by_player($player->id);
foreach ($scores as $score) {
$score->round = Round::find($score->roundId);
}
// $rounds = Round::find_by_player($player->id);
// Kint::dump($rounds);
View::make('player/show.html', array('player' => $player, 'scores' => $scores, 'moderatorOf' => $moderatorOf, 'course' => $course));
}
示例8: isValid
/**
* Validate shopping cart input data
* @author Anyun
* @param object $data
* @return
*/
public static function isValid($data)
{
$app = \Slim\Slim::getInstance();
$validata = $app->validata;
$validator = $validata::key('id', $validata::numeric()->notEmpty())->key('course_id', $validata::numeric()->notEmpty())->key('name', $validata::stringType()->notEmpty())->key('price', $validata::numeric())->key('qty', $validata::digit()->notEmpty());
if (!$validator->validate((array) $data)) {
$app->halt(400, json_encode('Cart Info is invalid.'));
}
$sale = Price::find($data->id);
if (!$sale || $sale->course_id != $data->course_id || !Course::find($data->course_id)) {
$app->halt(400, 'Cart Info is invalid.');
}
}
示例9: testFind
function testFind()
{
$name = "History";
$course_number = "HIST100";
$test_course = new Course($name, $course_number);
$test_course->save();
$name2 = "Math";
$course_number2 = "MATH100";
$test_course2 = new Course($name, $course_number);
$test_course2->save();
$result = Course::find($test_course->getId());
$this->assertEquals($test_course, $result);
}
示例10: mention
/**
* Notifies the user with Stud.IP-message that/he/she was mentioned in a
* blubber-posting.
* @param type $posting
*/
public function mention($posting)
{
$messaging = new messaging();
setTempLanguage($this->getId());
$url = $GLOBALS['ABSOLUTE_URI_STUDIP'] . "plugins.php/blubber/streams/thread/" . $posting['root_id'] . ($posting['context_type'] === "course" ? '?cid=' . $posting['Seminar_id'] : "");
$body = sprintf(gettext("%s hat Sie in einem Blubber erwähnt. Zum Beantworten klicken auf Sie auf folgenen Link:\n\n%s\n"), get_fullname(), $url);
if ($posting['context_type'] === "course" && !$GLOBALS['perm']->have_studip_perm("user", $posting['Seminar_id'], $this->getId())) {
$body .= "\n\n" . _("Sie sind noch kein Mitglied der zugehörigen Veranstaltung. Melden Sie sich erst hier an, damit Sie den Blubber sehen können: ") . ($GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][Course::find($posting['Seminar_id'])->status]['class']]['studygroup_mode'] ? $GLOBALS['ABSOLUTE_URI_STUDIP'] . "dispatch.php/course/studygroup/details/" . $posting['Seminar_id'] : $GLOBALS['ABSOLUTE_URI_STUDIP'] . "dispatch.php/course/details?sem_id=" . $posting['Seminar_id']);
}
$mention_text = _("Sie wurden erwähnt.");
restoreLanguage();
$messaging->insert_message($body, $this['username'], $GLOBALS['user']->id, null, null, null, null, $mention_text);
}
示例11: test_find
function test_find()
{
$course_name = "History";
$course_number = "HIST 101";
$test_course = new Course($course_name, $course_number);
$test_course->save();
$course_name2 = "Biology";
$course_number2 = "BIO 101";
$test_course2 = new Course($course_name2, $course_number2);
$test_course2->save();
$result = Course::find($test_course->getId());
$this->assertEquals($test_course, $result);
}
示例12: testFind
function testFind()
{
$course_name = "History";
$course_code = "HIST100";
$test_course = new Course($course_name, $course_code);
$test_course->save();
$course_name2 = "Gym";
$course_code2 = "GYM100";
$test_course2 = new Course($course_name2, $course_code2);
$test_course2->save();
$result = Course::find($test_course->getId());
$this->assertEquals($test_course, $result);
}
示例13: findCurrent
/**
* Returns the currently active course or false if none is active.
*
* @return mixed Course object of currently active course, false otherwise
* @since 3.0
*/
public static function findCurrent()
{
if (empty($GLOBALS['SessionSeminar'])) {
return null;
}
if (isset(self::$current_course) && $GLOBALS['SessionSeminar'] === self::$current_course->id) {
return self::$current_course;
}
$found = Course::find($GLOBALS['SessionSeminar']);
if ($found) {
self::$current_course = $found;
Seminar::setInstance(new Seminar(self::$current_course));
return self::$current_course;
}
}
示例14: getTabNavigation
function getTabNavigation($course_id)
{
#$navigation = new AutoNavigation(_('Teilnehmende'));
$navigation = new Navigation(_('Teilnehmende'));
$navigation->setImage(Icon::create('persons', 'info_alt'));
$navigation->setActiveImage(Icon::create('persons', 'info'));
$navigation->addSubNavigation('view', new Navigation(_('Teilnehmende'), 'dispatch.php/course/members'));
if (Course::find($course_id)->aux_lock_rule) {
$navigation->addSubNavigation('additional', new Navigation(_('Zusatzangaben'), 'dispatch.php/course/members/additional'));
}
$navigation->addSubNavigation('view_groups', new Navigation(_('Funktionen / Gruppen'), 'statusgruppen.php?view=statusgruppe_sem'));
if ($GLOBALS['perm']->have_studip_perm('tutor', $course_id) && !LockRules::check($course_id, 'groups')) {
$navigation->addSubNavigation('edit_groups', new Navigation(_('Funktionen / Gruppen verwalten'), 'admin_statusgruppe.php?new_sem=TRUE&range_id=' . $course_id));
}
return array('members' => $navigation);
}
示例15: parseSeminar
private function parseSeminar($id)
{
$course = Course::find($id);
$dates = $course->getDatesWithExdates()->findBy('end_time', array($this->start, $this->start + $this->timespan), '><');
foreach ($dates as $courseDate) {
// Build info
$info = array();
if ($courseDate->dozenten[0]) {
$info[_('Durchführende Dozenten')] = join(', ', $courseDate->dozenten->getFullname());
}
if ($courseDate->statusgruppen[0]) {
$info[_('Beteiligte Gruppen')] = join(', ', $courseDate->statusgruppen->getValue('name'));
}
// Store for view
$this->termine[] = array('id' => $courseDate->id, 'chdate' => $courseDate->chdate, 'title' => $courseDate->getFullname() . ($courseDate->topics[0] ? ', ' . join(', ', $courseDate->topics->getValue('title')) : ""), 'description' => $courseDate instanceof CourseExDate ? $courseDate->content : '', 'topics' => $courseDate->topics->toArray('title description'), 'room' => $courseDate->getRoomName(), 'info' => $info);
}
}