Location: PHPKode > projects > Course-manager > courseman-0.1.1/teilnehmerliste-kontakt.php
<?php
  require('local-criteria.php');
  require('global-php.php');
  $verbindung = database_connection($lang_database_failure[$language]);
  $PHP_AUTH_USER = $_SERVER["PHP_AUTH_USER"];
  $PHP_AUTH_PW = $_SERVER["PHP_AUTH_PW"];
  $kurs = intval($_REQUEST["kurs"]);
  $ergebnis = db_exec($verbindung,
  			"SELECT * FROM staff_authorization,authorized_course "
  				. "WHERE staff_authorization.id=account "
				. "AND "
				. login_query_clauses(
					$PHP_AUTH_USER,
					$PHP_AUTH_PW)
				. " AND course="
				. $kurs
				. ";");
  if (pg_numrows($ergebnis) < 1) {
    header('WWW-Authenticate: Basic realm="Kursverwaltung"');
    header("HTTP/1.0 401 Unauthorized");
    echo $lang_authentication_failure[$language];
    exit;
  }
  $course_period = option_value($course_period_option);
  $ergebnis = db_exec($verbindung,
			"SELECT name,description "
  			. "FROM course,$course_date_readable"
			. ($course_date_translated ? ",language" : "")
			. " WHERE $course_date_readable.id=$kurs"
			. ($course_date_translated
				? (" AND code='$language' "
					. "AND language=language.id")
				: "")
			. " AND course=course.id;");
  $course_name = pg_result($ergebnis, 0, 0);
  $termin = pg_result($ergebnis, 0, 1);
  $attendants = array();
  $ergebnis = db_exec($verbindung,
  			"SELECT "
  				. "person.name,first_name,phone,email "
				. "FROM person_course,person,"
				. "registration_person,valid_registration "
				. "WHERE person_course.person="
				. "person.id "
				. "AND course_period=$course_period "
				. "AND registration_person.person=person.id "
				. "AND person_course.course=$kurs "
				. "AND registration_person.registration"
				. "=valid_registration.registration "
				. "ORDER BY priority,person.name,first_name;");
  if (pg_numrows($ergebnis) == 0) {
    $presented['error'] .= "
" . lang_no_participants($language,$course_name);
  }
  for ($lt = 0; $lt < pg_numrows($ergebnis); $lt++) {
    $col = 0;
    $nummer = $lt + 1;
    $name = pg_result($ergebnis, $lt, $col++);
    $vorname = pg_result($ergebnis, $lt, $col++);
    $telefon = pg_result($ergebnis, $lt, $col++);
    $email = pg_result($ergebnis, $lt, $col++);
    array_push($attendants,array(
    	'nummer' => $nummer,
    	'name' => $name,
	'vorname' => $vorname,
	'telefon' => $telefon,
	'email' => $email));
  }
  db_close($verbindung);
  $presented['name'] = $course_name;
  $presented['termin'] = $termin;
  $presented['attendants'] = $attendants;
  load_template_overridable('teilnehmerliste-kontakt');
?>
Return current item: Course-manager