public function getInitData($req)
 {
     $data = array();
     $employees = new Employee();
     $data['numberOfEmployees'] = $employees->Count("1 = 1");
     $company = new CompanyStructure();
     $data['numberOfCompanyStuctures'] = $company->Count("1 = 1");
     $user = new User();
     $data['numberOfUsers'] = $user->Count("1 = 1");
     $project = new Project();
     $data['numberOfProjects'] = $project->Count("status = 'Active'");
     $attendance = new Attendance();
     $data['numberOfAttendanceLastWeek'] = $attendance->Count("in_time > '" . date("Y-m-d H:i:s", strtotime("-1 week")) . "'");
     if (empty($data['numberOfAttendanceLastWeek'])) {
         $data['numberOfAttendanceLastWeek'] = 0;
     }
     $empLeave = new EmployeeLeave();
     $data['numberOfLeaves'] = $empLeave->Count("date_start > '" . date("Y-m-d") . "'");
     $timeEntry = new EmployeeTimeEntry();
     $data['numberOfAttendanceLastWeek'] = $timeEntry->Count("in_time > '" . date("Y-m-d H:i:s", strtotime("-1 week")) . "'");
     $candidate = new Candidate();
     $data['numberOfCandidates'] = $candidate->Count("1 = 1");
     $job = new Job();
     $data['numberOfJobs'] = $job->Count("status = 'Active'");
     $course = new Course();
     $data['numberOfCourses'] = $course->Count("1 = 1");
     return new IceResponse(IceResponse::SUCCESS, $data);
 }
Exemplo n.º 2
0
/**
 * @brief create course
 * @param  type  $public_code
 * @param  type  $lang
 * @param  type  $title
 * @param string $description
 * @param  array $departments
 * @param  type  $vis
 * @param  type  $prof
 * @param  type  $password
 * @return boolean
 */
