<?php
/**
 * desc_edit_view.ph - Description edit view
 *
 * @author $Author: dtong $
 * @version $Id: desc_edit_view.php,v 1.30 2011/04/27 05:46:26 dtong Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
*/
?>

<br />
<div style="margin-left:10px;margin-bottom:10px;font-weight:bold"><?php echo lang('desc_header'); ?></div>
<form name="editcouresdes_form" >
<input type="hidden" name="courseid" value="<?php @osa_echo($courseid);?>">
<input type="hidden" name="descid" value="<?php @osa_echo($descobj->id);?>">
<input type="hidden" name="editorid" value="<?php @osa_echo($editorids);?>">
<table style="margin-left:15px;" border="0">
  <tr>
    <td align="left"  nowrap="nowrap" width="110"><?php echo lang('desc_course_name'); ?>:</td>
    <td align="left"  nowrap="nowrap" style="font-weight:bold"><?php @osa_echo($coursename);?></td>
 	</tr>
 	<tr>
    <td align="left"  nowrap="nowrap"><?php echo lang('desc_departmentname'); ?>:</td>
    <td align="left"  nowrap="nowrap" style="font-weight:bold"><?php @osa_echo($department);?></td>
 	</tr>
  <tr>
    <td align="left" valign="middle" nowrap="nowrap" <?php if ($canchangeeditor) echo 'class="required"';?>>
    	<?php echo lang('desc_editor_name');?>:</td>
   <td align="left" valign="middle" style="font-weight:bold" nowrap="nowrap">
    	<div id='editornames' style="display:inline;vertical-align:middle;"><?php @osa_echo($editornames);?></div>
    	 <?php if ($canchangeeditor) { ?>
       	<input name="editorbutton" type="button" value="<?php echo @$editorbutton; ?>"
       				onclick="JavaScript:newDhtmlWindow('<?php echo base_url()."course/desc/course_editor"?>'
       		 + '/<?php @osa_echo($courseid);?>'+'/<?php @osa_echo($descobj->id);?>',
       			  	  '<?php echo lang('desc_seleditor_wintitle');?>','600','450','course_input');"
       			  	  <?php osa_btn();?>
       		style="margin-left:10px;vertical-align:middle;" />
       			  	  <!--
       			  	  	onclick="JavaScript:newDhtmlWindow('<?php echo base_url()."course/desc/seleditor/"?>'
       		+ document.editcouresdes_form.editorid.value + '/<?php @osa_echo($courseid);?>',
       			  	  '<?php echo lang('desc_seleditor_wintitle');?>','320','310','changeteacher_div');"
       			  	  <?php osa_btn();?>
       			  	  -->
       <?php }?>
   </td>
  </tr>
    <tr>
    <td height="49" align="left" nowrap="nowrap" class="required"><?php echo lang('desc_grade_level'); ?>:</td>
    <td align="left" >
		<table style="padding:5px;border:2px solid #CCCCCC;">
		    <tr><td nowrap="nowrap">
				<?php
					if ( isset($gradesobj) && is_array($gradesobj) ) {
					$i=0;
					foreach($gradesobj as $grade){ $i++; ?>
					<input type="checkbox" name="gradeid_<?php echo $grade->id;?>" value="<?php echo $grade->id;?>" <?php
						if (!$this->config->item('cms_multiple_grade_display')) echo 'onClick="return allowOneCheckBox(this)" ';
						if ( $display_grades ) {
							if ( isset($display_grades) && is_array($display_grades) ) {
								foreach ($display_grades as $dgrade) {
									if ( $dgrade->gradeid == $grade->id ) {
										echo "checked";
										break;
									}
								}
							}
						}
						?> />
					<?php echo $grade->name; ?>&nbsp;&nbsp;&nbsp;
				<?php if ($i==4) {$i=0; echo '<br />';}
					} } ?>
			</td></tr>
		</table>
	</td>
  </tr>

<tr>
   <td  valign="middle" align="left" nowrap="nowrap"><?php echo lang('desc_course_hidden'); ?>:</td>
    <td valign="middle" align="left" nowrap="nowrap" >
     <table>
	     <tr>
	     	<td>
	      	<span class="show"><?php echo $label; ?></span>
	     	</td>
	     	<td valign="middle" align="left" nowrap="nowrap" >
	     	<div id="div_hidden" style="<?php echo $coursehide;?>">
			<input type="hidden"
					value="<?php echo $button; ?>"
					name="button_show" <?php osa_btn()?>
				    onClick="ajaxPostform('', '<?php echo $url; ?>', 'page_content', false);
				    ajaxGetpage('page_content', '<?php echo base_url()."course/desc/index/".$courseid; ?>', false);
				    return false;" />
	    	</div>
	    	</td>
	     </tr>
     </table>
   </td>
</tr>

  <tr>
    <td align="left" nowrap="nowrap"> <?php echo lang('desc_prerequisites'); ?>:</td>
    <td align="left" nowrap="nowrap">
    <textarea cols="100" rows="5" class="txtarea" id="prerequisites"
    	name="prerequisites"><?php @osa_echo($descobj->prerequisites);?></textarea>
    </td>
  </tr>
  <tr>
    <td align="left" nowrap="nowrap"> <?php echo lang('desc_course_desc'); ?>:</td>
    <td align="left">
    <textarea cols="100" rows="5" class="txtarea" id="coursedescription"
    	name="coursedescription"><?php @osa_echo($descobj->coursedescription);?></textarea></td>
  </tr>
  <?php if ( $show_resourcelist ) {?>
  <tr>
    <td align="left"  nowrap="nowrap"> <?php echo lang('desc_resouece_list'); ?>:</td>
    <td align="left"  nowrap="nowrap">
    <textarea cols="100" rows="5" class="txtarea" id="resourcelist"
    	name="resourcelist"><?php @osa_echo($descobj->resourcelist);?></textarea></td>
  </tr>
  <?php }?>
  <?php if ( $show_readings ) {?>
  <tr>
    <td align="left"  nowrap="nowrap"> <?php echo lang('desc_summer_reading'); ?>:</td>
    <td align="left"  nowrap="nowrap">
    <textarea cols="100" rows="5" class="txtarea" id="summerreadings"
    	name="summerreadings"><?php @osa_echo($descobj->summerreadings);?></textarea></td>
  </tr>
  <?php } ?>
  <tr>
  	<td colspan="2" align="center" style="font-size:9px"><span class="required">Red</span>=Required</td>
  </tr>
  <tr>
  	<td colspan="2" align="center"><br />
  		<input type="button" value="<?php echo lang('desc_button_cancel'); ?>"
  			onClick="return cancelInput('page_content',
  				'<?php  echo base_url()?>course/desc/<?php echo $cancelaction;?>/<?php @osa_echo($cancel_id);?>'
  				);" <?php osa_btn();?>/>
  		<span style="margin:0px;margin-left:20px;"></span>
  		<input type="button" value="<?php echo $savebutton; ?>"
  			onClick="saveCourseDesc('page_content',
  				'<?php  echo base_url()?>course/desc/<?php echo $action;?>/<?php @osa_echo($courseid);?>',
  				'editcouresdes_form'); reload_node();" <?php osa_btn();?>/>
  	</td>
  </tr>
</table>
</form>
<?php if ( $show_upload ) { ?>
<center>
<div class="course_desc_upload">
<?php echo lang('desc_course_resources');
	if ( isset($resources) && !empty($resources) ) {
		echo "<center><div class=\"course_desc_upload_html\">";
		osa_echo($resources);
		echo "</div></center>";
	}?>
</div></center>
<?php }?>