/** * Returns the ids of the Answertemplates of a user * @access public * @param string $userID The user id * @return array The ids of the answertemplates */ function getTemplateID($userID) { $db = DBManager::get(); if (EvaluationObjectDB::getGlobalPerm() == "root") { $sql = "SELECT" . " evalquestion_id " . "FROM" . " evalquestion " . "WHERE" . " parent_id = '0' ORDER BY text"; return $db->fetchFirst($sql); } else { $sql = "SELECT" . " evalquestion_id " . "FROM" . " evalquestion " . "WHERE" . " parent_id = '" . $userID . "' " . "OR " . " parent_id = '0' ORDER BY text"; $sql .= " "; return $db->fetchFirst($sql, array($userID)); } }
require_once EVAL_FILE_QUESTIONDB; require_once EVAL_FILE_OBJECTDB; # ====================================================== end: including files # /* Create objects ---------------------------------------------------------- */ $db = new EvaluationQuestionDB(); $lib = new EvalTemplateGUI(); /* ------------------------------------------------------------ end: objects */ #error_reporting( E_ALL ); /* Set variables ----------------------------------------------------------- */ $rangeID = $rangeID ? $rangeID : $SessSemName[1]; if (empty($rangeID)) { $rangeID = $user->id; } $command = $lib->getPageCommand(); $odb = new EvaluationObjectDB(); if ($odb->getGlobalPerm() == "root") { $myuserid = 0; } else { $myuserid = $user->id; } if (!$parentID) { $parentID = Request::option('parentID'); } $template_name = Request::get('template_name', $template_name); $template_type = Request::get('template_type') ? Request::get('template_type') : $template_type; $template_multiple = Request::get('template_multiple', $template_multiple); $template_answers = Request::getArray('template_answers'); $template_add_num_answers = Request::get('template_add_num_answers') ? Request::get('template_add_num_answers') : $template_add_num_answers; if (empty($template_answers)) { if (strstr($command, "edit")) { for ($i = 0; $i < 5; $i++) {
function createDomainLinks($search) { global $user; $db = new EvaluationObjectDB(); $evalDB = new EvaluationDB(); $globalperm = $db->getGlobalPerm(); // search results $results = $evalDB->search_range($search); if ($globalperm == "root") { $results["studip"] = array("type" => "system", "name" => _("Systemweite Evaluationen")); } else { $results[$user->id] = array("type" => "user", "name" => _("Profil")); } if ($globalperm == "dozent" || $globalperm == "autor" || $search) { $showsearchresults = 1; } if ($globalperm == "admin") { $range_types = array("user" => _("Benutzer"), "sem" => _("Veranstaltung"), "inst" => _("Einrichtung"), "fak" => _("Fakultät")); } elseif ($globalperm == "root") { $range_types = array("user" => _("Benutzer"), "sem" => _("Veranstaltung"), "inst" => _("Einrichtung"), "fak" => _("Fakultät"), "system" => _("System")); } // display search_results if ($results) { foreach ($results as $k => $v) { while (list($type_key, $type_value) = each($range_types)) { if ($v["type"] == $type_key) { $ranges["{$type_key}"][] = array("id" => $k, "name" => $v["name"]); } } reset($range_types); } $table = new HTML("table"); $table->addAttr("class", "default"); $table->addAttr("border", "0"); $table->addAttr("align", "center"); $table->addAttr("cellspacing", "0"); $table->addAttr("cellpadding", "0"); $table->addAttr("width", "100%"); while (list($type_key, $type_value) = each($range_types)) { // Überschriften $tr = new HTML("tr"); // Typ $td = new HTML("td"); $td->addAttr("colspan", "1"); $td->addAttr("class", "table_header"); $td->addAttr("height", "22"); $td->addAttr("width", "50%"); $td->addAttr("style", "vertical-align:bottom;"); $b = new HTML("b"); $b->addHTMLContent(" "); $b->addContent($type_value . ":"); $td->addContent($b); $tr->addContent($td); // Typ $td = new HTML("td"); $td->addAttr("class", "table_header"); $td->addAttr("height", "22"); $td->addAttr("align", "center"); $td->addAttr("style", "vertical-align:bottom;"); $b = new HTML("b"); $b->addContent(" "); $td->addContent($b); $tr->addContent($td); // Typ $td = new HTML("td"); $td->addAttr("class", "table_header"); $td->addAttr("height", "22"); $td->addAttr("align", "center"); $td->addAttr("style", "vertical-align:bottom;"); $b = new HTML("b"); $b->addContent(" "); $td->addContent($b); $tr->addContent($td); $table->addContent($tr); $counter = 0; if ($ranges["{$type_key}"]) { foreach ($ranges["{$type_key}"] as $range) { if ($counter == 0) { $displayclass = "content_body"; } elseif ($counter % 2 == 0) { $displayclass = "table_row_even"; } else { $displayclass = "table_row_odd"; } $tr = new HTML("tr"); // name $td = new HTML("td"); $td->addHTMLContent(" "); $td->addContent($range["name"]); $tr->addContent($td); // if the rangeID is a username, convert it to the userID $new_rangeID = get_userid($range['id']) ? get_userid($range['id']) : $range['id']; // link $td = new HTML("td"); $td->addAttr("align", "center"); $link = new HTML("a"); $link->addAttr("href", URLHelper::getLink(EVAL_FILE_ADMIN . "?rangeID=" . $range['id'])); $link->addContent(_("Diesen Bereich anzeigen.")); $td->addContent($link); $tr->addContent($td); // copy $td = new HTML("td"); $td->addAttr("align", "center"); $td->addContent(" "); $tr->addContent($td); $table->addContent($tr); $counter++; } } elseif ($globalperm == "root" || $globalperm == "admin") { $tr = new HTML("tr"); $td = new HTML("td"); $td->addAttr("class", "content_body"); $td->addAttr("colspan", "4"); $td->addHTMLContent(" "); $td->addContent(_("Es wurden keine Ergebnisse aus diesem Bereich gefunden.")); $tr->addContent($td); $table->addContent($tr); } reset($ranges); } } return $table->createContent(); }