function create_course($public_code, $lang, $title, $description, $departments, $vis, $prof, $password = '') {

    $code = strtoupper(new_code($departments[0]));
    if (!create_course_dirs($code)) {
        return false;
    }
    if (!$public_code) {
        $public_code = $code;
    }
    $q = Database::get()->query("INSERT INTO course
                         SET code = ?s,
                             lang = ?s,
                             title = ?s,
                             keywords = '',
                             description = ?s,
                             visible = ?d,
                             prof_names = ?s,
                             public_code = ?s,
                             created = " . DBHelper::timeAfter() . ",
                             password = ?s,
                             glossary_expand = 0,
                             glossary_index = 1", $code, $lang, $title, $description, $vis, $prof, $public_code, $password);
    if ($q) {
        $course_id = $q->lastInsertID;
    } else {
        return false;
    }       

    require_once 'include/lib/course.class.php';
    $course = new Course();
    $course->refresh($course_id, $departments);

    return array($code, $course_id);
}
Exemplo n.º 3
0
Arquivo: grab.php Projeto: zjy01/grab
function grab()
{
    //提交表单
    $grab = new Course($_POST['username']);
    $url = "http://jw.gdufs.edu.cn/" . $_POST['type'] . "&xh=" . $_POST['username'] . "&xm=" . urlencode($_POST['name']);
    $course = explode(",", $_POST['course']);
    $input = $_POST['input'];
    $tempReg = "/=>|&/";
    $arr = preg_split($tempReg, $input);
    $from = array();
    for ($i = 0; $i < count($arr); $i += 2) {
        $form[$arr[$i]] = $arr[$i + 1];
    }
    $form['ddl_ywyl'] = "";
    //有无余量
    $form['ddl_kcgs'] = "";
    //课程归属
    $form['ddl_sksj'] = "";
    //上课时间
    $form['ddl_xqbs'] = 2;
    //1:北校区,2:南校区
    $form['Button1'] = "提交";
    for ($i = 0; $i < count($course); $i++) {
        $form[$course[$i]] = "on";
    }
    $res = my_iconv($grab->submitForm($url, $form));
    echo json_encode($res);
}
Exemplo n.º 4
0
 function approve($id, $data = null)
 {
     $training = new Training();
     $course_obj = new Course();
     $request = $this->get(array('id' => $id));
     $course = $course_obj->get(array('id' => $request['course_id']));
     $data['course_id'] = $request['course_id'];
     $data['start'] = $request['planned_date'];
     $date = new DateTime($data['start']);
     if ($course['duration'] > 8) {
         $date->add(new DateInterval('P' . ceil($course['duration'] / 8) . 'DT' . $course['duration'] % 8 . 'H'));
     } else {
         $date->add(new DateInterval('PT' . $course['duration'] . 'H'));
     }
     $data['finish'] = $date->format('Y-m-d H:i');
     $data['user_id'] = $request['user_id'];
     $data['status_id'] = Training::CREATED;
     if ($course['format_id'] == Course::ONLINE || $course['format_id'] == Course::WEBCAST) {
         $data['course_hash'] = md5($data['user_id'] . $data['course_id'] . $data['start']);
     }
     $data['tries'] = 0;
     if ($course['exam'] == 't') {
         $data['exam_hash'] = md5($data['user_id'] . $data['course_id'] . $data['start'] . $data['tries']);
     }
     $data['request_id'] = $id;
     $data['active'] = 'true';
     $training->add($data);
     $this->disable($id);
 }
 public function newEntry($scholar_no, $course_code, $course_dep, $classes_attended, $classes_total)
 {
     if (!loggedIn() || privilege() == NULL || privilege() == 'admin') {
         return 0;
     }
     $c = new Course();
     if (!$c->appointError(Session::get('teacher_id'), $course_code, $course_dep)) {
         unset($c);
         return 0;
     }
     $this->_connect();
     $scholar_no = $this->_db->real_escape_string(escape($scholar_no));
     $course_code = $this->_db->real_escape_string(escape($course_code));
     $classes_attended = $this->_db->real_escape_string(escape($classes_attended));
     $classes_total = $this->_db->real_escape_string(escape($classes_total));
     $percentage = $classes_attended * 100 / $classes_total;
     $check = $this->getEntry($scholar_no, $course_code);
     if (empty($check)) {
         $query = "INSERT INTO attendance_data (scholar_no, course_code, classes_attended, classes_total, percentage) VALUES ('" . $scholar_no . "','" . $course_code . "','" . $classes_attended . "','" . $classes_total . "','" . $percentage . "')";
     } else {
         $query = "UPDATE attendance_data SET classes_attended = '" . $classes_attended . "', classes_total = '" . $classes_total . "', percentage = '" . $percentage . "' WHERE scholar_no='" . $scholar_no . "' AND course_code='" . $course_code . "' AND timestamp>='" . Session::get('semester_timestamp') . "'";
     }
     $result = $this->_db->query($query);
     if ($this->_db->error != '') {
         die('Database error!');
     }
     if ($this->_db->affected_rows) {
         return 1;
     } else {
         return 0;
     }
 }
Exemplo n.º 6
0
 public function getList($order = "didascalia")
 {
     $order = trim(filter_var($order, FILTER_SANITIZE_STRING));
     //interrogazione tabella
     $sql = "SELECT * FROM upload ORDER BY {$order}";
     $auth = $this->connector->query($sql);
     $list = array();
     // controllo sul risultato dell'interrogazione
     if (mysql_num_rows($auth) > 0) {
         $doc = new Document();
         $doc->setConnector($this->connector);
         $course = new Course();
         $course->setConnector($this->connector);
         while ($res = $this->connector->getObjectResult($auth)) {
             $doc = new Document($res->id, $res->path, $res->tipo, $res->didascalia);
             //Calcolo le informazioni di servizio
             if ($res->tipo == 1) {
                 $doc->course_name = "TUTTI";
             } else {
                 $doc->course_name = $course->getById($res->tipo)->name;
             }
             $list[] = $doc;
         }
     }
     return $list;
 }
 public function render()
 {
     $course = new Course();
     $course->include_related('period');
     $course->get_by_id((int) @$this->config['course_id']);
     $this->parser->assign('course', $course);
     if ($course->exists()) {
         $solutions = new Solution();
         $solutions->select_func('COUNT', '@id', 'count');
         $solutions->where('revalidate', 1);
         $solutions->where_related('task_set', 'id', '${parent}.id');
         $solutions->where_related('student/participant/course', 'id', $course->id);
         $solutions->where_related('student/participant', 'allowed', 1);
         $task_sets = new Task_set();
         $task_sets->select('*');
         $task_sets->select_subquery($solutions, 'solutions_count');
         $task_sets->where_related($course);
         $task_sets->where_related('solution', 'revalidate', 1);
         $task_sets->where_related('solution/student/participant/course', 'id', $course->id);
         $task_sets->where_related('solution/student/participant', 'allowed', 1);
         $task_sets->group_by('id');
         $task_sets->order_by_with_overlay('name', 'ASC');
         $task_sets->get_iterated();
         $this->parser->assign('task_sets', $task_sets);
     }
     $this->parser->parse('widgets/admin/unevaluated_solutions/main.tpl');
 }
 public function get_student_courses($order = null)
 {
     LoadHelper::model('course');
     $student_list = array();
     //connect to database
     $this->db->connect();
     //query
     $sql = "SELECT s.id,s.first_name,s.last_name,s.email,s.contact_no,c.id as course_id,c.course_name ";
     $sql .= " FROM students s JOIN courses c on s.course_id=c.id";
     if (isset($order)) {
         $sql = $sql . " ORDER BY " . $order;
     }
     //fetchquery
     $result = $this->db->fetchquery($sql);
     while ($row = $result->fetch_assoc()) {
         $student = new Students();
         $student->set_id($row['id']);
         $student->set_first_name($row['first_name']);
         $student->set_last_name($row['last_name']);
         $student->set_email($row['email']);
         $student->set_contact_no($row['contact_no']);
         $course = new Course();
         $course->set_id($row['course_id']);
         $course->set_course_name($row['course_name']);
         $student->set_course($course);
         array_push($student_list, $student);
     }
     $this->db->close();
     return $student_list;
 }
Exemplo n.º 9
0
    function displayBody()
    {
        parent::displayBody();
        $translator = new Translator();
        $course = new Course();
        $data = $course->get(array('id' => $this->id));
        foreach ($data as $key => $val) {
            $data[$key] = htmlspecialchars($val, ENT_QUOTES);
        }
        echo <<<EOF
<h2  class="page-header">{$data[name]}</h2>
<h4>{$data[category_name]}</h4>
<div class="col-lg-8">
    <ul class="list-group category-list" index="{$this->id}/">

EOF;
        $root = $_SERVER['DOCUMENT_ROOT'] . '/../files/courses/' . $this->id;
        $this->put_list($root);
        echo <<<EOF
    </ul>
    <div class="row">
\t
\t<a href="#"  data-toggle="toggler" parent-id="{$this->id}/" title="{$translator->addfile}" type="file">
\t\t\t<span class="glyphicon glyphicon-file"></span> </a>
\t\t\t<a href="#"  data-toggle="toggler" parent-id="{$this->id}/" title="{$translator->addfolder}" type="folder">
\t\t\t<span class="glyphicon glyphicon-folder-open"></span> </a>
\t
    </div>

</div>
EOF;
    }
Exemplo n.º 10
0
 private function map_data()
 {
     $Course = new Course();
     $Course->set_course_name($_POST['course_name']);
     $Course->set_status($_POST['status']);
     return $Course;
 }
Exemplo n.º 11
0
 public function displayDisciplinesOfSyllabus($syllabusId, $courseId)
 {
     $syllabusDisciplines = $this->getSyllabusDisciplines($syllabusId);
     $course = new Course();
     $foundCourse = $course->getCourseById($courseId);
     $data = array('syllabusDisciplines' => $syllabusDisciplines, 'syllabusId' => $syllabusId, 'course' => $foundCourse);
     loadTemplateSafelyByGroup("secretario", 'syllabus/course_syllabus_disciplines', $data);
 }
Exemplo n.º 12
0
 public function getCoursesByCategory()
 {
     $conn = new Course($this->_config);
     $result = $conn->getCourseBy($this->_data['target'], $this->_data['value']);
     $encodedResult = $this->utf8_converter($result);
     $courses = json_encode($encodedResult);
     echo $courses;
 }
Exemplo n.º 13
0
 public function testListCoursesShouldReturnAnIterator()
 {
     $stub = $this->getClientStub();
     $stub->expects($this->once())->method('request')->with($this->equalTo('GET'), $this->equalTo('/courses/all'))->willReturn([]);
     $provider = new Course($stub);
     $data = $provider->listCourses();
     $this->assertEquals([], $data);
 }
Exemplo n.º 14
0
function delete(Course $obj)
{
    $output = array('code' => '000', 'message' => 'Something gone wrong. Please try again', 'type' => 'danger');
    if ($obj->delete($_REQUEST['id'])) {
        $output = array('code' => '200', 'message' => 'Course deleted successfully.', 'type' => 'success');
    }
    return $output;
}
Exemplo n.º 15
0
 protected function specific_definition($mform)
 {
     global $CFG;
     global $COURSE;
     $Course = new Course();
     $course_notification_setting = $Course->get_registration($COURSE->id);
     // Fields for editing HTML block title and contents.
     $mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
     $attributes = array();
     $attributes['disabled'] = 'disabled';
     $attributes['group'] = 'moodle_notifications_settings';
     if ($CFG->block_moodle_notifications_email_channel == 1) {
         $mform->addElement('checkbox', 'notify_by_email', get_string('notify_by_email', 'block_moodle_notifications'));
     } else {
         $mform->addElement('advcheckbox', 'notify_by_email', get_string('notify_by_email', 'block_moodle_notifications'), null, $attributes);
     }
     if (isset($course_notification_setting->notify_by_email) and $course_notification_setting->notify_by_email == 1) {
         $mform->setDefault('notify_by_email', 1);
     }
     if ($CFG->block_moodle_notifications_sms_channel == 1 and class_exists('SMS')) {
         $mform->addElement('checkbox', 'notify_by_sms', get_string('notify_by_sms', 'block_moodle_notifications'));
     } else {
         $mform->addElement('advcheckbox', 'notify_by_sms', get_string('notify_by_sms', 'block_moodle_notifications'), null, $attributes);
     }
     if (isset($course_notification_setting->notify_by_sms) and $course_notification_setting->notify_by_sms == 1) {
         $mform->setDefault('notify_by_sms', 1);
     }
     if ($CFG->block_moodle_notifications_rss_channel == 1) {
         $mform->addElement('checkbox', 'notify_by_rss', get_string('notify_by_rss', 'block_moodle_notifications'));
     } else {
         $mform->addElement('advcheckbox', 'notify_by_rss', get_string('notify_by_rss', 'block_moodle_notifications'), null, $attributes);
     }
     if (isset($course_notification_setting->notify_by_rss) and $course_notification_setting->notify_by_rss == 1) {
         $mform->setDefault('notify_by_rss', 1);
     }
     if ($CFG->block_moodle_notifications_email_channel == 1 or $CFG->block_moodle_notifications_sms_channel == 1) {
         $options = array();
         for ($i = 1; $i < 25; ++$i) {
             $options[$i] = $i;
         }
         $mform->addElement('select', 'notification_frequency', get_string('notification_frequency', 'block_moodle_notifications'), $options);
         $mform->setDefault('notification_frequency', $course_notification_setting->notification_frequency / 3600);
     }
     $mform->addElement('html', '<br /><div class="qheader">' . get_string('course_configuration_presets_comment', 'block_moodle_notifications') . '</div>');
     $mform->addElement('checkbox', 'email_notification_preset', get_string('email_notification_preset', 'block_moodle_notifications'));
     if (isset($course_notification_setting->email_notification_preset) and $course_notification_setting->email_notification_preset == 1) {
         $mform->setDefault('email_notification_preset', 1);
     } else {
         $mform->setDefault('email_notification_preset', 0);
     }
     $mform->addElement('checkbox', 'sms_notification_preset', get_string('sms_notification_preset', 'block_moodle_notifications'));
     if (isset($course_notification_setting->sms_notification_preset) and $course_notification_setting->sms_notification_preset == 1) {
         $mform->setDefault('sms_notification_preset', 1);
     } else {
         $mform->setDefault('sms_notification_preset', 0);
     }
 }
Exemplo n.º 16
0
 /**
  * This static method retrieves all the subjects for a course.
  *
  * @param Course $course
  * @return Criteria
  */
 public static function retrieveForCourseCriteria(Course $course)
 {
     $c = new Criteria();
     $c->add(CourseSubjectPeer::COURSE_ID, $course->getId());
     $c->addJoin(CourseSubjectPeer::CAREER_SUBJECT_SCHOOL_YEAR_ID, CareerSubjectSchoolYearPeer::ID, Criteria::INNER_JOIN);
     $c->addJoin(CareerSubjectSchoolYearPeer::CAREER_SUBJECT_ID, CareerSubjectPeer::ID, Criteria::INNER_JOIN);
     $c->addJoin(CareerSubjectPeer::SUBJECT_ID, self::ID, Criteria::INNER_JOIN);
     $c->setDistinct();
     return $c;
 }
Exemplo n.º 17
0
    function displayBody()
    {
        parent::displayBody();
        $translator = new Translator();
        $request = new Request();
        try {
            $id = array_shift($this->param);
            $course = new Course();
            $c_data = $course->get(array('id' => $id));
            $data['course_id'] = $id;
            $data['user_id'] = $_SESSION['user_id'];
            $data['active'] = true;
            $data['planned_date'] = $_GET['planned_date'] != '' ? $_GET['planned_date'] : date('Y-m-d H:i:s', time());
            $r_id = $request->add($data);
            if ($c_data['need_approve'] == 'f') {
                $request->approve($r_id);
                echo <<<EOF
<div class="container">
   <div class="page-header">
        <h1>{$translator->Request_updated}</h1>
      </div>
   <p class="lead">{$translator->Request_updated_Desc}</p>
      <p >{$translator->Error_Backcourses}</p>
</div>
<script type="text/javascript">
window.location.href='/mycourses';
</script>

EOF;
            } else {
                echo <<<EOF
<div class="container">
   <div class="page-header">
        <h1>{$translator->Request_updated}</h1>
      </div>
   <p class="lead">{$translator->Request_need_approve_Desc}</p>
      <p >{$translator->Error_Backcourses}</p>
</div>

EOF;
            }
        } catch (Exception $e) {
            echo <<<EOF
<div class="container">
   <div class="page-header">
        <h1>{$translator->Request_error}</h1>
      </div>
   <p class="lead">{$translator->Request_error_Desc}</p>
      <p >{$translator->Error_Backcourses}</p>
</div>

EOF;
        }
    }
 public static function sandbox()
 {
     // Testaa koodiasi täällä
     $course = new Course(array('name' => '', 'city' => ''));
     $errors = $course->errors();
     Kint::dump($errors);
     $hole = new Hole(array('hole_num' => 'yksi', 'par' => 'kolme'));
     $errors = $hole->errors();
     Kint::dump($errors);
     echo Course::next_courseid();
 }
Exemplo n.º 19
0
 /**
  * If no training associations, delete course. 
  */
 public static function deleteIfNotFound($training_title_option_id, $training_id = 0)
 {
     $tableObj = new Course();
     $select = $tableObj->select()->from('training', array('COUNT(id) AS training_count'))->setIntegrityCheck(false)->where("course_id = {$training_title_option_id} AND id != {$training_id}");
     $row = $tableObj->fetchRow($select);
     if (!$row->training_count) {
         $tableObj = new Course();
         $tableObj->delete("training_title_option_id = {$training_title_option_id}");
         $tableObj = new ITechTable(array('name' => 'training_title_option'));
         $tableObj->delete("id = {$training_title_option_id}");
     }
 }
Exemplo n.º 20
0
/**
 * @author  ryan <*****@*****.**>
 */
function course_GET($id)
{
    $course = new Course($id);
    $teacher = $course->teacher();
    $comments = $course->comments();
    $has_login = $GLOBALS['has_login'];
    $data = compact('course', 'teacher', 'canStar', 'has_login', 'comments');
    if ($has_login) {
        $data['myStar'] = $course->starBy($GLOBALS['user']);
    }
    render_view('master', $data);
}
 public static function getRelatedDisciplinesForCourse(Course $course, PropelPDO $propelConnection)
 {
     $c = new Criteria();
     $c->addAscendingOrderByColumn(DisciplinePeer::DESCR);
     $rawResults = $course->getCourseDisciplineAssociationsJoinDiscipline($c, $propelConnection);
     $retResults = array();
     foreach ($rawResults as $result) {
         $en = $result->getDiscipline();
         $retResults[] = array("programName" => $en->getDescr(), "year" => helperFunctions::getYearOfStudy($result->getYearOfStudy()), "disciplineId" => $en->getId(), "numYear" => $result->getYearOfStudy());
     }
     return $retResults;
 }
Exemplo n.º 22
0
 /**
  * Remove a course subscription
  *
  * @param User $user
  * @param Course $course
  * @return boolean
  */
 public function unSubscribe($user, $course)
 {
     try {
         $em = $this->getEntityManager();
         $subscription = $em->getRepository('R4FSiteBundle:Subscription')->findOneBy(array('user' => $user->getId(), 'course' => $course->getId()));
         $em->remove($subscription);
         $em->flush();
         return true;
     } catch (Exception $e) {
         return false;
     }
 }
Exemplo n.º 23
0
function doDelete()
{
    @($id = $_POST['selector']);
    $key = count($id);
    //multi delete using checkbox as a selector
    for ($i = 0; $i < $key; $i++) {
        $Course = new Course();
        $Course->delete($id[$i]);
    }
    message("Course(s) already Deleted!", "info");
    redirect('index.php');
}
 function test_save()
 {
     //Arrange
     $course_name = "Monster Literature";
     $course_number = "ENG304";
     $test_course = new Course($course_name, $course_number);
     $test_course->save();
     //Act
     $result = Course::getAll();
     //Assert
     $this->assertEquals($test_course, $result[0]);
 }
Exemplo n.º 25
0
 public function preConfigureForm()
 {
     $courses = new Course();
     $courses->include_related('period');
     $courses->order_by_related('period', 'sorting', 'asc');
     $courses->order_by_with_constant('name');
     $courses->get_iterated();
     $courses_list = array('' => '');
     foreach ($courses as $course) {
         $courses_list[$this->lang->text($course->period_name)][$course->id] = $this->lang->text($course->name);
     }
     $this->parser->assign('courses', $courses_list);
 }
Exemplo n.º 26
0
 function testSave()
 {
     //Arrange
     $course_name = "HISTORY";
     $number = 101;
     $test_course = new Course($course_name, $number);
     //var_dump($test_course);
     //Act
     $test_course->save();
     //Assert
     $result = Course::getAll();
     $this->assertEquals($test_course, $result[0]);
 }
Exemplo n.º 27
0
function getListAdmin(QuestionBank $obj)
{
    $course = new Course();
    $list = $obj->getList(array('id', 'name', 'course'));
    $result = array();
    $i = 0;
    foreach ($list as $item) {
        $result[$i]['id'] = $item['id'];
        $result[$i]['name'] = $item['name'];
        $result[$i]['course'] = $item['course'];
        $result[$i++]['course_name'] = $course->getInfo($item['course'], 'course_name');
    }
    return $result;
}
 public function setCourse(Course $course)
 {
     $this->course = $course;
     $course_subject_students = $course->getCourseSubjectStudents();
     foreach ($course_subject_students as $course_subject_student) {
         $course_subject_student_id = $course_subject_student->getId();
         $this->setWidget("student_{$course_subject_student_id}", new mtWidgetFormPlain(array("object" => $course_subject_student, "add_hidden_input" => false, "use_retrieved_value" => false, 'method' => 'getStudent')));
         $this->setValidator("student_{$course_subject_student_id}", new sfValidatorPass());
         $this->setDefault("student_{$course_subject_student_id}", $course_subject_student_id);
         $this->widgetSchema->setLabel("student_{$course_subject_student_id}", "Student");
         $this->setDefault("free_student_{$course_subject_student_id}", $course_subject_student->getIsFree());
         $this->setWidget("free_student_{$course_subject_student_id}", new sfWidgetFormInputCheckbox());
         $this->setValidator("free_student_{$course_subject_student_id}", new sfValidatorBoolean(array('required' => false)));
     }
 }
Exemplo n.º 29
0
 public function update_course($id, $name, $public_description)
 {
     $data = json_encode(array("course" => array("name" => $name, "public_description" => $public_description)));
     $response = $this->put_json("/courses/" . $id, $data);
     $course = Course::load($response);
     return $course;
 }
Exemplo n.º 30
0
 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;
     }
 }