<? include ("../settings.php"); ?>
<? include ("session.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Abstract Details</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script>
        function frmsubmit(){
            $.ajax({
                type:"POST",
                url:"abstract_edit_ajax.php",
                data:$("#abstract").serialize(),//only input
                success: function(response){
                    if (response != "1"){
                        alert(response);
                    }else{
                        alert("Changes saved.");
                        $('#myModal').modal('hide');
                    }
                }
            });
        }
        
        function deleteabstract(){
            var ans = confirm("Are you sure you want to delete?");
            if (ans == true) {
                $.ajax({
                    type:"POST",
                    url:"abstract_delete_ajax.php",
                    data:$("#abstract").serialize(),//only input
                    success: function(response){
                        if (response != "1"){
                            alert(response);
                        }else{
                            alert("Abstract Deleted.");
                            $('#myModal').modal('hide');
                        }
                    }
                });
            }
        }
    </script>
   </head>
<body>
<div class="well">
<div class="content" bgcolor="#FFFFD0">
<div class="col-12 feature">
<div class="panelCheck">
    <div class="panel-heading">
        <h3 class "panel-title"><strong>Abstract Submission</strong></h3>
    </div>

    <form name="abstract" id="abstract" method='POST' action="" enctype="multipart/form-data" class="form-horizontal" role="form">
    <center>
       
<?
    $bind = array(
        ":search1" => $_REQUEST['abstract_id']
    );
    $results = $db->select("tbl_abstract as a, tbl_abstract_status as b, tbl_topic as c", "a.abstract_id = :search1 AND a.abstract_status=b.status_id AND a.topic_id=c.topic_id", $bind);
    $result = $results[0];
    if ($_SESSION['user_admin']!=1)
    	$disabled = "disabled";
    else
    	$disabled = "";
    //<input type='text' class='form-control' id='datevisit' name='datevisit' value="=date("d-m-Y",strtotime ($row['datevisit']));">
?>        
<div class="panel panel-default">
    <?
		if ($_SESSION['user_admin']==1){
	?>
	  <div class="panel-heading">
        <h3 class="panel-title">Author's Particulars</h3>
      </div>
      <div class="panel-body">
		<div class='form-group'>
            <label for='registrant_salutation' class='col-lg-4 control-label'>Salutation</label>
            <div class='col-lg-4 text-left'>
                <input type="text" <?=$disabled;?> name="registrant_salutation" id="registrant_salutation" value="<?=$result['registrant_salutation'];?>" class="form-control">
            </div>
        </div>
        <div class='form-group'>
            <label for='registrant_lastname' class='col-lg-4 control-label'>Last Name</label>
            <div class='col-lg-4 text-left'>
                <input type="text" <?=$disabled;?> name="registrant_lastname" id="registrant_lastname" value="<?=$result['registrant_lastname'];?>" class="form-control">
            </div>
        </div>
        <div class='form-group'>
            <label for='registrant_firstname' class='col-lg-4 control-label'>First Name</label>
            <div class='col-lg-4 text-left'>
                <input type="text" <?=$disabled;?> name="registrant_firstname" id="registrant_firstname" value="<?=$result['registrant_firstname'];?>" class="form-control">
            </div>
        </div>
        <div class='form-group'>
            <label for='registrant_organisation' class='col-lg-4 control-label'>Organisation</label>
            <div class='col-lg-4 text-left'>
                <input type="text" <?=$disabled;?> name="registrant_organisation" id="registrant_organisation" value="<?=$result['registrant_organisation'];?>" class="form-control">
            </div>
        </div>
		<div class='form-group'>
            <label for='registrant_designation' class='col-lg-4 control-label'>Designation</label>
            <div class='col-lg-4 text-left'>
                <input type="text" <?=$disabled;?> name="registrant_designation" id="registrant_designation" value="<?=$result['registrant_designation'];?>" class="form-control">
            </div>
        </div>
        <div class='form-group'>
            <label for='registrant_email' class='col-lg-4 control-label'>Email</label>
            <div class='col-lg-4 text-left'>
                <input type="text" <?=$disabled;?> name="registrant_email" id="registrant_email" value="<?=$result['registrant_email'];?>" class="form-control">
            </div>
        </div>
        <div class='form-group'>
            <label for='registrant_mailing1' class='col-lg-4 control-label'>Mailing 1</label>
            <div class='col-lg-4 text-left'>
                <input type="text" <?=$disabled;?> name="registrant_mailing1" id="registrant_mailing1" value="<?=$result['registrant_mailing1'];?>" class="form-control">
            </div>
        </div>
		<div class='form-group'>
            <label for='registrant_mailing2' class='col-lg-4 control-label'>Mailing 2</label>
            <div class='col-lg-4 text-left'>
                <input type="text" <?=$disabled;?> name="registrant_mailing2" id="registrant_mailing2" value="<?=$result['registrant_mailing2'];?>" class="form-control">
            </div>
        </div>
		<div class='form-group'>
            <label for='registrant_city' class='col-lg-4 control-label'>City</label>
            <div class='col-lg-4 text-left'>
                <input type="text" <?=$disabled;?> name="registrant_city" id="registrant_city" value="<?=$result['registrant_city'];?>" class="form-control">
            </div>
        </div>
		<div class='form-group'>
            <label for='registrant_state' class='col-lg-4 control-label'>State</label>
            <div class='col-lg-4 text-left'>
                <input type="text" <?=$disabled;?> name="registrant_state" id="registrant_state" value="<?=$result['registrant_state'];?>" class="form-control">
            </div>
        </div>
        <div class='form-group'>
            <label for='registrant_postal' class='col-lg-4 control-label'>Postal</label>
            <div class='col-lg-4 text-left'>
                <input type="text" <?=$disabled;?> name="registrant_postal" id="registrant_postal" value="<?=$result['registrant_postal'];?>" class="form-control">
            </div>
        </div>
		
        <div class='form-group'>
            <label for='registrant_city' class='col-lg-4 control-label'>City</label>
            <div class='col-lg-4 text-left'>
                <input type="text"  <?=$disabled;?> name="registrant_city" id="registrant_city" value="<?=$result['registrant_city'];?>" class="form-control">
            </div>
        </div>

        <div class='form-group'>
            <label for='registrant_country' class='col-lg-4 control-label'>Country</label>
            <div class='col-lg-4 text-left'>
                <select name="registrant_country" id="registrant_country" <?=$disabled;?> class='form-control'>
            	<?
            		$options = $db->select("tbl_country");
            		foreach($options as $option){
            			if ($result['registrant_country']==$option['country_name'])
            				echo "<option value='".$option['country_name']."' selected>".$option['country_name']."</option>";
            			else
            				echo "<option value='".$option['country_name']."'>".$option['country_name']."</option>";
            		}
            	?>
            	</select>
            </div>
        </div>

        <div class='form-group'>
            <label for='registrant_officecc' class='col-lg-4 control-label'>Office CC</label>
            <div class='col-lg-4 text-left'>
            	<input type="text" name="registrant_officecc" id="registrant_officecc" value="<?=$result['registrant_officecc'];?>" <?=$disabled;?> class='form-control'>
            </div>
        </div>
		<div class='form-group'>
            <label for='registrant_office' class='col-lg-4 control-label'>Office</label>
            <div class='col-lg-4 text-left'>
            	<input type="text" name="registrant_office" id="registrant_office" value="<?=$result['registrant_office'];?>" <?=$disabled;?> class='form-control'>
            </div>
        </div>
        <div class='form-group'>
            <label for='registrant_mobilecc' class='col-lg-4 control-label'>Mobile CC</label>
            <div class='col-lg-4 text-left'>
            	<input type="text" name="registrant_mobilecc" id="registrant_mobilecc" value="<?=$result['registrant_mobilecc'];?>" <?=$disabled;?> class='form-control'>
            </div>
        </div>  
        <div class='form-group'>
            <label for='registrant_mobile' class='col-lg-4 control-label'>Mobile</label>
            <div class='col-lg-4 text-left'>
            	<input type="text" name="registrant_mobile" id="registrant_mobile" value="<?=$result['registrant_mobile'];?>" <?=$disabled;?> class='form-control'>
            </div>
        </div> 
	  </div>       
    <?
		}
	?>
 
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title">Abstract Details</h3>
      </div>
      <div class="panel-body">
        <div class='form-group'>
            <label for='parent_name' class='col-lg-4 control-label'>Abstract Number</label>
            <div class='col-lg-4 text-left'>
               <?=$result['abstract_number'];?>
            </div>
        </div>   

        <div class='form-group'>
            <label for='abstract_title' class='col-lg-4 control-label'>Abstract Title</label>
            <div class='col-lg-4 text-left'>
            	<input type="text" <?=$disabled;?> name="abstract_title" id="abstract_title" value="<?=$result['abstract_title'];?>" class="form-control">
            </div>
        </div>   
 
        <div class='form-group'>
            <label for='parent_name' class='col-lg-4 control-label'>Abstract Category</label>
            <div class='col-lg-4 text-left'>
               <?=$result['topic'];?>
            </div>
        </div>   

        <div class='form-group'>
            <label for='parent_name' class='col-lg-4 control-label'>Abstract Submission Date/Time</label>
            <div class='col-lg-4 text-left'>
               <?=date("d-m-Y H:i",strtotime ($result['abstract_datetime']));?>
            </div>
        </div>   
        <div class='form-group'>
            <label for='parent_name' class='col-lg-4 control-label'>Abstract Download</label>
            <div class='col-lg-4 text-left'>
               <a href="../abstract_documents/<?=$result['abstract_path'];?>" target='_blank'>Click to download</a><br/>
			   <?
					if ($result['abstract_revision'])
						echo "<a href='../abstract_documents/".$result['abstract_revision_path']."' target='_blank'>Click to download revision abstract</a><br/>";
					if ($result['abstract_full'])
						echo "<a href='../abstract_documents/".$result['abstract_full_path']."' target='_blank'>Click to download full paper</a><br/>";
			   ?>
            </div>
        </div>            
    </div>       
    
        
     <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title">OFFICIAL USE</h3>
      </div>
      <div class="panel-body">
          
        <div class='form-group'>
            <label for='abstract_status_id' class='col-lg-4 control-label'>Abstract Status</label>
            <div class='col-lg-4'>
                <select class='form-control' id='abstract_status_id' name='abstract_status_id' <?=$disabled;?>>
                 <?
                    $output = "";
                    $statuses = $db->select("tbl_abstract_status");
                    foreach ($statuses as $status){
                        if ($status['status_id']==$result['abstract_status'])
                            echo "<option value='".$status['status_id']."' selected>".$status['status_name']."</option>";
                        else
                            echo "<option value='".$status['status_id']."'>".$status['status_name']."</option>";
                    }
                    echo $output;
                ?>            
                </select>
            </div>
        </div>
		
        <?
			echo "<div class='form-group'>";
			echo "<label for='house_id' class='col-lg-4 control-label'>Abstract Submission</label>";
			echo "<div class='col-lg-4'>";
			echo "<select class='form-control' id='abstract_op' name='abstract_op'  $disabled>";
			if ($result['abstract_op']=="OR")
				echo "<option value='OR' selected>Oral</option>";
			else
				echo "<option value='OR'>Oral</option>";
			
			if ($result['abstract_op']=="P")
				echo "<option value='P' selected>Poster</option>";
			else
				echo "<option value='P'>Poster</option>";
			echo "</select></div></div>";
			
			echo "<div class='form-group'>";
			echo "<label for='catid' class='col-lg-4 control-label'>Abstract Category</label>";
			echo "<div class='col-lg-4'>";
			echo "<select class='form-control' id='topic_id' name='topic_id' $disabled>";
			
			$cats = $db->select("tbl_topic");
			foreach ($cats as $cat){
				if ($cat['topic_id']==$result['topic_id'])
					echo "<option value='".$cat['topic_id']."' selected>".$cat['topic']."</option>";
				else
					echo "<option value='".$cat['topic_id']."'>".$cat['topic']."</option>";
			}
			echo "</select></div></div>"; 
        ?>
           
    </div>
     </div>   
	<?
		if ($_SESSION['user_admin']==1){
	?>
	<div class="panel panel-default">
		<div class="panel-heading">
			<h3 class="panel-title">REVIEWERS RESPONSES</h3>
		</div>
		<div class="panel-body">
        <div class='form-group'>
            <label for='score1' class='col-lg-4 control-label'><b><u><font size="+1">Background</font></u></b><br/>
			<font size="-1">Does the introduction provide sufficient background to understand the problem or hypothesis under study? Does it address the context and/or significance of the problem?</font>
			</label>
            <div class='col-lg-4'>
                <?
					$bind = array(
						":search1"=>$_REQUEST['abstract_id']
					);
					$responses = $db->select("tbl_abstract_remarks as a, tbl_abstract_user as b","a.user_id = b.user_id AND a.abstract_id = :search1 ORDER BY a.user_id",$bind);
					foreach ($responses as $response){
						echo $response['user_login']." => ".$response['score1']."<br/>";
					}
				?>
            </div>
        </div>
		<div class='form-group'>
            <label for='score2' class='col-lg-4 control-label'><b><u><font size="+1">Objectives/Hypothesis</font></u></b><br/>
			<font size="-1">Is the objectives or hypothesis stated clearly and succinctly? Is it sufficiently focused?</font>
			</label>
            <div class='col-lg-4'>
                <?
					foreach ($responses as $response){
						echo $response['user_login']." => ".$response['score2']."<br/>";
					}
				?>
            </div>
        </div>
		<div class='form-group'>
            <label for='score3' class='col-lg-4 control-label'><b><u><font size="+1">Methods</font></u></b><br/>
			<font size="-1">Are procedures or protocols described clearly? Are methods appropriate for question under study?</font>
			</label>
            <div class='col-lg-4'>
                <?
					foreach ($responses as $response){
						echo $response['user_login']." => ".$response['score3']."<br/>";
					}
				?>
            </div>
        </div>
		<div class='form-group'>
            <label for='score4' class='col-lg-4 control-label'><b><u><font size="+1">Results</font></u></b><br/>
			<font size="-1">Are key results described clearly and in an organized manner?</font>
			</label>
            <div class='col-lg-4'>
                <?
					foreach ($responses as $response){
						echo $response['user_login']." => ".$response['score4']."<br/>";
					}
				?>
            </div>
        </div>
		<div class='form-group'>
            <label for='score5' class='col-lg-4 control-label'><b><u><font size="+1">Discussions and Conclusions</font></u></b><br/>
			<font size="-1">Are conclusions supported by the data? Is the significance of the findings discussed?</font>
			</label>
            <div class='col-lg-4'>
                <?
					foreach ($responses as $response){
						echo $response['user_login']." => ".$response['score5']."<br/>";
					}
				?>
            </div>
        </div>
		<div class='form-group'>
            <label for='score6' class='col-lg-4 control-label'><b><u><font size="+1">Scientific Merit</font></u></b><br/>
			<font size="-1">Are there any novelty factors? Is the topic of importance or significance?</font>
			</label>
            <div class='col-lg-4'>
                <?
					foreach ($responses as $response){
						echo $response['user_login']." => ".$response['score6']."<br/>";
					}
				?>
            </div>
        </div>
		<div class='form-group'>
            <label for='score6' class='col-lg-4 control-label'><b><u><font size="+1">Recommendation</font></u></b><br/>
			<font size="-1">This abstract is recommended for: </font>
			</label>
            <div class='col-lg-4'>
                <?
					foreach ($responses as $response){
						echo $response['user_login']." => ".$response['recommendation']."<br/>";
					}
				?>
            </div>
        </div>
		<div class='form-group'>
            <label for='score6' class='col-lg-4 control-label'><b><u><font size="+1">Overall Comments </font></u></b><br/>
			<font size="-1">&nbsp;</font>
			</label>
            <div class='col-lg-4'>
                <?
					foreach ($responses as $response){
						echo $response['user_login']." => ".$response['remarks']."<br/>";
					}
				?>
            </div>
        </div>
		</div>
    </div> 
	<?
		}else{
	?>
	<div class="panel panel-default">
		<div class="panel-heading">
			<h3 class="panel-title">REVIEWER'S RESPONSE</h3>
		</div>
		<div class="panel-body">
        <?
			$bind = array(
				":search1"=>$_REQUEST['abstract_id'],
				":search2"=>$_SESSION['user_id']
			);
			$abstract = $db->select("tbl_abstract_remarks","abstract_id = :search1 AND user_id = :search2",$bind);
			if (count($abstract)>0){
				$score1 = $abstract[0]['score1'];
				$score2 = $abstract[0]['score2'];
				$score3 = $abstract[0]['score3'];
				$score4 = $abstract[0]['score4'];
				$score5 = $abstract[0]['score5'];
				$score6 = $abstract[0]['score6'];
				$recommendation = $abstract[0]['recommendation'];
				$remarks = $abstract[0]['remarks'];
			}
		?>
        <div class='form-group'>
            <label for='score1' class='col-lg-4 control-label'><b><u><font size="+1">Background</font></u></b><br/>
			<font size="-1">Does the introduction provide sufficient background to understand the problem or hypothesis under study? Does it address the context and/or significance of the problem?</font>
			</label>
            <div class='col-lg-4'>
                <select class='form-control' id='score1' name='score1' >
                <?
					$scoring = array("1","2","3","4","5","6","7","8","9","10");
					echo "<option value='0'>Please select</option>";
					foreach ($scoring as $scores){
						if ($scores == $score1)
							echo "<option value='$scores' selected>$scores</option>";
						else
							echo "<option value='$scores'>$scores</option>";
					}
                ?>            
                </select>
            </div>
        </div>
		<div class='form-group'>
            <label for='score2' class='col-lg-4 control-label'><b><u><font size="+1">Objectives/Hypothesis</font></u></b><br/>
			<font size="-1">Is the objectives or hypothesis stated clearly and succinctly? Is it sufficiently focused?</font>
			</label>
            <div class='col-lg-4'>
                <select class='form-control' id='score2' name='score2' >
                <?
					$scoring = array("1","2","3","4","5","6","7","8","9","10");
					echo "<option value='0'>Please select</option>";
					foreach ($scoring as $scores){
						if ($scores == $score2)
							echo "<option value='$scores' selected>$scores</option>";
						else
							echo "<option value='$scores'>$scores</option>";
					}
                ?>            
                </select>
            </div>
        </div>
		<div class='form-group'>
            <label for='score3' class='col-lg-4 control-label'><b><u><font size="+1">Methods</font></u></b><br/>
			<font size="-1">Are procedures or protocols described clearly? Are methods appropriate for question under study?</font>
			</label>
            <div class='col-lg-4'>
                <select class='form-control' id='score3' name='score3' >
                <?
					$scoring = array("2","4","6","8","10","12","14","16","18","20");
					echo "<option value='0'>Please select</option>";
					foreach ($scoring as $scores){
						if ($scores == $score3)
							echo "<option value='$scores' selected>$scores</option>";
						else
							echo "<option value='$scores'>$scores</option>";
					}
                ?>            
                </select>
            </div>
        </div>
		<div class='form-group'>
            <label for='score4' class='col-lg-4 control-label'><b><u><font size="+1">Results</font></u></b><br/>
			<font size="-1">Are key results described clearly and in an organized manner?</font>
			</label>
            <div class='col-lg-4'>
                <select class='form-control' id='score4' name='score4' >
                <?
					$scoring = array("1","2","3","4","5","6","7","8","9","10");
					echo "<option value='0'>Please select</option>";
					foreach ($scoring as $scores){
						if ($scores == $score4)
							echo "<option value='$scores' selected>$scores</option>";
						else
							echo "<option value='$scores'>$scores</option>";
					}
                ?>            
                </select>
            </div>
        </div>
		<div class='form-group'>
            <label for='score5' class='col-lg-4 control-label'><b><u><font size="+1">Discussions and Conclusions</font></u></b><br/>
			<font size="-1">Are conclusions supported by the data? Is the significance of the findings discussed?</font>
			</label>
            <div class='col-lg-4'>
                <select class='form-control' id='score5' name='score5' >
                <?
					$scoring = array("1","2","3","4","5","6","7","8","9","10");
					echo "<option value='0'>Please select</option>";
					foreach ($scoring as $scores){
						if ($scores == $score5)
							echo "<option value='$scores' selected>$scores</option>";
						else
							echo "<option value='$scores'>$scores</option>";
					}
                ?>            
                </select>
            </div>
        </div>
		<div class='form-group'>
            <label for='score6' class='col-lg-4 control-label'><b><u><font size="+1">Scientific Merit</font></u></b><br/>
			<font size="-1">Are there any novelty factors? Is the topic of importance or significance?</font>
			</label>
            <div class='col-lg-4'>
                <select class='form-control' id='score6' name='score6' >
                <?
					$scoring = array("2","4","6","8","10","12","14","16","18","20");
					echo "<option value='0'>Please select</option>";
					foreach ($scoring as $scores){
						if ($scores == $score6)
							echo "<option value='$scores' selected>$scores</option>";
						else
							echo "<option value='$scores'>$scores</option>";
					}
                ?>            
                </select>
            </div>
        </div>
		<div class='form-group'>
            <label for='recommendation' class='col-lg-4 control-label'><b><u><font size="+1">Recommendation</font></u></b><br/>
			<font size="-1">This abstract is recommended for: </font>
			</label>
            <div class='col-lg-4'>
				<select class='form-control' id='recommendation' name='recommendation' >
                <?
					$scoring = array("Oral (for excellent abstracts)","Poster","Reject");
					echo "<option value='0'>Please select</option>";
					foreach ($scoring as $scores){
						if ($scores == $recommendation)
							echo "<option value='$scores' selected>$scores</option>";
						else
							echo "<option value='$scores'>$scores</option>";
					}
                ?>  
				</select>
            </div>
        </div>
		<div class='form-group'>
            <label for='score6' class='col-lg-4 control-label'><b><u><font size="+1">Overall Comments </font></u></b><br/>
			<font size="-1">&nbsp;</font>
			</label>
            <div class='col-lg-4'>
                <textarea name="remarks">
					<?=$remarks;?>
				</textarea>
            </div>
        </div>
		</div>
    </div>  
	<?
		}
	?>	
    <input type="hidden" name="abstract_id" value="<?php echo $_REQUEST['abstract_id']; ?>">
        <?
        if ($_SESSION['user_admin']=="1"){ 
            echo "<input type='button' class='btn btn-danger' name='remove' value='Delete Abstract' onclick='deleteabstract();'><br/><br/>";
        }
        ?>
    <input type="button" name="confirm" value="Update" class="btn btn-default" onclick="frmsubmit();">
    <input type="button" value="Close" class="btn btn-default" onclick="$('#myModal').modal('hide')">
    <br><br>        
        
    </center>
    <span>
    </span>
    </form>
</div>
</div>
</div>
</div>
</body>
</html>
    
    

<?

	function cleandata(&$inputarray){
		foreach ($inputarray as $key => $value) {
			if (!is_array($inputarray[$key]))
				$inputarray[$key]=htmlentities($value,ENT_QUOTES);
		}
	}

?>