public function __construct()
 {
     parent::__construct();
     $this->link = false;
     $sprache = getSprache();
     $lv_obj = new lehrveranstaltung();
     if (!$lv_obj->load_lva('0', null, null, true, false, 'bezeichnung')) {
         echo "<tr><td>{$lv_obj->errormsg}</td></tr>";
     }
     foreach ($lv_obj->lehrveranstaltungen as $row) {
         $this->items[] = array('title' => $row->bezeichnung_arr[$sprache], 'target' => 'content', 'link' => 'private/lehre/lesson.php?lvid=' . $row->lehrveranstaltung_id, 'name' => '<span ' . (!$row->aktiv ? ' style="" ' : ' style=""') . '>' . (!$row->aktiv ? ' <img src="../skin/images/ampel_rot.png" height="8px" height="8px"> ' : ' <img src="../skin/images/ampel_gruen.png" height="8px"> ') . ' ' . $this->CutString($row->bezeichnung_arr[$sprache], 21) . '</span>');
     }
     $this->block .= '<script language="JavaScript" type="text/javascript">';
     $this->block .= '	parent.content.location.href="../cms/news.php?studiengang_kz=0&semester=0"';
     $this->block .= '</script>';
     $this->output();
 }
	<body>
	<h1><?php 
echo $p->t('freifach/freifaecherAnmeldungsuebersicht');
?>
</h1>
	<?php 
echo $p->t('freifach/bitteFreifachAuswaehlen');
?>
	<br />
