function display_memberdata_admin($template, $id, $name, $firstname, $fullname, $matriculation_number, $count, $points, $maxpoints, $write_mode = FALSE, $bonus_1 = FALSE, $bonus_2 = FALSE) { $sum = 0.0; if ($write_mode) { $block = "BLOCK_POINTS_ADMIN"; } else { $block = "BLOCK_POINTS"; } if (!is_array($points)) { $points = array(); } $template->setCurrentBlock("BLOCK_MEMBER"); $template->setVariable("MEMBER_NAME", $name . "<br /><small>(" . ($matriculation_number != 0 ? $matriculation_number : "n.a.") . ")</small>"); $template->setVariable("MEMBER_TITLE", $firstname . " " . $fullname); for ($i = 1; $i <= $count; $i++) { if (!isset($points[$i])) { $p = ""; } else { $p = $points[$i]; } if (isset($points[$i])) { $sum += (double) str_replace(",", ".", $points[$i]); } $template->setCurrentBlock($block); $template->setVariable("MEMBER_POINTS", trim($p)); if ($write_mode) { $template->setVariable("MEMBER_ID", $id); $template->setVariable("MEMBER_SHEETCOUNT", $i); $style = "text-align: right;"; $check = check_point($points[$i], $maxpoints[$i]); if ($check !== POINT_OK) { $hint = ""; $style .= " background-color: #D11E01; color: #ffffff;"; switch ($check) { case POINTERROR_NOINT: $hint = gettext("Not a number"); break; case POINTERROR_LOWERZERO: $hint = gettext("Lower than zero"); break; case POINTERROR_GREATERMAX: $hint = gettext("Greater than max"); break; default: $hint = gettext("Invalid input"); break; } $template->setVariable("POINT_TITLE", $hint); } $template->setVariable("POINT_STYLE", "style='" . $style . "'"); } $template->parse($block); } // SUM $template->setCurrentBlock("BLOCK_POINTS"); $template->setVariable("MEMBER_POINTS", $sum); $template->parse("BLOCK_POINTS"); // BONUS $template->setCurrentBlock("BLOCK_POINTS"); $bonustext = units_pointlist::calculate_bonus($sum, $bonus_1, $bonus_2); $template->setVariable("MEMBER_POINTS", $bonustext); $template->parse("BLOCK_POINTS"); $template->parse("BLOCK_MEMBER"); }
require_once "Spreadsheet/Excel/Writer.php"; $cache = get_cache_function($unit->get_id(), CACHE_LIFETIME_STATIC); $participant_group = $unit->get_attribute("UNIT_POINTLIST_PARTICIPANTS"); $proxy = $unit->get_attribute("UNIT_POINTLIST_PROXY"); if (defined("LOG_DEBUGLOG")) { $time1 = microtime(TRUE); $login = lms_steam::get_current_user()->get_name(); logging::write_log(LOG_DEBUGLOG, "units_pointlist_excel:\t " . $login . "\t" . $unit->get_display_name() . "\t" . $participant_group->get_identifier() . "\t" . $participant_group->count_members() . "\t" . date("d.m.y G:i:s", time()) . "... "); } $members = $cache->call("lms_steam::group_get_members", $participant_group->get_id(), TRUE); // INITIALIZATION $course_id = $course->get_course_id(); $course_name = $course->get_course_name(); $semester = $course->get_semester(); $proxy_data = $proxy->get_all_attributes(); $points = units_pointlist::extract_pointlist($proxy_data); $maxpoints = $proxy_data["UNIT_POINTLIST_MAXPOINTS"]; $count = $unit->get_attribute("UNIT_POINTLIST_COUNT"); $bonus_1 = $unit->get_attribute("UNIT_POINTLIST_BONUS_1"); $bonus_2 = $unit->get_attribute("UNIT_POINTLIST_BONUS_2"); $unit_name = $unit->get_display_name(); $excel = new Spreadsheet_Excel_Writer(); $excel->setTempDir(PATH_TEMP); $format_table_header =& $excel->addFormat(array('Size' => 12, 'Align' => 'left', 'Bold' => 1)); $format_table_header_number =& $excel->addFormat(array('Size' => 12, 'Align' => 'right', 'Bold' => 1)); $sheet_table_header =& $excel->addFormat(array('Size' => 14, 'Align' => 'left')); $format_table_header =& $excel->addFormat(array('Size' => 12, 'Align' => 'left', 'Bold' => 1)); $format_table_header_faded =& $excel->addFormat(array('Size' => 12, 'Align' => 'left', 'Color' => 'grey')); $format_cell =& $excel->addFormat(array('Size' => 9, 'Align' => 'left', 'Bold' => 1)); $format_cell->setAlign('vcenter'); $format_cell->setTextWrap(1);
$content->parse("BLOCK_PARTICIPANTS"); $content->setCurrentBlock("BLOCK_BONUS"); if (!empty($values["bonus_1"])) { $content->setVariable("BONUS_VALUE", h($values["bonus_1"])); } $content->setVariable("BONUS_LABEL", gettext("First Bonus") . ":"); $content->setVariable("BONUS_NAME", "values[bonus_1]"); $content->parse("BLOCK_BONUS"); $content->setCurrentBlock("BLOCK_BONUS"); if (!empty($values["bonus_2"])) { $content->setVariable("BONUS_VALUE", h($values["bonus_2"])); } $content->setVariable("BONUS_LABEL", gettext("Second Bonus") . ":"); $content->setVariable("BONUS_NAME", "values[bonus_2]"); $content->parse("BLOCK_BONUS"); $content->setVariable("UNIT_ICON", units_pointlist::get_big_icon()); $content->setVariable("CONFIRMATION_TEXT", gettext("You are going to add a new unit for this course.")); $content->setVariable("CONFIRMATION_TEXT_LONG", gettext("You are going to add a new pointlist unit.")); $content->setVariable("LABEL_NAME", gettext("Name")); $content->setVariable("LABEL_DSC", gettext("Description of the unit")); $content->setVariable("LABEL_SHORT_DSC", gettext("Description")); $content->setVariable("LABEL_DSC", gettext("Long description")); $content->setVariable("LABEL_LONG_DSC", gettext("Long description") . ":"); $content->setVariable("UNIT", "units_pointlist"); if (!is_object($unit)) { $backlink = $course->get_url() . "units/"; } else { $backlink = $unit->get_url(); } $content->setVariable("BACKLINK", " <a class=\"button\" href=\"{$backlink}\">" . gettext("back") . "</a>"); $content->setVariable("LABEL_BB_BOLD", gettext("B"));
} if (isset($member) && is_object($member)) { $id = $member->get_id(); $matriculation_number = $member->get_attribute("ldap:USER_MATRICULATION_NUMBER"); $name = $user->get_id() == $id ? gettext("Your Points") : $member->get_name() . "<br /><small>(" . ($matriculation_number != 0 ? $matriculation_number : "n.a.") . ")</small>"; $firstname = $member->get_attribute("USER_FIRSTNAME"); $fullname = $member->get_attribute("USER_FULLNAME"); $points = $proxy->get_attribute("UNIT_POINTLIST_POINTS_" . $id); if (!is_array($points)) { $points = array(); } } if (!isset($name)) { $name = gettext("n.a."); $id = -1; $firstname = ""; $fullname = ""; } if (!isset($points)) { $points = array(); } units_pointlist::display_memberdata($content, $id, $name, $firstname, $fullname, $count, $points, FALSE, $bonus_1, $bonus_2); } units_pointlist::display_maxpoints_data($content, $count, $maxpoints, $bonus_1, $bonus_2); if (defined("LOG_DEBUGLOG")) { logging::append_log(LOG_DEBUGLOG, " \t" . round((microtime(TRUE) - $time1) * 1000) . " ms"); } $html_handler->set_html_left($content->get()); $portal->set_page_main($html_handler->get_headline(), $html_handler->get_html(), ""); $portal->show_html(); exit;