File: /var/www/nclive/technc/exam_link_editor.php
<?php
include 'config.php';
?>
<!DOCTYPE html>
<!--[if IE 9]> <html class="ie9 no-focus" lang="en"> <![endif]-->
<!--[if gt IE 9]><!--> <html class="no-focus" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Naukri Connect - Dashboard</title>
<meta name="description" content="OneUI - Admin Dashboard Template & UI Framework created by pixelcave and published on Themeforest">
<meta name="author" content="pixelcave">
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!-- Icons -->
<!-- The following icons can be replaced with your own, they are used by desktop and mobile browsers -->
<link rel="shortcut icon" href="assets/img/favicons/favicon.png">
<link rel="icon" type="image/png" href="assets/img/favicons/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="assets/img/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="assets/img/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="assets/img/favicons/favicon-160x160.png" sizes="160x160">
<link rel="icon" type="image/png" href="assets/img/favicons/favicon-192x192.png" sizes="192x192">
<link rel="apple-touch-icon" sizes="57x57" href="assets/img/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="assets/img/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="assets/img/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="assets/img/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="assets/img/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="assets/img/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="assets/img/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="assets/img/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="assets/img/favicons/apple-touch-icon-180x180.png">
<!-- END Icons -->
<!-- Stylesheets -->
<!-- Web fonts -->
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400italic,600,700%7COpen+Sans:300,400,400italic,600,700">
<!-- Page JS Plugins CSS -->
<link rel="stylesheet" href="assets/js/plugins/slick/slick.min.css">
<link rel="stylesheet" href="assets/js/plugins/slick/slick-theme.min.css">
<!-- Bootstrap and OneUI CSS framework -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" id="css-main" href="assets/css/oneui.css">
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/flick/jquery-ui.css">
<!-- You can include a specific file from css/themes/ folder to alter the default color theme of the template. eg: -->
<!-- <link rel="stylesheet" id="css-theme" href="assets/css/themes/flat.min.css"> -->
<!-----ckeditor----->
<script src="ckeditor/ckeditor.js" type="text/javascript"></script>
<style type="text/css">
#form .form-group label.error {
color: #FB3A3A;
display: inline-block;
margin: 0px 0 0px 0px;
padding: 0;
text-align: left;
}
</style>
<!-- END Stylesheets -->
</head>
<body>
<!-- Page Container -->
<!--
Available Classes:
'enable-cookies' Remembers active color theme between pages (when set through color theme list)
'sidebar-l' Left Sidebar and right Side Overlay
'sidebar-r' Right Sidebar and left Side Overlay
'sidebar-mini' Mini hoverable Sidebar (> 991px)
'sidebar-o' Visible Sidebar by default (> 991px)
'sidebar-o-xs' Visible Sidebar by default (< 992px)
'side-overlay-hover' Hoverable Side Overlay (> 991px)
'side-overlay-o' Visible Side Overlay by default (> 991px)
'side-scroll' Enables custom scrolling on Sidebar and Side Overlay instead of native scrolling (> 991px)
'header-navbar-fixed' Enables fixed header
-->
<div id="page-container" class="sidebar-l sidebar-o side-scroll header-navbar-fixed">
<!-- Header -->
<header id="header-navbar" class="content-mini content-mini-full">
<!-- Header Navigation Left -->
<ul class="nav-header pull-left">
<li class="hidden-md hidden-lg">
<!-- Layout API, functionality initialized in App() -> uiLayoutApi() -->
<button class="btn btn-default" data-toggle="layout" data-action="sidebar_toggle" type="button">
<i class="fa fa-navicon"></i>
</button>
</li>
<li class="hidden-xs hidden-sm">
<!-- Layout API, functionality initialized in App() -> uiLayoutApi() -->
<button class="btn btn-default" data-toggle="layout" data-action="sidebar_mini_toggle" type="button">
<i class="fa fa-ellipsis-v"></i>
</button>
</li>
<li>
<!-- Opens the Apps modal found at the bottom of the page, before including JS code -->
<button class="btn btn-default pull-right" data-toggle="modal" data-target="#apps-modal" type="button">
<i class="si si-grid"></i>
</button>
</li>
<li class="visible-xs">
<!-- Toggle class helper (for .js-header-search below), functionality initialized in App() -> uiToggleClass() -->
<button class="btn btn-default" data-toggle="class-toggle" data-target=".js-header-search" data-class="header-search-xs-visible" type="button">
<i class="fa fa-search"></i>
</button>
</li>
<li class="js-header-search header-search">
<form class="form-horizontal" action="base_pages_search.html" method="post">
<div class="form-material form-material-primary input-group remove-margin-t remove-margin-b">
<input class="form-control" type="text" id="base-material-text" name="base-material-text" placeholder="Search..">
<span class="input-group-addon"><i class="si si-magnifier"></i></span>
</div>
</form>
</li>
</ul>
<!-- END Header Navigation Left -->
</header>
<!-- END Header -->
<!-- Main Container -->
<main id="main-container">
<div class="content content-narrow">
<!-- Forms Row -->
<div class="row">
<div class="col-lg-12">
<!-- Bootstrap Forms Validation -->
<h2 class="content-heading">Add Exam Links</h2>
<?php
date_default_timezone_set('Asia/Calcutta');
$curDate = date('Y-m-d H:i:s'); // add 5 hrs 30 min in curr time
if(isset($_REQUEST['submit'])){
$examname=$_REQUEST['examname'];
$entity=$_REQUEST['entity'];
$display=$_REQUEST['dis_text'];
$dis_text_dates=$_REQUEST['dis_text_dates'];
$desc=$_REQUEST['editor'];
$link=$_REQUEST['link'];
$type=$_REQUEST['search_type'];
$desc2=$_REQUEST['desc2'];
$status=0;
if($type=='N'){
$date=$_REQUEST['normal'];
}
else if($type=='FT'){
$date=$_REQUEST['fromdate'] .',' . $_REQUEST['todate'];
}
$query="INSERT INTO sp_exam_links SET exam_id='$examname',entity_id='$entity',display_text='$display',display_text_dates='$dis_text_dates',description='$desc',links='$link',date_type='$type',date='$date',status='0',add_by='$user_id',add_date='$curDate',update_date='$curDate'";
/*$query='INSERT INTO sp_exam_links SET exam_id="$examname",entity_id="$entity", display_text="$display", description="$desc", links="$link",
date_type="$type", date="$date", update_date="$curDate", status="$status"';
*/
$sql=$db->prepare($query);
$sql->execute();
$lastid = $db->lastInsertId();
$query3="INSERT INTO sp_exam_update SET exam_id='$lastid',type='AL',user_id='$user_id',date='$curDate', description='$desc'";
$sql2=$db->prepare($query3);
$sql2->execute();
echo '<h3 style="color:#000000;">Data submit successfully</h3>';
}
?>
<div class="block">
<div class="block-header">
<ul class="block-options">
<li>
<button type="button"><i class="si si-settings"></i></button>
</li>
</ul>
<h3 class="block-title"></h3>
</div>
<div class="block-content block-content-narrow">
<!-- jQuery Validation (.js-validation-bootstrap class is initialized in js/pages/base_forms_validation.js) -->
<!-- For more examples you can check out https://github.com/jzaefferer/jquery-validation -->
<form class="js-validation-bootstrap form-horizontal" action="exam_link_editor.php" method="post" id="form">
<div class="form-group">
<label class="col-md-2 control-label" for="val-select2">Select Exam</label>
<div class="col-md-10">
<select class="js-select2 form-control" name="examname" style="width: 100%;">
<?php
$sql = $db->prepare("SELECT exam_id,exam_name FROM sp_exam");
$sql->execute();
?><option selected="selected">--Select exam--</option><?php
while($row=$sql->fetch(PDO::FETCH_ASSOC))
{
?>
<option value="<?php echo $row['exam_id']; ?>"><?php echo $row['exam_name']; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="val-select2">Select Exam Entity</label>
<div class="col-md-10">
<select class="js-select2 form-control" name="entity" style="width: 100%;">
<?php
$sql = $db->prepare("SELECT id,name FROM sp_exam_entity");
$sql->execute();
?><option selected="selected">--Select exam--</option><?php
while($row=$sql->fetch(PDO::FETCH_ASSOC))
{
?>
<option value="<?php echo $row['id']; ?>"><?php echo $row['name']; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="val-username">Display Text (Links)<span class="text-danger">*</span></label>
<div class="col-md-10">
<input class="form-control" type="text" name="dis_text" placeholder="Display text for LINKS ONLY">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="val-username">Display Text (Dates)<span class="text-danger">*</span></label>
<div class="col-md-10">
<input class="form-control" type="text" name="dis_text_dates" placeholder="Display text for DATES ONLY">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="val-email">Description<span class="text-danger">*</span></label>
<div class="col-md-10">
<textarea class="ckeditor" name="editor"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="val-password">Links<span class="text-danger">*</span></label>
<div class="col-md-10">
<input class="form-control" type="text" name="link" placeholder="">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="val-password">On Date<span class="text-danger">*</span></label>
<div class="col-md-1">
<input type="radio" name="search_type" class="radio" value="N" />
</div>
<div class="col-md-5" id="normal" style="display:none;">
<input type="text" placeholder="Select Dates" class="dates_opted dates_opted_1 width_100" name="normal" style="width:400px">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="val-password">From & To Date<span class="text-danger">*</span></label>
<div class="col-md-1" >
<input type="radio" name="search_type" value="FT" class="radio" />
</div>
<div class="col-md-5" id="fromto" style="display:none;">
<input class="form-control" type="date" name="fromdate" placeholder="">
<input class="form-control" type="date" name="todate" placeholder="">
</div>
<div class="form-group">
<div class="col-md-10 col-md-offset-2">
<button class="btn btn-lg btn-primary" type="submit" name="submit">Submit</button>
</div>
</div>
</form>
</div>
</div>
<!-- Bootstrap Forms Validation -->
</div>
</div>
</div>
<!-- END Forms Row -->
</div>
<!-- END Page Content -->
<!-- Page Content -->
<!-- END Page Content -->
</main>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('.radio').on('change', function() {
if (this.value == 'N') {
$("#normal").css('display','block');
$("#fromto").css('display','none');
}
else if (this.value == 'FT') {
$("#fromto").css('display','block');
$("#normal").css('display','none');
}
});
});
</script>
<script type="text/javascript">
(function ($, W, D)
{
var JQUERY4U = {};
JQUERY4U.UTIL =
{
setupFormValidation: function ()
{
//form validation rules
$("#form").validate({
rules: {
examname: {
required: true,
},
entity: {
required: true,
},
editor: {
required: true,
}
},
messages: {
examname: "Please select exam name",
entity: "Please select exam name",
editor: "Please fill exam title details",
link: "Please fill link details"
},
submitHandler: function (form) {
form.submit();
}
});
}
}
//when the dom has loaded setup form validation rules
$(D).ready(function ($) {
JQUERY4U.UTIL.setupFormValidation();
});
})(jQuery, window, document);
</script>
<script>
function cleanArray(actual) {
var newArray = new Array();
for (var i = 0; i < actual.length; i++) {
if (actual[i]) {
newArray.push(actual[i]);
}
}
return newArray;
}
jQuery(document).ready(function($) {
$('.dates_opted').each(function(index){
var dates=[];
$(this).datepicker({
dateFormat: "yy-mm-dd",
onSelect: function(){
dates=cleanArray(dates);
dates.push($(this).val());
//console.log(dates);
$(this).val(dates);
},showAnim :'clip',
changeYear:true,
changeMonth:true,
yearRange:"2000:2030"
}).keyup(function(e) {
if(e.keyCode == 8 || e.keyCode == 46) {
var datesString=$(this).val().split(",");
dates=[];
for(var i=0 ; i<datesString.length-1;i++){
dates.push(datesString[i]);
}
$(this).blur();
$(this).val(dates);
}
});
});
});
</script>
<?php include 'footer.php'; ?>
<!-- END Main Container -->