<?php
/**
 * desc_ro_view.php - Description readonly view
 *
 * @author $Author: wichai $
 * @version $Id: desc_ro_view.php,v 1.32 2011/06/03 11:46:42 wichai Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
*/
?>
<br />
<table width="96%" border="0">
<tr><td><nobr></nobr>
<span style="vertical-align: middle;"><?php
	if ( isset($editmodebutton) ) { ?>
	<input name="editmodebutton" type="button" value="<?php echo $editmodebutton;?>" <?php osa_btn();?>
		onClick="ajaxGetpage('page_content','<?php echo base_url()?>course/desc/edit/<?php @osa_echo($descobj->id); ?>',false);return false;" />
<?php } ?>
</span>
<span style="vertical-align: middle; margin-left:20px;">
<?php
$width = '1000';
$height = '750';
$url_pdf = base_url() . 'pdf/pdfgen/index/' . 'pdf_render_' . 'url_course-desc-indexsess-' .
			  $courseid."-PHPSESSIONID/CourseDescription";
$jscript_pdf = "onClick=\"return openBrowserWindow('$url_pdf')\"";
?>
<input type="button" value="<?php echo lang('desc_button_pdf'); ?>" name="pdf" <?php osa_btn()?>
<?php echo $jscript_pdf;?>  />
<?php if ( isset($show_pdf_private_resource_select) && $show_pdf_private_resource_select ) {
	$privateres_link = base_url() . 'unit/unit/privateres/'?>
	<input type="checkbox" <?php echo $checked_privateres?>
	onClick="ajaxGetpage('','<?php echo $privateres_link?>'+this.checked,true);return true" />
<?php echo lang('unit_no_private_resource_pdf');
}?>
</span>
</td></tr></table>
<span style="margin-left:10px;margin-bottom:10px;font-size:13px;font-weight:bold;vertical-align: middle;"><?php echo lang('desc_header'); ?></span>
<table style="margin-left:15px;margin-right:15px" width="96%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="left" nowrap="nowrap" width="15%"><?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 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>
   </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 $coursename; ?>" id="coursename" name="coursename" />
			<input type="button" style="margin-left:15px"
					value="<?php echo $button; ?>"
					name="button_show" id="hide_button" <?php osa_btn()?>
				    onClick="ajaxPostform('', '<?php echo	 $url; ?>', 'page_content', false);
				    ajaxGetpage('page_content', '<?php echo base_url()."course/desc/index/".$courseid; ?>', false);
				    change_course('<?php echo $courseid; ?>', <?php echo $hidden; ?>);
				    return false;" />
	    	</div>
	    	</td>
	     </tr>
     </table>
   </td>
  </tr>

    <tr>
    <td align="left" nowrap="nowrap"><?php echo lang('desc_grade_level'); ?>:</td>
    <td align="left" >
		<table width="100%" border="0">
		    <tr><td nowrap="nowrap">
				<?php
					if ( isset($gradesobj) && is_array($gradesobj) ) {
					$i=0; $sep='';
						foreach($gradesobj as $grade){ $i++;
							if ( isset($display_grades) && is_array($display_grades) ) {
								foreach ($display_grades as $dgrade) {
									if ( $dgrade->gradeid == $grade->id ) {
										echo "{$sep}{$grade->name}";
										$sep=', ';
										break;
									}
								}
							}
						}
					if ($i==4) {$i=0;$sep=''; echo '<br />';}
					}
				?>
			</td></tr>
		</table>
	</td>
  </tr>
  <tr><td colspan="2"><div style="margin:5px;"><br/></div></td></tr>

  <!-- ///prerequisites  -->
  <?php if (!isset($is_pdf) || $is_pdf != FALSE){?>
		   <?php if (isset($descobj->prerequisites) && $descobj->prerequisites != FALSE ){?>
				 <tr style="height:30px;width:300px;virtical-align:middle;">
				    <td align="left" nowrap="nowrap" class="text1"> <?php echo lang('desc_prerequisites'); ?>:</td>
				    <td align="left" class="text1">
				    <div class="text1"><?php @osa_echo($descobj->prerequisites);?></div>
				    </td>
				  </tr>
		 <?php }?>
  <?php }else{?>
	  	<tr style="height:30px;width:300px;virtical-align:middle;">
		    <td align="left" nowrap="nowrap" class="text1"> <?php echo lang('desc_prerequisites'); ?>:</td>
		    <td align="left" class="text1">
		    	<div class="text1"><?php @osa_echo($descobj->prerequisites);?></div>
		    </td>
	  	</tr>
  <?php }?>

 <!-- ///coursedescription  -->
 <?php if (!isset($is_pdf) || $is_pdf != FALSE){?>
		  <?php if (isset($descobj->coursedescription) && $descobj->coursedescription != FALSE ){?>
			  <tr style="height:30px;virtical-align:middle;">
			    <td align="left" class="text2"><?php echo lang('desc_course_desc'); ?>:</td>
			    <td align="left" class="text2">
			    	<div class="text2"><?php @osa_echo($descobj->coursedescription);?></div>
			    </td>
			  </tr>
  		 <?php }?>
  <?php }else{?>
			   <tr style="height:30px;virtical-align:middle;">
			    <td align="left" class="text2"><?php echo lang('desc_course_desc'); ?>:</td>
			    <td align="left" class="text2">
			    	<div class="text2"><?php @osa_echo($descobj->coursedescription);?></div>
			    </td>
			  </tr>
   <?php }?>

<?php if ( $show_resourcelist ) {?>
 <!-- ///resourcelist  -->
 <?php if (!isset($is_pdf) || $is_pdf != FALSE){?>
		  <?php if (isset($descobj->resourcelist) && $descobj->resourcelist != FALSE ){?>
			  <tr style="height:30px;virtical-align:middle;">
			    <td align="left"  nowrap="nowrap" class="text1"><?php echo lang('desc_resouece_list'); ?>:</td>
			    <td align="left" class="text1">
			    	<div class="text1"><?php @osa_echo($descobj->resourcelist);?></div>
			    </td>
			  </tr>
  		 <?php }?>
  <?php }else{?>
			  <tr style="height:30px;virtical-align:middle;">
			    <td align="left"  nowrap="nowrap" class="text1"><?php echo lang('desc_resouece_list'); ?>:</td>
			    <td align="left" class="text1">
			    	<div class="text1"><?php @osa_echo($descobj->resourcelist);?></div>
			    </td>
			  </tr>
  <?php }?>
<?php } ?>

<?php if ( $show_readings ) {?>
  <!-- ///summerreadings  -->
 <?php if (!isset($is_pdf) || $is_pdf != FALSE){?>
		  <?php if (isset($descobj->summerreadings) && $descobj->summerreadings != FALSE ){?>
			  <tr style="height:30px;virtical-align:middle;">
			    <td align="left"  nowrap="nowrap" class="text2"><?php echo lang('desc_summer_reading'); ?>:</td>
			    <td align="left" class="text2">
			    	<div class="text2"><?php @osa_echo($descobj->summerreadings);?></div>
			    </td>
			  </tr>
  		 <?php }?>
  <?php }else{?>
		  <tr style="height:30px;virtical-align:middle;">
		    <td align="left"  nowrap="nowrap" class="text2"><?php echo lang('desc_summer_reading'); ?>:</td>
		    <td align="left" class="text2">
		    	<div class="text2"><?php @osa_echo($descobj->summerreadings);?></div>
		    </td>
		  </tr>
  <?php }?>
 <?php } ?>
</table>
<?php if ( $show_upload ) { ?>

<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>
<?php }?>
