$content_array = get_content_table($content);
+ // Create the array of alternative information for generating the AFA tool bar
+ $alt_infos = array();
+ $pause_image = find_image("pause.png");
+
+ if($has_text_alternative){
+ $alt_infos['has_text_alternative'] = array('3', _AT('apply_text_alternatives'), _AT('stop_apply_text_alternatives'), $pause_image, find_image('text_alternative.png'));
+ }
+ if($has_audio_alternative){
+ $alt_infos['has_audio_alternative'] = array('1', _AT('apply_audio_alternatives'), _AT('stop_apply_audio_alternatives'), $pause_image, find_image('audio_alternative.png'));
+ }
+ if($has_visual_alternative){
+ $alt_infos['has_visual_alternative'] = array('4', _AT('apply_visual_alternatives'), _AT('stop_apply_visual_alternatives'), $pause_image, find_image('visual_alternative.png'));
+ }
+ if($has_sign_lang_alternative){
+ $alt_infos['has_sign_lang_alternative'] = array('2', _AT('apply_sign_lang_alternatives'), _AT('stop_apply_sign_lang_alternatives'), $pause_image, find_image('sign_lang_alternative.png'));
+ }
+
$savant->assign('content_table', $content_array[0]);
$savant->assign('body', $content_array[1]);
$savant->assign('cid', $cid);
- $savant->assign('has_text_alternative', $has_text_alternative);
- $savant->assign('has_audio_alternative', $has_audio_alternative);
- $savant->assign('has_visual_alternative', $has_visual_alternative);
- $savant->assign('has_sign_lang_alternative', $has_sign_lang_alternative);
-
+ $savant->assign('alt_infos', $alt_infos);
+
//assign test pages if there are tests associated with this content page
if (!empty($content_test_ids)){
$savant->assign('test_message', $content_row['test_message']);
$savant->assign('test_ids', array());
}
- /*TODO***************BOLOGNA***************REMOVE ME**********/
- //assign forum pages if there are forums associated with this content page
+ /*TODO***************BOLOGNA***************REMOVE ME**********/
+ //assign forum pages if there are forums associated with this content page
if (!empty($content_forum_ids)){
$savant->assign('forum_message','');
$savant->assign('forum_ids', $content_forum_ids);
unset($infos);
}
-//Create has_alternatives array for generating the AFA tool bar
-$alt_parts = array();
-$theme_image_path = "themes/".$_SESSION['prefs']['PREF_THEME']."/images/";
-if($has_text_alternative){
- if(file_exists($theme_image_path.'text_alternative.png')){
- $img_path = '../'.$theme_image_path;
- }else{
- $img_path = '../images/';
- }
- $alt_parts['has_text_alternative'] = array('3', $img_path,_AT('apply_text_alternatives'),_AT('stop_apply_text_alternatives'),'pause.png','text_alternative.png');
-}
-if($has_audio_alternative){
- if(is_file($theme_image_path.'audio_alternative.png')){
- $img_path = '../'.$theme_image_path;
- }else{
- $img_path = '../images/';
- }
- $alt_parts['has_audio_alternative'] = array('1', $img_path,_AT('apply_audio_alternatives'),_AT('stop_apply_audio_alternatives'),'pause.png','audio_alternative.png');
-}
-if($has_visual_alternative){
- if(is_file($theme_image_path.'visual_alternative.png')){
- $img_path = '../'.$theme_image_path;
- }else{
- $img_path = '../images/';
- }
- $alt_parts['has_visual_alternative'] = array('4', $img_path,_AT('apply_visual_alternatives'),_AT('stop_apply_visual_alternatives'),'pause.png','visual_alternative.png');
-}
-if($has_sign_lang_alternative){
- if(is_file($theme_image_path.'sign_lang_alternative.png')){
- $img_path = '../'.$theme_image_path;
- }else{
- $img_path = '../images/';
- }
- $alt_parts['has_sign_lang_alternative'] = array('2', $img_path,_AT('apply_sign_lang_alternatives'),_AT('stop_apply_sign_lang_alternatives'),'pause.png','sign_lang_alternative.png');
-}
-
-
-$savant->assign('theme_image_path', $has_text_alternative);
-$savant->assign('alt_parts', $alt_parts);
$savant->assign('content_info', _AT('page_info', AT_date(_AT('inbox_date_format'), $content_row['last_modified'], AT_DATE_MYSQL_DATETIME), $content_row['revision'], AT_date(_AT('inbox_date_format'), $content_row['release_date'], AT_DATE_MYSQL_DATETIME)));
require(AT_INCLUDE_PATH.'header.inc.php');
$_SESSION['last_visited_page'] = $server_protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
require (AT_INCLUDE_PATH.'footer.inc.php');
-
-
-/**
-* Creates the AccessForAll Toolbar based on the $alt_parts array
-* See the $alt_parts array generated above
-* @param $cid the content id used to check if alternatiove are available
-* @param $theme_image_path the path to the theme image directory, checked to see if custom icons exist for the toolbar
-* @param $alt_parts the array of images, paths, and text used to construct the AFA toolbar
-* @param $has_sign_lang_alternative returns TRUE if sign alternatives are available for the current cid
-* @param $has_visual_alternative returns TRUE if visual alternatives are available for the current cid
-* @param $has_audio_lang_alternative returns TRUE if audio alternatives are available for the current cid
-* @param $has_sign_lang_alternative returns TRUE if text alternatives are available for the current cidy
-* @author Greg Gay/Cindy Li
-*/
-
-function print_alternative_tools($cid,$theme_image_path,$alt_parts,$has_sign_lang_alternative,$has_visual_alternative,$has_audio_alternative,$has_text_alternative){
-
-if ($has_text_alternative || $has_audio_alternative || $has_visual_alternative || $has_sign_lang_alternative){
- foreach ($alt_parts as $alt_part){
- echo '<a href="'.$_SERVER['PHP_SELF'].'?cid='.$cid.(($_GET['alternative'] == $alt_part['0']) ? '' : htmlentities_utf8(SEP).'alternative='.$alt_part[0]).'">
- <img src="'.$alt_part[1].(($_GET['alternative'] == $alt_part['0']) ? $alt_part['4'] : $alt_part['5']).'" alt="'.(($_GET['alternative'] == $alt_part['0']) ? $alt_part['3'] : $alt_part['2']).'" title="'.(($_GET['alternative'] == $alt_part['0']) ? $alt_part['3'] : $alt_part['2']).'" border="0" class="img1616"/></a>';
- }
- }
-}
?>
\ No newline at end of file
// Look for tree icons for displaying content navigation from theme image folder,
// if the icon is not there, look up in atutor root image folder
- $theme_image_folder = 'themes/'.$_SESSION['prefs']['PREF_THEME'].'/images/';
- $atutor_image_folder = 'images/';
-
- if (file_exists(AT_INCLUDE_PATH.'../'.$theme_image_folder.$rtl.'tree/tree_collapse.gif')) {
- $this->tree_collapse_icon = $theme_image_folder.$rtl.'tree/tree_collapse.gif';
- } else {
- $this->tree_collapse_icon = $atutor_image_folder.$rtl.'tree/tree_collapse.gif';
- }
-
- if (file_exists(AT_INCLUDE_PATH.'../'.$theme_image_folder.'tree/tree_expand.gif')) {
- $this->tree_expand_icon = $theme_image_folder.$rtl.'tree/tree_expand.gif';
- } else {
- $this->tree_expand_icon = $atutor_image_folder.$rtl.'tree/tree_expand.gif';
- }
-
- if (file_exists(AT_INCLUDE_PATH.'../'.$theme_image_folder.'tree/tree_vertline.gif')) {
- $this->tree_vertline_icon = $theme_image_folder.$rtl.'tree/tree_vertline.gif';
- } else {
- $this->tree_vertline_icon = $atutor_image_folder.$rtl.'tree/tree_vertline.gif';
- }
-
- if (file_exists(AT_INCLUDE_PATH.'../'.$theme_image_folder.'tree/tree_horizontal.gif')) {
- $this->tree_horizontal_icon = $theme_image_folder.$rtl.'tree/tree_horizontal.gif';
- } else {
- $this->tree_horizontal_icon = $atutor_image_folder.$rtl.'tree/tree_horizontal.gif';
- }
-
- if (file_exists(AT_INCLUDE_PATH.'../'.$theme_image_folder.'tree/tree_split.gif')) {
- $this->tree_split_icon = $theme_image_folder.$rtl.'tree/tree_split.gif';
- } else {
- $this->tree_split_icon = $atutor_image_folder.$rtl.'tree/tree_split.gif';
- }
-
- if (file_exists(AT_INCLUDE_PATH.'../'.$theme_image_folder.'tree/tree_disabled.gif')) {
- $this->tree_disabled_icon = $theme_image_folder.$rtl.'tree/tree_disabled.gif';
- } else {
- $this->tree_disabled_icon = $atutor_image_folder.$rtl.'tree/tree_disabled.gif';
- }
-
- if (file_exists(AT_INCLUDE_PATH.'../'.$theme_image_folder.'tree/tree_end.gif')) {
- $this->tree_end_icon = $theme_image_folder.$rtl.'tree/tree_end.gif';
- } else {
- $this->tree_end_icon = $atutor_image_folder.$rtl.'tree/tree_end.gif';
- }
-
- if (file_exists(AT_INCLUDE_PATH.'../'.$theme_image_folder.'tree/tree_space.gif')) {
- $this->tree_space_icon = $theme_image_folder.$rtl.'tree/tree_space.gif';
- } else {
- $this->tree_space_icon = $atutor_image_folder.$rtl.'tree/tree_space.gif';
- }
+ $this->tree_collapse_icon = find_image($rtl.'tree/tree_collapse.gif');
+ $this->tree_expand_icon = find_image($rtl.'tree/tree_expand.gif');
+ $this->tree_vertline_icon = find_image($rtl.'tree/tree_vertline.gif');
+ $this->tree_horizontal_icon = find_image($rtl.'tree/tree_horizontal.gif');
+ $this->tree_split_icon = find_image($rtl.'tree/tree_split.gif');
+ $this->tree_disabled_icon = find_image($rtl.'tree/tree_disabled.gif');
+ $this->tree_end_icon = find_image($rtl.'tree/tree_end.gif');
+ $this->tree_space_icon = find_image($rtl.'tree/tree_space.gif');
}
function initContent( ) {
return $return;
}
-
/**
* Convert all '&' to '&' from the input
* @param string any string input, mainly URLs.
}
}
+/*
+ * Finds the image in the theme image folder first. If the image does not exist, look up in
+ * core image folder.
+ * @param: The relative path and name to the image.
+ * "Relative" means relative to the "image" folder, with subfolders and image name.
+ * @return: The path to the image in the theme folder, if exists.
+ * Otherwise, the path to the image in the core image folder.
+ * Example:
+ * 1. pass in "rtl_tree/tree/collapse.gif"
+ * 2. return the path to this image in the theme folder: include/../themes/default/images/rtl_tree/tree/collapse.gif
+ * if the theme image does not exist, return the path to the image in the core "image" folder: include/../images/rtl_tree/tree/collapse.gif
+ * These pathes are relative to ATutor installation directory.
+ */
+function find_image($image_name) {
+ // The returned path is determined by AT_INCLUDE_PATH. If AT_INCLUDE_PATH is undefined, return the parameter itself.
+ if (!defined('AT_INCLUDE_PATH')) return $image_name;
+
+ // remove leading "/"
+ if (substr($image_name, 0, 1) == "/") $image_name = substr($image_name, 1);
+
+ $theme_image_folder = AT_INCLUDE_PATH.'../themes/'.$_SESSION['prefs']['PREF_THEME'].'/images/';
+ $atutor_image_folder = AT_INCLUDE_PATH.'../images/';
+
+ if (file_exists($theme_image_folder.$image_name)) {
+ return $theme_image_folder.$image_name;
+ } else {
+ return $atutor_image_folder.$image_name;
+ }
+}
require(AT_INCLUDE_PATH . '../mods/_core/modules/classes/Module.class.php');