<?php
$directory = "content-library/$course_creator_info->url/my-work-file/$course_info->url";
if (is_dir($directory)) {
    $_SESSION['upload_dir'] = '/content-library/' . $course_creator_info->url . '/my-work-file/' . $course_info->url . '/';
    $_SESSION['current_path'] = '../content-library/' . $course_creator_info->url . '/my-work-file/' . $course_info->url . '/';
} else {
    $_SESSION['upload_dir'] = '/source/' . $course_creator_info->url . '/';
    $_SESSION['current_path'] = '../source/' . $course_creator_info->url . '/';
}

$person_id = $this->session->userdata('user_id');
$person_role = $this->session->userdata('person_role');
?>
<div class="col-sm-8">
    <div class="row gray_ttc">
        <div class="col-sm-12">
            <div class="col-sm-12">
                <nav class="text-justify">
                    <div class="col-sm-12" style="padding: 0">
                        <span class="clo-sm-3" title="Course Information" style="padding: 0">
                            <h3 style="text-align: center !important">Edit Course Information</h3>
                        </span>
                    </div>
                </nav>
            </div>
            <div class="col-sm-12"><br></div>

            <div class="col-sm-12">
                <?php
//                echo validation_errors(); //formID3 
                $url = 'user/edit-course/' . $course_info->url;
                echo form_open_multipart($url, 'class="formID3" id="" name="editCourseForm"');
                ?>
                <div class="form-group col-sm-12">
                    <div class="input-group">
                        <input type="text" 
                               data-errormessage-value-missing="Course Name is Required!" 
                               class="form-control validate[required] text-input" 
                               id="edit_course_name" 
                               name="edit_course_name" 
                               value="<?php
                               echo set_value('edit_course_name') ? set_value('edit_course_name') : $course_info->course_name;
                               ?>" 
                               placeholder="Please enter your Course Title.."
                               aria-describedby="basic-addon1"
                               title="Course Title">
                        <span class="input-group-addon" id="basic-addon1"><i class="fa fa-book"></i></span>
                    </div>
                    <span id="course_name_error" style="color:red;"><?php echo form_error('edit_course_name'); ?></span>
                </div>
                <input type="hidden" id="course_creator_id" value="<?php echo $course_info->course_creator_id ?>">
                <div class="col-sm-12"><br> </div>




                <div class="form-group col-sm-6">
                    <div class="input-group">
                        <input type="text"
                               data-errormessage-value-missing="Course Url is Required!" 
                               class="form-control validate[required, custom[urlSpecialCaracter], custom[spaceFunction], custom[urlExistence]] text-input"  
                               id="course_url" 
                               name="course_url" 
                               value="<?php
                               echo set_value('course_url') ? set_value('course_url') : $course_info->url;
                               ?>"
                               title="Course Url"
                               oninput="checkEditCourseURl(this.value,'<?php echo $course_info->url ?>')"
                               placeholder="Please enter your Course URL.." 
                               aria-describedby="basic-addon1"
                               <?php echo ($course_info->url_type == 1) ? "readonly=''" : "" ?> readonly="readonly">
                        <input type="hidden" name="url_exist" id="url_exist" value="">
                        <span class="input-group-addon" id="basic-addon1" title="Course Url"><i class="fa fa-link"></i></span>
                    </div>
                    <span id="course_url_error" style="color:red;"><?php echo form_error('course_url'); ?></span>
                    <input type="hidden" id="course_ajax_url" value="<?php echo base_url() . 'check-course-url-existance'; ?>">
                </div>




                <div class="form-group col-sm-6">
                    <select data-errormessage-value-missing="Parent Topic is Required!" 
                            class="form-control validate[required] text-input" 
                            name="parent_topic_id"
                            id="parent_topic_id" 
                            onchange="getParentTopic(this.value, '<?php echo base_url() . 'user/view-child-topic' ?>', '', '<?php echo $person_info->person_id ?>')"
                            title="Parent Topic">
                        <option value="">Select Parent Topic</option>
                        <?php
                        foreach ($parent_topic as $topic_value) {
                            echo '<option value="' . $topic_value->topic_id . '">' . $topic_value->topic_name . '</option>';
                        }
                        ?>
                    </select>
                    <span id="parent_topic_id_error" style="color:red;"><?php echo form_error('parent_topic_id'); ?></span>
                </div>
                <script>
                    document.forms['editCourseForm'].elements['parent_topic_id'].value = '<?php
                        echo set_value('parent_topic_id') ? set_value('parent_topic_id') : $parent_topic_info->parent_topic_id;
                        ?>';
                </script>
                <div class="col-sm-12"><br> </div>





                <div class="form-group col-sm-6">
                    <select data-errormessage-value-missing="Course Category is Required!" 
                            class="form-control validate[required] text-input" 
                            name="topic_id"
                            id="topic_id" 
                            onchange="getOtherTopic(this.value);"
                            title="Topic">
                        <option value="">Select Topic</option>
                    </select>
                    <span id="topic_id_error" style="color:red;"><?php echo form_error('topic_id'); ?></span>
                </div>




                <div class="form-group col-sm-6"  id="otherTopic" style="display: none">
                    <input type="text" 
                           data-errormessage-value-missing="Topic Name is required!" 
                           class="form-control validate[required, custom[courseName], custom[topicNameExistence]] text-input" 
                           id="other_topic_name" 
                           name="other_topic_name"
                           oninput="checkOtherTopicName(this.value,'<?php echo base_url() . 'user/check-topic-name'; ?>')"
                           placeholder="Please Enter Topic Name"  
                           value="<?php echo set_value('other_topic_name'); ?>" 
                           title="New Topic Name" >
                    <input type="hidden" id="other_topic_name_exist" value="">
                    <span id="other_topic_name_error" style="color:red;"><?php echo form_error('other_topic_name'); ?></span>
                </div>





                <?php if ($person_role == 4) { ?>
                    <div class="col-sm-12"><br> </div>
                    <div class="form-group col-sm-6 ">
                        <select data-errormessage-value-missing="Resource person is Required!" 
                                class="form-control validate[required] text-input" 
                                name="resource_person_id" 
                                id="resource_person_id" 
                                onchange="otherResourcePerson(this.value);"
                                title="Resource person">
                            <option value="">Resource Person</option>
                            <option value="<?php echo $resource_person_info->resource_person_id ?>"><?php echo $person_info->person_first_name . ' ' . $person_info->person_last_name; ?></option>
                            <?php foreach ($all_resource_person as $resource_person_value) { ?>
                                <option value="<?php echo $resource_person_value->resource_person_id; ?>"><?php echo $resource_person_value->person_first_name . ' ' . $resource_person_value->person_last_name; ?></option>
                            <?php } ?>
                            <option value="other">Other Resource Person</option>
                        </select>
                        <span id="resource_person_id_message" style="color:red;"><?php echo form_error('resource_person_id'); ?></span>
                    </div>

                    <script>
                        document.forms['editCourseForm'].elements['resource_person_id'].value = '<?php
                        echo set_value('resource_person_id') ? set_value('resource_person_id') : $course_info->resource_person_id;
                        ?>';
                    </script>




                    <div class="form-group col-sm-6"  id="other_resource_person" style="display: none">
                        <input type="text" 
                               data-errormessage-value-missing="Resource Person Name is required!" 
                               class="form-control validate[required,custom[personName]] text-input" 
                               id="resource_person_name" 
                               name="resource_person_name" 
                               placeholder="Please Enter Resource Person Name"  
                               value="<?php echo set_value('resource_person_name'); ?>" autofocus 
                               title="New Resource Person Name" >
                        <span id="resource_person_name_error" style="color:red;"><?php echo form_error('resource_person_name'); ?></span>                        
                    </div>
                    <?php
                } else {
                    echo '<input type="hidden" id="resource_person_id" value="' . $course_info->resource_person_id . '">';
                }
                ?>




                <div class="form-group col-sm-12"><br></div>
                <div class="form-group col-sm-6">
                    <div class=" col-sm-12" style="padding: 0">
                        <label class="col-xs-4 col-sm-4  text-left" style="padding: 0">Course type: </label>
                        <div  class="col-xs-8 col-sm-8 radio radio-success" style="margin: 0">
                            <input data-errormessage-value-missing="Course Type is Required!" 
                                   class="validate[required]" 
                                   type="radio" 
                                   name="course_type" 
                                   id="paid" 
                                   value="1" 
                                   onclick="getCourseType(this.value)">
                            <label for="paid">Paid</label>
                            <span style="margin-right: 30px"></span>
                            <input  data-errormessage-value-missing="Course Type is Required!" 
                                    class="validate[required]"  
                                    type="radio" 
                                    name="course_type" 
                                    id="free" 
                                    value="2" 
                                    onclick="getCourseType(this.value)">
                            <label for="free">Free</label>
                            <div id="course_type_error"style="color: red"><?php echo form_error('course_type'); ?></div>
                        </div>
                    </div>
                    <script>
                        document.forms['editCourseForm'].elements['course_type'].value = '<?php
                echo set_value('course_type') ? set_value('course_type') : $course_info->course_type;
                ?>';
                    </script>
                </div>
                <div class="col-sm-12"><br></div>


                <div class="form-group col-sm-12 padding-zero" style="display:<?php
                if (set_value('course_type')) {
                    echo set_value('course_type') ? ((set_value('course_type') == 1) ? 'block' : 'none') : 'none';
                } else {
                    echo ($course_info->course_type == 1) ? 'block' : 'none';
                }
                ?>;" id="course_price_view">
                    <div class="col-sm-6">
                        <select class="form-control validate[required]"
                                name="course_price_currency" 
                                id="course_price_currency">
                            <option value="">Select Currency</option>
                            <option value="1">BDT</option>
                            <option value="2">USD</option>
                        </select>
                        <script>
                            document.forms['editCourseForm'].elements['course_price_currency'].value = '<?php
                     echo set_value('course_price_currency') ? set_value('course_price_currency') : ($course_info->course_type == 1) ? $course_price_info->price_currency : '';
                ?>';
                        </script>
                        <div id="course_price_currency_error" style="color: red"><?php echo form_error('course_price_currency'); ?></div>
                    </div>


                    <div class="col-sm-6">
                        <div class="input-group">
                            <input type="text" 
                                   data-errormessage-value-missing="Course Price is Required!" 
                                   class="form-control validate[required, custom[coursePriceValue], custom[checkCoursePrice], custom[number], custom[nonZeroValue]] text-input" 
                                   id="course_price" 
                                   name="course_price"  
                                   value="<?php
                                   echo set_value('course_price') ? set_value('course_price') : ($course_info->course_type == 1) ? $course_price_info->price : '';
                                   ?>"
                                   maxlength="10" 
                                   title="Course Price"
                                   placeholder="Set Course Price">
                            <span class="input-group-addon" id="basic-addon1" title="Course Price"><i class="fa fa-usd"></i></span>
                        </div>
                        <div id="course_price_error" style="color: red"><?php echo form_error('course_price'); ?></div>
                    </div>
                </div>
                





                <div class="col-sm-12"><br></div>
                <div class="form-group col-sm-6">
                    <select data-errormessage-value-missing="Course Level is Required!" 
                            class="form-control validate[required] text-input" 
                            name="course_level" id="course_level"
                            title="Course Level">
                        <option value="">Select Course Level</option>
                        <option value="0">Any</option>
                        <option value="1">Basic</option>
                        <option value="2">Intermediate</option>
                        <option value="3">Advance</option>
                    </select>
                    <script>
                        document.forms['editCourseForm'].elements['course_level'].value = '<?php
                                   echo set_value('course_level') ? set_value('course_level') : $course_info->course_level;
                                   ?>';
                    </script>
                    <span id="course_level_message" style="color:red;"><?php echo form_error('course_level'); ?></span>
                </div>




                <div class="form-group col-sm-6">
                    <div class="input-group">
                        <input type="text"
                               data-errormessage-value-missing="Number of Class is Required!" 
                               class="form-control validate[required, custom[integer], custom[nonZeroValue], custom[numberOfClasses]] text-input" 
                               id="number_of_classes" 
                               name="number_of_classes" 
                               oninput="getTotalClassHour();"
                               value="<?php
                               echo set_value('number_of_classes') ? set_value('number_of_classes') : $course_info->number_of_classes;
                               ?>"
                               placeholder="Total Number of Class.." aria-describedby="basic-addon1"
                               title="Number of Class" maxlength="2">
                        <span class="input-group-addon" id="basic-addon1"><i class="fa fa-users"></i></span>
                    </div>
                    <span id="number_of_classes_error" style="color:red;"><?php echo form_error('number_of_classes'); ?></span>
                </div>





                <div class="col-sm-12"><br></div>
                <div class="form-group col-sm-6">
                    <div class="input-group">
                        <input type="text" 
                               data-errormessage-value-missing="Class Hour Per Day is Required!" 
                               class="form-control validate[required, custom[integer], custom[nonZeroValue], custom[numberOfClassesMinute]] text-input" 
                               id="class_hour_per_day" 
                               name="class_hour_per_day" 
                               placeholder="Please Type per day Class Minute"
                               oninput="getTotalClassHour();"
                               value="<?php
                               echo set_value('class_hour_per_day') ? set_value('class_hour_per_day') : $course_info->class_hour_per_day;
                               ?>"
                               title="Class Hour Per Day">
                        <span class="input-group-addon" id="basic-addon1" title="Class Hour Per Day"><i class="fa fa-clock-o"></i></span>
                    </div>
                    <span id="class_hour_per_day_error" style="color:red;"><?php echo form_error('class_hour_per_day'); ?></span>
                </div>

                <input type="hidden" id="total_class_hour" name="total_class_hour" value="<?php echo set_value('total_class_hour'); ?>" placeholder="Total Number of Class.." >
                <div class="col-sm-6" id="show_total_class_hour"><?php echo set_value('total_class_hour'); ?></div>




                <div class="col-sm-12"><br></div>
                <div class="form-group col-sm-6">
                    <div class='input-group' id='datetimepicker5'>
                        <input type="text" 
                               data-errormessage-value-missing="Course Start date is Required!" 
                               class="form-control"  
                               id="course_start_date" 
                               name="course_start_date" 
                               value="<?php
                               echo set_value('course_start_date') ? set_value('course_start_date') : $course_info->course_start_date;
                               ?>"
                               onblur="getStartDate(this.value, '<?php echo $course_info->course_start_date; ?>')"
                               placeholder=" Course Start Date"  
                               title="Course Start date">
                        <span class="input-group-addon">
                            <span class="glyphicon glyphicon-calendar"></span><br>
                        </span>
                    </div>
                    <span id="course_start_date_error" style="color:red;"><?php echo form_error('course_start_date'); ?></span>
                </div>


                <div class="form-group col-sm-6">
                    <div class='input-group' id="datetimepicker3">
                        <input type="text" 
                               data-errormessage-value-missing="Class Time is Required!"
                               class="form-control validate[required] text-input"
                               id="class_time" 
                               name="class_time" 
                               placeholder="Class Time"  
                               value="<?php
                               echo set_value('class_time') ? set_value('class_time') : $course_info->class_time;
                               ?>"
                               title="Class Time"/>
                        <span class="input-group-addon">
                            <span class="glyphicon glyphicon-time"></span>
                        </span>
                    </div>
                    <span id="class_time_error" style="color:red;"><?php echo form_error('class_time'); ?></span>
                </div>
                <div class="col-sm-12"><br></div>




                <div class="form-group col-sm-6">
                    <div class="input-group " id="datetimepicker1">
                        <input type="text" 
                               data-errormessage-value-missing="Last Date of Registration is Required!" 
                               class="form-control"  
                               id="last_date_of_registration" 
                               name="last_date_of_registration" 
                               placeholder="Last Date of Registration"  
                               value="<?php
                               echo set_value('last_date_of_registration') ? set_value('last_date_of_registration') : $course_info->last_date_of_registration;
                               ?>"
                               onblur="getLastDate(this.value, '<?php echo $course_info->last_date_of_registration; ?>')"
                               title="Last Date of Registration">
                        <span class="input-group-addon" title="Last Date of Registration">
                            <span class="glyphicon glyphicon-calendar"></span>
                        </span>
                    </div>
                    <span id="last_date_of_registration_error" style="color:red;"><?php echo form_error('last_date_of_registration'); ?></span>
                </div>



                <div class="form-group col-sm-6">
                    <div class='input-group' id='datetimepicker6'>
                        <input type="text" 
                               data-errormessage-value-missing="Course Finished Date is Required!" 
                               class="form-control"  
                               id="course_finished_date"
                               name="course_finished_date"
                               placeholder=" Course Finished Date"
                               value="<?php
                               echo set_value('course_finished_date') ? set_value('course_finished_date') : $course_info->course_finished_date;
                               ?>"
                               onblur="getFinishDate(this.value, '<?php echo $course_info->course_finished_date; ?>')"
                               title="Course Finished Date">
                        <span class="input-group-addon" title="Course Finished Date">
                            <span class="glyphicon glyphicon-calendar" title="Course Finished Date"></span>
                        </span>
                    </div>
                    <span id="course_finished_date_error" style="color:red;"><?php echo form_error('course_finished_date'); ?></span>
                </div>
                <div class="col-sm-12"><br></div>




                <div class="col-sm-12"><br></div>
                <div class="form-group col-sm-12 ">
                    <div class=" col-sm-6" style="padding: 0">
                        <label class="col-xs-4 col-sm-4  text-left" style="padding: 0">Work Files : </label>
                        <div  class="col-xs-8 col-sm-8 radio radio-success" style="margin: 0">
                            <input  data-errormessage-value-missing="Work Files is Required!" 
                                    class="validate[required] text-input radio" type="radio"                                    
                                    name="course_work_files" 
                                    id="Yes" 
                                    value="1">
                            <label for="Yes">Yes</label>
                            <span style="margin-right: 30px"></span>

                            <input data-errormessage-value-missing="Work Files is Required!" 
                                   class="validate[required] text-input radio" type="radio"
                                   name="course_work_files" 
                                   id="No" 
                                   value="2">
                            <label for="No">No</label>
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <span id="course_work_files_message" style="color:red;"><?php echo form_error('course_work_files'); ?></span>
                    </div>
                    <script>
                        document.forms['editCourseForm'].elements['course_work_files'].value = '<?php
                               echo set_value('course_work_files') ? set_value('course_work_files') : $course_info->course_work_files;
                               ?>';
                    </script>
                </div>
                <div class="col-sm-12"><br></div>




                <div class="form-group col-sm-12" >
                    <div class="input-group text-left">
                        <label>Course Training Objective</label>
                        <textarea class="form-control  resoulation1280" 
                                  name="course_training_objectives"
                                  id="course_training_objectives"  
                                  placeholder="Course Training Objective" ><?php
                                      echo set_value('course_training_objectives') ? set_value('course_training_objectives') : $this->tinymce_model->view_tinyMce_information($course_info->course_creator_id, $course_info->url, $course_info->course_training_objectives);
                                      ?></textarea>
                    </div>
                    <div class="text-left" id="course_training_objectives_error" style="color: red"><?php echo form_error('course_training_objectives'); ?></div>
                </div>
                <div class="col-sm-12"><br></div>





                <div class="form-group col-sm-12" >
                    <div class="input-group text-left">
                        <label>Course Training Outline</label>
                        <textarea class="form-control  resoulation1280" 
                                  name="course_training_outline"
                                  id="course_training_outline"  
                                  placeholder="Course Training Outline" ><?php
                                      echo set_value('course_training_outline') ? set_value('course_training_outline') : $this->tinymce_model->view_tinyMce_information($course_info->course_creator_id, $course_info->url, $course_info->course_training_outline);
                                      ?></textarea>
                    </div>
                    <div class="text-left" id="course_training_outline_error" style="color: red"><?php echo form_error('course_training_outline'); ?></div>
                </div>
                <div class="col-sm-12"><br></div>



                <?php
                $days = array('Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednessday', 'Thursday', 'Friday');
                $selected_days = array('');
                if ($this->input->post('course_days', TRUE) != '') {
                    $selected_days = $this->input->post('course_days', TRUE);
                } else {
                    $selected_days = explode(',', $course_info->course_days);
                }
                ?>

                <div class="form-group col-sm-12">
                    <div class="full text-left">
                        <label class="text-left" >Course Days</label>
                    </div>
                    <?php foreach ($days as $k => $v) { ?>
                        <div class="col-sm-3">
                            <div class="checkbox checkbox-success" style="margin-top: -5px">
                                <input class="styled" type="checkbox" 
                                       name="course_days[<?php echo $k + 1; ?>]" 
                                       id="course_days<?php echo $k + 1; ?>" 
                                       value="<?php echo $v; ?>"
                                       <?php
                                       if (in_array($v, $selected_days)) {
                                           echo "checked='1'";
                                       }
                                       ?>>
                                <label for="checkbox1"><?php echo $v; ?></label>
                            </div>
                        </div>
                    <?php } ?>
                    <div class="full text-left">
                        <label class="text-left" id="course_days"></label>
                    </div>
                    <div class="col-sm-12" id="course_days_validation" style="color: red;">
                        <span id="course_days_error" style="color:red;"><?php echo form_error('course_days[]'); ?></span>
                    </div>
                </div>


                <div class="form-group col-sm-6">
                    <select data-errormessage-value-missing="Course Language is Required!" 
                            class="form-control validate[required] text-input"   
                            name="course_language" 
                            id="course_language"
                            title="Course Language">
                        <option value="">Select Language</option>
                        <option value="1">English</option>
                        <option value="2">বাংলা (Bengali)</option>
                    </select>
                    <script>
                        document.forms['editCourseForm'].elements['course_language'].value = '<?php
                    echo set_value('course_language') ? set_value('course_language') : $course_info->course_language;
                    ?>';</script>
                    <span id="course_language_error" style="color:red;"><?php echo form_error('course_language'); ?></span>
                </div>




                <div class="form-group col-sm-6">
                    <select data-errormessage-value-missing="Access Level is Required!" 
                            class="form-control validate[required] text-input"   
                            name="course_access_level" 
                            id="course_access_level"
                            onchange="getAccessLevel(this.value);"
                            title="Access Level">
                        <option value="">Select Access Level</option>
                        <option value="1">Public</option>
                        <option value="2">TalhaTraining user</option>
                    </select>

                    <script>
                        document.forms['editCourseForm'].elements['course_access_level'].value = '<?php
                    echo set_value('course_access_level') ? set_value('course_access_level') : $course_info->course_access_level;
                    ?>';
                    </script>
                    <span id="course_access_level_error" style="color:red;"><?php echo form_error('course_access_level'); ?></span>
                </div>
                <div class="col-sm-12"><br></div>





                <?php
                if ($person_role == 4) {
                    ?>
                    <div class="col-sm-12"><br></div>
                    <div class="form-group col-sm-12">
                        <div class="form-group col-sm-6">
                            <div class="checkbox checkbox-success">
                                <input type="checkbox"
                                       id="course_resource_person_edit" 
                                       class="styled"
                                       name="course_resource_person_edit"
                                       value="1" >
                                <label for="course_resource_person_edit">Resource Person Edit Allow?</label>
                            </div>
                        </div>

                        <div class="form-group col-sm-6">
                            <div class="checkbox checkbox-success">
                                <input type="checkbox"
                                       id="course_resource_person_view_invoice" 
                                       class="styled"
                                       name="course_resource_person_view_invoice"
                                       value="1" >
                                <label for="course_resource_person_view_invoice">Resource Person View Invoice?</label>
                            </div>
                        </div>
                    </div>
                    <script>
                        '<?php if (set_value('course_resource_person_edit')) { ?>';
                            document.forms['editCourseForm'].elements['course_resource_person_edit'].checked = true;
                            '<?php } else if ($course_info->course_resource_person_edit == 1) { ?>';
                            document.forms['editCourseForm'].elements['course_resource_person_edit'].checked = true;
                            '<?php } ?>';

                        '<?php if (set_value('course_resource_person_view_invoice')) { ?>';
                            document.forms['editCourseForm'].elements['course_resource_person_view_invoice'].checked = true;
                            '<?php } else if ($course_info->course_resource_person_view_invoice == 1) { ?>';
                            document.forms['editCourseForm'].elements['course_resource_person_view_invoice'].checked = true;
                            '<?php } ?>';
                    </script>
                <?php } ?>

                <div class="col-sm-5"></div>
                <div class="col-sm-2">
                    <input type="submit" class="green-btn btn btn-default" value="Update"><br/><br/>
                </div>
                <div class="col-sm-5"></div>

                <!--</form>-->
                <?php echo form_close(); ?>
            </div>
        </div>
    </div>  <!-- /.row gray_ttc -->
