File: /home/thehunarfound/www/sms/get-institute-time.php_8-sep-2018
<?php
include('lib/config.php');
if(($_POST["institute"]) != "")
{
// $sql ="Select `time_start`,`time_end` from `institute_profile` where abbreviation = '".($_POST['institute'])."'";
// $res = $db->ExecuteQuery($sql);
// // while(list($starttimes,$endtimes) = $res->FetchAsArray()){
// list($starttimes,$endtimes) = $res->FetchAsArray())
// $final[]= array($starttimes,$endtimes);
// // }
$starttimes = $db->GetSingleRecord("SELECT `time_start` FROM `institute_profile` where abbreviation = '".$_POST["institute"]."'");
$endtimes = $db->GetSingleRecord("SELECT `time_end` FROM `institute_profile` where abbreviation = '".$_POST["institute"]."'");
$data='<style>
span.multiselect-native-select {
position: relative
}
span.multiselect-native-select select {
border: 0!important;
clip: rect(0 0 0 0)!important;
height: 1px!important;
margin: -1px -1px -1px -3px!important;
overflow: hidden!important;
padding: 0!important;
position: absolute!important;
width: 1px!important;
left: 50%;
top: 30px;
}
.multiselect-container {
position: absolute;
list-style-type: none;
margin: 0;
padding: 0;
}
.multiselect-container .input-group {
margin: 5px;
}
.multiselect-container>li {
padding: 0;
}
.multiselect-container>li>a.multiselect-all label {
font-weight: 700;
}
.multiselect-container>li.multiselect-group label {
margin: 0;
padding: 3px 20px 3px 20px;
height: 100%;
font-weight: 700;
}
.multiselect-container>li.multiselect-group-clickable label {
cursor: pointer
}
.multiselect-container>li>a {
padding: 0
}
.multiselect-container>li>a>label {
margin: 0;
height: 100%;
cursor: pointer;
font-weight: 400;
padding: 3px 0 3px 30px;
color:#000;
}
.multiselect-container>li>a>label.radio, .multiselect-container>li>a>label.checkbox {
margin: 0
}
.multiselect-container>li>a>label>input[type=checkbox] {
margin-bottom: 5px
}
.btn-group>.btn-group:nth-child(2)>.multiselect.btn {
border-top-left-radius: 4px;
border-bottom-left-radius: 4px
}
.form-inline .multiselect-container label.checkbox, .form-inline .multiselect-container label.radio {
padding: 3px 20px 3px 40px
}
.form-inline .multiselect-container li a label.checkbox input[type=checkbox], .form-inline .multiselect-container li a label.radio input[type=radio] {
margin-left: -20px;
margin-right: 0
}
.multiselect-selected-text{
margin-left:52px;
}
</style>';
//add counter here so that it can be incremented in append
$data.='<select id="instructor_time" multiple="multiple" class="multiselect-ui form-control" style = "width:125px;">';
// $data .='<option >--Select--</option>';
//Exceptional condition- this needs to be resolved
$count=0;
for($a = 1; $a<=30; $a++){
$totaltime = strtotime("+60 min", strtotime($starttimes));
$temp = date('h:i', $totaltime);
// echo "____________________________";
// echo $totaltime;
// echo ":::";
//$endtimes= date("g:i a", strtotime($endtimes));
// $endtimes=str_replace(" pm","",$endtimes);
//$endtimes=str_replace(" am","",$endtimes);
// echo $endtimes;
// $start_bak=substr($starttimes, 0, 2) ;
// if(substr($starttimes, 0, 2) > 12 || $count==1){
// $starttimes =$starttimes."pm";
// }else{
// if($start_bak == 12){
// $count=1;
// }
// $starttimes =$starttimes."am";
// }
$data .= "<option value='$starttimes - $temp'";
$data .= ">$starttimes - $temp</option>";
if($temp == $endtimes) {
break;
}
$starttimes = $temp;
}
$data .= '</select>';
$data.='<script src="js/mselect.js" type="text/javascript"></script>';
/* $row = $res->fetch_assoc();
$start = $row['time_start'];
$end = $row['time_end'];
$json = array('time_start' => $start, 'time_end' => $end);
echo json_encode($json);*/
// echo $sql;
// print_r($final);
$final[]= array($starttimes,$endtimes,$data);
echo json_encode($final);
}
?>