Current File : /home/inlingua/www/noida/icentex/admin_fd/ingl_class.form.php
<?php
// Copyright, Panalink Infotech Limited. Created on: 27-11-2010

// Include header
include "header_fd.php";
?>
<h3>&nbsp;&nbsp;&nbsp;Add New Class</h3>
<div style="margin-left:10px;">
<?php
echo '<h4>'.$succFailMesg.'</h4>'; 

// Show result of a form submission?
if ($showResult == "Y")
{	//echo "<br><a href='ingl_course.select.php'>Back</a><br>";
echo '<h4>'.$succFailMesg.'SUCCESS'.'</h4>'; 
header("Location:ingl_class.select.php");
	// Include footer
	include "../footer.php";
	//return; 
}
?>

<script language="javascript">
<!--
function validate(form) 

{
if (form.c_location.value=="")
	{	alert("location cannot be blank. Please enter it.");
		form.c_location.focus(); return false;
	}
	if (form.c_name.value=="")
	{	alert("Class Name cannot be blank. Please enter it.");
		form.c_name.focus(); return false;
	}
	
	if (form.c_capacity.value=="")
	{	alert(" capacity cannot be blank. Please enter it.");
		form.c_capacity.focus(); return false;
	}
	
	
	return true;
}
-->
</script>
<script language="javascript">
	
	function monthDiff(start, end) {
                var tempDate = new Date(start);
                var monthCount = 0;
                while((tempDate.getMonth()+''+tempDate.getFullYear()) != (end.getMonth()+''+end.getFullYear())) {
                    monthCount++;
                    tempDate.setMonth(tempDate.getMonth()+1);
                }
                return monthCount+1;
            }
	
$(function() {
	          
		$('#datepicker3').datepicker({
			changeMonth: true,
			changeYear: true,
			
			onSelect: function(date) {
                        date1=$('#datepicker4').datepicker('getDate');
			date2=$.datepicker.formatDate('yy-mm-dd', date1);
			
			
			if(date1!=null)
			{
                             tmonth=1;
			     //alert(tmonth);
			     // Set the date format to something that is easy for our backend to understand...
				Date.format = 'yyyy-mm-dd';
				
				// Save a reference to the hidden input form field...
				var $hiddenInput = $('#selectedDate');
				
				// and a reference to the element we are turning into a date picker...
				var $mm = $('#multimonth');
				
				// initialise the date picker with your chosen settings
				$mm.datePickerMultiMonth(
					{
						startDate: date,
						endDate: date2,
						numMonths: tmonth,
						inline: true,
						selectMultiple: true
					}
				);
				
				// set all of the current dates selected
				var selectedDates = $hiddenInput.val().split(',');
				for (var i=0; i<selectedDates.length; i++) {
					$mm.dpmmSetSelected(  
						selectedDates[i]
					)
				}
				
				// listen for changes in the selected dates status
				$mm.bind( 
					'dateSelected',
					function(event, date, $td, status)
					{
						// and update the hidden field with a comma seperated list of selected dates...
						var selectedDates = $mm.dpmmGetSelected();
						for (var i=0; i<selectedDates.length; i++) {
							selectedDates[i] = selectedDates[i].asString();
						}
						$hiddenInput.val(selectedDates.join(','));
						$('#cancelled_days').html(selectedDates.join(' ,'));
					}
				);
				
				
				// and just for debugging on this page...
				$('#showHiddenValue').bind(
					'click',
					function(e)
					{
						alert($hiddenInput.val());
						return false;
					}
				);

			
			}
                      }
		});
	});
	$(function() {
		$('#datepicker4').datepicker({
			changeMonth: true,
			changeYear: true,
			onSelect: function(date) {
                        date1=$('#datepicker3').datepicker('getDate');
			date2=$.datepicker.formatDate('yy-mm-dd', date1);
			if(date1!=null)
			{
				//alert(date2);
				
			     tmonth=1;
			     //alert(tmonth);
			     // Set the date format to something that is easy for our backend to understand...
				Date.format = 'yyyy-mm-dd';
				
				// Save a reference to the hidden input form field...
				var $hiddenInput = $('#selectedDate');
				
				// and a reference to the element we are turning into a date picker...
				var $mm = $('#multimonth');
				
				// initialise the date picker with your chosen settings
				$mm.datePickerMultiMonth(
					{
						startDate: date2,
						endDate: date,
						numMonths: tmonth,
						inline: true,
						selectMultiple: true
					}
				);
				
				// set all of the current dates selected
				var selectedDates = $hiddenInput.val().split(',');
				for (var i=0; i<selectedDates.length; i++) {
					$mm.dpmmSetSelected(  
						selectedDates[i]
					)
				}
				
				// listen for changes in the selected dates status
				$mm.bind( 
					'dateSelected',
					function(event, date, $td, status)
					{
						// and update the hidden field with a comma seperated list of selected dates...
						var selectedDates = $mm.dpmmGetSelected();
						for (var i=0; i<selectedDates.length; i++) {
							selectedDates[i] = selectedDates[i].asString();
						}
						$hiddenInput.val(selectedDates.join(','));
						$('#cancelled_days').html(selectedDates.join(' ,'));
					}
				);
				
				
				// and just for debugging on this page...
				$('#showHiddenValue').bind(
					'click',
					function(e)
					{
						alert($hiddenInput.val());
						return false;
					}
				);


				
			}
                      }
		});
	});
