Uname:Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64

403WebShell
403Webshell
Server IP : 188.114.97.2  /  Your IP : 104.23.197.230
Web Server : Apache/2.4.59 (Debian)
System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
User : edlftp ( 1002)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/git/sms.edl.codes.solutions/application/views/backend/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/git/sms.edl.codes.solutions/application/views/backend/course.php
<?php
/*********************
 *********************
 Indian template : "old_course.php"
 template fix 19 mars 2019
 Aernout Guillaume
 *********************
 *********************/
 ?>
 <hr />
 <div class="row">
 	<div class="col-md-12">

     	<!------CONTROL TABS START------>
 		<ul class="nav nav-tabs bordered">
 			<li class="active" id="tabList">
             	<a href="#list" data-toggle="tab"><i class="entypo-menu"></i>
 					<?php echo get_phrase('class_list');?>
                     	</a></li>
 			<li id="tabAdd">
             	<a href="#add" data-toggle="tab"><i class="entypo-plus-circled"></i>
 					<?php echo get_phrase('add_course');?>
                     	</a></li>
      <li id="tabEdit">
              <a href="#edit" data-toggle="tab"><i class="entypo-feather"></i>
                <?php echo get_phrase('edit_course');?>
                            </a></li>
      <li id="tabConfirm">
              <a href="#confirm" data-toggle="tab"><i class="entypo-lock"></i>
               <?php echo get_phrase('confirm_lesson');?>
              </a>
      </li>
 		</ul>
     	<!------CONTROL TABS END------>

 		<div class="tab-content">
         <br>
             <!----TABLE LISTING STARTS-->
             <div class="tab-pane box active" id="list">

                 <table class="table table-bordered datatable" id="table_export">
                 	<thead>
                 		<tr>
                     		<th><div>#</div></th>
                     		<th><div><?php echo get_phrase('course_name');?></div></th>
                     		<!--<th><div><?php echo get_phrase('numeric_name');?></div></th>:Obsolete-->
                     		<th><div><?php echo get_phrase('teachers_List');?></div></th>
                        <th><div><?php echo get_phrase('student_List');?></div></th>
                        <th><div><?php echo get_phrase('#students');?></div>
                        <th><div><?php echo get_phrase('date_start');?></div></th>
                        <th><div><?php echo get_phrase('date_end');?></div></th></th>
                        <th><div><?php echo get_phrase('hour_total');?></div></th>
                        <th><div><?php echo get_phrase('hour_remaining');?></div></th>
                        <th><div><?php echo get_phrase('age_interval');?></div></th>
 						</tr>
 					</thead>
                     <tbody>
                      <?php /* print_r($course_list); */?>
                     	<?php $count = 1;foreach($course_list as $row):

                        if(!isset($teacherId)){
                          $teacherId = "431";
                        }
                        //var_dump($teacher)
                        ?>
                         <tr>
                            <td><?php echo $count++;?></td>
               							<td><span class="btn btn-default"  onclick="showEdit('<?php echo $row['ID']; ?>')"><?php echo $row['CourseName'];?></span></td>
               							<td>
                              <?php
                              $teacherList = $this->crud_model->get_teacher($row['ID']);
                              if(!empty($teacherList)){
                              foreach($teacherList as $teacher):
                              ?>
                                <a class="btn btn-default" href="/teacher/index/edit/<?php echo $teacher['teacher_id']?>"><?php echo $this->crud_model->get_teacher_name($teacher['teacher_id']);?></a>
                              <?
                              endforeach;
                              }
                              else{
                              ?>
                                  <a class="btn btn-danger" href="">Default Teacher</a>
                              <? }?>
                              <span class="btn btn-info" onclick="window.location.replace('/lesson/index/add/109')">add +</span>
                            </td>
                            <td>

                                <?php
                                $studentList = $this->crud_model->get_students($row['ID']);
                                if(!empty($studentList)){
                                foreach($studentList as $student):
                                ?>
                                  <a class="btn btn-default" href="/student/index/edit/<?php echo $student['student_id']?>"><?php echo $this->crud_model->get_student_name($student['student_id']);?></a>
                                <?
                                endforeach;
                                }
                                else{
                                ?>
                                    <a class="btn btn-default" href="">No Students</a>
                                <? }?>
                                <span class="btn btn-info" onclick="window.location.replace('/lesson/index/add/109')">add +</span>

                            </td>
                            <td><?php echo $this->crud_model->get_students_count($row['ID']);?></td>
                            <td><?php print_r($this->crud_model->get_course_start($row['ID']));?></td>
                            <td><?php echo $this->crud_model->get_course_end($row['ID']);?></td>
                            <td><?php echo $this->crud_model->get_course_hours_total($row['ID']);?></td>
                            <td><?php echo $this->crud_model->get_course_hours_remain($row['ID']);?></td>
                            <td><?php  print_r($this->crud_model->get_students_age_interval($row['ID']));?></td>
                         </tr>
                         <?php endforeach;?>
                     </tbody>
                 </table>
 			</div>
             <!----TABLE LISTING ENDS--->


 			<!----CREATION FORM STARTS---->
 			<div class="tab-pane box" id="add" style="padding: 5px">
                 <div class="box-content">
                 	<?php echo form_open(base_url() . 'index.php?CoursesNew/save' , array('class' => 'form-horizontal form-groups-bordered validate','target'=>'_top', 'id'=>'create-form'));?>
                         <div class="padded">
                             <div class="form-group">
                                 <label class="col-sm-3 control-label"><?php echo get_phrase('name');?></label>
                                 <div class="col-sm-5">
                                     <input type="text" class="form-control" name="name" data-validate="required" data-message-required="<?php echo get_phrase('value_required');?>"/>
                                 </div>
                             </div>
                             <div class="form-group">
                                 <label class="col-sm-3 control-label"><?php echo get_phrase('Certificat_Name');?></label>
                                 <div class="col-sm-5">
                                     <input type="text" class="form-control" name="certif_name" data-validate="required" data-message-required="<?php echo get_phrase('value_required');?>"/>
                                 </div>
                             </div>
                             <div class="form-group">
                               <label class="col-sm-3 control-label"><?php echo get_phrase('course_language'); ?></label>
                               <div class="col-sm-5">
                                 <select name="course_language_id" class="form-control select22" style="width:100%;" data-validate="required" data-message-required="<?php echo get_phrase('value_required'); ?>">
                                   <option value=""><?php echo get_phrase('select_course_language'); ?></option>
                                   <?php
                                   foreach ($course_language_list as $row):
                                     ?>
                                     <option value="<?php echo $row['course_language_id']; ?>"><?php echo $row['code']; ?></option>
                                     <?php
                                   endforeach;
                                   ?>
                                 </select>
                               </div>
                             </div>
                             <div class="form-group">
                               <label class="col-sm-3 control-label"><?php echo get_phrase('course_level'); ?></label>
                               <div class="col-sm-5">
                                 <select name="course_level_id"  class="form-control select22" style="width:100%;" data-validate="required" data-message-required="<?php echo get_phrase('value_required'); ?>">
                                   <option value=""><?php echo get_phrase('select_course_level'); ?></option>
                                   <?php
                                   $courseLevels = $this->crud_model->get_courses_level();
                                   foreach ($courseLevels as $row):
                                     ?>
                                     <option value="<?php echo $row['course_level_id']; ?>"><?php echo $row['code']; ?></option>
                                     <?php
                                   endforeach;
                                    ?>
                                 </select>
                               </div>
                             </div>
                             <!---->
                             <div class="form-group">
                               <label class="col-sm-3 control-label"><?php echo get_phrase('course_type'); ?></label>
                               <div class="col-sm-5">
                                 <select name="course_type_id" class="form-control select22" style="width:100%;" data-validate="required" data-message-required="<?php echo get_phrase('value_required'); ?>">
                                   <option value=""><?php echo get_phrase('select_course_type'); ?></option>
                                   <?php
                                   $courseTypes = $this->crud_model->get_courses_type();
                                   foreach ($courseTypes as $row):
                                     ?>
                                     <option value="<?php echo $row['course_type_id']; ?>"><?php echo $row['code']; ?></option>
                                     <?php
                                   endforeach;
                                   ?>
                                 </select>
                               </div>
                             </div>
                             <!---->
                             <!-- teacher moved to asign from teacher tab
                             <div class="form-group">
                                 <label class="col-sm-3 control-label"><?php echo get_phrase('teacher');?></label>
                                 <div class="col-sm-5">
                                     <select name="teacher_id" class="form-control select2" style="width:100%;" data-validate="required" data-message-required="<?php echo get_phrase('value_required');?>">
                                         <option value=""><?php echo get_phrase('select_teacher');?></option>
                                     	<?php
 										$teachers = $this->crud_model->get_teachers();
 										foreach($teachers as $row):
                      $teacher_name = $this->crud_model->get_teacher_name($row['teacher_id']);
                      if($teacher_name!= " "){
 										?>
                                     	<option value="<?php echo $row['teacher_id'];?>"><?php echo $this->crud_model->get_teacher_name($row['teacher_id']);?></option>
                                         <?php
                      }
                    endforeach;
 										?>
                                     </select>
                                 </div>
                             </div>
                           -->
                             <!---->
                             <hr>
                             <div class="form-group">
                              <label for="field-2" class="col-sm-3 control-label"><?php echo get_phrase('add hour');?></label>
                               <div class="col-sm-5">
                                 <div class="row">
                                   <div class="col-sm-6">
                                    <!-- <input type="hidden" class="form-control col-sm-6" name="day" value=""/>-->
                                     <label>Date of Course</label><input type="text" class="col-sm-6 datepick"  id="doc" name="datepicker_day" value=""/>
                                     <label>Start Hour</label><input type="time" value="08:30:00" step="900" min="8:00" max="22:00" name="start_hour" id="start_hour">
                                     <label>End Hour</label><input type="time" value="22:00:00" step="900" min="8:00" max="22:00" name="end_hour" id="end_hour">
                                     <br>
                                     <span class="btn btn-info" id="planHours">+add this hour</span>
                                   </div>

                                 </div>
                               </div>
                             </div>
                             <input type="hidden" id="planned_nb" value="0"></input>
                             <input type="hidden" id="hours_planned" name="hours_planned" value="{}"></input>
                             <!---->
                             <div class="form-group">
                               <label for="field-2" class="col-sm-3 control-label"><?php echo get_phrase('scheduled');?></label><br>

                               <table style="font-size: 10px;" >
                                 <tr id="scheduledHead">
                                <th></th>
                                <th class="schedule">Monday</th>
                                <th class="schedule">Thuesday</th>
                                <th class="schedule">Wednesday</th>
                                <th class="schedule">Thursday</th>
                                <th class="schedule">Friday</th>
                                <th class="schedule">Saturday</th>
                                <th class="schedule">Sunday</th>
                              </tr>

                                </table>

                              </div>
                             <!---->
                             <div class="form-group">
                              <label for="field-2" class="col-sm-3 control-label"><?php echo get_phrase('hours_planned');?></label><span>(hours)</span>
                               <div class="col-sm-5">
                                 <div class="row">
                                   <input type="number" id="hour_total" name="hour_total" value="0" min="0" max="100"></input>
                                   <div class="col-sm-6">
                                   </div>
                                 </div>
                               </div>
                             </div>
                             <!---->
                             <div class="form-group contract">
                              <label for="field-2" class="col-sm-3 control-label"><?php echo get_phrase('contract_hours');?></label><span>(hours)</span>
                               <div class="col-sm-5">
                                 <div class="row">
                                   <input type="number" id="hour_contract" name="hour_contract"  min="0" step="0.25" max="100"></input>
                                   <div class="col-sm-6">
                                   </div>
                                 </div>
                               </div>
                             </div>
                             <!---->
                         </div>
                         <hr>
                         <!---->
                         <div class="form-group">
                           <label for="field-2" class="col-sm-3 control-label">Description</label>
                            <div class="col-sm-5">
                              <textarea name="description" class="form-control col-sm-12"></textarea>
                            </div>
                          </div>
                          <!---->

                          <div class="form-group">
                            <label for="field-2" class="col-sm-3 control-label">Client Price</label>
                            <div class="col-sm-5">
                              <input type="text" class="form-control" name="client_price" value="">
                            </div>
                          </div>
                          <!---->
                         <div class="form-group">
                               <div class="col-sm-offset-3 col-sm-5">
                                   <button id="btn-create"  class="btn btn-info"><?php echo get_phrase('add_class');?></button>
                               </div>

 							</div>
                     </form>
                 </div>
 			</div>
 			<!----CREATION FORM ENDS-->
        <!----EDITION FORM STARTS---->
      <div class="tab-pane box" id="edit" style="padding: 5px">
                 <div class="box-content">
                  <?php echo form_open(base_url() . 'index.php?CoursesNew/save' , array('class' => 'form-horizontal form-groups-bordered validate','target'=>'_top', 'id'=>'edit-form'));?>
                         <div class="padded">
                             <div class="form-group">
                                 <label class="col-sm-3 control-label"><?php echo get_phrase('name');?></label>
                                 <div class="col-sm-5">

                                   <select name="name_E" id="name_E" class="form-control select22" style="width:100%;" data-validate="required" data-message-required="<?php echo get_phrase('value_required'); ?>">
                                     <option value=""><?php echo get_phrase('select_course_name'); ?></option>
                                     <?php
                                     $courseList = $this->crud_model->get_courses();
                                     foreach ($courseList as $row):
                                       ?>
                                       <option value="<?php echo $row['ID']; ?>"><?php echo $row['CourseName']; ?></option>
                                       <?php
                                     endforeach;
                                     ?>
                                   </select>
                                     <!--<input type="hidden" value="" id="course_id_E">-->
                                     <!--<input type="text" class="form-control" name="name_E" data-validate="required" data-message-required="<?php echo get_phrase('value_required');?>"/>-->
                                 </div>
                             </div>
                             <div class="form-group">
                                 <label class="col-sm-3 control-label"><?php echo get_phrase('Certificat_Name');?></label>
                                 <div class="col-sm-5">
                                     <input type="text" class="form-control" name="certif_name_E" data-validate="required" data-message-required="<?php echo get_phrase('value_required');?>"/>
                                 </div>
                             </div>
                             <div class="form-group">
                               <label class="col-sm-3 control-label"><?php echo get_phrase('course_language'); ?></label>
                               <div class="col-sm-5">
                                 <select name="course_language_id_E" class="form-control select22" style="width:100%;" data-validate="required" data-message-required="<?php echo get_phrase('value_required'); ?>">
                                   <option value=""><?php echo get_phrase('select_course_language'); ?></option>
                                   <?php
                                   foreach ($course_language_list as $row):
                                     ?>
                                     <option value="<?php echo $row['course_language_id']; ?>"><?php echo $row['code']; ?></option>
                                     <?php
                                   endforeach;
                                   ?>
                                 </select>
                               </div>
                             </div>
                             <div class="form-group">
                               <label class="col-sm-3 control-label"><?php echo get_phrase('course_level'); ?></label>
                               <div class="col-sm-5">
                                 <select name="course_level_id_E"  class="form-control select22" style="width:100%;" data-validate="required" data-message-required="<?php echo get_phrase('value_required'); ?>">
                                   <option value=""><?php echo get_phrase('select_course_level'); ?></option>
                                   <?php
                                   $courseLevels = $this->crud_model->get_courses_level();
                                   foreach ($courseLevels as $row):
                                     ?>
                                     <option value="<?php echo $row['course_level_id']; ?>"><?php echo $row['code']; ?></option>
                                     <?php
                                   endforeach;
                                    ?>
                                 </select>
                               </div>
                             </div>
                             <!---->
                             <div class="form-group">
                               <label class="col-sm-3 control-label"><?php echo get_phrase('course_type'); ?></label>
                               <div class="col-sm-5">
                                 <select name="course_type_id_E" class="form-control select22" style="width:100%;" data-validate="required" data-message-required="<?php echo get_phrase('value_required'); ?>">
                                   <option value=""><?php echo get_phrase('select_course_type'); ?></option>
                                   <?php
                                   $courseTypes = $this->crud_model->get_courses_type();
                                   foreach ($courseTypes as $row):
                                     ?>
                                     <option value="<?php echo $row['course_type_id']; ?>"><?php echo $row['code']; ?></option>
                                     <?php
                                   endforeach;
                                   ?>
                                 </select>
                               </div>
                             </div>
                             <!---->
                             <!-- teacher moved to assign from teacher tab
                             <div class="form-group">
                                 <label class="col-sm-3 control-label"><?php echo get_phrase('teacher');?></label>
                                 <div class="col-sm-5">
                                     <select name="teacher_id_E" class="" style="width:100%;" data-validate="required" data-message-required="<?php echo get_phrase('value_required');?>">
                                         <option value=""><?php echo get_phrase('select_teacher');?></option>
                                      <?php
                    $teachers = $this->crud_model->get_teachers();
                    foreach($teachers as $row):
                      $teacher_name = $this->crud_model->get_teacher_name($row['teacher_id']);
                      if($teacher_name!= " "){
                    ?>
                                      <option value="<?php echo $row['teacher_id'];?>"><?php echo $this->crud_model->get_teacher_name($row['teacher_id']);?></option>
                                         <?php
                      }
                    endforeach;
                    ?>
                                     </select>
                                 </div>
                             </div>
                           -->
                             <!---->
                             <hr>
                             <div class="form-group">
                              <label for="field-2" class="col-sm-3 control-label"><?php echo get_phrase('add hour');?></label>
                               <div class="col-sm-5">
                                 <div class="row">
                                   <div class="col-sm-6">
                                    <!-- <input type="hidden" class="form-control col-sm-6" name="day" value=""/>-->
                                     <label>Date of Course</label><input type="text" class="form-control col-sm-6 datepick"  id="doc_E" name="datepicker_day" value=""/>
                                     <label>Start Hour</label><input type="time" value="08:30:00" step="900" min="8:00" max="22:00" name="start_hour_E" id="start_hour_E">
                                     <label>End Hour</label><input type="time" value="22:00:00" step="900" min="8:00" max="22:00" name="end_hour_E" id="end_hour_E">
                                     <br>
                                     <span class="btn btn-info" id="planHours_E">+add this hour</span>
                                   </div>

                                 </div>
                               </div>
                             </div>
                             <input type="hidden" id="planned_nb_E" value="0"></input>
                             <input type="hidden" id="hours_planned_E" name="hours_planned_E" value="{}"></input>
                             <!---->
                             <div class="form-group">
                               <label for="field-2" class="col-sm-3 control-label"><?php echo get_phrase('scheduled');?></label><br>

                               <table style="font-size: 10px;" id="table">
                                 <tr id="scheduledHead_E">
                                <th></th>
                                <th class="schedule">Monday</th>
                                <th class="schedule">Thuesday</th>
                                <th class="schedule">Wednesday</th>
                                <th class="schedule">Thursday</th>
                                <th class="schedule">Friday</th>
                                <th class="schedule">Saturday</th>
                                <th class="schedule">Sunday</th>
                              </tr>

                                </table>

                              </div>
                             <!---->
                             <div class="form-group">
                              <label for="field-2" class="col-sm-3 control-label"><?php echo get_phrase('hours_planned');?></label><span>(hours)</span>
                               <div class="col-sm-5">
                                 <div class="row">
                                   <input type="number" id="hour_total_E" name="hour_total_E" value="0" min="0" max="100"></input>
                                   <div class="col-sm-6">
                                   </div>
                                 </div>
                               </div>
                             </div>
                             <!---->
                             <div class="form-group contract_E">
                              <label for="field-2" class="col-sm-3 control-label"><?php echo get_phrase('contract_hours');?></label><span>(hours)</span>
                               <div class="col-sm-5">
                                 <div class="row">
                                   <input type="number" id="hour_contract_E" name="hour_contract_E" min="0" step="0.25" max="100"></input>
                                   <div class="col-sm-6">
                                   </div>
                                 </div>
                               </div>
                             </div>
                             <!---->
                         </div>
                         <hr>
                         <!---->
                         <div class="form-group">
                           <label for="field-2" class="col-sm-3 control-label">Description</label>
                            <div class="col-sm-5">
                              <textarea name="description_E" class="form-control col-sm-12"></textarea>
                            </div>
                          </div>
                          <!---->

                          <div class="form-group">
                            <label for="field-2" class="col-sm-3 control-label">Client Price</label>
                            <div class="col-sm-5">
                              <input type="text" class="form-control" name="client_price_E" value="">
                            </div>
                          </div>
                          <!---->
                         <div class="form-group">
                               <div class="col-sm-offset-3 col-sm-5">
                                   <button id="btn-create"  class="btn btn-info"><?php echo get_phrase('edit_class');?></button>
                                   <button id="btn-delete"  class="btn btn-danger"><?php echo get_phrase('delete_class');?></button>

                               </div>
                             </div>
                     </form>
                 </div>
      </div>
      <!---->
      <!----CONFIRMATION FORM STARTS---->
    <div class="tab-pane box" id="confirm" style="padding: 5px">
      <div class="box-content">
       <?php echo form_open(base_url() . 'index.php?CoursesNew/confirm' , array('class' => 'form-horizontal form-groups-bordered validate','target'=>'_top', 'id'=>'validate-form'));?>
              <div class="padded">
                  <div class="form-group">
                    <label for="field-2" class="col-sm-3 control-label"><?php echo get_phrase('Course_name');?></label>
                     <div class="col-sm-5">
                       <div class="row">
                    <select name="name_C" id="name_C" class="form-control select22" style="width:100%;" data-validate="required" data-message-required="<?php echo get_phrase('value_required'); ?>">
                      <option value=""><?php echo get_phrase('select_course_name'); ?></option>
                      <?php
                      $courseList = $this->crud_model->get_courses();
                      foreach ($courseList as $row):
                        ?>
                        <option value="<?php echo $row['ID']; ?>"><?php echo $row['CourseName']; ?></option>
                        <?php
                      endforeach;
                      ?>

                    </select>
                  </div>
                  </div>
              </div>
              <div class="form-group">
                <label for="field-2" class="col-sm-3 control-label"><?php echo get_phrase('Course_Lesson');?></label>
                 <div class="col-sm-5">
                   <div class="row">
                <select name="hour_C" id="hour_C" class="form-control select22" style="width:100%;" data-validate="required" data-message-required="<?php echo get_phrase('value_required'); ?>">
                  <option value=""><?php echo get_phrase('select_lesson_hour'); ?></option>
                </select>
                <input type="hidden" value="{}" name="lesson_list" id="lesson_list"/>
              </div>
              </div>
          </div>

              <div class="form-group">
                <label for="field-2" class="col-sm-3 control-label"><?php echo get_phrase('Lesson_Statut');?></label>
                 <div class="col-sm-5">
                   <div class="row">
                <select name="statut_C" id="name_V" class="form-control select22" style="width:100%;" data-validate="required" data-message-required="<?php echo get_phrase('value_required'); ?>">
                  <option value="0"><?php echo get_phrase('select_statut'); ?></option>
                  <option value="1"><?php echo get_phrase('Lesson_Aborted'); ?></option>
                  <option value="2"><?php echo get_phrase('Lesson_Done'); ?></option>
                  <!--<option value="3"><?php echo get_phrase('Lesson_Billed'); ?></option>-->
                </select>
                  </div>
                </div>
              </div>
              <div class="form-group">
                <label for="field-2" class="col-sm-3 control-label">Description</label>
                 <div class="col-sm-5">
                   <textarea name="description_C" class="form-control col-sm-12"></textarea>
                 </div>
               </div>
            </div>
            <div class="form-group">
                  <div class="col-sm-offset-3 col-sm-5">
                      <span id="btn-confirm"  class="btn btn-info"><?php echo get_phrase('Confirm_hour');?></span>
                  </div>
            </div>
            </form>
        </div>
    </div>
      <!---->
 <!-----  DATA TABLE EXPORT CONFIGURATIONS ---->
 <script type="text/javascript">

 	jQuery(document).ready(function($)
 	{
    <?php if(isset($course_from_dash)){
      echo "showEdit('$course_from_dash');";
    }
    ?>
    $('[data-toggle="tooltip"]').tooltip();
    $('#name_E').change(function() {
      //console.log('courses changed');
      var id = $('#name_E').val();
      showEdit(id);
    });
    $('#name_C').change(function() {
      var id = $('#name_C').val();
      showConfirm(id);
    });
    $('#hour_C').change(function() {
      //var courseId = $('#name_C').val();
      var lessonId = $('select[name=hour_C]').val();
      //console.log(id);
      showConfirmInfo(lessonId);
    });
    $("#planHours").click(function(event){
      //this function add hours to the list
    var picked = $('#doc').datepicker('getDate');
    picked.setHours(picked.getHours()+12);
    var date = picked;
    var weekNb = picked.getWeek();
    var dayNb = picked.getUTCDay();
    var timeStart = $("#start_hour").val();
    //timeStartS = timeStart.slice(0,-3);
    var timeEnd = $("#end_hour").val();
    //timeEnd = timeEnd.slice(0,-3);
    ////////////////////////////////
    var planned =$('#hours_planned').val();
    var plannedNb =$('#planned_nb').val();
    plannedNb = parseInt(plannedNb)+1;

    var obj = JSON.parse(planned);
    console.log(obj);
    obj[plannedNb] = {};
    obj[plannedNb]['date'] = picked;
    obj[plannedNb]['start'] = timeStart;
    obj[plannedNb]['end'] = timeEnd;
    //console.log(JSON.stringify(obj));
    $('#hours_planned').val(JSON.stringify(obj));
    $('#planned_nb').val(plannedNb);

    //console.log(dayName);
    switch (dayNb){
    case 1 :
    $('#scheduledHead').after("<tr id="+plannedNb+"><th class='schedule'>week "+weekNb+"</th><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+timeStart+"-"+timeEnd+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHour("+plannedNb+")'>Remove</td></tr>");
    break;
    case 2:
    $('#scheduledHead').after("<tr  id="+plannedNb+"><th class='schedule'>week"+weekNb+"</th><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+timeStart+"-"+timeEnd+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHour("+plannedNb+")'>Remove</td></tr>");
    break;
    case 3:
    $('#scheduledHead').after("<tr  id="+plannedNb+"><th class='schedule'>week"+weekNb+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+timeStart+"-"+timeEnd+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHour("+plannedNb+")'>Remove</td></tr>");
    break;
    case 4:
    $('#scheduledHead').after("<tr  id="+plannedNb+"><th class='schedule'>week"+weekNb+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+timeStart+"-"+timeEnd+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHour("+plannedNb+")'>Remove</td></tr>");
    break;
    case 5:
    $('#scheduledHead').after("<tr  id="+plannedNb+"><th class='schedule'>week"+weekNb+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+timeStart+"-"+timeEnd+"</td><td class='schedule'></td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHour("+plannedNb+")'>Remove</td></tr>");
    break;
    case 6:
    $('#scheduledHead').after("<tr id="+plannedNb+"><th class='schedule'>week"+weekNb+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+timeStart+"-"+timeEnd+"</td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHour("+plannedNb+")'>Remove</td></tr>");
    break;
    case 0:
    $('#scheduledHead').after("<tr id="+plannedNb+"><th class='schedule'>week"+weekNb+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+timeStart+"-"+timeEnd+"</td><td class='remove' onclick='removeHour("+plannedNb+")'>Remove</td></tr>");
    }
    calculHour();

  });

  $("#planHours_E").click(function(event){
    //this function add hours to the list
  var picked = $('#doc_E').datepicker('getDate');
  picked.setHours(picked.getHours()+12);
  var date = picked;
  console.log(date);
  var weekNb = picked.getWeek();
  var dayNb = picked.getUTCDay();
  var timeStart = $("#start_hour_E").val();
  //timeStartS = timeStart.slice(0,-3);
  var timeEnd = $("#end_hour_E").val();
  //timeEnd = timeEnd.slice(0,-3);
  ////////////////////////////////
  var planned =$('#hours_planned_E').val();
  var plannedNb =$('#planned_nb_E').val();
  plannedNb = parseInt(plannedNb)+1;

  var obj = JSON.parse(planned);
  console.log(obj);
  obj[plannedNb] = {};
  obj[plannedNb]['date'] = picked;
  obj[plannedNb]['start'] = timeStart;
  obj[plannedNb]['end'] = timeEnd;
  console.log(JSON.stringify(obj));
  $('#hours_planned_E').val(JSON.stringify(obj));
  $('#planned_nb_E').val(plannedNb);

  //console.log(dayName);
  switch (dayNb){
  case 1 :
  $('#scheduledHead_E').after("<tr id="+plannedNb+"><th class='schedule'>week "+weekNb+"</th><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+timeStart+"-"+timeEnd+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHourE("+plannedNb+")'>Remove</td></tr>");
  break;
  case 2:
  $('#scheduledHead_E').after("<tr  id="+plannedNb+"><th class='schedule'>week"+weekNb+"</th><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+timeStart+"-"+timeEnd+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHourE("+plannedNb+")'>Remove</td></tr>");
  break;
  case 3:
  $('#scheduledHead_E').after("<tr  id="+plannedNb+"><th class='schedule'>week"+weekNb+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+timeStart+"-"+timeEnd+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHourE("+plannedNb+")'>Remove</td></tr>");
  break;
  case 4:
  $('#scheduledHead_E').after("<tr  id="+plannedNb+"><th class='schedule'>week"+weekNb+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+timeStart+"-"+timeEnd+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHourE("+plannedNb+")'>Remove</td></tr>");
  break;
  case 5:
  $('#scheduledHead_E').after("<tr  id="+plannedNb+"><th class='schedule'>week"+weekNb+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+timeStart+"-"+timeEnd+"</td><td class='schedule'></td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHourE("+plannedNb+")'>Remove</td></tr>");
  break;
  case 6:
  $('#scheduledHead_E').after("<tr id="+plannedNb+"><th class='schedule'>week"+weekNb+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+timeStart+"-"+timeEnd+"</td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHourE("+plannedNb+")'>Remove</td></tr>");
  break;
  case 0:
  $('#scheduledHead_E').after("<tr id="+plannedNb+"><th class='schedule'>week"+weekNb+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+timeStart+"-"+timeEnd+"</td><td class='remove' onclick='removeHourE("+plannedNb+")'>Remove</td></tr>");
  }
  calculHourE();

  });


 		var datatable = $("#table_export").dataTable();

 		$(".dataTables_wrapper select").select2({
 			minimumResultsForSearch: -1
 		});
    /////////////////////
    //listening functions
    $( function() {$( ".datepick" ).datepicker();} );

    $( "#hour_contract" ).mousedown(function(){overContract('create')});
    $( "#hour_contract_E" ).mousedown(function(){overContract('edit')});

 	});

  function overContract(from){
      if(from == "edit"){
        //console.log('test sur edit');
        var contract = $( "#hour_contract_E").val();
        var planned = $("#hour_total_E").val();
        if (contract < planned){
          $(".contract_E").css("color","red");
          //console.log('over contract');
          return true;
        }
        else{
          $(".contract_E").css("color","");
          return false;
        }
    }
    else{
      var contract = $( "#hour_contract").val();
      var planned = $("#hour_total").val();
      if (contract < planned){
        $(".contract").css("color","red");
        //console.log('over contract');
        return true;
      }
      else{
        $(".contract").css("color","");
        return false;
      }
    }

  }
  function cleanHour(){
     $("#table").find("tr:gt(0)").remove();
     $("#hours_planned_E").val('{}');
  }
  function removeHour(id){
     //this function remove hour from the list
      $("#"+id).remove();
      var planned =$('#hours_planned').val();
      var obj = JSON.parse(planned);
      delete obj[id];
      console.log(JSON.stringify(obj));
      $('#hours_planned').val(JSON.stringify(obj));
      calculHour();
  }
  function removeHourE(id){
     //this function remove hour from the list

      console.log("id to remove :"+id);
      var planned =$('#hours_planned_E').val();
      var obj = JSON.parse(planned);
      if(new Date(obj[id]['date']).getTime() - new Date().getTime() < "86400000"){
        alert("you cannot delete course until 24h or passed course");
      }
      else{
      $("#"+id).remove();
      delete obj[id];
      console.log(JSON.stringify(obj));
      $('#hours_planned_E').val(JSON.stringify(obj));
      calculHourE();
      }
  }
  document.getElementById("hour_total").disabled = true;//disable modification on hours calcul
  document.getElementById("hour_total_E").disabled = true;//
//// Fonction helpers js ////

function calculHour(){

  //this function calcul the total hours
    var planned =$('#hours_planned').val();
    var obj = JSON.parse(planned);
    var timeTot ="0";
    $.each(obj, function(i, obj) {
      var timeProg = (new Date("1970-1-1, "+obj.end) - new Date("1970-1-1, "+obj.start))/ 1000 / 60 / 60;
      //console.log(timeProg);
      timeTot = parseFloat(timeTot) + parseFloat(timeProg);
      //console.log(timeTot);
  });
  $('#hour_total').val(timeTot);
  overContract('create');
}
  function calculHourE(){

    //this function calcul the total hours
      var planned =$('#hours_planned_E').val();
      var obj = JSON.parse(planned);
      var timeTot ="0";
      $.each(obj, function(i, obj) {
        var timeProg = (new Date("1970-1-1, "+obj.end) - new Date("1970-1-1, "+obj.start))/ 1000 / 60 / 60;
        timeTot = parseFloat(timeTot) + parseFloat(timeProg);
    });
    $('#hour_total_E').val(timeTot);
    overContract('edit');
}
//List links
//////////////
function showEdit(id){
  cleanHour();
  $('#list').removeClass('active');
  $('#tabList').removeClass('active');
  $('#edit').addClass('active');
  $('#tabEdit').addClass('active');
  var obj;

  $.post('<?php echo base_url() . 'index.php?CoursesNew/courseStatuts'; ?>', {
    id: id,
  }, function(data){
    console.log(data);
        obj = jQuery.parseJSON(data);
        console.log(obj);
        setData(obj);
      });

}
function showConfirm(id){
  //cleanHour();
  $('#list').removeClass('active');
  $('#tabList').removeClass('active');
  $('#confirm').addClass('active');
  $('#tabConfirm').addClass('active');
  var obj;

  $.post('<?php echo base_url() . 'index.php?CoursesNew/courseStatuts'; ?>', {
    id: id,
  }, function(data){
    //console.log(data);
        obj = jQuery.parseJSON(data);
        console.log(obj);
        setData2(obj);
      });

}
function showConfirmInfo(lesson_id){
  var data = $("#lesson_list").val();
  var obj = JSON.parse(data);

  $.each( obj.hours, function( key, val ) {
    if (val.id == lesson_id) {
      $("textarea[name='description_C']").val(val.comment);
      $("select[name='statut_C']").val(val.done);
    }
  });

}
/////////////
function convertToHHMM(int) {
  var hrs = parseInt(Number(int));
  var min = Math.round((Number(int)-hrs) * 60);
  return hrs+':'+min;
}
  Date.prototype.getWeek = function() {
    var onejan = new Date(this.getFullYear(),0,1);
    var today = new Date(this.getFullYear(),this.getMonth(),this.getDate());
    var dayOfYear = ((today - onejan +1)/86400000);
    return Math.ceil(dayOfYear/7)
};

//// Ajax Submit Edit / Create ////
//Create
$(document).ready(function() {

  var form = $('#create-form')

  form.submit(function(event){
    if(overContract('create')){
      alert('the planned hours overpass the contract hours')
    }
    else{
        var courseName = $('input[name=name]').val();
        var courseCertificate = $('input[name=certif_name]').val();
        var courseLang = $('select[name=course_language_id]').val();
        var courseLvl = $('select[name=course_level_id]').val();
        var courseType= $('select[name=course_type_id]').val();
        //var courseTeach = $('select[name=teacher_id]').val();
        var courseContract =$('input[name=hour_contract]').val();
        var courseProgram = $('#hours_planned').val();
        var courseDesc = $('textarea[name=description]').val();
        var coursePrice = $('input[name=client_price]').val();

        if(checkNotEmpty(courseName) && checkNotEmpty(courseLang) && checkNotEmpty(courseLvl) && checkNotEmpty(courseType)){
          $.post('<?php echo base_url() . 'index.php?CoursesNew/save'; ?>', {
            name: courseName,
            certificate : courseCertificate,
            course_language_id: courseLang,
            course_level_id: courseLvl,
            course_type_id: courseType,
            course_contract: courseContract,
            hours_planned: courseProgram,
            description: courseDesc,
            client_price: coursePrice,
          }, function(data){

                console.log(data);
              });
               //location.reload(true);
        }
        else{
          alert('please enter required fields');
        }
  }
});
    var form2 = $('#edit-form')

    form2.submit(function(event){
      if(overContract('edit')){
        alert('the planned hours overpass the contract hours')
      }
      else{
          var courseId = $('select[name=name_E').val();
          var courseName = $('#name_E option:selected').text();
          var courseCertificate = $('input[name=certif_name_E]').val();
          //console.log(courseName);
          var courseLang = $('select[name=course_language_id_E]').val();
          var courseLvl = $('select[name=course_level_id_E]').val();
          var courseType= $('select[name=course_type_id_E]').val();
          //var courseTeach = $('select[name=teacher_id_E]').val();
          var courseContract =$('input[name=hour_contract_E]').val();
          var courseProgram = $('#hours_planned_E').val();
          //console.log(courseProgram);
          var courseDesc = $('textarea[name=description_E]').val();
          var coursePrice = $('input[name=client_price_E]').val();

          if(checkNotEmpty(courseName) && checkNotEmpty(courseLang) && checkNotEmpty(courseLvl) && checkNotEmpty(courseType)){
            $.post('<?php echo base_url() . 'index.php?CoursesNew/edit'; ?>', {
              id : courseId,
              name: courseName,
              certificate :courseCertificate,
              course_language_id: courseLang,
              course_level_id: courseLvl,
              course_type_id: courseType,
              course_contract: courseContract,
              hours_planned: courseProgram,
              description: courseDesc,
              client_price: coursePrice,
            }, function(data){

                  console.log(data);
                });
                // location.reload(true);
          }
          else{
            ('please enter required fields');
          }
      }
  });
//delete ajax
$('#btn-delete').click(function(event){
    var courseId = $('#name_E').val();
    if (window.confirm("Do you really want to delete?")) {
    if(checkNotEmpty(courseId)){
      $.post('<?php echo base_url() . 'index.php?CoursesNew/delete'; ?>', {
        id : courseId
      }, function(data){
            console.log(data);
          });
           location.reload(true);
    }
    else{
      ('please select a course to delete');
    }
  }
  });
//confirm ajax
  $('#btn-confirm').click(function(event){
      var lessonId = $('select[name=hour_C]').val();
      var lessonStatut = $('select[name=statut_C]').val();
      var lessonComment = $('textarea[name=description_C]').val();
      if(checkNotEmpty(lessonId)){
        $.post('<?php echo base_url() . 'index.php?CoursesNew/confirm'; ?>', {
          id : lessonId,
          statut : lessonStatut,
          comment : lessonComment
        }, function(data){
              console.log(data);
            });
             location.reload(true);
      }
      else{
        ('please select a course to delete');
      }

    });

  function checkNotEmpty(chckvar){
    //console.log(chckvar);
    if (chckvar == "" || chckvar == null) {return false;}
    else {return true;}
  }
});

//// Set Edit Values ////
function setData(passed){
    //$("#name_E").editableSelect();
    $("#course_id_E").val(passed.id);
    $("select[name='name_E']").val(passed.id);
    $("input[name='certif_name_E']").val(passed.certificate);
    //console.log(passed.certificate);
    $("select[name='course_language_id_E']").val(passed.lan);
    $("select[name='course_level_id_E']").val(passed.lvl);
    $("select[name='course_type_id_E']").val(passed.type);
    //$("select[name='teacher_id_E']").val(passed.teach);
    $("input[name='hour_contract_E']").val(passed.contract);
    //$(".select2-chosen").val(passed.teach);
    $("textarea[name='description_E']").val(passed.desc);
    $("input[name='client_price_E']").val(passed.price);
    //console.log(passed.hour);
    //$('#hours_planned_E').val(JSON.stringify(passed.hours));

    $.each( passed.hours, function( key, val ) {
      formatHours(key,val.date,val.start,val.end,val.done);

      var planned =$('#hours_planned_E').val();
      var plannedNb =$('#planned_nb_E').val();
      plannedNb = parseInt(plannedNb)+1;
      var obj = JSON.parse(planned);
      //console.log(obj);
      obj[plannedNb] = {};
      obj[plannedNb]['date'] = val.date;
      obj[plannedNb]['start'] = val.start;
      obj[plannedNb]['end'] = val.end;
      obj[plannedNb]['done'] = val.done;
      $('#hours_planned_E').val(JSON.stringify(obj));
      $('#planned_nb_E').val(plannedNb);
  });
 calculHourE();
}
function setData2(passed){
  var data = JSON.stringify(passed);
  $("#lesson_list").val(data);
        $.each( passed.hours, function( key, val ) {
      //$("#hour_C").val(val['id']);
      var lesson = passed.name +" : "+ val.date +"["+val.start+"-"+val.end+"]";
      $("#hour_C").append(new Option(lesson, val.id));
  });
}
function formatHours(i,date,s,e,d){
  date = new Date(date);
  i++;
  console.log(date);
  var dayNb = date.getUTCDay();
  dateTh = "";
  switch (dayNb){
  case 1 :
  if(d=="1"||d=="3"){
  $('#scheduledHead_E').after("<tr id="+i+" class='aborted'><th class='schedule'>week "+dateTh+"</th><td class='schedule' data-toggle='tooltip'  title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td></tr>");
  }
  else if (d=="2") {
    $('#scheduledHead_E').after("<tr id="+i+" class='done'><th class='schedule'>week "+dateTh+"</th><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td></tr>");
  }
  else{
    $('#scheduledHead_E').after("<tr id="+i+"><th class='schedule'>week "+dateTh+"</th><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHourE("+i+")'>Remove</td></tr>");
  }
  break;
  case 2:
    if(d =="1"|| d=="3"){
      $('#scheduledHead_E').after("<tr  id="+i+" class='aborted'><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td></tr>");
    }
    else if (d=="2") {
      $('#scheduledHead_E').after("<tr  id="+i+" class='done'><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td></tr>");
    }
    else{
      $('#scheduledHead_E').after("<tr  id="+i+"><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHourE("+i+")'>Remove</td></tr>");
    }
  break;
  case 3:
    if(d=="1"|| d=="3"){
      $('#scheduledHead_E').after("<tr  id="+i+" class='aborted'><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td></tr>");
    }
    else if (d=="2") {
      $('#scheduledHead_E').after("<tr  id="+i+" class='done'><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td></tr>");
    }
    else{
      $('#scheduledHead_E').after("<tr  id="+i+"><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHourE("+i+")'>Remove</td></tr>");
    }
    break;
  case 4:
  if(d=="1"|| d=="3"){
    $('#scheduledHead_E').after("<tr  id="+i+" class='aborted'><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><</tr>");
  }
  else if (d=="2") {
    $('#scheduledHead_E').after("<tr  id="+i+" class='done'><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><</tr>");
  }
  else{
    $('#scheduledHead_E').after("<tr  id="+i+"><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHourE("+i+")'>Remove</td></tr>");
  }
    break;
  case 5:
  if(d=="1"|| d=="3"){
    $('#scheduledHead_E').after("<tr  id="+i+" class='aborted'><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td><td class='schedule'></td></tr>");
  }
  else if (d=="2") {
    $('#scheduledHead_E').after("<tr  id="+i+" class='done'><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td><td class='schedule'></td></tr>");
  }
  else{
    $('#scheduledHead_E').after("<tr  id="+i+"><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHourE("+i+")'>Remove</td></tr>");
  }
    break;
  case 6:
  if(d=="1"|| d=="3"){
    $('#scheduledHead_E').after("<tr id="+i+" class='aborted'><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td></tr>");
  }
  else if (d=="2") {
    $('#scheduledHead_E').after("<tr id="+i+" class='done'><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td></tr>");
  }
  else{
    $('#scheduledHead_E').after("<tr id="+i+"><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='schedule'></td><td class='remove entypo-trash danger' onclick='removeHourE("+i+")'>Remove</td></tr>");
  }
    break;
  case 0:
  if(d=="1"|| d=="3"){
    $('#scheduledHead_E').after("<tr id="+i+" class='aborted'><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td>/tr>");
  }
  else if (d=="2") {
    $('#scheduledHead_E').after("<tr id="+i+" class='done'><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td>/tr>");
  }
  else{
    $('#scheduledHead_E').after("<tr id="+i+"><th class='schedule'>week"+dateTh+"</th><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule'></td><td class='schedule' data-toggle='tooltip' title='"+date+"'>"+s+"-"+e+"</td><td class='remove' onclick='removeHourE("+i+")'>Remove</td></tr>");
  }
}
}
 </script>

Youez - 2016 - github.com/yon3zu
LinuXploit