<?php include 'dbcon.php'; ?>
<?php

if(isset($_POST['submit']))
{   
    $id=$_POST['hid_id'];
    $country=$_POST['country'];
    $name=$_POST['name'];
 $name1=$_FILES['photo']['name'];
    $tmp_name=$_FILES['photo']['tmp_name'];
    move_uploaded_file($tmp_name,'images/'.$name);
    if($name1==''){
        $name1=$_POST['hid1'];

    }
 $name2=$_POST['file'];
    $video=$_POST['video'];
    $file1=$_POST['file1'];
    $file2=$_POST['file2'];
    $file3=$_POST['file3'];
    $file4=$_POST['file4'];
    $query=mysqli_query($con,"update college set name='$name',country='$country',photo='$name1',file='$name2',file1='$file1',file2='$file2',file3='$file3',file4='$file4',video='$video' where id='$id'");
    if($query){
        echo"<script>alert('completed');</script>";
    }
}
?>
<?php
if(isset($_GET['id'])){
$query=mysqli_query($con,"delete from college where id='".$_GET['id']."'");
if($query){
    echo "<script>alert('College is Deleted');window.location.href='country_college_list.php';</script>";
}
}

?>
<!doctype html>
<html class="no-js" lang="">


<!-- Mirrored from www.radiustheme.com/demo/html/psdboss/global-abroadstudy/global-abroadstudy/all-student.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 06 Sep 2022 11:11:33 GMT -->
<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>global-abroadstudy | Country Courses List</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Favicon -->
    <link rel="shortcut icon" type="image/x-icon" href="images/logo-mobile.jpg">
    <!-- Normalize CSS -->
    <link rel="stylesheet" href="css/normalize.css">
    <!-- Main CSS -->
    <link rel="stylesheet" href="css/main.css">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <!-- Fontawesome CSS -->
    <link rel="stylesheet" href="css/all.min.css">
    <!-- Flaticon CSS -->
    <link rel="stylesheet" href="fonts/flaticon.css">
    <!-- Animate CSS -->
    <link rel="stylesheet" href="css/animate.min.css">
    <!-- Data Table CSS -->
    <link rel="stylesheet" href="css/jquery.dataTables.min.css">
    <!-- Custom CSS -->
    <link rel="stylesheet" href="style.css">
     <link rel="stylesheet" href="ckeditor/ckeditor.css">
    <!-- Modernize js -->
    <script src="js/modernizr-3.6.0.min.js"></script>
</head>

