~ubuntu-branches/ubuntu/jaunty/moodle/jaunty

« back to all changes in this revision

Viewing changes to mod/hotpot/report/default.php

  • Committer: Bazaar Package Importer
  • Author(s): Jordan Mantha, Matt Oquist
  • Date: 2009-02-25 15:16:22 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20090225151622-0ekt1liwhv2obfza
Tags: 1.9.4.dfsg-0ubuntu1
* Merge with Debian git (Closes LP: #322961, #239481, #334611):
  - use Ubuntu's smarty lib directory for linking
  - use internal yui library 
  - add update-notifier support back in

[Matt Oquist]
  * renamed prerm script
  * significantly rewrote postinst and other maintainer scripts to improve
    user experience and package maintainability
    (Closes LP: #225662, #325450, #327843, #303078, #234609)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?PHP  // $Id: default.php,v 1.13 2006/12/14 07:48:41 toyomoyo Exp $ 
 
1
<?PHP  // $Id: default.php,v 1.13.4.2 2008/03/06 07:34:04 gbateson Exp $
2
2
 
3
3
////////////////////////////////////////////////////////////////////
4
4
/// Default class for report plugins
5
 
///                                                            
6
 
/// Doesn't do anything on it's own -- it needs to be extended.   
7
 
/// This class displays quiz reports.  Because it is called from 
 
5
///
 
6
/// Doesn't do anything on it's own -- it needs to be extended.
 
7
/// This class displays quiz reports.  Because it is called from
8
8
/// within /mod/quiz/report.php you can assume that the page header
9
9
/// and footer are taken care of.
10
 
/// 
11
 
/// This file can refer to itself as report.php to pass variables 
12
 
/// to itself - all these will also be globally available.  You must 
 
10
///
 
11
/// This file can refer to itself as report.php to pass variables
 
12
/// to itself - all these will also be globally available.  You must
13
13
/// pass "id=$cm->id" or q=$quiz->id", and "mode=reportname".
14
14
////////////////////////////////////////////////////////////////////
15
15
 
17
17
 
18
18
class hotpot_default_report {
19
19
 
20
 
    function display($hotpot, $cm, $course, $users, $attempts, $questions, $options) {   
 
20
    function display($hotpot, $cm, $course, $users, $attempts, $questions, $options) {
21
21
        /// This function just displays the report
22
22
        // it is replaced by the "display" functions in the scripts in the "report" folder
23
23
        return true;
68
68
 
69
69
            // add $value to answers array, if it was not there
70
70
            if ($i==$i_max) {
71
 
                $table->legend[$q]['answers'][$i] = $value; 
 
71
                $table->legend[$q]['answers'][$i] = $value;
72
72
            }
73
73
 
74
74
            // convert $value to alphabetic index (A, B ... AA, AB ...)
98
98
            foreach($table->legend as $q=>$question) {
99
99
 
100
100
                $legend->stat[] = array(
101
 
                    get_string('questionshort', 'hotpot', $q+1), 
 
101
                    get_string('questionshort', 'hotpot', $q+1),
102
102
                    $question['name']
103
103
                );
104
104
                foreach($question['answers'] as $a=>$answer) {
105
105
                    $legend->stat[] = array(
106
 
                        $this->dec_to_ALPHA($a), 
 
106
                        $this->dec_to_ALPHA($a),
107
107
                        $answer
108
108
                    );
109
109
                }
324
324
 
325
325
    function print_report_finish(&$course, &$hotpot, &$options) {
326
326
        switch ($options['reportformat']) {
327
 
            case 'txt' : 
 
327
            case 'txt' :
328
328
                // do nothing
329
329
                break;
330
330
            case 'xls':
389
389
 
390
390
            $align = empty($table->align[$i]) ? '' : ' align="'.$table->align[$i].'"';
391
391
            $class = empty($table->class[$i]) ? $d : ' class="'.$table->class[$i].'"';
 
392
            $class = ' class="'.(empty($table->class[$i]) ? $d : $table->class[$i]).'"';
392
393
            $size  = empty($table->size[$i])  ? '' : ' width="'.$table->size[$i].'"';
393
394
            $wrap  = empty($table->wrap[$i])  ? '' : ' nowrap="nowrap"';
394
395
 
449
450
                    $col = 0; // column index
450
451
                    while ($col<$table->colspan && isset($cells[$i])) {
451
452
                        if (empty($skipcol[$col])) {
452
 
                            $cell = &$cells[$i++]; 
 
453
                            $cell = &$cells[$i++];
453
454
                            $td = $table->td[$col];
454
455
                            if (is_object($cell)) {
455
456
                                $text = $cell->text;
472
473
                            } else { // $cell is a string
473
474
                                $text = $cell;
474
475
                            }
475
 
                            print $td.$text."</td>\n";
 
476
                            print $td.$text.(empty($table->fontsize[$col]) ? '' : '</font>')."</td>\n";
476
477
                        } else {
477
478
                            $skipcol[$col]--;
478
479
                        }
545
546
    }
546
547
    function print_text_start(&$course, &$hotpot, &$options) {
547
548
        $downloadfilename = clean_filename("$course->shortname $hotpot->name.txt");
548
 
        header("Content-Type: application/download\n"); 
 
549
        header("Content-Type: application/download\n");
549
550
        header("Content-Disposition: attachment; filename=$downloadfilename");
550
551
        header("Expires: 0");
551
552
        header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
657
658
            $this->print_excel_stat($wb, $ws, $table, $row, $options);
658
659
            $this->print_excel_foot($wb, $ws, $table, $row, $options);
659
660
        }
660
 
    
 
661
 
661
662
        // close the workbook (and send it to the browser)
662
663
        $wb->close();
663
664
    }
678
679
    function print_excel_head(&$wb, &$ws, &$table, &$row, &$options) {
679
680
        // define format properties
680
681
        $properties = array(
681
 
            'bold'=>1, 
682
 
            'align'=>'center', 
 
682
            'bold'=>1,
 
683
            'align'=>'center',
683
684
            'v_align'=>'bottom',
684
685
            'text_wrap'=>1
685
686
        );