示例#1
0
 /**
  * Shows the current restrictions for course participation.
  */
 function index_action()
 {
     URLHelper::addLinkParam('return_to_dialog', Request::isDialog());
     $this->sidebar = Sidebar::get();
     $this->sidebar->setImage("sidebar/seminar-sidebar.png");
     if ($GLOBALS['perm']->have_perm('admin')) {
         $list = new SelectorWidget();
         $list->setUrl("?#admin_top_links");
         $list->setSelectParameterName("cid");
         foreach (AdminCourseFilter::get()->getCoursesForAdminWidget() as $seminar) {
             $list->addElement(new SelectElement($seminar['Seminar_id'], $seminar['Name']), 'select-' . $seminar['Seminar_id']);
         }
         $list->setSelection($this->course_id);
         $this->sidebar->addWidget($list);
     }
     $this->all_domains = UserDomain::getUserDomains();
     $this->seminar_domains = array_map(function ($d) {
         return $d->getId();
     }, UserDomain::getUserDomainsForSeminar($this->course_id));
     $this->current_courseset = CourseSet::getSetForCourse($this->course_id);
     $this->activated_admission_rules = AdmissionRule::getAvailableAdmissionRules();
     if (!$this->current_courseset) {
         $available_coursesets = new SimpleCollection();
         foreach (CourseSet::getCoursesetsByInstituteId($this->course->institut_id) as $cs) {
             $cs = new CourseSet($cs['set_id']);
             if ($cs->isUserAllowedToAssignCourse($this->user_id, $this->course_id)) {
                 $available_coursesets[] = array('id' => $cs->getId(), 'name' => $cs->getName(), 'chdate' => $cs->chdate, 'my_own' => $cs->getUserId() === $GLOBALS['user']->id);
             }
         }
         foreach (CourseSet::getglobalCoursesets() as $cs) {
             $cs = new CourseSet($cs['set_id']);
             if ($cs->isUserAllowedToAssignCourse($this->user_id, $this->course_id)) {
                 $available_coursesets[] = array('id' => $cs->getId(), 'name' => $cs->getName(), 'chdate' => $cs->chdate, 'my_own' => $cs->getUserId() === $GLOBALS['user']->id);
             }
         }
         $available_coursesets = $available_coursesets->findBy('chdate', strtotime('-1 year'), '>');
         $available_coursesets->orderBy('name');
         $this->available_coursesets = $available_coursesets;
         PageLayout::postMessage(MessageBox::info(_("Für diese Veranstaltung sind keine Anmelderegeln festgelegt. Die Veranstaltung ist damit für alle Nutzer zugänglich.")));
     } else {
         if ($this->current_courseset->isSeatDistributionEnabled() && !$this->course->admission_turnout) {
             PageLayout::postMessage(MessageBox::info(_("Diese Veranstaltung ist teilnahmebeschränkt, aber die maximale Teilnehmeranzahl ist nicht gesetzt.")));
         }
     }
     $lockdata = LockRules::getObjectRule($this->course_id);
     if ($lockdata['description'] && LockRules::CheckLockRulePermission($this->course_id, $lockdata['permission'])) {
         PageLayout::postMessage(MessageBox::info(formatLinks($lockdata['description'])));
     }
 }
示例#2
0
 /**
  * Relocate the user to another location. This is a specialized version
  * of redirect that differs in two points:
  *
  * - relocate() will force the browser to leave the current dialog while
  *   redirect would refresh the dialog's contents
  * - relocate() accepts all the parameters that url_for() accepts so it's
  *   no longer neccessary to chain url_for() and redirect()
  *
  * @param String $to Location to redirect to
  */
 public function relocate($to)
 {
     $from_dialog = Request::isDialog();
     if (func_num_args() > 1 || $from_dialog) {
         $to = call_user_func_array(array($this, 'url_for'), func_get_args());
     }
     if ($from_dialog) {
         $this->response->add_header('X-Location', $to);
         $this->render_nothing();
     } else {
         parent::redirect($to);
     }
 }
示例#3
0
 /**
  *
  */
 function auth_loginform()
 {
     if (Request::isXhr()) {
         if (Request::isDialog()) {
             header('X-Location: ' . URLHelper::getURL($_SERVER['REQUEST_URI']));
             page_close();
             die;
         }
         throw new AccessDeniedException();
     }
     // first of all init I18N because seminar_open is not called here...
     global $_language_path;
     // set up dummy user environment
     if ($GLOBALS['user']->id !== 'nobody') {
         $GLOBALS['user'] = new Seminar_User('nobody');
         $GLOBALS['perm'] = new Seminar_Perm();
         $GLOBALS['auth'] = $this;
     }
     if (!$_SESSION['_language']) {
         $_SESSION['_language'] = get_accepted_languages();
     }
     if (!$_SESSION['_language']) {
         $_SESSION['_language'] = $GLOBALS['DEFAULT_LANGUAGE'];
     }
     // init of output via I18N
     $_language_path = init_i18n($_SESSION['_language']);
     include 'config.inc.php';
     // load the default set of plugins
     PluginEngine::loadPlugins();
     if (Request::get('loginname') && !$_COOKIE[get_class($GLOBALS['sess'])]) {
         $login_template = $GLOBALS['template_factory']->open('nocookies');
     } else {
         if (isset($this->need_email_activation)) {
             $this->unauth();
             header('Location: ' . URLHelper::getURL('activate_email.php?cancel_login=1&key=&uid=' . $this->need_email_activation));
             page_close();
             die;
         } else {
             unset($_SESSION['semi_logged_in']);
             // used by email activation
             $login_template = $GLOBALS['template_factory']->open('loginform');
             $login_template->set_attribute('loginerror', isset($this->auth["uname"]) && $this->error_msg);
             $login_template->set_attribute('error_msg', $this->error_msg);
             $login_template->set_attribute('uname', isset($this->auth["uname"]) ? $this->auth["uname"] : Request::username('loginname'));
             $login_template->set_attribute('self_registration_activated', $GLOBALS['ENABLE_SELF_REGISTRATION']);
         }
     }
     PageLayout::setHelpKeyword('Basis.AnmeldungLogin');
     $header_template = $GLOBALS['template_factory']->open('header');
     $header_template->current_page = _('Login');
     $header_template->link_params = array('cancel_login' => 1);
     include 'lib/include/html_head.inc.php';
     echo $header_template->render();
     echo $login_template->render();
     include 'lib/include/html_end.inc.php';
     page_close();
 }