<body>
    <!-- Preloader Start Here -->
     <link rel="stylesheet" href="ckeditor/ckeditor.css">
    <div id="preloader"></div>
    <!-- Preloader End Here -->
    <div id="wrapper" class="wrapper bg-ash">
        <!-- Header Menu Area Start Here -->
        <?php include 'header.php'; ?>
        <!-- Header Menu Area End Here -->
        <!-- Page Area Start Here -->
        <div class="dashboard-page-one">
            <!-- Sidebar Area Start Here -->
        <?php include 'sidebar.php'; ?>
            <!-- Sidebar Area End Here -->
            <div class="dashboard-content-one">
                <!-- Breadcubs Area Start Here -->
                <div class="breadcrumbs-area">
                    <h3>Country List</h3>
                    <ul>
                        <li>
                            <a href="index.html">Home</a>
                        </li>
                        <li>Country List</li>
                    </ul>
                </div>
                <!-- Breadcubs Area End Here -->
                <!-- Student Table Area Start Here -->
                <div class="card height-auto">
                    <div class="card-body">
                        <div class="heading-layout1">
                            <div class="item-title">
                                <h3>All Country</h3>
                            </div>
                        
                        </div>
                       
                        <div class="table-responsive">
                            <table class="table display data-table text-nowrap">
                                <thead>
                                    <tr>
                                        <th> S.NO </th>
                                        <!-- <th>Unique ID</th> -->
                                         <th>Country</th>
                                        <th>College Name</th>
                                        <th>College Photo</th>
                                        <th>College Video</th>
                                        <th>College Fast Facts</th>
                                         <th>College Cost of Study</th>
                                          <th>College Admission</th>
                                           <th>College Cost of living</th>
                                            <th>College FAQ</th>
                                          
                                        <!-- <th>Report Photo</th> -->
                                       
                                        <th>Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php 
                                    include 'dbcon.php'; ?>
                                    <?php
                                    $query=mysqli_query($con,"select * from college");
                                    $a=1;
                                    while($row=mysqli_fetch_array($query)){
                                    ?>
                                    <tr>
                                        <td>
                                           <?php echo $a ?>
                                        </td>
                                        <td  ><?php echo $row['country'] ?></td>
                                    
                                        <td  ><?php echo $row['name'] ?></td>
                                        <td  ><img style="height:100px" src="images/<?php echo $row['photo']; ?>"></td>
                                     <td>   <?php
// YouTube video URL
if(strpos($row['video'], ",")){
$video=explode(",",$row['video']);

for($i=0;$i<count($video);$i++){
$videoUrl =$video[$i];
 $i;
// Extract the video ID from the URL
preg_match("/(?:https?:\/\/(?:www\.)?youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/", $videoUrl, $matches);

// The YouTube video ID is stored in $matches[1]
$videoId = $matches[1];

// Embed the video
echo '<iframe width="100" height="100" class="mx-3" src="https://www.youtube.com/embed/' . $videoId . '" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
}}
else{
   $videoUrl =$row['video'];

// Extract the video ID from the URL
preg_match("/(?:https?:\/\/(?:www\.)?youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/", $videoUrl, $matches);

// The YouTube video ID is stored in $matches[1]
$videoId = $matches[1];

// Embed the video
echo '<iframe width="100" height="100" src="https://www.youtube.com/embed/' . $videoId . '" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';

}
?></td>

                                          
                                                         <td >
                       <div class="content-container">
    <!-- Show the first few words -->
    <?php
    $fileContent = $row['file'];
    // Split the content by spaces into an array (words)
    $words = explode(" ", $fileContent);
    
    // Show only the first two or three words
    echo isset($words[0]) ? $words[0] . ' ' : ''; // First word
    echo isset($words[1]) ? $words[1] . ' ' : ''; // Second word
    echo isset($words[2]) ? $words[2] : ''; // Third word (if exists)
  if (count($words) > 3) {
    ?>
    
    <a class="content4more" href="javascript:void(0);" onclick="toggleContent(this)">See More</a>
    <?php } ?>
    </div>
    <div class="content-full" style="display:none;">
    <?php echo $row['file']; ?> <!-- Show the full content -->
    <a class="content4less" href="javascript:void(0);" onclick="toggleContent(this)">See Less</a>
</div>
</td>              <td >
                       <div class="content-container1">
    <!-- Show the first few words -->
    <?php
    $fileContent = $row['file1'];
    // Split the content by spaces into an array (words)
    $words = explode(" ", $fileContent);
    
    // Show only the first two or three words
    echo isset($words[0]) ? $words[0] . ' ' : ''; // First word
    echo isset($words[1]) ? $words[1] . ' ' : ''; // Second word
    echo isset($words[2]) ? $words[2] : ''; // Third word (if exists)
   if (count($words) > 3) {
    ?>
    
    <a class="content4more" href="javascript:void(0);" onclick="toggleContent1(this)">See More</a>
    <?php } ?>
    </div>
    <div class="content-full1" style="display:none;">
    <?php echo $row['file1']; ?> <!-- Show the full content -->
    <a class="content4less" href="javascript:void(0);" onclick="toggleContent1(this)">See Less</a>
</div>
</td>                                           <td >
                       <div class="content-container2">
    <!-- Show the first few words -->
    <?php
    $fileContent = $row['file2'];
    // Split the content by spaces into an array (words)
    $words = explode(" ", $fileContent);
    
    // Show only the first two or three words
    echo isset($words[0]) ? $words[0] . ' ' : ''; // First word
    echo isset($words[1]) ? $words[1] . ' ' : ''; // Second word
    echo isset($words[2]) ? $words[2] : ''; // Third word (if exists)
  if (count($words) > 3) {
    ?>
    
    <a class="content4more" href="javascript:void(0);" onclick="toggleContent2(this)">See More</a>
    <?php } ?>
    </div>
    <div class="content-full2" style="display:none;">
    <?php echo $row['file2']; ?> <!-- Show the full content -->
    <a class="content4less" href="javascript:void(0);" onclick="toggleContent2(this)">See Less</a>
</div>
</td>
                                              <td ><?php echo $row['file3'] 
?></td>

   
                   <td >
                       <div class="content-container4">
    <!-- Show the first few words -->
    <?php
    $fileContent = $row['file4'];
    // Split the content by spaces into an array (words)
    $words = explode(" ", $fileContent);
    
    // Show only the first two or three words
    echo isset($words[0]) ? $words[0] . ' ' : ''; // First word
    echo isset($words[1]) ? $words[1] . ' ' : ''; // Second word
    echo isset($words[2]) ? $words[2] : ''; // Third word (if exists)
if (count($words) > 3) {
    ?>
    
    <a class="content4more" href="javascript:void(0);" onclick="toggleContent4(this)">See More</a>
    <?php } ?>
    </div>
    <div class="content-full4" style="display:none;">
    <?php echo $row['file4']; ?> <!-- Show the full content -->
    <a class="content4less" href="javascript:void(0);" onclick="toggleContent4(this)">See Less</a>
</div>
</td>







                                        <td>
                                            <div class="dropdown">
                                                <a href="#" class="dropdown-toggle" data-toggle="dropdown"
                                                    aria-expanded="false">
                                                    <span class="flaticon-more-button-of-three-dots"></span>
                                                </a>
                                                <div class="dropdown-menu dropdown-menu-right">
                                                    <a class="dropdown-item" href="country_college_list.php?id=<?php echo $row['id']; ?>"><i
                                                            class="fas fa-times text-orange-red" ></i>Delete</a>
                                                    <a class="dropdown-item" data-toggle="modal" data-target="#edit<?php echo $row['id']; ?>"><i
                                                            class="fas fa-cogs text-dark-pastel-green"></i>Edit</a>
                                                    <!-- <a class="dropdown-item" href="#"><i
                                                            class="fas fa-redo-alt text-orange-peel"></i>Refresh</a> -->
                                                </div>
                                            
                                            </div>
                                        </td>
                                    </tr>
                                    <div class="modal  sign-up-modal fade" id="edit<?php echo $row['id']; ?>" tabindex="-1" role="dialog"
                                    aria-hidden="true">
                                    <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
                                        <div class="modal-content">
                                            <div class="modal-body">
                                                <div class="close-btn">
                                                    <button type="button" class="close" data-dismiss="modal"
                                                        aria-label="Close">
                                                        <span aria-hidden="true">&times;</span>
                                                    </button>
                                                </div>
                                                <div class="item-logo text-center mb-20">
                                                   
                                                   
                                                </div>
                                                <form class="login-form" method="post" enctype="multipart/form-data">
                                                    <div class="row gutters-15">
                                                    <div class="form-group col-sm-12">
                                                            <input type="hidden" placeholder="Country Name" name="hid_id" class="form-control" value="<?php echo $row['id'] ?>">
                                                        </div>
                                                      <div class="form-group col-sm-12">
                                                         <select name="country" class="form-control">
                                                             <?php $query1=mysqli_query($con,"select * from country");
                                                                 while($rows=mysqli_fetch_array($query1)){
                                                                     ?>
                                                             <option value="<?php echo $rows['name'] ?>" <?php if($rows['name']==$row['country']){echo 'selected';}?>>
                                                                 <?php echo $rows['name']; ?>
                                                                 
                                                                     
                                                                 
                                                             </option>
                                                                 <?php
                                                                 }
                                                                 ?>
                                                         </select>
                                                        </div>
                                                      
                                                      
                                                        <div class="form-group col-sm-6">
                                                            <input type="hidden" placeholder="City" name="hid1" class="form-control" value="<?php echo $row['photo'] ?>">
                                                        </div>
                                                 
                                                        <div class="form-group col-sm-12">
                                                            <input type="text" placeholder="College Name" name="name" class="form-control" value="<?php echo $row['name']; ?>">
                                                        </div>
                                                        <div class="form-group col-sm-4">
                                                            <img style="height:100px" src="<?php echo 'images/'.$row['photo'] ?>">
                                                             </div>
                                                       <div class="form-group col-sm-8">
                                                            <input type="file" placeholder="College Photo" name="photo" class="form-control">
                                                        </div>
                                                     
                                                       <div class="form-group col-sm-12">
                                                            <input type="text" placeholder="youtube link seperate with comma" name="video" class="form-control" value="<?php echo $row['video'] ?>">
                                                        </div>
                                                        
                                                          <div class="form-group col-sm-12">
                                                              <label>Add Fast Facts</label>
                                                              <textarea placeholder="College File" name="file" class="form-control ckeditor"><?php echo $row['file'] ?></textarea>
                                                           
                                                        </div>
                                                       
                                                          <div class="form-group col-sm-12">
                                                              <label>Add Cost of Study detail</label>
                                                              <textarea placeholder="College File" name="file1" class="form-control ckeditor"><?php echo $row['file1'] ?></textarea>
                                                           
                                                        </div>
                                                         <div class="form-group col-sm-12">
                                                             <label>Add Admission detail</label>
                                                              <textarea placeholder="College File" name="file2" class="form-control ckeditor"><?php echo $row['file2'] ?></textarea>
                                                           
                                                        </div>
                                                         <div class="form-group col-sm-12">
                                                             <label>Add Cost of living</label>
                                                              <textarea placeholder="College File" name="file3" class="form-control ckeditor"><?php echo $row['file3'] ?></textarea>
                                                           
                                                        </div>
                                                         <div class="form-group col-sm-12">
                                                             <label>Add Faq</label>
                                                              <textarea placeholder="College File" name="file4" class="form-control ckeditor"><?php echo $row['file4'] ?></textarea>
                                                           
                                                        </div>
                                                        
                                                       
                                                       
                                                      

                                                        <div class="form-group col-12 text-center">
                                                            <button type="submit" name="submit" class="border-0 rounded text-light footer-btn bg-linkedin">Edit College Detail</button>
                                                        </div>
                                                    </div>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                    <?php  $a++;} ?>
                              
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <!-- Student Table Area End Here -->
             <?php include 'footer.php'; ?>
            </div>
        </div>
        <!-- Page Area End Here -->
    </div>
    <!-- jquery-->
     <script src="ckeditor/ckeditor.js"></script>
    <script src="js/jquery-3.3.1.min.js"></script>
    <!-- Plugins js -->
    <script src="js/plugins.js"></script>
    <!-- Popper js -->
    <script src="js/popper.min.js"></script>
    <!-- Bootstrap
    <script src="ckeditor/ckeditor.js"></script> js -->
    <script src="js/bootstrap.min.js"></script>
    <!-- Scroll Up Js -->
    <script src="js/jquery.scrollUp.min.js"></script>
    <!-- Data Table Js -->
    <script src="js/jquery.dataTables.min.js"></script>
    <!-- Custom Js -->
    <script src="js/main.js"></script>
    <!--read-more-->
