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