Replace $CFG->pixpath with $OUPTUT->old_icon_url(...) instead.
*/
function MoodleQuickForm($formName, $method, $action, $target='', $attributes=null){
global $CFG, $OUTPUT;
- $OUTPUT->initialise_deprecated_cfg_pixpath();
static $formcounter = 1;
public function container_end() {
return $this->opencontainers->pop('container');
}
-
- /**
- * At the moment we frequently have a problem with $CFG->pixpath not being
- * initialised when it is needed. Unfortunately, there is no nice way to handle
- * this. I think we need to replace $CFG->pixpath with something like $OUTPUT->icon(...).
- * However, until then, we need a way to force $CFG->pixpath to be initialised,
- * to fix the error messages, and that is what this function if for.
- */
- public function initialise_deprecated_cfg_pixpath() {
- // Actually, we don't have to do anything here. Just calling any method
- // of $OBJECT is enough. However, if the only reason you are calling
- // an $OUTPUT method is to get $CFG->pixpath initialised, please use this
- // method, so we can find them and clean them up later once we have
- // found a better replacement for $CFG->pixpath.
- }
}
function helpbutton($page, $title, $module='moodle', $image=true, $linktext=false, $text='', $return=false,
$imagetext='') {
global $CFG, $COURSE, $OUTPUT;
- $OUTPUT->initialise_deprecated_cfg_pixpath();
//warning if ever $text parameter is used
//$text option won't work properly because the text needs to be always cleaned and,
$linkobject .= $imagetext;
} else {
$linkobject .= '<img class="iconhelp" alt="'.s(strip_tags($tooltip)).'" src="'.
- $CFG->pixpath .'/help.gif" />';
+ $OUTPUT->old_icon_url('help') . '" />';
}
} else {
$linkobject .= $tooltip;
// setup $PAGE so that format_text will work properly
$PAGE->set_cm($cm, $course, $chat);
-$OUTPUT->initialise_deprecated_cfg_pixpath();
-
if($CFG->chat_use_cache){
$cache = new file_cache();
$users = $cache->get('user');
$this->str->cancel = get_string('cancel');
$this->str->editcategories = get_string('editcategories', 'quiz');
$this->str->page = get_string('page');
- $OUTPUT->initialise_deprecated_cfg_pixpath();
$this->pixpath = $CFG->pixpath;
$this->pageurl = $pageurl;
public function get_listing($uuid = '', $path = '') {
global $CFG, $SESSION, $OUTPUT;
- $OUTPUT->initialise_deprecated_cfg_pixpath();
$ret = array();
$ret['dynload'] = true;
$ret['list'] = array();
'children'=>array());
} elseif ($child->child->type == $file_filter) {
$ret['list'][] = array('title'=>$child->child->cm_name,
- 'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo('icon32', $child->child->cm_name),
+ 'thumbnail' => $OUTPUT->old_icon_url('f/'. str_replace(array('.png', '.gif'), '', mimeinfo('icon32', $child->child->cm_name))),
'source'=>$child->child->id);
}
}
*/
public function search($search_text) {
global $CFG, $OUTPUT;
- $OUTPUT->initialise_deprecated_cfg_pixpath();
$list = array();
$ret = array();
$tree = $this->box->getAccountTree();
'date'=>$filedates[$n],
'source'=>'http://box.net/api/1.0/download/'
.$this->auth_token.'/'.$fileids[$n],
- 'thumbnail'=>$CFG->pixpath.'/f/'.mimeinfo('icon32', $v));
+ 'thumbnail'=>$OUTPUT->old_icon_url('f/'. str_replace(array('.png', '.gif'), '', mimeinfo('icon32', $v))));
}
}
}
*/
public function get_listing($path = '', $page = '') {
global $CFG, $USER, $itemid, $OUTPUT;
- $OUTPUT->initialise_deprecated_cfg_pixpath();
$ret = array();
$ret['dynload'] = true;
$ret['nosearch'] = true;
set_time_limit(0);
require_login();
-$OUTPUT->initialise_deprecated_cfg_pixpath();
$page = optional_param('page', '', PARAM_RAW); // page
$client_id = optional_param('client_id', SITEID, PARAM_RAW); // client ID
}
public function get_listing($path = '', $page = '') {
global $CFG, $OUTPUT;
- $OUTPUT->initialise_deprecated_cfg_pixpath();
-
$list = array();
$list['list'] = array();
// process breacrumb trail
'source' => $path.'/'.$file,
'size' => filesize($this->root_path.$file),
'date' => time(),
- 'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo('icon32', $this->root_path.$file)
+ 'thumbnail' => $OUTPUT->old_icon_url('f/'. str_replace(array('.png', '.gif'), '', mimeinfo('icon32', $this->root_path.$file)))
);
} else {
if (!empty($path)) {
*/
public static function move_to_filepool($path, $name, $itemid, $filearea = 'user_draft') {
global $DB, $CFG, $USER, $OUTPUT;
- $OUTPUT->initialise_deprecated_cfg_pixpath();
$context = get_context_instance(CONTEXT_USER, $USER->id);
$now = time();
$entry = new object();
return array('url'=>$ret->get_url(),
'id'=>$file->get_itemid(),
'file'=>$file->get_filename(),
- 'icon'=>$CFG->pixpath.'/f/'.mimeinfo('icon32', $path)
+ 'icon'=>$OUTPUT->old_icon_url('f/'. str_replace(array('.png', '.gif'), '', mimeinfo('icon32', $path)))
);
} else {
return null;
*/
public static function build_tree($fileinfo, $search, $dynamicmode, &$list) {
global $CFG, $OUTPUT;
- $OUTPUT->initialise_deprecated_cfg_pixpath();
$filecount = 0;
$children = $fileinfo->get_children();
*/
public function get_listing($encodedpath = '', $page = '', $search = '') {
global $CFG, $USER, $OUTPUT;
- $OUTPUT->initialise_deprecated_cfg_pixpath();
$ret = array();
$ret['dynload'] = true;
$ret['nosearch'] = true;
*/
public function get_listing($path = null, $page = 1, $search = '') {
global $CFG, $DB, $USER, $OUTPUT;
- $OUTPUT->initialise_deprecated_cfg_pixpath();
///check that Mahara has a good version
///We also check that the "get file list" method has been activated (if it is not
if ($file['artefacttype'] == 'image') {
$thumbnail = $host->wwwroot."/artefact/file/download.php?file=".$file['id']."&size=70x55";
} else {
- $thumbnail = $CFG->pixpath .'/f/'. mimeinfo('icon32', $file['title']);
+ $thumbnail = $OUTPUT->old_icon_url('f/'. str_replace(array('.png', '.gif'), '', mimeinfo('icon32', $file['title'])));
}
$list[] = array( 'title'=>$file['title'], 'date'=>$file['mtime'], 'source'=>$file['id'], 'thumbnail' => $thumbnail);
}
}
public function get_listing($path = '', $page = '') {
global $CFG, $OUTPUT;
- $OUTPUT->initialise_deprecated_cfg_pixpath();
$list = array();
$list['list'] = array();
// the management interface url
'size'=>$file['size'],
'date'=>userdate($file['time']),
'source'=>$path.'/'.$file['name'],
- 'thumbnail'=>$CFG->pixpath.'/f/'.mimeinfo('icon32', $file['name'])
+ 'thumbnail'=>$OUTPUT->old_icon_url('f/'. str_replace(array('.png', '.gif'), '', mimeinfo('icon32', $file['name'])))
);
}
}
*/
public function get_listing($path='', $page='') {
global $CFG, $OUTPUT;
- $OUTPUT->initialise_deprecated_cfg_pixpath();
$ret = array();
$curl = new curl;
$msg = $curl->head($this->file_url);
$ret['list'][] = array(
'title'=>$filename,
'source'=>$this->file_url,
- 'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo('icon32', $filename)
+ 'thumbnail' => $OUTPUT->old_icon_url('f/'. str_replace(array('.png', '.gif'), '', mimeinfo('icon32', $filename)))
);
}
}
}
public function analyse_page($baseurl, $content, &$list) {
global $CFG, $OUTPUT;
- $OUTPUT->initialise_deprecated_cfg_pixpath();
$urls = extract_html_urls($content);
$images = $urls['img']['src'];
$pattern = '#img(.+)src="?\'?([[:alnum:]:?=&@/._+-]+)"?\'?#i';
'thumbnail'=>url_to_absolute($baseurl, $url),
'thumbnail_height'=>84,
'thumbnail_width'=>84
- //'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo('icon32', $url)
- );
+ );
}
}
}
}
public function get_listing($path='', $page = '') {
global $CFG, $OUTPUT;
- $OUTPUT->initialise_deprecated_cfg_pixpath();
$list = array();
$ret = array();
$ret['dynload'] = true;
$size = !empty($v['getcontentlength'])? $v['getcontentlength']:'';
$ret['list'][] = array(
'title'=>$title,
- 'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo('icon32', $title),
+ 'thumbnail' => $OUTPUT->old_icon_url('f/'. str_replace(array('.png', '.gif'), '', mimeinfo('icon32', $title))),
'size'=>$size,
'date'=>$filedate,
'source'=>$v['href']