Skip to content

Commit

Permalink
Replace img/ paths with function
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Mar 22, 2016
1 parent e86630a commit 5d2a334
Show file tree
Hide file tree
Showing 34 changed files with 153 additions and 209 deletions.
2 changes: 1 addition & 1 deletion main/admin/group_edit.php
Expand Up @@ -145,7 +145,7 @@ function text_longitud(){
$image_path = GroupPortalManager::get_group_picture_path_by_id($group_id, 'web');
$image_dir = $image_path['dir'];
$image = $image_path['file'];
$image_file = ($image != '' ? $image_dir.$image : api_get_path(WEB_CODE_PATH).'img/unknown_group.jpg');
$image_file = ($image != '' ? $image_dir.$image : Display::returnIconPath('unknown_group.jpg'));
$image_size = api_getimagesize($image_file);

$img_attributes = 'src="'.$image_file.'?rand='.time().'" '
Expand Down
21 changes: 11 additions & 10 deletions main/coursecopy/classes/CourseSelectForm.class.php
Expand Up @@ -44,11 +44,11 @@ function exp(item) {
el = document.getElementById('div_'+item);
if (el.style.display=='none'){
el.style.display='';
document.getElementById('img_'+item).src='../img/1.gif';
document.getElementById('img_'+item).src='<?php echo Display::returnIconPath('1.gif'); ?>';
}
else{
el.style.display='none';
document.getElementById('img_'+item).src='../img/0.gif';
document.getElementById('img_'+item).src='<?php echo Display::returnIconPath('O.gif'); ?>';
}
}

Expand Down Expand Up @@ -147,8 +147,8 @@ function check_topic(obj) {
}
echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>';
echo '<script type="text/javascript">var myUpload = new upload(1000);</script>';

echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.api_get_path(WEB_CODE_PATH).'img/progress_bar.gif\',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">';
$icon = Display::returnIconPath('myprogress_bar.gif');
echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.$icon.',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">';
echo '<input type="hidden" name="action" value="course_select_form"/>';

if (!empty($hidden_fields['destination_course']) &&
Expand Down Expand Up @@ -203,7 +203,7 @@ function check_topic(obj) {
case RESOURCE_SCORM:
break;
default :
echo '<img id="img_'.$type.'" src="../img/1.gif" onclick="javascript:exp('."'$type'".');" />&nbsp;';
echo '<img id="img_'.$type.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$type'".');" />&nbsp;';
echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[$type].'</b><br />';
echo '<div id="div_'.$type.'">';
if ($type == RESOURCE_LEARNPATH) {
Expand Down Expand Up @@ -244,7 +244,7 @@ function check_topic(obj) {
if (!empty($forum_categories)) {
$type = RESOURCE_FORUMCATEGORY;

echo '<img id="img_'.$type.'" src="../img/1.gif" onclick="javascript:exp('."'$type'".');" />&nbsp;';
echo '<img id="img_'.$type.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$type'".');" />&nbsp;';
echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[RESOURCE_FORUM].'</b><br />';
echo '<div id="div_'.$type.'">';

Expand Down Expand Up @@ -581,11 +581,11 @@ function exp(item) {
el = document.getElementById('div_'+item);
if (el.style.display=='none'){
el.style.display='';
document.getElementById('img_'+item).src='../img/1.gif';
document.getElementById('img_'+item).src='<?php echo Display::returnIconPath('1.gif'); ?>';
}
else{
el.style.display='none';
document.getElementById('img_'+item).src='../img/0.gif';
document.getElementById('img_'+item).src='<?php echo Display::returnIconPath('0.gif'); ?>';
}
}
function setCheckbox(type,value) {
Expand Down Expand Up @@ -632,12 +632,13 @@ function checkLearnPath(message){

echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>';
echo '<script type="text/javascript">var myUpload = new upload(1000);</script>';
echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.api_get_path(WEB_CODE_PATH).'img/progress_bar.gif\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">';
$icon = Display::returnIconPath('progress_bar.gif');
echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.$icon.'\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">';
echo '<input type="hidden" name="action" value="course_select_form"/>';
foreach ($list_course as $course){
foreach ($course->resources as $type => $resources) {
if (count($resources) > 0) {
echo '<img id="img_'.$course->code.'" src="../img/1.gif" onclick="javascript:exp('."'$course->code'".');" />';
echo '<img id="img_'.$course->code.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$course->code'".');" />';
echo '<b onclick="javascript:exp('."'$course->code'".');" > '.$course->code.'</b><br />';
echo '<div id="div_'.$course->code.'">';
echo '<blockquote>';
Expand Down
2 changes: 1 addition & 1 deletion main/document/create_document.php
Expand Up @@ -18,7 +18,7 @@
$("#template_col").hide();
$("#doc_form").removeClass("col-md-9");
$("#doc_form").addClass("col-md-11");
$("#hide_bar_template").css({"background-image" : \'url("../img/hide2.png")\'})
$("#hide_bar_template").css({"background-image" : \'url("'.Display::returnIconPath('hide2.png').'")\'})
}
$(document).ready(function() {
Expand Down
5 changes: 3 additions & 2 deletions main/document/document.php
Expand Up @@ -670,8 +670,9 @@ function insertAtCarret() {

echo '<style>body {background:none;}</style>
<style media="print" type="text/css"> #print_div { visibility:hidden; } </style>';
echo '<a href="javascript:window.print();" style="float:right; padding:4px;" id="print_div">
<img src="../img/printmgr.gif" alt="'.get_lang('Print').'"/>'.get_lang('Print').'</a>';
echo '<a href="javascript:window.print();" style="float:right; padding:4px;" id="print_div">';
echo Display::return_icon('printmgr.gif', get_lang('Print'));
echo '</a>';
if (is_file($qr_code_filename) && is_readable($qr_code_filename)) {
$new_content_html = str_replace(
'((certificate_barcode))',
Expand Down
8 changes: 4 additions & 4 deletions main/document/edit_document.php
Expand Up @@ -34,7 +34,7 @@
$("#template_col").hide();
$("#doc_form").removeClass("col-md-9");
$("#doc_form").addClass("col-md-11");
$("#hide_bar_template").css({"background-image" : \'url("../img/hide2.png")\'})
$("#hide_bar_template").css({"background-image" : \'url("'.Display::returnIconPath('hide.png').'")\'})
}
$(document).ready(function() {
Expand Down Expand Up @@ -139,9 +139,9 @@
);

if ($is_certificate_mode) {
$editorConfig['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
$editorConfig['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
$editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir;
$editorConfig['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
$editorConfig['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
$editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir;
}

$is_allowed_to_edit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights']||
Expand Down
2 changes: 1 addition & 1 deletion main/document/slideshow.php
Expand Up @@ -439,7 +439,7 @@ function resizeImage() {

if (initial_height>height || initial_width>width) {
document.getElementById('image').style.visibility='hidden';
document.getElementById('td_image').style.background='url(../img/loadingAnimation.gif) center no-repeat';
document.getElementById('td_image').style.background='url(<?php echo Display::returnIconPath('loadingAnimation.gif'); ?>) center no-repeat';
document.getElementById('image').onload = resizeImage;
window.onresize = resizeImage;
}
Expand Down
8 changes: 4 additions & 4 deletions main/exercice/calculated_answer.class.php
Expand Up @@ -12,8 +12,8 @@
**/
class CalculatedAnswer extends Question
{
static $typePicture = 'calculated_answer.png';
static $explanationLangVar = 'CalculatedAnswer';
public static $typePicture = 'calculated_answer.png';
public static $explanationLangVar = 'CalculatedAnswer';

/**
* Constructor
Expand All @@ -29,7 +29,7 @@ public function __construct()
* function which redefines Question::createAnswersForm
* @param FormValidator $form
*/
function createAnswersForm($form)
public function createAnswersForm($form)
{
$defaults = array();

Expand Down Expand Up @@ -126,7 +126,7 @@ function updateBlanks(e) {
$form->addElement(
'html_editor',
'answer',
'<img src="../img/fill_field.png">',
Display::returnIconPath('fill_field.png'),
array(
'id' => 'answer',
'onkeyup' => 'javascript: updateBlanks(this);'
Expand Down
6 changes: 4 additions & 2 deletions main/exercice/exercise.php
Expand Up @@ -674,7 +674,9 @@
$class_tip = 'link_tooltip';
}
//$class_tip = 'exercise_link';
$url = $move.'<a '.$alt_title.' class="'.$class_tip.'" id="tooltip_'.$row['id'].'" href="overview.php?'.api_get_cidreq().$myorigin.$mylpid.$mylpitemid.'&exerciseId='.$row['id'].'"><img src="../img/quiz.gif" /> '.$title.' </a>';
$url = $move.'<a '.$alt_title.' class="'.$class_tip.'" id="tooltip_'.$row['id'].'" href="overview.php?'.api_get_cidreq().$myorigin.$mylpid.$mylpitemid.'&exerciseId='.$row['id'].'">
'.Display::returnIconPath('quiz.gif').'
'.$title.' </a>';

$item = Display::tag('td', $url.' '.$session_img.$lp_blocked);

Expand Down Expand Up @@ -1025,7 +1027,7 @@

// prof only
if ($is_allowedToEdit) {
$item = Display::tag('td', '<img src="../img/hotpotatoes_s.png" alt="HotPotatoes" /> <a href="showinframes.php?file='.$path.'&cid='.api_get_course_id().'&uid='.$userId.'" '.(!$active ? 'class="invisible"' : '').' >'.$title.'</a> ');
$item = Display::tag('td', Display::return_icon('hotpotatoes_s.png', "HotPotatoes").'<a href="showinframes.php?file='.$path.'&cid='.api_get_course_id().'&uid='.$userId.'" '.(!$active ? 'class="invisible"' : '').' >'.$title.'</a> ');
$item .= Display::tag('td', '-');

$actions = Display::url(
Expand Down
2 changes: 1 addition & 1 deletion main/exercice/fill_blanks.class.php
Expand Up @@ -256,7 +256,7 @@ function trimBlanksBetweenSeparator(inTxt, inSeparatorStart, inSeparatorEnd)
$form->addElement(
'html_editor',
'answer',
'<img src="../img/fill_field.png">',
Display::returnIconPath('fill_field.png'),
['id' => 'answer', 'onkeyup' => "javascript: updateBlanks(this);"],
array('ToolbarSet' => 'TestQuestionDescription')
);
Expand Down
2 changes: 1 addition & 1 deletion main/exercice/global_multiple_answer.class.php
Expand Up @@ -45,7 +45,7 @@ public function createAnswersForm($form)

$html .='<th>' . get_lang('Comment') . '</th>';
$html .='</tr>';
$form->addElement('label', get_lang('Answers') . '<br /> <img src="../img/fill_field.png">', $html);
$form->addElement('label', get_lang('Answers') . '<br /> '.Display::returnIconPath('fill_field.png'), $html);
$defaults = array();
$correct = 0;
$answer = false;
Expand Down
5 changes: 4 additions & 1 deletion main/exercice/hotspot_admin.inc.php
Expand Up @@ -563,7 +563,10 @@
);
}

Display::tag('h3', get_lang('Question') . ": " . $questionName . ' <img src="../img/info3.gif" title="' . strip_tags(get_lang('HotspotChoose')) . '" alt="' . strip_tags(get_lang('HotspotChoose')) . '" />');
Display::tag(
'h3',
get_lang('Question') . ": " . $questionName . Display::return_icon('info3.gif', strip_tags(get_lang('HotspotChoose')))
);

if (!empty($msgErr)) {
Display::display_normal_message($msgErr); //main API
Expand Down
2 changes: 1 addition & 1 deletion main/forum/forumfunction.inc.php
Expand Up @@ -3678,7 +3678,7 @@ function display_user_image($user_id, $name, $origin = '')
if ($user_id != 0) {
return $link.'<img src="'.$userInfo['avatar'].'" alt="'.$name.'" title="'.$name.'" /></a>';
} else {
return $link.'<img src="'.api_get_path(WEB_CODE_PATH)."img/unknown.jpg".'" alt="'.$name.'" title="'.$name.'" /></a>';
return $link.Display::return_icon('unknown.jpg', $name).'</a>';
}
}

Expand Down
2 changes: 0 additions & 2 deletions main/gradebook/gradebook.php
Expand Up @@ -561,8 +561,6 @@ function confirmation ()
$pdf->line(50,50,790,50);
$pdf->line(50,550,790,550);
$pdf->ezSetY(450);
//@todo replace image
//$pdf->ezImage(api_get_path(SYS_CODE_PATH).'img/dokeos_logo_certif.png',1,400,'','center','');
$pdf->ezSetY(480);
$pdf->ezText($certif_text,28,array('justification'=>'center'));
//$pdf->ezSetY(750);
Expand Down
9 changes: 2 additions & 7 deletions main/gradebook/index.php
Expand Up @@ -24,14 +24,9 @@

$this_section = SECTION_COURSES;

/*
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/jqplot/jquery.jqplot.min.css');
$htmlHeadXtra[] = api_get_js('jqplot/jquery.jqplot.min.js');
$htmlHeadXtra[] = api_get_js('jqplot/plugins/jqplot.donutRenderer.min.js');*/

$htmlHeadXtra[] = '<script>
var show_icon = "../img/view_more_stats.gif";
var hide_icon = "../img/view_less_stats.gif";
var show_icon = "'.Display::returnIconPath('view_more_stats.gif').'";
var hide_icon = "'.Display::returnIconPath('view_less_stats.gif').'";
$(document).ready(function() {
$("body").on("click", ".view_children", function() {
Expand Down
13 changes: 3 additions & 10 deletions main/gradebook/lib/GradebookUtils.php
Expand Up @@ -271,13 +271,6 @@ public static function build_edit_icons_cat($cat, $selectcat)
'',
ICON_SIZE_SMALL
) . '</a>';
//no move ability for root categories
if ($cat->is_movable()) {
/* $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?movecat=' . $cat->get_id() . '&amp;selectcat=' . $selectcat . ' &amp;cidReq='.$cat->get_course_code().'">
<img src="../img/icons/22/move.png" border="0" title="' . get_lang('Move') . '" alt="" /></a>'; */
} else {
//$modify_icons .= '&nbsp;<img src="../img/deplacer_fichier_na.gif" border="0" title="' . get_lang('Move') . '" alt="" />';
}

if ($cat->is_locked() && !api_is_platform_admin()) {
$modify_icons .= Display::return_icon('delete_na.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL);
Expand Down Expand Up @@ -357,8 +350,6 @@ public static function build_edit_icons_link($link, $selectcat)
$modify_icons = '<a href="gradebook_edit_link.php?editlink=' . $link->get_id() . '&cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id().'">' .
Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
}

//$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?movelink=' . $link->get_id() . '&selectcat=' . $selectcat . '"><img src="../img/deplacer_fichier.gif" border="0" title="' . get_lang('Move') . '" alt="" /></a>';
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visiblelink=' . $link->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&id_session='.$link->get_session_id(). ' ">' .
Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
$modify_icons .= '&nbsp;<a href="gradebook_showlog_link.php?visiblelink=' . $link->get_id() . '&selectcat=' . $selectcat . '&cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id(). '">' .
Expand Down Expand Up @@ -712,7 +703,9 @@ public static function get_user_certificate_content($user_id, $course_code, $ses
//add print header
if ($hide_print_button == false) {
$print = '<style media="print" type="text/css">#print_div {visibility:hidden;}</style>';
$print .= '<a href="javascript:window.print();" style="float:right; padding:4px;" id="print_div"><img src="' . api_get_path(WEB_CODE_PATH) . 'img/printmgr.gif" alt="' . get_lang('Print') . '" /> ' . get_lang('Print') . '</a>';
$print .= '<a href="javascript:window.print();" style="float:right; padding:4px;" id="print_div">';
$print .= Display::return_icon('printmgr.gif', get_lang('Print'));
$print .= '</a>';
}

// Add header
Expand Down

0 comments on commit 5d2a334

Please sign in to comment.