<!-- page title -->
<header id="page-header">
	<h1>Update Course</h1>
	<ol class="breadcrumb">
		<li>Courses</li>
		<li class="active"><?php echo $course->courseName;   ?></li>
	</ol>
</header>
<div class="col-sm-12">
<?php if($saved){
	if($success>0){ ?>
	 <center>&#9432; Course updated</center>
	<?php }else{ ?>
	<center>&#xf071; Failed.Try again!  </center>
 <?php }} ?>
</div>

<div class="panel panel-default">
	

		<div class="panel-body">

			<form method="post" action="<?php echo base_url('updatecourse');   ?>" enctype = "multipart/form-data" data-success="Sent! Thank you!" data-toastr-position="top-right">

				<input type="hidden" name="courseid"  value="<?php echo $course->courseID;   ?>"/>


				<div class="row">
					<div class="form-group">
						<div class="col-md-6 col-sm-6">
							<label>Category</label>
							<select name="category" id="demo-category" class="form-control" required>
								<option value="">- Select Category -</option>
	                            <?php foreach($cats as $cat):?>
								<option value=<?php echo $cat['facultyID'];   ?>
									<?php  if($cat['facultyID']==$course->facultyID){ echo "SELECTED"; }           ?>
									><?php echo $cat['facultyName'];   ?>
								</option>
									 <?php endforeach; ?>
							</select>
						</div>
					
					<div class="col-md-6 col-sm-6">
						<label>Course Name</label>
						<input type="text" name="coursename" class="form-control" id="demo-name" value="<?php echo $course->courseName;   ?>" placeholder="Course Name" required />
					</div>
				</div>
			</div>
			<div class="row">

				<div class="form-group">
				<div class="col-sm-6- col-sm-6">
					<label>Image</label>
					<div class="fancy-file-upload fancy-file-success">
						<i class="fa fa-upload"></i>
						<input type="file" id="files" class="form-control" name="image" onchange="jQuery(this).next('input').val(this.value);">
						<input type="text" class="form-control" placeholder="no file selected" readonly="">
						<span class="button">Choose File</span>
					</div>
				</div><br>
			</div>
		</div>
			<div class="row">

					<div class="form-group">
                    <div class="col-sm-12">
                    	<label>Description</label>
						<textarea name="introtext" id="editor" class="form-control summernote"  placeholder=""  ><?php echo $course->introText;   ?></textarea>
					</div>
                   </div>
               </div>
               <div class="row">
                   <div class="form-group">
                   	
					<div class="col-sm-6 col-sm-6">
						<label>Duration</label>
						<input type="text" name="duration" class="form-control" id="demo-name" value="<?php echo $course->duration;   ?>" placeholder="Duration" required/>
					</div>


					<div class="col-sm-6 col-sm-6">
						<label>Duration in:</label>
						<select name="durationtype" class="form-control" id="demo-category" required>
							<option value="">- Duration in -</option>
							<option value="1" <?php if($course->durationType==1){ echo "SELECTED";} ?>>Days</option>
							<option value="2" <?php if($course->durationType==2){ echo "SELECTED";} ?>>Weeks</option>
							<option value="3" <?php if($course->durationType==3){ echo "SELECTED";} ?>>Months</option>
							<option value="4" <?php if($course->durationType==4){ echo "SELECTED";} ?>>Years</option>


						</select>
					</div>
				</div>
			</div>

					<!--
                    <div class="col-12">
						<textarea name="targetgroup" id="demo-message" placeholder="Target Group" rows="2" ><?php echo $course->targetAudience;   ?></textarea>
					</div>
					<div class="col-12">
						<textarea name="methodology" id="demo-message" placeholder="Methodology" rows="4" ><?php echo $course->methodology;   ?></textarea>
					</div>
					<div class="col-12">
						<textarea name="objectives" id="demo-message" placeholder="Course Objectives (use comma to separate them)" rows="4" ><?php echo $course->courseObjectives;   ?></textarea>
					</div>
                    -->


					<!-- Break -->

					<div class="row">
				<div class="form-group">

					<div class="col-sm-6 col-sm-6">
						<label>Fees in KSh</label>
						<input type="text"  class="form-control" name="feekshs" id="demo-name" value="<?php echo $course->feeKshs;   ?>" placeholder="Fee in Kshs" required />
					</div>

					<div class="col-sm-6 col-md-6">
						<label>Fees in USD</label>
						<input type="text" class="form-control" name="feeusd" id="demo-email" value="<?php echo $course->feeUsd;   ?>" placeholder="Fee in USD" required />
					</div>
				</div>
			</div>

<!--
					<div class="col-12">
						<h4>Course Contents</h4>
					</div>
					<?php
					$itemone="nini";
					$itemsone="";
					$itemtwo="";

					$itemstwo="";
					$itemthree="";
					$itemsthree="";
					$itemfour="";
					$itemsfour="";

					if($contents && $contents[0]){
						$itemone=$contents[0]['outlineItem'];
						$itemsone=$contents[0]['outlineItems'];
					}
					if($contents && $contents[1]){
						$itemtwo=$contents[1]['outlineItem'];
						$itemstwo=$contents[1]['outlineItems'];
					}
					if($contents && $contents[2]){
						$itemthree=$contents[2]['outlineItem'];
						$itemsthree=$contents[2]['outlineItems'];
					}
					if($contents && $contents[3]){
						$itemfour=$contents[3]['outlineItem'];
						$itemsfour=$contents[3]['outlineItems'];
					}








					 ?>



					<div class="col-6 col-12-xsmall">
						<input type="text" name="moduleone" id="demo-name"  value="<?php echo $itemone;   ?>"  placeholder="MODULE 1:TOPIC TITLE" />
					</div>
					<div class="col-12">
						<textarea name="moduleoneitems" id="demo-message" placeholder="Module Items (use comma to separate them)" rows="4"><?php echo $itemsone;   ?></textarea>
					</div>
					<div class="col-6 col-12-xsmall">
						<input type="text" name="moduletwo" id="demo-name" value="<?php echo $itemtwo;   ?>" placeholder="MODULE 2:TOPIC TITLE" />
					</div>
					<div class="col-12">
						<textarea name="moduletwoitems" id="demo-message" placeholder="Module Items (use comma to separate them)" rows="4"><?php echo $itemstwo;   ?></textarea>
					</div>
					<div class="col-6 col-12-xsmall">
						<input type="text" name="modulethree" id="demo-name" value="<?php echo $itemthree;   ?>" placeholder="MODULE 3:TOPIC TITLE" />
					</div>
					<div class="col-12">
						<textarea name="modulethreeitems" id="demo-message" placeholder="Module Items (use comma to separate them)" rows="4"><?php echo $itemsthree;   ?></textarea>
					</div>
					<div class="col-6 col-12-xsmall">
						<input type="text" name="modulefour" id="demo-name" value="<?php echo $itemfour;   ?>" placeholder="MODULE 4:TOPIC TITLE" />
					</div>
					<div class="col-12">
						<textarea name="modulefouritems" id="demo-message" placeholder="Module Items (use comma to separate them)" rows="4"><?php echo $itemsfour;   ?></textarea>
					</div>
-->
					<!-- Break -->

					<!-- Break -->
					<div class="row">
						<div class="col-md-12">
							<button type="submit" class="btn btn-3d btn-teal btn-xlg btn-block margin-top-30">
								Update Course
							</button>
						</div>
					</div>
				</div>
			</form>

		</div>

	</div>