</script>

<!-- page specific scripts -->
		
		<style type="text/css">
		#multimonth {
			border: 2px solid #000;
			overflow: auto;
			float: left;
			
		}
		.dp-applied {
			float: left;
		}
		table.jCalendar {
			border: none;
		}
		.dp-popup-inline {
			height: 180px;
		}
		</style>

<form method='post' action='ingl_class.main.php' onsubmit="return validate(this)">

<table boder='1' class='pa-nor' width="100%" border="0">
<tr valign='top'><td>Location</td><td>

<select name='c_location'>
<option value="">--Select Location--</option>
<?php 

$queryloc="select * from timesheet_location where  location !=''";
$resultloc=mysql_query($queryloc) or die(mysql_error());
while ($numloc=mysql_fetch_array($resultloc))
{
echo"<option value='".$numloc[recNo]."' ";
if($dbObject->getDbField('c_location')==$numloc[recNo])
{
echo"selected";
}
echo">".$numloc[location]."</option>";
}
?>
</select>

</td></tr>
<tr valign='top'><td>Class Name</td><td><input type='text' name='c_name' value="<?php echo $dbObject->getDbField('c_name');?>" size='20' maxlength='250'></td></tr>
<tr valign='top'><td>Capacity </td><td><input type='text' name='c_capacity' value="<?php echo $dbObject->getDbField('c_capacity');?>" size='20' maxlength='250'></td></tr>
<td colspan='2'><input class="submit1" type='submit' name='aC' value='<?php echo $currentMode;?>'></td></tr>
</table>
</form>

</div>
<div style="margin-top:100px">&nbsp;</div>
<?php
// Include footer
include "footer_fd.php";
?>
<?php
if($currentMode=="Update")
{
?>
	<script type="text/javascript" charset="utf-8">
            $(function()
            {
				// Set the date format to something that is easy for our backend to understand...
				Date.format = 'yyyy-mm-dd';
				
				// Save a reference to the hidden input form field...
				var $hiddenInput = $('#selectedDate');
				
				// and a reference to the element we are turning into a date picker...
				var $mm = $('#multimonth');
				
				// initialise the date picker with your chosen settings
				$mm.datePickerMultiMonth(
					{
						startDate: '<?php echo $dbObject->getDbField('startdate');?>',
						endDate: '<?php echo $dbObject->getDbField('enddate');?>',
						numMonths: 1,
						
						inline: true,
						selectMultiple: true,
						
					}
				);
				
				// set all of the current dates selected
				var selectedDates = $hiddenInput.val().split(',');
				for (var i=0; i<selectedDates.length; i++) {
					$mm.dpmmSetSelected(  
						selectedDates[i]
					)
				}
				
				// listen for changes in the selected dates status
				$mm.bind( 
					'dateSelected',
					function(event, date, $td, status)
					{
						// and update the hidden field with a comma seperated list of selected dates...
						var selectedDates = $mm.dpmmGetSelected();
						for (var i=0; i<selectedDates.length; i++) {
							selectedDates[i] = selectedDates[i].asString();
						}
						$hiddenInput.val(selectedDates.join(','));
						$('#cancelled_days').html(selectedDates.join(', '));
					}
				);
				
				
				// and just for debugging on this page...
				$('#showHiddenValue').bind(
					'click',
					function(e)
					{
						alert($hiddenInput.val());
						return false;
					}
				);
            });
		</script>

<?php
}
?>