From 3c4f45c2d98708e09c7bf4b836c42e0ca3386e9b Mon Sep 17 00:00:00 2001 From: gbateson Date: Thu, 14 Sep 2006 07:16:14 +0000 Subject: [PATCH] remove   from blank cells when generating Excel sheet --- mod/hotpot/report/overview/report.php | 338 +++++++++++++------------- 1 file changed, 169 insertions(+), 169 deletions(-) diff --git a/mod/hotpot/report/overview/report.php b/mod/hotpot/report/overview/report.php index fd691c2a47..bd4a21e499 100644 --- a/mod/hotpot/report/overview/report.php +++ b/mod/hotpot/report/overview/report.php @@ -1,169 +1,169 @@ -create_overview_table($hotpot, $cm, $course, $users, $attempts, $questions, $options, $tables); - $this->print_report($course, $hotpot, $tables, $options); - return true; - } - function create_overview_table(&$hotpot, &$cm, &$course, &$users, &$attempts, &$questions, &$options, &$tables) { - global $CFG; - $strtimeformat = get_string('strftimedatetime'); - $is_html = ($options['reportformat']=='htm'); - $spacer = $is_html ? ' ' : ' '; - $br = $is_html ? "
\n" : "\n"; - // initialize $table - unset($table); - $table->border = 1; - $table->width = 10; - $table->head = array(); - $table->align = array(); - $table->size = array(); - $table->wrap = array(); - // picture column, if required - if ($is_html) { - $table->head[] = $spacer; - $table->align[] = 'center'; - $table->size[] = 10; - $table->wrap[] = "nowrap"; - } - array_push($table->head, - get_string("name"), - hotpot_grade_heading($hotpot, $options), - get_string("attempt", "quiz"), - get_string("time", "quiz"), - get_string("reportstatus", "hotpot"), - get_string("timetaken", "quiz"), - get_string("score", "quiz") - ); - array_push($table->align, "left", "center", "center", "left", "center", "center", "center"); - array_push($table->wrap, "nowrap", "nowrap", "nowrap", "nowrap", "nowrap", "nowrap", "nowrap"); - array_push($table->size, "*", "*", "*", "*", "*", "*", "*"); - $abandoned = 0; - foreach ($users as $user) { - // shortcut to user info held in first attempt record - $u = &$user->attempts[0]; - $picture = ''; - $name = fullname($u); - if ($is_html) { - $picture = print_user_picture($u->userid, $course->id, $u->picture, false, true); - $name = ''.$name.''; - } - $grade = isset($user->grade) ? $user->grade : $spacer; - $attemptcount = count($user->attempts); - if ($attemptcount>1) { - $text = $name; - $name = NULL; - $name->text = $text; - $name->rowspan = $attemptcount; - $text = $grade; - $grade = NULL; - $grade->text = $text; - $grade->rowspan = $attemptcount; - } - $data = array(); - if ($is_html) { - if ($attemptcount>1) { - $text = $picture; - $picture = NULL; - $picture->text = $text; - $picture->rowspan = $attemptcount; - } - $data[] = $picture; - } - array_push($data, $name, $grade); - foreach ($user->attempts as $attempt) { - // increment count of abandoned attempts - // if attempt is marked as finished but has no score - if ($attempt->status==HOTPOT_STATUS_ABANDONED) { - $abandoned++; - } - $attemptnumber = $attempt->attempt; - $starttime = trim(userdate($attempt->timestart, $strtimeformat)); - if ($is_html && isset($attempt->score) && (has_capability('mod/hotpot:viewreport',get_context_instance(CONTEXT_COURSE, $course->id)) || $hotpot->review)) { - $attemptnumber = ''.$attemptnumber.''; - $starttime = ''.$starttime.''; - } - if ($is_html && has_capability('mod/hotpot:viewreport',get_context_instance(CONTEXT_COURSE, $course))) { - $checkbox = ''.$spacer; - } else { - $checkbox = ''; - } - $timetaken = empty($attempt->timefinish) ? $spacer : format_time($attempt->timefinish - $attempt->timestart); - $score = hotpot_format_score($attempt); - if ($is_html && is_numeric($score) && $score==$user->grade) { // best grade - $score = ''.$score.''; - } - array_push($data, - $attemptnumber, - $checkbox.$starttime, - hotpot_format_status($attempt), - $timetaken, - $score - ); - $table->data[] = $data; - $data = array(); - } // end foreach $attempt - $table->data[] = 'hr'; - } // end foreach $user - // remove final 'hr' from data rows - array_pop($table->data); - // add the "delete" form to the table - if ($options['reportformat']=='htm' && has_capability('mod/hotpot:viewreport',get_context_instance(CONTEXT_COURSE, $course->id))) { - $strdeletecheck = get_string('deleteattemptcheck','quiz'); - $table->start = $this->deleteform_javascript(); - $table->start .= '
'."\n"; - $table->start .= ''."\n"; - $table->start .= ''."\n"; - $table->finish = '
'."\n"; - $table->finish .= ' '."\n"; - if ($abandoned) { - $table->finish .= ''."\n"; - } - $table->finish .= ''."\n"; - $table->finish .= '
'."\n"; - $table->finish .= '
'."\n"; - } - $tables[] = &$table; - } - function deleteform_javascript() { - $strselectattempt = addslashes(get_string('selectattempt','hotpot')); - return << - - -END_OF_JAVASCRIPT -; - } // end function -} // end class -?> +create_overview_table($hotpot, $cm, $course, $users, $attempts, $questions, $options, $tables); + $this->print_report($course, $hotpot, $tables, $options); + return true; + } + function create_overview_table(&$hotpot, &$cm, &$course, &$users, &$attempts, &$questions, &$options, &$tables) { + global $CFG; + $strtimeformat = get_string('strftimedatetime'); + $is_html = ($options['reportformat']=='htm'); + $spacer = $is_html ? ' ' : ' '; + $br = $is_html ? "
\n" : "\n"; + // initialize $table + unset($table); + $table->border = 1; + $table->width = 10; + $table->head = array(); + $table->align = array(); + $table->size = array(); + $table->wrap = array(); + // picture column, if required + if ($is_html) { + $table->head[] = $spacer; + $table->align[] = 'center'; + $table->size[] = 10; + $table->wrap[] = "nowrap"; + } + array_push($table->head, + get_string("name"), + hotpot_grade_heading($hotpot, $options), + get_string("attempt", "quiz"), + get_string("time", "quiz"), + get_string("reportstatus", "hotpot"), + get_string("timetaken", "quiz"), + get_string("score", "quiz") + ); + array_push($table->align, "left", "center", "center", "left", "center", "center", "center"); + array_push($table->wrap, "nowrap", "nowrap", "nowrap", "nowrap", "nowrap", "nowrap", "nowrap"); + array_push($table->size, "*", "*", "*", "*", "*", "*", "*"); + $abandoned = 0; + foreach ($users as $user) { + // shortcut to user info held in first attempt record + $u = &$user->attempts[0]; + $picture = ''; + $name = fullname($u); + if ($is_html) { + $picture = print_user_picture($u->userid, $course->id, $u->picture, false, true); + $name = ''.$name.''; + } + $grade = isset($user->grade) && $user->grade<>' ' ? $user->grade : $spacer; + $attemptcount = count($user->attempts); + if ($attemptcount>1) { + $text = $name; + $name = NULL; + $name->text = $text; + $name->rowspan = $attemptcount; + $text = $grade; + $grade = NULL; + $grade->text = $text; + $grade->rowspan = $attemptcount; + } + $data = array(); + if ($is_html) { + if ($attemptcount>1) { + $text = $picture; + $picture = NULL; + $picture->text = $text; + $picture->rowspan = $attemptcount; + } + $data[] = $picture; + } + array_push($data, $name, $grade); + foreach ($user->attempts as $attempt) { + // increment count of abandoned attempts + // if attempt is marked as finished but has no score + if ($attempt->status==HOTPOT_STATUS_ABANDONED) { + $abandoned++; + } + $attemptnumber = $attempt->attempt; + $starttime = trim(userdate($attempt->timestart, $strtimeformat)); + if ($is_html && isset($attempt->score) && (has_capability('mod/hotpot:viewreport',get_context_instance(CONTEXT_COURSE, $course->id)) || $hotpot->review)) { + $attemptnumber = ''.$attemptnumber.''; + $starttime = ''.$starttime.''; + } + if ($is_html && has_capability('mod/hotpot:viewreport',get_context_instance(CONTEXT_COURSE, $course))) { + $checkbox = ''.$spacer; + } else { + $checkbox = ''; + } + $timetaken = empty($attempt->timefinish) ? $spacer : format_time($attempt->timefinish - $attempt->timestart); + $score = hotpot_format_score($attempt); + if ($is_html && is_numeric($score) && $score==$user->grade) { // best grade + $score = ''.$score.''; + } + array_push($data, + $attemptnumber, + $checkbox.$starttime, + hotpot_format_status($attempt), + $timetaken, + $score + ); + $table->data[] = $data; + $data = array(); + } // end foreach $attempt + $table->data[] = 'hr'; + } // end foreach $user + // remove final 'hr' from data rows + array_pop($table->data); + // add the "delete" form to the table + if ($options['reportformat']=='htm' && has_capability('mod/hotpot:viewreport',get_context_instance(CONTEXT_COURSE, $course->id))) { + $strdeletecheck = get_string('deleteattemptcheck','quiz'); + $table->start = $this->deleteform_javascript(); + $table->start .= '
'."\n"; + $table->start .= ''."\n"; + $table->start .= ''."\n"; + $table->finish = '
'."\n"; + $table->finish .= ' '."\n"; + if ($abandoned) { + $table->finish .= ''."\n"; + } + $table->finish .= ''."\n"; + $table->finish .= '
'."\n"; + $table->finish .= '
'."\n"; + } + $tables[] = &$table; + } + function deleteform_javascript() { + $strselectattempt = addslashes(get_string('selectattempt','hotpot')); + return << + + +END_OF_JAVASCRIPT +; + } // end function +} // end class +?> -- 2.39.5