ATutor 2.0
[atutor.git] / tools / prog.php
1 <?php
2 /****************************************************************/
3 /* ATutor                                                                                                               */
4 /****************************************************************/
5 /* Copyright (c) 2002-2010                                      */
6 /* Inclusive Design Institute                                   */
7 /* http://atutor.ca                                                                                             */
8 /*                                                              */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License  */
11 /* as published by the Free Software Foundation.                                */
12 /****************************************************************/
13 // $Id$
14 sleep(1);
15 $_user_location = 'prog';
16 define('AT_INCLUDE_PATH', '../include/');
17 require(AT_INCLUDE_PATH.'vitals.inc.php');
18 session_write_close();
19 if ($_GET['tile']) {
20         $lang_variable = 'tile_progress';
21 } else {
22         $lang_variable = 'upload_progress';
23 }
24
25 ?>
26 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
27 <html lang="<?php echo $myLang->getCode(); ?>">
28 <head>
29         <title><?php echo _AT($lang_variable); ?></title>
30         <?php if ($_GET['frame']) { ?>
31                 <meta http-equiv="refresh" content="3;URL=prog.php?frame=1" /> 
32         <?php } ?>
33         <meta http-equiv="Content-Type" content="text/html; <?php echo $myLang->getCharacterSet(); ?>" />
34     <script src="<?php echo $_base_path; ?>jscripts/infusion/InfusionAll.js" type="text/javascript"></script>
35     <script language="javascript" type="text/javascript">
36     //<!--
37     jQuery.noConflict();
38     //-->
39     </script>
40     <script src="<?php echo $_base_path; ?>jscripts/ATutor.js" type="text/javascript"></script>   
41     <script type="text/javascript" src="<?php echo $_base_path; ?>jscripts/ATutorCourse.js"></script>
42     <link rel="stylesheet" href="<?php echo $_base_path; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/styles.css" type="text/css" />
43     <style id="pref_style" type="text/css"></style> 
44 </head>
45 <body <?php
46         if ($_SESSION['done']) {
47                 echo 'onload="parent.window.close();"';
48         }
49 ?>>
50 <?php 
51 if (!$_GET['frame']) {  ?>
52 &nbsp;<a href="javascript:window.close();"><?php echo _AT('close'); ?></a>
53 <h3><?php echo _AT($lang_variable); ?></h3>
54 <p><small><?php echo _AT('window_auto_close'); ?></small></p>
55
56 <br /><br />
57 <table border="0" align="center">
58 <tr>
59         <td><img src="<?php echo AT_BASE_HREF; ?>images/transfer.gif" height="20" width="90" alt="<?php echo _AT($lang_variable); ?>"></td>
60         <td valign="middle"><iframe src="prog.php?frame=1" width="100" height="25" frameborder="0" scrolling="no" marginwidth="0" marginheight="1">
61 </iframe>
62 <?php } else { 
63         $tmp_dir = ini_get('upload_tmp_dir') . DIRECTORY_SEPARATOR;
64         if (!$_GET['t']) {
65                 $newest_file_name = '';
66                 $newest_file_time = 0;
67                 // get the name of the temp file.
68                 if ($dir = @opendir($tmp_dir)) {
69                         while (($file = readdir($dir)) !== false) {
70                                 if ((strlen($file) == 9) && (substr($file, 0, 3) == 'php')) {
71                                         $filedata = stat($tmp_dir . $file);
72                                         if ($filedata['mtime'] > $newest_file_time) {
73                                                 $newest_file_time = $filedata['mtime'];
74                                                 $newest_file_name = $file;
75                                                 $size = $filedata['size'] / 1024;
76                                         }
77                                 }
78                         }
79                         closedir($dir);
80                 }
81         } else {
82                 $filedata = stat($tmp_dir . $_GET['t']);
83                 $size = $filedata['size'] / AT_KBYTE_SIZE;
84         }
85         // not sure where these are displayed in the progress popup
86         echo '<small>';
87         if ($size == '') {
88                 echo '<em>'._AT('unknown').' </em>  '._AT('kb');
89         } else {
90                 echo number_format($size, 2).' '._AT('kb');
91         }
92         echo '</small>';
93 } ?></td>
94 </tr>
95 </table>
96 <script type="text/javascript">
97 //<!--
98     <?php require_once(AT_INCLUDE_PATH.'../jscripts/ATutor_js.php'); ?>
99 //-->
100 </script>
101 </body>
102 </html>