~ubuntu-branches/ubuntu/breezy/moodle/breezy

« back to all changes in this revision

Viewing changes to mod/resource/type/html/resource.class.php

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Mitchell
  • Date: 2005-10-13 02:00:59 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051013020059-y2qcyo41t7nqppcg
Tags: 1.5.2-1ubuntu1
* Resync with debian (security update)
* changed dependencys to php5
* changed apache dependency to apache2 
* References
  CAN-2005-2247

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php // $Id: resource.class.php,v 1.10.2.3 2004/10/25 20:33:27 gustav_delius Exp $
 
1
<?php // $Id: resource.class.php,v 1.20 2005/04/05 22:37:06 stronk7 Exp $
2
2
 
3
3
class resource_html extends resource_base {
4
4
 
77
77
 
78
78
 
79
79
function display() {
80
 
    global $CFG, $THEME;
 
80
    global $CFG;
81
81
 
82
82
/// Set up generic stuff first, including checking for access
83
83
    parent::display();
87
87
    $course = $this->course;
88
88
    $resource = $this->resource; 
89
89
 
90
 
    $pagetitle = strip_tags($course->shortname.': '.$resource->name);
 
90
    $pagetitle = strip_tags($course->shortname.': '.format_string($resource->name));
91
91
    $formatoptions->noclean = true;
92
92
    $inpopup = !empty($_GET["inpopup"]);
93
93
 
96
96
            add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
97
97
            print_header();
98
98
            print_simple_box(format_text($resource->alltext, FORMAT_HTML, $formatoptions, $course->id), 
99
 
                                         "center", "", "$THEME->cellcontent", "20");
100
 
            print_footer();
 
99
                                         "center", "", "", "20");
 
100
            print_footer($course);
101
101
        } else {                           /// Make a page and a pop-up window
102
102
 
103
 
            print_header($pagetitle, $course->fullname, "$this->navigation {$resource->name}", 
 
103
            print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), 
104
104
                         "", "", true, update_module_button($cm->id, $course->id, $this->strresource), 
105
105
                         navmenu($course, $cm));
106
106
 
107
 
            echo "\n<script language=\"Javascript\">";
 
107
            echo "\n<script language=\"javascript\" type=\"text/javascript\">";
108
108
            echo "\n<!--\n";
109
109
            echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n";
110
110
            echo "\n-->\n";
114
114
                print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
115
115
            }
116
116
    
117
 
            $link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$cm->id}\" target=\"resource{$resource->id}\" onClick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">{$resource->name}</a>";
 
117
            $link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&amp;id={$cm->id}\" target=\"resource{$resource->id}\" onclick=\"return openpopup('/mod/resource/view.php?inpopup=true&amp;id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">".format_string($resource->name,true)."</a>";
118
118
    
119
119
            echo "<p>&nbsp</p>";
120
120
            echo '<p align="center">';
128
128
    } else {    /// not a popup at all
129
129
 
130
130
        add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
131
 
        print_header($pagetitle, $course->fullname, "$this->navigation {$resource->name}",
 
131
        print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name),
132
132
                     "", "", true, update_module_button($cm->id, $course->id, $this->strresource), 
133
133
                     navmenu($course, $cm));
134
134
    
135
 
        print_simple_box(format_text($resource->alltext, FORMAT_HTML, $formatoptions, $course->id), "center", "", "$THEME->cellcontent", "20");
 
135
        print_simple_box(format_text($resource->alltext, FORMAT_HTML, $formatoptions, $course->id), "center", "", "", "20");
136
136
    
137
137
        $strlastmodified = get_string("lastmodified");
138
 
        echo "<center><p><font size=1>$strlastmodified: ".userdate($resource->timemodified)."</p></center>";
 
138
        echo "<center><p><font size=\"1\">$strlastmodified: ".userdate($resource->timemodified)."</font></p></center>";
139
139
    
140
140
        print_footer($course);
141
141
    }
185
185
                if ($optionname == "height" or $optionname == "width") {
186
186
                    $window->$optionname = $optionvalue;
187
187
                } else if ($optionvalue) {
188
 
                    $window->$optionname = "checked";
 
188
                    $window->$optionname = 'checked="checked"';
189
189
                }
190
190
            }
191
191
        }
192
192
    } else {
193
193
        foreach ($RESOURCE_WINDOW_OPTIONS as $optionname) {
194
194
            $defaultvalue = "resource_popup$optionname";
195
 
            $window->$optionname = $CFG->$defaultvalue;
 
195
 
 
196
            if ($optionname == "height" or $optionname == "width") {
 
197
                $window->$optionname = $CFG->$defaultvalue;
 
198
            } else if ($CFG->$defaultvalue) {
 
199
                $window->$optionname = 'checked="checked"';
 
200
            }
196
201
        }
197
202
 
198
203
        $windowtype = ($CFG->resource_popup) ? 'popup' : 'page';