move code up one directory
[atutor.git] / themes / simplified-desktop / index.tmpl.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002 - 2009                                            */
6 /* Adaptive Technology Resource Centre / University of Toronto          */
7 /*                                                                      */
8 /* This program is free software. You can redistribute it and/or        */
9 /* modify it under the terms of the GNU General Public License          */
10 /* as published by the Free Software Foundation.                        */
11 /************************************************************************/
12
13 if (!defined('AT_INCLUDE_PATH')) { exit; }
14 global $_base_path;
15
16 if ($this->banner): ?>
17
18 <?php echo $this->banner; ?><br /><?php endif;
19 /** Icon View removed for mobile.
20 // positioning switch of home ONLY FOR INSTRUCTORS. two icons will be used for identification to distinguish the two different views of the home.
21 if(authenticate(AT_PRIV_ADMIN,AT_PRIV_RETURN) && count($this->home_links) > 0){
22         if($this->view_mode==0)
23                 echo '<a href ="'.AT_BASE_HREF.'switch_view.php?swid='.$this->view_mode.'" ><img src="'.AT_BASE_HREF.'images/detail_view.png" title ="'._AT('detail_view').'"  alt ="'._AT('detail_view').'" /></a><br />';
24         else
25                 echo '<a href ="'.AT_BASE_HREF.'switch_view.php?swid='.$this->view_mode.'" ><img src="'.AT_BASE_HREF.'images/icon_view.png"  title ="'._AT('icon_view').'" alt ="'._AT('icon_view').'" /></a><br        />';
26 }       
27
28
29 // Icon View, $this->view_mode = 0. course will be made changes to the icons to restore the classic icons.
30 if($this->view_mode==0){
31 ?>
32         <div id="home-links-container">
33                 <ul id="home-links">
34                 <?php if (is_array($this->home_links)): ?>
35                 <?php foreach ($this->home_links as $link): ?>
36                         <li><a href="<?php echo $link['url']; ?>"><img src="<?php echo $link['img']; ?>" alt="" class="img-size-home" border="0" /><?php echo $link['title']; ?></a></li>
37                 <?php endforeach; ?>
38                 <?php endif; ?>
39                 </ul>
40         </div> <?php
41 } else { ?>
42         
43         <div id="details_view" class="fluid-horizontal-order">
44 <?php                           // create table container divided into two columns for the placement of modules
45         if(authenticate(AT_PRIV_ADMIN,AT_PRIV_RETURN) && is_array($this->home_links)){          // display enabled course tool
46                 foreach ($this->home_links as $link){ 
47 ?>
48                 <div class="home_box" id="<?php echo str_replace('/', '-', substr($link['url'], strlen($_base_path))); ?>"> 
49 <?php print_sublinks($link);                                            // display each module ?>
50                 </div>
51 <?php
52                 } // end of foreach 
53         }  // end of inner if 
54         else {
55                 if (is_array($this->home_links)) {
56                         foreach ($this->home_links as $link){?>
57                 <div class="home_box">
58 <?php print_sublinks($link); ?>
59                 </div>
60 <?php                   }  // end of foreach
61                 }// end of inner inner if
62         } ?>
63         </div> 
64 <?php
65 } // end of if
66 */
67
68 if ($this->announcements): ?>
69 <h2 class="page-title"><?php echo _AT('announcements'); ?></h2>
70         <?php foreach ($this->announcements as $item): ?>
71                 <div class="news">
72                         <h3><?php echo $item['title']; ?></h3>
73                         <span class="date"><?php echo $item['date'] .' '. _AT('by').' ' . $item['author']; ?></span></p> <?php echo $item['body']; ?></span>
74                         
75                 </div>
76         <?php endforeach; ?>
77
78         <?php if ($this->num_pages > 1): ?>
79                 <?php echo _AT('page'); ?>: | 
80                 <?php for ($i=1; $i<=$this->num_pages; $i++): ?>
81                         <?php if ($i == $this->current_page): ?>
82                                 <strong><?php echo $i; ?></strong>
83                         <?php else: ?>
84                                 <a href="<?php echo $_SERVER['PHP_SELF']; ?>?p=<?php echo $i; ?>"><?php echo $i; ?></a>
85                         <?php endif; ?>
86                          | 
87                 <?php endfor; ?>
88         <?php endif; ?>
89 <?php endif;
90
91 // Generate HTML for modules at "detail view"
92 function print_sublinks($link){
93         global $_base_path;
94 ?>
95 <div class="details_ol">
96         <div class="details_or">
97                 <div class="outside_box">
98 <?php if (authenticate(AT_PRIV_ADMIN,AT_PRIV_RETURN)) {?>
99                         <div class="buttonbox">
100                         <a href="#" onclick="javascript: remove_module('<?php echo htmlentities(substr($link['url'], strlen($_base_path))); ?>'); return false;"><img src="<?php echo AT_BASE_HREF; ?>images/x.gif" border="0" alt="<?php echo _AT('close'); ?>"/></a>
101                         </div>
102 <?php }?>
103                         <img src="<?php echo $link['img']; ?>" alt="" border="0" height="45" width="45"/>
104                         <span class="home-title"><a href="<?php echo $link['url']; ?>"><?php echo $link['title']; ?></a></span>
105                         <div class="inside_box">
106
107 <?php
108         // if $link['sub_file'] is defined, print the text array returned from sub_file, otherwise, print the text defined in $link['text']
109         if($link['sub_file']!=""){
110                 $array = require(AT_INCLUDE_PATH.'../'.$link['sub_file']);
111                 if(!is_array($array)){ 
112 ?>
113                                 <div class="details-text">
114                                 <i><?php echo _AT('none_found'); ?></i>
115                                 </div>
116 <?php } else { ?>
117                                 <div class="details-text">
118 <?php   foreach($array as $sublink){ ?>
119                                         <img src="<?php echo $link['icon']; ?>" border="0" alt=""/> 
120 <?php           if ($sublink <> '') echo $sublink."<br />"; } ?>
121                                 </div> 
122 <?php 
123                 } // end of else                                                
124         } else { ?>
125                                 <div class="details_text"><?php echo $link['text']; ?></div>
126 <?php } ?>
127                         </div>
128                 </div>
129         </div>
130 </div>
131
132
133
134
135 <!--
136 <div class="details_ol">
137         <div class="details_or">
138                 <div class="outside_box">
139 <?php if (authenticate(AT_PRIV_ADMIN,AT_PRIV_RETURN)) {?>
140                         <div class="buttonbox">
141                         <a href="#" onclick="javascript: remove_module('<?php echo htmlentities(substr($link['url'], strlen($_base_path))); ?>'); return false;"><img src="<?php echo AT_BASE_HREF; ?>images/x.gif" border="0" alt="<?php echo _AT('close'); ?>"/></a>
142                         </div>
143 <?php }?>
144                         <img src="<?php echo $link['img']; ?>" alt="" border="0" height="51" width="51"/>
145                         <span class="home-title"><a href="<?php echo $link['url']; ?>"><?php echo $link['title']; ?></a></span>
146                         <div class="inside_box">
147                                 <div class="details_il">&nbsp;</div>
148                                 <div class="details_ir"></div>
149 <?php
150         // if $link['sub_file'] is defined, print the text array returned from sub_file, otherwise, print the text defined in $link['text']
151         if($link['sub_file']!=""){
152                 //$array = require(AT_INCLUDE_PATH.'../'.$link['sub_file']);
153                 if(!is_array($array)){ 
154 ?>
155                                 <div class="details-text">
156                                 <i><?php echo _AT('none_found'); ?></i>
157                                 </div>
158 <?php } else { ?>
159                                 <div class="details-text">
160 <?php   foreach($array as $sublink){ ?>
161                                         <img src="<?php echo $link['icon']; ?>" border="0" alt="" /> 
162 <?php           if ($sublink <> '') echo $sublink."<br />"; } ?>
163                                 </div> 
164 <?php 
165                 } // end of else                                                
166         } else { ?>
167                                 <div class="details_text"><?php echo $link['text']; ?></div>
168 <?php } ?>
169                         </div>
170                 </div>
171         </div>
172 </div>
173 -->
174 <?php } ?>
175