<script>
function toggleContent(link) {
    // Find the closest <td> element that contains the clicked link
    var parentTd = link.closest('td');
    
    // Find both the content-container and content-full divs within the same <td>
    var contentContainer = parentTd.querySelector('.content-container');
    var contentFull = parentTd.querySelector('.content-full');
    
    // Toggle the display styles between the two divs
    if (contentContainer.style.display !== 'none') {
        // Hide the truncated content and show the full content
        contentContainer.style.display = 'none';
        contentFull.style.display = 'block';
    } else {
        // Show the truncated content and hide the full content
        contentContainer.style.display = 'block';
        contentFull.style.display = 'none';
    }
}
function toggleContent1(link) {
    // Find the closest <td> element that contains the clicked link
    var parentTd = link.closest('td');
    
    // Find both the content-container and content-full divs within the same <td>
    var contentContainer = parentTd.querySelector('.content-container1');
    var contentFull = parentTd.querySelector('.content-full1');
    
    // Toggle the display styles between the two divs
    if (contentContainer.style.display !== 'none') {
        // Hide the truncated content and show the full content
        contentContainer.style.display = 'none';
        contentFull.style.display = 'block';
    } else {
        // Show the truncated content and hide the full content
        contentContainer.style.display = 'block';
        contentFull.style.display = 'none';
    }
}
function toggleContent2(link) {
    // Find the closest <td> element that contains the clicked link
    var parentTd = link.closest('td');
    
    // Find both the content-container and content-full divs within the same <td>
    var contentContainer = parentTd.querySelector('.content-container2');
    var contentFull = parentTd.querySelector('.content-full2');
    
    // Toggle the display styles between the two divs
    if (contentContainer.style.display !== 'none') {
        // Hide the truncated content and show the full content
        contentContainer.style.display = 'none';
        contentFull.style.display = 'block';
    } else {
        // Show the truncated content and hide the full content
        contentContainer.style.display = 'block';
        contentFull.style.display = 'none';
    }
}
function toggleContent4(link) {
    // Find the closest <td> element that contains the clicked link
    var parentTd = link.closest('td');
    
    // Find both the content-container and content-full divs within the same <td>
    var contentContainer = parentTd.querySelector('.content-container4');
    var contentFull = parentTd.querySelector('.content-full4');
    
    // Toggle the display styles between the two divs
    if (contentContainer.style.display !== 'none') {
        // Hide the truncated content and show the full content
        contentContainer.style.display = 'none';
        contentFull.style.display = 'block';
    } else {
        // Show the truncated content and hide the full content
        contentContainer.style.display = 'block';
        contentFull.style.display = 'none';
    }
}
</script>
</body>


<!-- Mirrored from www.radiustheme.com/demo/html/psdboss/global-abroadstudy/global-abroadstudy/all-student.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 06 Sep 2022 11:11:33 GMT -->
</html>