/** * Constructor * @access public */ function EvaluationAnswerDB() { /* Set default values ------------------------------------------------ */ parent::EvaluationObjectDB(); $this->instanceof = INSTANCEOF_EVALANSWERDB; /* ------------------------------------------------------------------- */ }
/** * Constructor * @access public */ function EvaluationDB() { /* Set default values -------------------------------------------------- */ parent::EvaluationObjectDB(); $this->instanceof = INSTANCEOF_EVALDBOBJECT; /* --------------------------------------------------------------------- */ }
/** * Constructor * @access public */ function EvaluationGroupDB() { /* Set default values -------------------------------------------------- */ parent::EvaluationObjectDB(); $this->instanceof = INSTANCEOF_EVALGROUPDB; /* --------------------------------------------------------------------- */ }
/** * Gets the evaluation id for a object id * @access public * @param string $objectID The object id * @return string The evaluation id or nothing */ function getEvalID($objectID) { if (empty($objectID)) { die("FATAL ERROR in getEvalID ;)"); } $type = EvaluationObjectDB::getType($objectID); # echo "Bekomme: $objectID - $type<br>\n"; switch ($type) { case INSTANCEOF_EVALANSWER: $parentID = EvaluationAnswerDB::getParentID($objectID); break; case INSTANCEOF_EVALQUESTION: $parentID = EvaluationQuestionDB::getParentID($objectID); break; case INSTANCEOF_EVALGROUP: $parentID = EvaluationGroupDB::getParentID($objectID); break; default: return $objectID; } $type = EvaluationObjectDB::getType($parentID); # echo "Leite weiter: $parentID - $type<br>\n"; return EvaluationObjectDB::getEvalID($parentID); }
# ===================================================== END: check the itemID # # check the rangeID ======================================================== # if (Request::option("rangeID")) { $_SESSION['rangeID'] = Request::option("rangeID"); } # ==================================================== END: check the rangeID # # EVTAU: employees of the vote-team against urlhacking ====================== # $eval = new Evaluation($evalID, NULL, EVAL_LOAD_NO_CHILDREN); // someone has voted if ($eval->hasVoted()) { $error = EvalCommon::createReportMessage(_("An dieser Evaluation hat bereits jemand teilgenommen. Sie darf nicht mehr verändert werden."), EVAL_PIC_ERROR, EVAL_CSS_ERROR); $error_msgs[] = $error->createContent(); } // only the author or user with tutor perm in all evalRangeIDs should edit an eval $authorID = $eval->getAuthorID(); $db = new EvaluationObjectDB(); if ($authorID != $user->id) { $no_permisson = 0; if (is_array($eval->getRangeIDs())) { foreach ($eval->getRangeIDs() as $rangeID) { $user_perm = $db->getRangePerm($rangeID, $user->id, YES); // every range with a lower perm than Tutor if ($user_perm < 7) { $no_permisson++; } } if ($no_permisson > 0) { if ($no_permisson == 1) { $no_permisson_msg = _("Sie haben in einem Bereich, in welchem diese Evaluation hängt, nicht aussreichene Rechte, um diese Eval zu bearbeiten."); } else { $no_permisson_msg = sprintf(_("Sie haben in %s Bereichen, in denen diese Evaluation hängt, nicht aussreichene Rechte, um diese Eval zu bearbeiten."), $no_permisson);
require_once EVAL_FILE_QUESTION; 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")) {
/** * creates the infobox * */ function createInfoBox($command) { global $evalID, $rangeID; $id = Request::option("itemID"); $level = EvaluationObjectDB::getType($id); # echo $level; switch ($level) { case "0": case "Evaluation": $infoMain = array("icon" => Icon::create('test', 'info')->asImagePath(16), "text" => _("Links können Sie die Grundattribute der Evaluation definieren und neue Gruppierungsblöcke anlegen.")); break; case "EvaluationGroup": $group = new EvaluationGroup($id); switch ($group->getChildType()) { case "": case "EvaluationGroup": $infoMain = array("icon" => EVAL_PIC_TREE_GROUP, "text" => _("Links können Sie den ausgewählten Gruppierungsblock bearbeiten und darin Fragenblöcke oder weitere Gruppierungsblöcke anlegen.")); break; case "EvaluationQuestion": $infoMain = array("icon" => EVAL_PIC_TREE_QUESTIONGROUP, "text" => _("Links können Sie den ausgewählten Fragenblock bearbeiten und darin Fragen des zugeordneten Vorlagentyps anlegen.<br>Sie können auch den Vorlagentyp ändern. Dies wirkt sich auf alle Fragen aus.")); break; } } $previewLink = EvalCommon::createEvalShowLink($evalID, _("Vorschau"), YES, NO); $previewLink .= " " . _("der Evaluation"); $infoTemplates = array("icon" => Icon::create('info', 'info')->asImagePath(16), "text" => _("Der rechte Bereich dient der Bearbeitung von Antwortenvorlagen.")); $infoPreview = array("icon" => Icon::create('question-circle', 'info')->asImagePath(16), "text" => $previewLink); if (get_Username($rangeID)) { $rangeID = get_Username($rangeID); } if (empty($rangeID)) { $rangeID = get_Username($user->id); } $infoOverviewText = sprintf(_("Zurück zur %s Evaluations-Verwaltung %s"), "<a href=\"" . URLHelper::getLink('admin_evaluation.php?page=overview' . "&check_abort_creation_button=1&evalID={$evalID}&rangeID={$rangeID}") . "\">", "</a>"); $infoOverview = array("icon" => Icon::create('link-intern', 'info')->asImagePath(16), "text" => $infoOverviewText); if ($command) { $infobox = array(array("kategorie" => _("Aktionen:"), "eintrag" => array($infoPreview, $infoOverview))); } else { $infobox = array(array("kategorie" => _("Information:"), "eintrag" => array($infoMain, $infoTemplates, $infoPreview, $infoOverview))); } # ob_start(); return print_infobox($infobox, false, YES); # $html = ob_get_contents(); # ob_end_clean(); # return $html; }
/** * 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)); } }
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(); }
// initialise Stud.IP-Session // -- here you have to put initialisations for the current page require_once 'lib/evaluation/evaluation.config.php'; require_once EVAL_FILE_EVAL; require_once EVAL_FILE_OBJECTDB; // Start of Output PageLayout::setTitle(_('Evaluations-Auswertung')); PageLayout::setHelpKeyword('Basis.Evaluationen'); Navigation::activateItem('/tools/evaluation'); // Extract variables from request $eval_id = Request::option('eval_id'); $template_id = Request::option('template_id'); // Überprüfen, ob die Evaluation existiert oder der Benutzer genügend Rechte hat $eval = new Evaluation($eval_id); $eval->check(); if (EvaluationObjectDB::getEvalUserRangesWithNoPermission($eval) == YES || count($eval->errorArray) > 0) { throw new Exception(_("Diese Evaluation ist nicht vorhanden oder Sie haben nicht ausreichend Rechte!")); } // Store settings if (Request::submitted('store')) { if (!$template_id) { $template_id = DbView::get_uniqid(); $query = "INSERT INTO eval_templates_eval (eval_id, template_id)\n VALUES (?, ?)"; $statement = DBManager::get()->prepare($query); $statement->execute(array($eval_id, $template_id)); } $show_questions = Request::int('show_questions'); $show_total_stats = Request::int('show_total_stats'); $show_graphics = Request::int('show_graphics'); $show_questionblock_headline = Request::int('show_questionblock_headline'); $show_group_headline = Request::int('show_group_headline');