<?php 
$lvid = trim(isset($_POST['lvid']) ? $_POST['lvid'] : '');
//Aktuelles Studiensemester holen
$stsem_obj = new studiensemester();
$stsem = $stsem_obj->getaktorNext();
$lv_obj = new lehrveranstaltung();
if ($lv_obj->load_lva('0', null, null, true, null, 'bezeichnung')) {
    echo "<FORM method='POST' name='frmauswahl'>";
    echo "<SELECT name='lvid' onchange='window.document.frmauswahl.submit();'>";
    if ($lvid == '') {
        echo "\n<OPTION value='0' selected>--" . $p->t('freifach/auswahl') . "--</OPTION>";
    }
    foreach ($lv_obj->lehrveranstaltungen as $row) {
        if ($lvid == $row->lehrveranstaltung_id) {
            echo "\n<OPTION value='{$row->lehrveranstaltung_id}' selected>{$row->bezeichnung}</OPTION>";
        } else {
            echo "\n<OPTION value='{$row->lehrveranstaltung_id}'>{$row->bezeichnung}</OPTION>";
        }
    }
    echo "\n</SELECT>";
    echo "\n</FORM>";
} else {
    public function __construct()
    {
        global $params;
        parent::__construct();
        $this->link = false;
        $sprache = getSprache();
        $user = get_uid();
        $student = new student();
        if ($student->load($user)) {
            $studiengang_kz = $student->studiengang_kz;
            $semester = $student->semester;
        }
        $p = new phrasen($sprache);
        $this->block .= '
			<script language="JavaScript" type="text/javascript">
			<!--
				function MM_jumpMenu(targ, selObj, restore)
				{
				  eval(targ + ".location=\'" + selObj.options[selObj.selectedIndex].value + "\'");
			
				  if(restore)
				  {
				  	selObj.selectedIndex = 0;
				  }
				}
			  //-->
			</script>';
        $this->block .= '
		<table class="tabcontent">
			<tr>
				<td width="81" class="tdwrap">' . $p->t('global/studiengang') . ': </td>
				<td class="tdwrap">
					<select name="course" onChange="MM_jumpMenu(\'self\',this,0)" style="width: 100px;">';
        $stg_obj = new studiengang();
        $stg_obj->getAll('typ, kurzbz');
        if (isset($params['studiengang_kz']) && is_numeric($params['studiengang_kz'])) {
            $studiengang_kz = $params['studiengang_kz'];
        }
        if (isset($params['semester']) && is_numeric($params['semester'])) {
            $semester = $params['semester'];
        } else {
            if (!isset($semester)) {
                $semester = 1;
            }
        }
        $sel_kurzbzlang = '';
        foreach ($stg_obj->result as $row) {
            if ($row->studiengang_kz != 0) {
                if (isset($studiengang_kz) and $studiengang_kz == $row->studiengang_kz) {
                    $this->block .= '<option value="?content_id=' . $_GET['content_id'] . '&studiengang_kz=' . $row->studiengang_kz . '&semester=' . $semester . '" selected>' . $row->kuerzel . ' (' . $row->bezeichnung . ')</option>';
                    $sel_kurzbzlang = $row->kurzbzlang;
                } else {
                    $this->block .= '<option value="?content_id=' . $_GET['content_id'] . '&studiengang_kz=' . $row->studiengang_kz . '&semester=' . $semester . '">' . $row->kuerzel . ' (' . $row->bezeichnung . ')</option>';
                }
                if (!isset($studiengang_kz)) {
                    $studiengang_kz = $row->studiengang_kz;
                }
            }
        }
        $this->block .= '
			  	</select>
			  	</td>
			  </tr>
			  <tr>
			  	<td class="tdwrap">&nbsp;</td>
			  </tr>
			  <tr>
			  	<td class="tdwrap">' . $p->t('global/semester') . ': </td>
			  	<td class="tdwrap">
			  	<select name="term" onChange="MM_jumpMenu(\'self\',this,0)">';
        $short = 'Fehler Stg.Kz ' . $studiengang_kz;
        $max = 1;
        if ($stg_obj = new studiengang($studiengang_kz)) {
            $short = $stg_obj->kuerzel;
            $max = $stg_obj->max_semester;
        }
        if ($semester > $max) {
            $semester = 1;
        }
        $params['studiengang_kz'] = $studiengang_kz;
        $params['semester'] = $semester;
        $params['studiengang_kurzbz_lo'] = strtolower($short);
        $params['studiengang_kurzbz_hi'] = $short;
        for ($i = 0; $i < $max; $i++) {
            if ($i + 1 == $semester) {
                $this->block .= '<option value="?content_id=' . $_GET['content_id'] . '&studiengang_kz=' . $studiengang_kz . '&semester=' . ($i + 1) . '" selected >' . ($i + 1) . '. Semester</option>';
            } else {
                $this->block .= '<option value="?content_id=' . $_GET['content_id'] . '&studiengang_kz=' . $studiengang_kz . '&semester=' . ($i + 1) . '">' . ($i + 1) . '. Semester</option>';
            }
        }
        $this->block .= '
			  	</select>
			  	</td>
			  </tr>
			</table>
		<table>';
        $this->block .= '<script language="JavaScript" type="text/javascript">';
        $this->block .= '	parent.content.location.href="../cms/news.php?studiengang_kz=' . $studiengang_kz . '&semester=' . $semester . '"';
        $this->block .= '</script>';
        $this->block .= '
		<tr>
		  <td class="tdwrap">&nbsp;</td>
		</tr>';
        if (!($lv_obj = new lehrveranstaltung())) {
            die('Fehler beim Oeffnen der Lehrveranstaltung');
        }
        $lv_obj->lehrveranstaltungen = array();
        if ($lv_obj->load_lva($studiengang_kz, $semester, null, TRUE, TRUE, 'orgform_kurzbz DESC, bezeichnung')) {
            $lastform = null;
            foreach ($lv_obj->lehrveranstaltungen as $row) {
                if ($row->orgform_kurzbz != $lastform) {
                    $orgform = new organisationsform();
                    $orgform->load($row->orgform_kurzbz);
                    $this->block .= "<tr><td><b>{$orgform->bezeichnung}</b></td></tr>";
                    $lastform = $row->orgform_kurzbz;
                }
                $this->block .= '<tr>';
                $this->block .= '	<td class="tdwrap"><ul style="margin: 0px; padding: 0px; ">';
                $this->block .= "<li style='padding: 0px;'><a title=\"" . $row->bezeichnung_arr[$sprache] . "\" href=\"private/lehre/lesson.php?lvid={$row->lehrveranstaltung_id}\" target=\"content\">" . $this->CutString($row->bezeichnung_arr[$sprache], 21) . ' ' . $row->lehrform_kurzbz . "</a></li>";
                $this->block .= '	</ul></td>';
                $this->block .= '</tr>';
            }
        }
        $this->block .= '</table>';
        $this->output();
    }