</div>


<script type="text/javascript" src="<?php echo base_url() ?>front_end_resource/course/course.js">
</script>
<script>
    getParentTopic('<?php echo set_value('parent_topic_id') ? set_value('parent_topic_id') : $parent_topic_info->parent_topic_id; ?>', '<?php echo base_url() . 'user/view-child-topic' ?>', '<?php echo set_value('topic_id') ? set_value('topic_id') : $course_info->topic_id ?>', '<?php echo $person_info->person_id ?>');
    getOtherTopic('<?php echo set_value('topic_id') ?>');
    document.getElementById('other_topic_name').value = '<?php echo set_value('other_topic_name'); ?>';

    '<?php if ($person_role == 4) { ?>';
        otherResourcePerson('<?php echo set_value('resource_person_id'); ?>');
        '<?php } ?>';

    '<?php if (set_value('number_of_classes') !== '' && set_value('class_hour_per_day') !== '') { ?>';
        viewTotalClassHour('<?php echo set_value('number_of_classes') ?>', '<?php echo set_value('class_hour_per_day'); ?>');
        '<?php } else { ?>';
        viewTotalClassHour('<?php echo $course_info->number_of_classes; ?>', '<?php echo $course_info->class_hour_per_day; ?>');
        '<?php } ?>';

    getAccessLevel('<?php
                echo set_value('course_access_level') ? set_value('course_access_level') : $course_info->course_access_level;
                ?>');

</script>