remove old readme
[atutor.git] / themes / default / index.tmpl.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002 - 2009                                            */
6 /* Inclusive Design Institute                                           */
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): ?><?php echo $this->banner; ?><br /><?php endif;
17
18 // positioning switch of home ONLY FOR INSTRUCTORS. two icons will be used for identification to distinguish the two different views of the home.
19 if(authenticate(AT_PRIV_ADMIN,AT_PRIV_RETURN) && count($this->home_links) > 0){
20         if($this->view_mode==0)
21                 echo '<a href ="'.AT_BASE_HREF.'switch_view.php?swid='.$this->view_mode.'" style="background-color:#FFFFFF;"><img src="'.AT_BASE_HREF.'images/detail_view.png" title ="'._AT('detail_view').'"  alt ="'._AT('detail_view').'" border="0" class="img1616"/></a><br />';
22         else
23                 echo '<a href ="'.AT_BASE_HREF.'switch_view.php?swid='.$this->view_mode.'" style="background-color:#FFFFFF;"><img src="'.AT_BASE_HREF.'images/icon_view.png"  title ="'._AT('icon_view').'" alt ="'._AT('icon_view').'" border="0" class="img1616"/></a><br />';
24 }       
25
26 // Icon View, $this->view_mode = 0. course will be made changes to the icons to restore the classic icons.
27 if($this->view_mode==0){
28 ?>
29         <div style="width: 98%; margin-top: -5px; float:left;">
30                 <ul id="home-links">
31                 <?php if (is_array($this->home_links)): ?>
32                 <?php foreach ($this->home_links as $link): ?>
33                         <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>
34                 <?php endforeach; ?>
35                 <?php endif; ?>
36                 </ul>
37         </div> <?php
38 } else { ?>
39         
40         <div id="details_view" class="fluid-horizontal-order" style="width: 98%; margin-top: -5px; float: left; ">
41 <?php                           // create table container divided into two columns for the placement of modules
42         if(authenticate(AT_PRIV_ADMIN,AT_PRIV_RETURN) && is_array($this->home_links)){          // display enabled course tool
43                 foreach ($this->home_links as $link){ 
44 ?>
45                 <div class="home_box" id="<?php echo str_replace('/', '-', substr($link['url'], strlen($_base_path))); ?>"> 
46 <?php print_sublinks($link);                                            // display each module ?>
47                 </div>
48 <?php
49                 } // end of foreach 
50         }  // end of inner if 
51         else {
52                 if (is_array($this->home_links)) {
53                         foreach ($this->home_links as $link){?>
54                 <div class="home_box">
55 <?php print_sublinks($link); ?>
56                 </div>
57 <?php                   }  // end of foreach
58                 }// end of inner inner if
59         } ?>
60
61         </div> 
62         <br style="clear:both;" />&nbsp;
63 <?php
64 } // end of if
65
66 if ($this->announcements): ?>
67         <br style="clear:both;" />
68 <h2 class="page-title"><?php echo _AT('announcements'); ?></h2>
69         <?php foreach ($this->announcements as $item): ?>
70                 <div class="news">
71                         <h3><?php echo $item['title']; ?></h3>
72                         <p><span class="date"><?php echo $item['date'] .' '. _AT('by').' ' . $item['author']; ?></span></p> <?php echo $item['body']; ?>
73                 </div>
74         <?php endforeach; ?>
75
76         <?php if ($this->num_pages > 1): ?>
77                 <?php echo _AT('page'); ?>: | 
78                 <?php for ($i=1; $i<=$this->num_pages; $i++): ?>
79                         <?php if ($i == $this->current_page): ?>
80                                 <strong><?php echo $i; ?></strong>
81                         <?php else: ?>
82                                 <a href="<?php echo $_SERVER['PHP_SELF']; ?>?p=<?php echo $i; ?>"><?php echo $i; ?></a>
83                         <?php endif; ?>
84                          | 
85                 <?php endfor; ?>
86         <?php endif; ?>
87 <?php endif;
88
89 // Generate HTML for modules at "detail view"
90 function print_sublinks($link){
91         global $_base_path;
92 ?>
93 <!--  <div class="details_ol">-->
94         <div class="details_or">
95                 <div class="outside_box">
96 <?php if (authenticate(AT_PRIV_ADMIN,AT_PRIV_RETURN)) {?>
97                         <div class="buttonbox">
98                         <input type="image" onclick="javascript: remove_module('<?php echo htmlentities(substr($link['url'], strlen($_base_path))); ?>');" src="<?php echo AT_BASE_HREF; ?>images/x.gif" alt="<?php echo _AT('close'); ?>" value="<?php echo _AT('close'); ?>" class="img1616"/>
99                         </div>
100 <?php }?>
101                         <img src="<?php echo $link['img']; ?>" alt="" border="0" style="vertical-align:middle;" class="img-size-home"/>
102                         <span class="home-title"><a href="<?php echo $link['url']; ?>"><?php echo $link['title']; ?></a></span>
103                         <div class="inside_box">
104
105 <?php
106         // if $link['sub_file'] is defined, print the text array returned from sub_file, otherwise, print the text defined in $link['text']
107         if($link['sub_file']!=""){
108                 $array = require(AT_INCLUDE_PATH.'../'.$link['sub_file']);
109                 if(!is_array($array)){ 
110 ?>
111                                 <div class="details-text">
112                                 <?php echo _AT('none_found'); ?>
113                                 </div>
114 <?php } else { ?>
115                                 <div class="details-text">
116 <?php   foreach($array as $sublink){ ?>
117                                         <img src="<?php echo $link['icon']; ?>" border="0" alt="" style="vertical-align:middle;"/> 
118 <?php           if ($sublink <> '') echo $sublink."<br />"; } ?>
119                                 </div> 
120 <?php 
121                 } // end of else                                                
122         } else { ?>
123                                 <div class="details_text"><?php echo $link['text']; ?></div>
124 <?php } ?>
125                         </div>
126                 </div>
127         </div>
128
129 <!-- </div> -->
130 <br style="clear:both;" />
131
132 <?php } ?>