remove old readme
[atutor.git] / themes / simplified-desktop / admin / courses / create_course.tmpl.php
1
2 <?php 
3 global $languageManager,  $_config, $MaxCourseSize, $MaxFileSize;
4
5 ?>
6 <?php //echo _AT('available_immediately'); ?>
7 <form method="post" action="<?php echo $_SERVER['PHP_SELF'];  ?>" name="course_form" enctype="multipart/form-data">
8         <input type="hidden" name="form_course" value="true" />
9         <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_config['prof_pic_max_file_size']; ?>" />
10         <input type="hidden" name="course" value="<?php echo $this->course; ?>" />
11         <input type="hidden" name="old_access" value="<?php echo $this->row['access']; ?>" />
12         <input type="hidden" name="created_date" value="<?php echo $this->row['created_date']; ?>" />
13         <input type="hidden" name="show_courses" value="<?php echo $_GET['show_courses']; ?>" />
14         <input type="hidden" name="current_cat" value="<?php echo $_GET['current_cat']; ?>" />
15         <input type="submit" name="submit" style="display:none;"/>
16
17 <div class="input-form">
18         <fieldset class="group_form"><legend class="group_form"><?php echo _AT('properties'); ?></legend>
19 <?php if ($this->isadmin): ?>
20         <div class="row">
21                 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="inst"><?php echo  _AT('instructor'); ?></label><br />
22                         <?php 
23                         
24                         
25                         if ($instructor_row = mysql_fetch_assoc($this->result)) {
26                                 echo '<select name="instructor" id="inst">';
27                                 do {
28                                         if ($instructor_row['member_id'] == $this->row['member_id']) {
29                                                 echo '<option value="'.$instructor_row['member_id'].'" selected="selected">'.$instructor_row['login'].'</option>';
30                                         } else {
31                                                 echo '<option value="'.$instructor_row['member_id'].'">'.$instructor_row['login'].'</option>';
32                                         }
33                                 } while($instructor_row = mysql_fetch_assoc($this->result));
34                                 echo '</select>';
35                         } else {
36                                 echo '<span id="inst">'._AT('none_found').'</span>';
37                         }
38                         ?>
39         </div>
40 <?php endif; ?>
41
42         <div class="row">
43                 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="title"><?php echo _AT('title'); ?></label><br />
44                 <input type="text" id="title" name="title" size="40" value="<?php echo htmlspecialchars($this->row['title']); ?>" />
45         </div>
46
47         <div class="row">
48                 <label for="pri_lang"><?php  echo _AT('primary_language'); ?></label><br />
49                 <?php $languageManager->printDropdown($this->row['primary_language'], 'pri_lang', 'pri_lang'); ?>
50         </div>
51
52         <div class="row">
53                 <label for="description"><?php echo _AT('description'); ?></label><br />
54                 <textarea id="description" cols="40" rows="2" name="description"><?php echo $this->row['description']; ?></textarea>
55         </div>
56         <?php if ($_config['course_dir_name']): ?>
57         <div class="row">
58                 <label for="course_dir_name"><?php echo _AT('course_dir_name'); ?></label><br />
59                 <input type="text" id="course_dir_name" name="course_dir_name" size="40" value="<?php echo htmlspecialchars($this->row['course_dir_name']); ?>" />
60         </div>
61         <?php endif; ?>
62
63         <?php $categories = get_categories(); ?>
64         <?php if (is_array($categories)): ?>
65                 <div class="row">
66                 <label for="cat"><?php echo _AT('category'); ?></label><br />
67                         <select name="category_parent" id="cat">
68                                 <option value="0">&nbsp;&nbsp;&nbsp;[&nbsp;&nbsp;<?php echo _AT('cats_uncategorized'); ?>&nbsp;&nbsp;]&nbsp;&nbsp;&nbsp;</option>
69                                 <?php select_categories($categories, 0, $this->row['cat_id'], false); ?>
70
71                         </select>
72                 </div>
73         <?php endif; ?>
74
75         <div class="row">
76         <fieldset>
77         <legend><?php  echo _AT('export_content'); ?></legend>
78                 <?php
79                         switch ($this->row['content_packaging']) {
80                                 case 'none':
81                                                 $none = ' checked="checked"';
82                                                 break;
83
84                                 case 'top':
85                                                 $top     = ' checked="checked"';
86                                                 break;
87
88                                 case 'all':
89                                                 $all    = ' checked="checked"';
90                                                 break;
91                         }
92                         ?>
93                 <label for="none" ><input type="radio" name="content_packaging" value="none" id="none" <?php echo $none; ?> /><?php echo _AT('content_packaging_none'); ?></label><br />
94                 <label for="ctop"><input type="radio" name="content_packaging" value="top" id="ctop"  <?php echo $top; ?> /><?php  echo _AT('content_packaging_top'); ?></label><br />
95                 <label for="all"><input type="radio" name="content_packaging" value="all" id="all" <?php echo $all; ?> /><?php  echo _AT('content_packaging_all'); ?></label>
96         </fieldset>
97         </div>
98
99         <div class="row">
100         <fieldset>
101                 <legend><?php echo _AT('syndicate_announcements'); ?></legend>
102                 <?php
103                                 $rss_no = $rss_yes = '';
104
105                                 if ($this->row['rss']) {
106                                         $rss_yes = ' checked="checked"';
107                                 } else {
108                                         $rss_no = ' checked="checked"';
109                                 }
110                 ?>
111                 <label for="rss_y"><input type="radio" name="rss" value="1" id="rss_y" <?php echo $rss_yes; ?> /><?php echo _AT('enable_syndicate'); ?></label><br />
112                 <label for="rss_n"><input type="radio" name="rss" value="0" id="rss_n"  <?php echo $rss_no; ?> /><?php  echo _AT('disable_syndicate'); ?></label>
113         </fieldset>
114         </div>
115
116         <div class="row">
117         <fieldset>
118                 <legend><?php echo _AT('access'); ?></legend>
119                 <?php
120                                 switch ($this->row['access']) {
121                                         case 'public':
122                                                         $pub = ' checked="checked"';
123                                                         $disable = 'disabled="disabled"'; // disable the nofity box
124                                                         break;
125
126                                         case 'protected':
127                                                         $prot    = ' checked="checked"';
128                                                         $disable = 'disabled="disabled"'; // disable the nofity box
129                                                         break;
130
131                                         case 'private':
132                                                         $priv   = ' checked="checked"';
133                                                         break;
134                                 }
135
136                                 if ($this->row['notify']) {
137                                         $notify = ' checked="checked"';
138                                 }
139
140                                 if ($this->row['hide']) {
141                                         $hide = ' checked="checked"';
142                                 }
143                 ?>
144                 <input type="radio" name="access" value="public" id="pub" onclick="disableNotify();" <?php echo $pub; ?> /><label for="pub"><strong> <?php echo  _AT('public'); ?>: </strong></label><?php echo  _AT('about_public'); ?><br /><br />
145
146                 <input type="radio" name="access" value="protected" id="prot" onclick="disableNotify();" <?php echo $prot; ?> /><label for="prot"><strong><?php echo  _AT('protected'); ?>:</strong></label> <?php echo _AT('about_protected'); ?><br /><br />
147
148                 <input type="radio" name="access" value="private" id="priv" onclick="enableNotify();" <?php echo $priv; ?> /><label for="priv"><strong><?php echo  _AT('private'); ?>:</strong></label> <?php echo  _AT('about_private'); ?><br />
149                 <input type="checkbox" name="notify" id="notify" value="1" <?php
150                         echo $disable;
151                         echo $notify; ?> /><label for="notify"><?php echo  _AT('email_approvals'); ?></label>
152                 <br />
153                 <input type="checkbox" name="hide" id="hide" value="1" <?php
154                 echo $disable;
155                 echo $hide; ?> /><label for="hide"><?php echo  _AT('hide_course'); ?></label>.
156         </fieldset>
157         </div>
158
159         <div class="row">
160         <fieldset>
161                 <legend><?php echo _AT('release_date'); ?></legend>
162                 <?php
163                         $rel_no = $rel_yes = '';
164
165                         if (intval($this->row['release_date'])) {
166                                 $rel_yes = ' checked="checked"';
167
168                                 $today_day   = substr($this->row['release_date'], 8, 2);
169                                 $today_mon   = substr($this->row['release_date'], 5, 2);
170                                 $today_year  = substr($this->row['release_date'], 0, 4);
171
172                                 $today_hour  = substr($this->row['release_date'], 11, 2);
173                                 $today_min   = substr($this->row['release_date'], 14, 2);
174                         } else {
175                                 $rel_no = ' checked="checked"'; 
176                                 $today_year  = date('Y');
177                         }
178
179                 ?>
180
181                 <input type="radio" name="release_date" value="0" id="release_now" <?php echo $rel_no; ?> /> <label for="release_now"><?php echo _AT('available_immediately'); ?></label><br />
182
183
184                 <input type="radio" name="release_date" value="1" id="release_later" <?php echo $rel_yes; ?> /> <label for="release_later"><?php echo _AT('release_on'); ?></label> 
185                 <?php
186                         $name = '_release';
187                         require(AT_INCLUDE_PATH.'html/release_date.inc.php');
188                 ?>
189         </fieldset>     
190         </div>
191
192         <div class="row">
193         <fieldset><legend>
194                 <?php echo _AT('end_date'); ?></legend>
195                 <?php
196                         $end_no = $end_yes = '';
197
198                         if (intval($this->row['end_date'])) {
199                                 $end_yes = ' checked="checked"';
200
201                                 $today_day   = substr($this->row['end_date'], 8, 2);
202                                 $today_mon   = substr($this->row['end_date'], 5, 2);
203                                 $today_year  = substr($this->row['end_date'], 0, 4);
204
205                                 $today_hour  = substr($this->row['end_date'], 11, 2);
206                                 $today_min   = substr($this->row['end_date'], 14, 2);
207                         } else {
208                                 $end_no = ' checked="checked"'; 
209                                 $today_year  = date('Y')+1;
210                         }
211
212                 ?>
213
214                 <input type="radio" name="end_date" value="0" id="end_now" <?php echo $end_no; ?> /> <label for="end_now"><?php echo _AT('no_end_date'); ?></label><br />
215
216                 <input type="radio" name="end_date" value="1" id="end_later" <?php echo $end_yes; ?> /> <label for="end_later"><?php echo _AT('end_on'); ?></label> 
217                 <?php
218                         $name = '_end';
219                         require(AT_INCLUDE_PATH.'html/release_date.inc.php');
220                 ?>
221                 </fieldset>
222         </div>
223
224         <div class="row">
225                 <?php
226                         if (($_POST['setvisual'] && !$_POST['settext']) || $_GET['setvisual']){
227                                 echo '<input type="hidden" name="setvisual" value="'.$_POST['setvisual'].'" />';
228                                 echo '<input type="submit" name="settext" value="'._AT('switch_text').'"  class="button"/>';
229                         } else {
230                                 echo '<input type="submit" name="setvisual" value="'._AT('switch_visual').'" class="button"/>';
231                         }
232                 ?>
233         </div>
234         <div class="row">
235
236                 <label for="banner"><?php echo _AT('banner'); ?></label><br />
237                 <textarea id="banner" cols="40" rows="15" name="banner"><?php echo $this->row['banner']; ?></textarea>
238         </div>
239 <!-- FIX  -->
240 <?php if (!$this->course) : ?>
241         <div class="row">
242                 <label for="initial_content"><?php echo _AT('initial_content'); ?></label><br />
243                 <select name="initial_content" id="initial_content" size="5">
244                         <option value="0"><?php echo _AT('empty'); ?></option>
245                         <option value="1" selected="selected"><?php echo _AT('create_basic'); ?></option>
246                         <?php 
247                         
248                         if ($course_row = mysql_fetch_assoc($result)) {
249                                 do {
250                                         $Backup->setCourseID($course_row['course_id']);
251                                         $list = $Backup->getAvailableList();
252
253                                         if (!empty($list)) { 
254                                                 echo '<optgroup label="'. _AT('restore').': '.$course_row['title'].'">';
255                                                 foreach ($list as $list_item) {
256                                                         echo '<option value="'.$list_item['backup_id'].'_'.$list_item['course_id'].'">'.$list_item['file_name'].' - '.get_human_size($list_item['file_size']).'</option>';
257                                                 }
258                                                 echo '</optgroup>';
259                                         }
260                                 } while ($course_row = mysql_fetch_assoc($result));
261                         }
262                         ?>
263                         </select>
264         </div>
265 <?php endif; // !$course_id ?>
266
267 <?php if ($this->isadmin) : ?>
268         <div class="row">
269                 <?php  echo _AT('course_quota'); ?><br />
270                 <?php 
271                         if ($this->row['max_quota'] == AT_COURSESIZE_UNLIMITED) { 
272                                 $c_unlim = ' checked="checked" ';
273                                 $c_oth2 = ' disabled="disabled" ';
274                         } elseif ($this->row['max_quota'] == AT_COURSESIZE_DEFAULT) {
275                                 $c_def = ' checked="checked" ';
276                                 $c_oth2 = ' disabled="disabled" ';
277                         } else {
278                                 $c_oth = ' checked="checked" ';
279                                 $c_oth2 = '';
280                         }
281
282                         if ($this->course > 0) {
283                                 $course_size = dirsize(AT_CONTENT_DIR . $this->course.'/');
284                         } else {
285                                 $course_size = 0;
286                         }
287
288                         if ($this->course) {
289                                 echo _AT('current_course_size') .': '.get_human_size($course_size).'<br />'; 
290                         }
291                 ?>
292
293                 <input type="radio" id="c_default" name="quota" value="<?php echo AT_COURSESIZE_DEFAULT; ?>" onclick="disableOther();" <?php echo $c_def;?> /><label for="c_default"> <?php echo _AT('default') . ' ('.get_human_size($MaxCourseSize).')'; ?></label> <br />
294                 <input type="radio" id="c_unlim" name="quota" value="<?php echo AT_COURSESIZE_UNLIMITED; ?>" onclick="disableOther();" <?php echo $c_unlim;?>/><label for="c_unlim"> <?php echo _AT('unlimited'); ?></label> <br />
295                 <input type="radio" id="c_other" name="quota" value="2" onclick="enableOther();" <?php echo $c_oth;?>/><label for="c_other"> <?php echo _AT('other'); ?> </label> - 
296                 <label for="quota_entered">Quota Entered</label>
297                 <input type="text" id="quota_entered" name="quota_entered" <?php echo $c_oth2?> value="<?php if ($this->row['max_quota']!=AT_COURSESIZE_UNLIMITED && $this->row['max_quota']!=AT_COURSESIZE_DEFAULT) { echo bytes_to_megabytes($this->row['max_quota']); } ?>" size="4" /> <?php echo _AT('mb'); ?>
298         </div>
299
300         <div class="row">
301                 <?php  echo _AT('max_file_size'); ?><br />
302                 <?php 
303                         $max_allowed = megabytes_to_bytes(substr(ini_get('upload_max_filesize'), 0, -1));
304
305                         if ($this->row['max_file_size'] == AT_FILESIZE_DEFAULT) { 
306                                 $f_def = ' checked="checked" ';
307                                 $f_oth2 = ' disabled="disabled" ';
308                         } elseif ($this->row['max_file_size'] == AT_FILESIZE_SYSTEM_MAX) {
309                                 $f_max = ' checked="checked" ';
310                                 $f_oth2 = ' disabled="disabled" ';
311                         } else {
312                                 $f_oth = ' checked="checked" ';
313                                 $f_oth2 = '';
314                         }
315                 ?>
316                 <input type="radio" id="f_default" name="filesize" value="<?php echo AT_FILESIZE_DEFAULT; ?>" onclick="disableOther2();" <?php echo $f_def;?> /><label for="f_default"> <?php echo _AT('default') . ' ('.get_human_size($MaxFileSize).')'; ?></label> <br />
317                 <input type="radio" id="f_maxallowed" name="filesize" value="<?php echo AT_FILESIZE_SYSTEM_MAX; ?>" onclick="disableOther2();" <?php echo $f_max;?>/><label for="f_maxallowed"> <?php echo _AT('max_file_size_system') . ' ('.get_human_size($max_allowed).')'; ?></label> <br />
318                 <input type="radio" id="f_other" name="filesize" value="2" onclick="enableOther2();" <?php echo $f_oth;?>/><label for="f_other"> <?php echo _AT('other'); ?> </label> - 
319                 <label for="filesize_entered">Filesize entered</label>
320                 <input type="text" id="filesize_entered" name="filesize_entered" <?php echo $f_oth2?> value="<?php if ($this->row['max_file_size']!=AT_FILESIZE_DEFAULT && $this->row['max_file_size']!=AT_FILESIZE_SYSTEM_MAX) { echo bytes_to_megabytes($this->row['max_file_size']); } ?>" size="4" /> <?php echo _AT('mb'); ?>
321         </div>
322
323 <?php else: ?>
324         <input type="hidden" name="quota" value="<?php echo $this->row['max_quota']; ?>" />
325         <input type="hidden" name="filesize" value="<?php echo $this->row['max_file_size']; ?>" />
326         <input type="hidden" name="tracking" value="<?php echo $this->row['tracking']; ?>" />
327 <?php endif; ?>
328
329         <div class="row">
330                 <label for="copyright"><?php echo _AT('course_copyright'); ?></label><br />
331                 <textarea name="copyright" rows="2" cols="40" id="copyright"><?php echo $this->row['copyright']; ?></textarea>
332         </div>
333         <div class="row">
334                 <?php 
335             if ($this->row['icon'] != ''): 
336                 $path = AT_CONTENT_DIR.$this->row['course_id']."/custom_icons/";
337                 if (file_exists($path.$this->row['icon'])) {
338                     if (defined('AT_FORCE_GET_FILE') && AT_FORCE_GET_FILE) {
339                         $custom_icon_path = 'get_course_icon.php/?id='.$this->row['course_id'];
340                     } else {
341                         $_base_href = 'content/' . $this->row['course_id'] . '/';
342                     }
343                 } else {
344                     $_base_href = "images/courses/";    //$_base_href = 'get_course_icon.php/?id='.$row['course_id'];
345                 }
346
347             $force_get = (defined('AT_FORCE_GET_FILE') && AT_FORCE_GET_FILE) ? true : false;
348             echo "<input type='hidden' name='boolForce' id='boolForce' value='$force_get' />";
349         
350        //include(AT_INCLUDE_PATH.'html/course_icon.inc.php');        
351         ?>
352                 <img id="i0" src="<?php echo ($custom_icon_path=='')?$_base_href.$this->row['icon']:$custom_icon_path; ?>" alt="<?php echo $this->row['icon']; ?>" border="1" height="79" width="79"  />
353
354                 <?php else: ?>
355                         <img id="i0" src="images/clr.gif" alt="" border="1" height="79" width="79"  />
356                         <input type='hidden' name='boolForce' id='boolForce' value='' />
357                 <?php endif; ?>
358                 <div>
359                 <label for="icons"><?php echo _AT('icon'); ?></label><br />
360                 <select name="icon" id="icons" onchange="SelectImg()">
361                         <option value=""><?php echo _AT('no_icon'); ?></option>
362             <?php // ------------- custom course icons
363                 $path = AT_CONTENT_DIR.$this->row['course_id']."/custom_icons/";
364                 $boolCustom = false;
365                 $optCount = 0;
366
367                 if (is_dir($path)) {
368                     $boolCustom = true;  // true if custom icons are uploaded, otherwise false
369                     
370                     /*$files = scandir($path);  //SCANDIR STOPS ATUTOR WHEN RUN AS INSTRUCTOR, BUT NOT AS ADMIN. WHY? -Gorzan */
371                     
372                     /* PHP 4 REPLACEMENT FOR SCANDIR */
373                                         $dh  = opendir($path);
374                                         while (false !== ($filename = readdir($dh))) {
375                                                 $files[] = $filename;
376                                         }
377
378                                         /*END PHP 4 REPLACEMENT FOR SCANDIR*/
379                     echo "<optgroup label='"._AT('custom_icons')."'>";
380                     foreach($files as $val) {
381                                                 $file_ext = substr(strtolower($val), -3);
382                         if ($file_ext == "jpg" || $file_ext == "png" || $file_ext == "gif") {
383                             $optCount++;
384                             echo "<option value='".$val."'";
385                             if ($val == $this->row['icon']) {
386                                 echo 'selected="selected"';
387                             }
388                             echo ">".$val."</option>";
389                         }
390                     }
391                     echo "</optgroup>";
392                 }
393                 
394             ?>
395                         <?php // ------------- other icons
396
397                                 $course_imgs = array();
398                                 if ($dir = opendir(AT_INCLUDE_PATH.'../images/courses/')) {
399                                         while (false !== ($file = readdir($dir)) ) {
400                                                 if( ($file == '.') || ($file == '..')) { 
401                                                         continue;
402                                                 }
403                                                 $course_imgs[] = $file;
404                                         }               
405                                         closedir($dir); 
406                                 }
407                                 sort($course_imgs);
408                 if ($boolCustom == true) {
409                     echo "<optgroup label='"._AT('builtin_icons')."'>";
410                 }
411                                 foreach ($course_imgs as $file) {
412                                         echo '<option value="' . $file . '" ';
413                                         if ($file == $this->row['icon']) { 
414                                                 echo 'selected="selected"'; 
415                                         }
416                                         echo ' >' . $file . '</option>';        
417                                 }
418                 if ($boolCustom == true) {
419                     echo "</optgroup>";
420                 }
421                         ?>
422                 </select><?php echo "&nbsp;&nbsp;&nbsp; "._AT('or'); echo "<br />"?>
423         </div>
424     
425             <?php echo _AT('upload_icon'); ?><br />
426                 <label for="customicon"><input type="file" name="customicon" title="custom icon" id="customicon" value="<?php echo $_POST['customicon']; ?>"/></label><br />
427                 <small><?php echo _AT('upload_icon_text'); ?></small>
428        
429         <?php  //require_once(AT_INCLUDE_PATH.'../mods/_core/courses/html/course_icon.inc.php'); ?>
430
431         <br />
432
433         </div>
434
435    
436         <div class="buttons">
437
438                 <?php
439             echo "<input type='hidden' name='custOptCount' id='custOptCount' value='".$optCount."' />";
440             echo "<input type='hidden' name='courseId' id='courseId' value='".$this->row['course_id']."' />";
441                 ?>
442
443                 <input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s" /> 
444                 <input type="submit" name="cancel" value="<?php echo _AT('cancel');?>" />
445         </div>
446     </fieldset>
447 </div>
448
449 </form>