Skip to content

Instantly share code, notes, and snippets.

@Goddard
Created July 12, 2014 00:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Goddard/90813fe70d3cadc2953f to your computer and use it in GitHub Desktop.
Save Goddard/90813fe70d3cadc2953f to your computer and use it in GitHub Desktop.
semi-fixed form.php file from ohana
<? (defined('_JEXEC') && defined('KOOWA')) or die('Restricted access'); ?>
<style src="media://com_ohanah/lib/cleditor/jquery.cleditor.css" />
<style src="media://com_ohanah/css/jquery-ui.css" />
<style>
.authorInfo {
overflow: hidden;
}
.debug {
color: #555;
margin: 20px;
clear:both;
border: 1px dotted #ccc;
padding: 20px;
}
.debuglabel {
font-weight: bold;
width: 100px;
display: inline-block;
border-bottom: 1px solid #EEE;
}
.debugvalue {
display: inline-block;
width: 200px;
border-bottom: 1px solid #EEE;
}
.debuginfo {
color: #8996A2;
border-bottom: 1px solid #EEE;
}
</style>
<?
if (version_compare(JVERSION, '3.0', 'ge')) {
JHTML::_('behavior.framework', true);
JHtml::_('jquery.framework');
} else {
JHTML::_('behavior.mootools', false);
}
?>
<?=@helper('behavior.validator') ?>
<script src="media://lib_koowa/js/koowa.js" />
<script src="media://com_ohanah/lib/cleditor/jquery.cleditor.min.js" />
<?= @template('com://admin/ohanah.view.common.images', array('item' => $event, 'name' => 'event')); ?>
<?
$params = (json_decode(JComponentHelper::getComponent('com_ohanah')->params));
?>
<script>
function check_times() {
if (($jq('#end_date_1').val() == $jq('#date_1').val()) || ($jq('#end_date_2').val() == $jq('#date_2').val()) || ($jq('#end_date_3').val() == $jq('#date_3').val()) || ($jq('#end_date_4').val() == $jq('#date_4').val()) || ($jq('#end_date_5').val() == $jq('#date_5').val())) {
var hS = $jq('select[name="start_time_h"]');
var mS = $jq('select[name="start_time_m"]');
var ampmS = $jq('select[name="start_time_ampm"]'); // return empty array if there is no such element
var hE = $jq('select[name="end_time_h"]');
var mE = $jq('select[name="end_time_m"]');
var ampmE = $jq('select[name="end_time_ampm"]'); // return empty array if there is no such element
if (ampmS.length) { // ampm returned something, so actually there is AMPM selector and we should do the math
if (ampmS.val() == ampmE.val()) { // if start and end are in the same part of the day, we do the math
// problem is that 12 means 00, so we treat this case special
// f end is 12, then it's OK just if start is 12, otherwise it's bad
if (hE.val() == "12") {
hE.val(hS.val()); // if start is 12 too, nothing will change, otherwise end = start
} else { // now we know end is not 12, so we do the check
if (hS.val() != "12" & hS.val() > hE.val()) { // if it's 12, it's OK, it's like 00, everything is fine
hE.val(hS.val());
}
}
// if hours are the same, we check minutes
if (hS.val() == hE.val()) {
if (mS.val() > mE.val()) {
mE.val(mS.val());
}
}
}
// if start is AM and end is PM, then it's fine, nothitg to worry about
// else, it's start PM and end AM, that's wrong, switch end to PM also
if (ampmS.val() == "PM" & ampmE.val() == "AM") {
ampmE.val("PM");
}
} else { // 24 hour format, yey...
if (hS.val() > hE.val()) {
hE.val(hS.val());
}
if (hS.val() == hE.val()) {
if (mS.val() > mE.val()) {
mE.val(mS.val());
}
}
}
}
}
$jq(function() {
$jq("#description_textarea").cleditor({ width: 626, height: 113, controls: "bold italic underline bullets link unlink source"});
//SHORT URL FUNCTIONS
$jq( "#slugEdit" ).click(function() {
$jq( "#slug" ).css('left', '0px');
$jq( "#slugContainer" ).css('opacity', '0');
});
$jq( "#slug" ).bind('keypress', function(e) {
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) { //ENTER KEY PRESSED
$jq( ".slug" ).html($jq( "#slug" ).val());
$jq( "#slug" ).css('left', '-9999px');
$jq( "#slugContainer" ).css('opacity', '100');
}
});
//DATE ELEMENTS
<?
$firstDay = 0;
if (isset($params->dateFormat)) {
if ($params->dateFormat == 'int') $firstDay = 1;
}
?>
$jq( ".cal1" ).datepicker({ dateFormat: 'yy-mm-dd', showAnim: '' , firstDay: <?=$firstDay?> });
// $jq( ".my" ).datepicker({ dateFormat: 'yy-mm-dd', showAnim: '' , firstDay: <?=$firstDay?> });
$jq( ".cal2" ).datepicker({ dateFormat: 'yy-mm-dd', showAnim: '' , firstDay: <?=$firstDay?> });
$jq( ".cal3" ).datepicker({ dateFormat: 'yy-mm-dd', showAnim: '' , firstDay: <?=$firstDay?> });
$jq( ".cal4" ).datepicker({ dateFormat: 'yy-mm-dd', showAnim: '' , firstDay: <?=$firstDay?> });
$jq( ".cal5" ).datepicker({ dateFormat: 'yy-mm-dd', showAnim: '' , firstDay: <?=$firstDay?> });
$jq( ".cal6" ).datepicker({ dateFormat: 'yy-mm-dd', showAnim: '' , firstDay: <?=$firstDay?> });
$jq( ".cal7" ).datepicker({ dateFormat: 'yy-mm-dd', showAnim: '' , firstDay: <?=$firstDay?> });
$jq( ".cal8" ).datepicker({ dateFormat: 'yy-mm-dd', showAnim: '' , firstDay: <?=$firstDay?> });
$jq( ".cal9" ).datepicker({ dateFormat: 'yy-mm-dd', showAnim: '' , firstDay: <?=$firstDay?> });
$jq( ".cal10" ).datepicker({ dateFormat: 'yy-mm-dd', showAnim: '' , firstDay: <?=$firstDay?> });
$jq( ".cal1" ).focus(function() {
$jq( "#calendarTab" ).css('top', $jq( "#ui-datepicker-div" ).css('top'));
$jq( "#calendarTab" ).css('left', $jq( "#ui-datepicker-div" ).css('left'));
$jq( "#calendarTab" ).css('width', $jq( "#ui-datepicker-div" ).css('width'));
$jq( "#calendarTab" ).css('display', 'block');
});
$jq( ".cal2" ).focus(function() {
$jq( "#calendarTab" ).css('top', $jq( "#ui-datepicker-div" ).css('top'));
$jq( "#calendarTab" ).css('left', $jq( "#ui-datepicker-div" ).css('left'));
$jq( "#calendarTab" ).css('width', $jq( "#ui-datepicker-div" ).css('width'));
$jq( "#calendarTab" ).css('display', 'block');
});
$jq( ".cal3" ).focus(function() {
$jq( "#calendarTab" ).css('top', $jq( "#ui-datepicker-div" ).css('top'));
$jq( "#calendarTab" ).css('left', $jq( "#ui-datepicker-div" ).css('left'));
$jq( "#calendarTab" ).css('width', $jq( "#ui-datepicker-div" ).css('width'));
$jq( "#calendarTab" ).css('display', 'block');
});
$jq( ".cal4" ).focus(function() {
$jq( "#calendarTab" ).css('top', $jq( "#ui-datepicker-div" ).css('top'));
$jq( "#calendarTab" ).css('left', $jq( "#ui-datepicker-div" ).css('left'));
$jq( "#calendarTab" ).css('width', $jq( "#ui-datepicker-div" ).css('width'));
$jq( "#calendarTab" ).css('display', 'block');
});
$jq( ".cal5" ).focus(function() {
$jq( "#calendarTab" ).css('top', $jq( "#ui-datepicker-div" ).css('top'));
$jq( "#calendarTab" ).css('left', $jq( "#ui-datepicker-div" ).css('left'));
$jq( "#calendarTab" ).css('width', $jq( "#ui-datepicker-div" ).css('width'));
$jq( "#calendarTab" ).css('display', 'block');
});
$jq( ".cal6" ).focus(function() {
$jq( "#calendarTab" ).css('top', $jq( "#ui-datepicker-div" ).css('top'));
$jq( "#calendarTab" ).css('left', $jq( "#ui-datepicker-div" ).css('left'));
$jq( "#calendarTab" ).css('width', $jq( "#ui-datepicker-div" ).css('width'));
$jq( "#calendarTab" ).css('display', 'block');
});
$jq( ".cal7" ).focus(function() {
$jq( "#calendarTab" ).css('top', $jq( "#ui-datepicker-div" ).css('top'));
$jq( "#calendarTab" ).css('left', $jq( "#ui-datepicker-div" ).css('left'));
$jq( "#calendarTab" ).css('width', $jq( "#ui-datepicker-div" ).css('width'));
$jq( "#calendarTab" ).css('display', 'block');
});
$jq( ".cal8" ).focus(function() {
$jq( "#calendarTab" ).css('top', $jq( "#ui-datepicker-div" ).css('top'));
$jq( "#calendarTab" ).css('left', $jq( "#ui-datepicker-div" ).css('left'));
$jq( "#calendarTab" ).css('width', $jq( "#ui-datepicker-div" ).css('width'));
$jq( "#calendarTab" ).css('display', 'block');
});
$jq( ".cal9" ).focus(function() {
$jq( "#calendarTab" ).css('top', $jq( "#ui-datepicker-div" ).css('top'));
$jq( "#calendarTab" ).css('left', $jq( "#ui-datepicker-div" ).css('left'));
$jq( "#calendarTab" ).css('width', $jq( "#ui-datepicker-div" ).css('width'));
$jq( "#calendarTab" ).css('display', 'block');
});
$jq( ".cal10" ).focus(function() {
$jq( "#calendarTab" ).css('top', $jq( "#ui-datepicker-div" ).css('top'));
$jq( "#calendarTab" ).css('left', $jq( "#ui-datepicker-div" ).css('left'));
$jq( "#calendarTab" ).css('width', $jq( "#ui-datepicker-div" ).css('width'));
$jq( "#calendarTab" ).css('display', 'block');
});
$jq( ".cal1" ).blur(function() {
$jq( "#calendarTab" ).css('display', 'none');
$jq( ".cal1" ).css('color', '#000');
});
$jq( ".cal2" ).blur(function() {
$jq( "#calendarTab" ).css('display', 'none');
$jq( ".cal2" ).css('color', '#000');
});
$jq( ".cal3" ).blur(function() {
$jq( "#calendarTab" ).css('display', 'none');
$jq( ".cal3" ).css('color', '#000');
});
$jq( ".cal4" ).blur(function() {
$jq( "#calendarTab" ).css('display', 'none');
$jq( ".cal4" ).css('color', '#000');
});
$jq( ".cal5" ).blur(function() {
$jq( "#calendarTab" ).css('display', 'none');
$jq( ".cal5" ).css('color', '#000');
});
$jq( ".cal6" ).blur(function() {
$jq( "#calendarTab" ).css('display', 'none');
$jq( ".cal5" ).css('color', '#000');
});
$jq( ".cal7" ).blur(function() {
$jq( "#calendarTab" ).css('display', 'none');
$jq( ".cal5" ).css('color', '#000');
});
$jq( ".cal8" ).blur(function() {
$jq( "#calendarTab" ).css('display', 'none');
$jq( ".cal5" ).css('color', '#000');
});
$jq( ".cal9" ).blur(function() {
$jq( "#calendarTab" ).css('display', 'none');
$jq( ".cal5" ).css('color', '#000');
});
$jq( ".cal10" ).blur(function() {
$jq( "#calendarTab" ).css('display', 'none');
$jq( ".cal5" ).css('color', '#000');
});
//TIME ELEMENTS
$jq('.time1').focus(function() { $jq(".time1").mask("99:99"); });
$jq('.time2').focus(function() { $jq(".time2").mask("99:99"); });
$jq('.time3').focus(function() { $jq(".time3").mask("99:99"); });
$jq('.time4').focus(function() { $jq(".time4").mask("99:99"); });
$jq('.time5').focus(function() { $jq(".time5").mask("9"); });
$jq('.time1').blur(function() { $jq( ".time1" ).css('color', '#000'); });
$jq('.time2').blur(function() { $jq( ".time2" ).css('color', '#000'); });
$jq('.time3').blur(function() { $jq( ".time3" ).css('color', '#000'); });
$jq('.time4').blur(function() { $jq( ".time4" ).css('color', '#000'); });
$jq('.time5').blur(function() { $jq( ".time5" ).css('color', '#000'); });
//DISABLE DATEPICKER VARIABLE POSITION
$jq.extend($jq.datepicker,{_checkOffset:function(inst,offset,isFixed){return offset}});
//TURN OFF DATEPICKER ON WINDOW RESIZE
$jq(window).resize(function() {
var field = $jq(document.activeElement);
if (field.is('.cal1')) { field.datepicker('hide').datepicker('show'); }
if (field.is('#cal2')) { field.datepicker('hide').datepicker('show'); }
if (field.is('#cal3')) { field.datepicker('hide').datepicker('show'); }
if (field.is('#cal4')) { field.datepicker('hide').datepicker('show'); }
if (field.is('#cal5')) { field.datepicker('hide').datepicker('show'); }
if (field.is('#cal6')) { field.datepicker('hide').datepicker('show'); }
if (field.is('#cal7')) { field.datepicker('hide').datepicker('show'); }
if (field.is('#cal8')) { field.datepicker('hide').datepicker('show'); }
if (field.is('#cal9')) { field.datepicker('hide').datepicker('show'); }
if (field.is('#cal10')) { field.datepicker('hide').datepicker('show'); }
});
//INTERACTIVE FIELDS
$jq('select[name="limit_number_of_attendees"]').change(function(){
if ($jq(this).attr('value')=="1") { $jq('#attendees_limit').css('display', 'inline'); }
else { $jq('#attendees_limit').css('display', 'none'); }
});
<? if (!$event->limit_number_of_attendees) : ?>
$jq('#attendees_limit').css('display', 'none');
<? endif ?>
$jq('select[name="isRecurring"]').change(function(){
if($jq(this).attr('value')=="1") {
$jq('#recurrCount').css('display', 'inline');
$jq('#recurrPeriod').css('display', 'inline');
$jq('#recurrEnd').css('display', 'inline');
} else {
$jq('#recurrCount').css('display', 'none');
$jq('#recurrPeriod').css('display', 'none');
$jq('#recurrEnd').css('display', 'none');
}
});
<? if (!$event->end_time_enabled) : ?>
$jq('#end_timer_h').css('display', 'none');
$jq('#end_timer_m').css('display', 'none');
$jq('#end_timer_ampm').css('display', 'none');
$jq('#end_date_1').css('display', 'none');
$jq('#end_date_2').css('display', 'none');
$jq('#end_date_3').css('display', 'none');
$jq('#end_date_4').css('display', 'none');
$jq('#end_date_5').css('display', 'none');
<? endif ?>
$jq('input[name="end_time_enabled_1"]').change(function(){
if($jq(this).is(":checked")) {
// visual
$jq('#end_date_1').css('display', 'inline');
$jq('#end_timer_h_1').css('display', 'inline');
$jq('#end_timer_m_1').css('display', 'inline');
$jq('#end_timer_ampm_1').css('display', 'inline');
var start_hours = parseInt($jq('select[name="start_time_h"]').val(), 10);
var end_hours = start_hours + 6;
var inc_date = false;
if ($jq('select[name="end_time_ampm_1"]').length) { // we are in AM/PM mode
// 12 means 00 so + 6 will be OK, just adjust it
if (start_hours == 12) {
end_hours = end_hours - 12;
}
// if we get over 11, we must check if we are in AM or PM
if (end_hours > 11) {
if ($jq('select[name="start_time_ampm_1"]').val() == "AM") {
// it's AM and +6 led us into PM
$jq('select[name="end_time_ampm_1"]').val("PM");
} else { // it's PM
$jq('select[name="end_time_ampm_1"]').val("AM");
inc_date = true;
}
if (end_hours > 12) { // if it's 12, leave it alone, it's OK
end_hours = end_hours - 12;
}
}
} else { // 24h mode
if (end_hours > 23) {
end_hours = end_hours - 24;
inc_date = true;
}
}
// now to set up end_timer_h to it's proper value and to increase date if needed
if (inc_date) {
var date2 = $jq('#date_1').datepicker('getDate', '+1d');
date2.setDate(date2.getDate()+1);
$jq('#end_date_1').datepicker('setDate', date2);
} else {
var date2 = $jq('#date_1').datepicker('getDate');
$jq('#end_date_1').datepicker('setDate', date2);
}
if (end_hours < 10) end_hours = "0" + end_hours;
$jq('select[name="end_time_h_1"]').val(end_hours);
// put minutes the same
$jq('select[name="end_time_m_1"]').val($jq('select[name="start_time_m_1"]').val())
} else { // uncheck
$jq('#end_timer_h_1').css('display', 'none');
$jq('#end_timer_m_1').css('display', 'none');
$jq('#end_timer_ampm_1').css('display', 'none');
$jq('#end_date_1').css('display', 'none');
}
});
$jq('input[name="end_time_enabled_2"]').change(function(){
if($jq(this).is(":checked")) {
// visual
//$jq('#end_date_1').css('display', 'inline');
$jq('#end_date_2').css('display', 'inline');
$jq('#end_timer_h_2').css('display', 'inline');
$jq('#end_timer_m_2').css('display', 'inline');
$jq('#end_timer_ampm_2').css('display', 'inline');
var start_hours = parseInt($jq('select[name="start_time_h_2"]').val(), 10);
var end_hours = start_hours + 6;
var inc_date = false;
if ($jq('select[name="end_time_ampm_2"]').length) { // we are in AM/PM mode
// 12 means 00 so + 6 will be OK, just adjust it
if (start_hours == 12) {
end_hours = end_hours - 12;
}
// if we get over 11, we must check if we are in AM or PM
if (end_hours > 11) {
if ($jq('select[name="start_time_ampm_2"]').val() == "AM") {
// it's AM and +6 led us into PM
$jq('select[name="end_time_ampm_2"]').val("PM");
} else { // it's PM
$jq('select[name="end_time_ampm_2"]').val("AM");
inc_date = true;
}
if (end_hours > 12) { // if it's 12, leave it alone, it's OK
end_hours = end_hours - 12;
}
}
} else { // 24h mode
if (end_hours > 23) {
end_hours = end_hours - 24;
inc_date = true;
}
}
// now to set up end_timer_h to it's proper value and to increase date if needed
if (inc_date) {
var date2 = $jq('#date_2').datepicker('getDate', '+1d');
date2.setDate(date2.getDate()+1);
$jq('#end_date_2').datepicker('setDate', date2);
} else {
var date2 = $jq('#date_2').datepicker('getDate');
$jq('#end_date_2').datepicker('setDate', date2);
}
if (end_hours < 10) end_hours = "0" + end_hours;
$jq('select[name="end_time_h_2"]').val(end_hours);
// put minutes the same
$jq('select[name="end_time_m_2"]').val($jq('select[name="start_time_m_2"]').val())
} else { // uncheck
$jq('#end_timer_h_2').css('display', 'none');
$jq('#end_timer_m_2').css('display', 'none');
$jq('#end_timer_ampm_2').css('display', 'none');
$jq('#end_date_2').css('display', 'none');
}
});
$jq('input[name="end_time_enabled_3"]').change(function(){
if($jq(this).is(":checked")) {
// visual
//$jq('#end_date_1').css('display', 'inline');
$jq('#end_date_3').css('display', 'inline');
$jq('#end_timer_h_3').css('display', 'inline');
$jq('#end_timer_m_3').css('display', 'inline');
$jq('#end_timer_ampm_3').css('display', 'inline');
var start_hours = parseInt($jq('select[name="start_time_h_3"]').val(), 10);
var end_hours = start_hours + 6;
var inc_date = false;
if ($jq('select[name="end_time_ampm_3"]').length) { // we are in AM/PM mode
// 12 means 00 so + 6 will be OK, just adjust it
if (start_hours == 12) {
end_hours = end_hours - 12;
}
// if we get over 11, we must check if we are in AM or PM
if (end_hours > 11) {
if ($jq('select[name="start_time_ampm_3"]').val() == "AM") {
// it's AM and +6 led us into PM
$jq('select[name="end_time_ampm_3"]').val("PM");
} else { // it's PM
$jq('select[name="end_time_ampm_3"]').val("AM");
inc_date = true;
}
if (end_hours > 12) { // if it's 12, leave it alone, it's OK
end_hours = end_hours - 12;
}
}
} else { // 24h mode
if (end_hours > 23) {
end_hours = end_hours - 24;
inc_date = true;
}
}
// now to set up end_timer_h to it's proper value and to increase date if needed
if (inc_date) {
var date2 = $jq('#date_3').datepicker('getDate', '+1d');
date2.setDate(date2.getDate()+1);
$jq('#end_date_3').datepicker('setDate', date2);
} else {
var date2 = $jq('#date_3').datepicker('getDate');
$jq('#end_date_3').datepicker('setDate', date2);
}
if (end_hours < 10) end_hours = "0" + end_hours;
$jq('select[name="end_time_h_3"]').val(end_hours);
// put minutes the same
$jq('select[name="end_time_m_3"]').val($jq('select[name="start_time_m_3"]').val())
} else { // uncheck
$jq('#end_timer_h_3').css('display', 'none');
$jq('#end_timer_m_3').css('display', 'none');
$jq('#end_timer_ampm_3').css('display', 'none');
$jq('#end_date_3').css('display', 'none');
}
});
$jq('input[name="end_time_enabled_4"]').change(function(){
if($jq(this).is(":checked")) {
// visual
//$jq('#end_date_1').css('display', 'inline');
$jq('#end_date_4').css('display', 'inline');
$jq('#end_timer_h_4').css('display', 'inline');
$jq('#end_timer_m_4').css('display', 'inline');
$jq('#end_timer_ampm_4').css('display', 'inline');
var start_hours = parseInt($jq('select[name="start_time_h_4"]').val(), 10);
var end_hours = start_hours + 6;
var inc_date = false;
if ($jq('select[name="end_time_ampm_4"]').length) { // we are in AM/PM mode
// 12 means 00 so + 6 will be OK, just adjust it
if (start_hours == 12) {
end_hours = end_hours - 12;
}
// if we get over 11, we must check if we are in AM or PM
if (end_hours > 11) {
if ($jq('select[name="start_time_ampm_4"]').val() == "AM") {
// it's AM and +6 led us into PM
$jq('select[name="end_time_ampm_4"]').val("PM");
} else { // it's PM
$jq('select[name="end_time_ampm_4"]').val("AM");
inc_date = true;
}
if (end_hours > 12) { // if it's 12, leave it alone, it's OK
end_hours = end_hours - 12;
}
}
} else { // 24h mode
if (end_hours > 23) {
end_hours = end_hours - 24;
inc_date = true;
}
}
// now to set up end_timer_h to it's proper value and to increase date if needed
if (inc_date) {
var date2 = $jq('#date_4').datepicker('getDate', '+1d');
date2.setDate(date2.getDate()+1);
$jq('#end_date_4').datepicker('setDate', date2);
} else {
var date2 = $jq('#date_4').datepicker('getDate');
$jq('#end_date_2').datepicker('setDate', date2);
}
if (end_hours < 10) end_hours = "0" + end_hours;
$jq('select[name="end_time_h_4"]').val(end_hours);
// put minutes the same
$jq('select[name="end_time_m_4"]').val($jq('select[name="start_time_m_4"]').val())
} else { // uncheck
$jq('#end_timer_h_4').css('display', 'none');
$jq('#end_timer_m_4').css('display', 'none');
$jq('#end_timer_ampm_4').css('display', 'none');
$jq('#end_date_4').css('display', 'none');
}
});
$jq('input[name="end_time_enabled_5"]').change(function(){
if($jq(this).is(":checked")) {
// visual
//$jq('#end_date_1').css('display', 'inline');
$jq('#end_date_5').css('display', 'inline');
$jq('#end_timer_h_5').css('display', 'inline');
$jq('#end_timer_m_5').css('display', 'inline');
$jq('#end_timer_ampm_5').css('display', 'inline');
var start_hours = parseInt($jq('select[name="start_time_h_5"]').val(), 10);
var end_hours = start_hours + 6;
var inc_date = false;
if ($jq('select[name="end_time_ampm_5"]').length) { // we are in AM/PM mode
// 12 means 00 so + 6 will be OK, just adjust it
if (start_hours == 12) {
end_hours = end_hours - 12;
}
// if we get over 11, we must check if we are in AM or PM
if (end_hours > 11) {
if ($jq('select[name="start_time_ampm_5"]').val() == "AM") {
// it's AM and +6 led us into PM
$jq('select[name="end_time_ampm_5"]').val("PM");
} else { // it's PM
$jq('select[name="end_time_ampm_5"]').val("AM");
inc_date = true;
}
if (end_hours > 12) { // if it's 12, leave it alone, it's OK
end_hours = end_hours - 12;
}
}
} else { // 24h mode
if (end_hours > 23) {
end_hours = end_hours - 24;
inc_date = true;
}
}
// now to set up end_timer_h to it's proper value and to increase date if needed
if (inc_date) {
var date2 = $jq('#date_5').datepicker('getDate', '+1d');
date2.setDate(date2.getDate()+1);
$jq('#end_date_5').datepicker('setDate', date2);
} else {
var date2 = $jq('#date_5').datepicker('getDate');
$jq('#end_date_5').datepicker('setDate', date2);
}
if (end_hours < 10) end_hours = "0" + end_hours;
$jq('select[name="end_time_h_5"]').val(end_hours);
// put minutes the same
$jq('select[name="end_time_m_5"]').val($jq('select[name="start_time_m_5"]').val())
} else { // uncheck
$jq('#end_timer_h_5').css('display', 'none');
$jq('#end_timer_m_5').css('display', 'none');
$jq('#end_timer_ampm_5').css('display', 'none');
$jq('#end_date_5').css('display', 'none');
}
});
$jq('#end_date_1').change(function() {
if ($jq('#end_date_1').val() < $jq('#date_1').val()) {
alert('End date must be after start date');
$jq('#end_date_1').val($jq('#date_1').val());
}
check_times();
});
$jq('#date_1').change(function() {
if ($jq('#end_date_1').val() < $jq('#date_1').val()) {
$jq('#end_date_1').val($jq('#date_1').val());
}
check_times();
});
$jq('#end_date_2').change(function() {
if ($jq('#end_date_2').val() < $jq('#date_2').val()) {
alert('End date must be after start date');
$jq('#end_date_2').val($jq('#date_2').val());
}
check_times();
});
$jq('#date_2').change(function() {
if ($jq('#end_date_2').val() < $jq('#date_2').val()) {
$jq('#end_date_2').val($jq('#date_2').val());
}
check_times();
});
$jq('#end_date_3').change(function() {
if ($jq('#end_date_3').val() < $jq('#date_3').val()) {
alert('End date must be after start date');
$jq('#end_date_3').val($jq('#date_3').val());
}
check_times();
});
$jq('#date_2').change(function() {
if ($jq('#end_date_3').val() < $jq('#date_3').val()) {
$jq('#end_date_3').val($jq('#date_3').val());
}
check_times();
});
$jq('#end_date_4').change(function() {
if ($jq('#end_date_4').val() < $jq('#date_4').val()) {
alert('End date must be after start date');
$jq('#end_date_4').val($jq('#date_4').val());
}
check_times();
});
$jq('#date_4').change(function() {
if ($jq('#end_date_4').val() < $jq('#date_4').val()) {
$jq('#end_date_4').val($jq('#date_4').val());
}
check_times();
});
$jq('#end_date_5').change(function() {
if ($jq('#end_date_5').val() < $jq('#date_5').val()) {
alert('End date must be after start date');
$jq('#end_date_5').val($jq('#date_5').val());
}
check_times();
});
$jq('#date_5').change(function() {
if ($jq('#end_date_5').val() < $jq('#date_5').val()) {
$jq('#end_date_5').val($jq('#date_5').val());
}
check_times();
});
$jq('select[name="start_time_h"], select[name="start_time_m"], select[name="start_time_ampm"], select[name="end_time_h"], select[name="end_time_m"], select[name="end_time_ampm"]').change(function() {
check_times();
});
});
</script>
<?
$config =& JFactory::getConfig();
$language = $config->get('language');
$orig_language = $language;
$languagesSupportedByjQueryUI = array('af', 'ar', 'az', 'bg', 'bs', 'ca', 'cs', 'da', 'de-CH', 'de', 'el', 'en-GB', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr-CH', 'fr', 'he', 'hr', 'hu', 'hy', 'id', 'is', 'it', 'ja', 'ko', 'lt', 'lv', 'ms', 'nl-BE', 'nl', 'no', 'pl', 'pt-BR', 'ro', 'ru', 'sk', 'sl', 'sq', 'sr-SR', 'sr', 'sv', 'ta', 'th', 'tr', 'uk', 'vi', 'zh-CN', 'zh-HK', 'zh-TW');
if (in_array($orig_language, $languagesSupportedByjQueryUI)) {
$language = $orig_language;
}
else {
if (in_array(strtolower(substr($orig_language, -2, 2)), $languagesSupportedByjQueryUI)) {
$language = strtolower(substr($orig_language, -2, 2));
} else {
if (in_array(substr($orig_language, 0, 2), $languagesSupportedByjQueryUI))
$language = substr($orig_language, 0, 2);
else
$language = 'en-GB';
}
}
// fix because googlecode don't have portuguese (portugal) as language and brazilian and portuguese are the same in this matter
if ($orig_language == "pt-PT") {$language = "pt-BR";}
if ($orig_language == "ca-ES") {$language = "ca";}
?>
<script type="text/javascript" src="media://com_ohanah/js/datepicker-locale/jquery.ui.datepicker-<?=$language?>.js"></script>
<form action="" method="post" class="form-validate -koowa-form" id="edit-form" enctype="multipart/form-data">
<input type="hidden" name="id" value="<?=$event->id?>" />
<? if (JVersion::isCompatible('3.0')) : ?>
<? JSession::getFormToken() ?>
<? else : ?>
<? JUtility::getToken() ?>
<? endif ?>
<? if (!$event->id) : ?>
<input type="hidden" id="random_id" name="random_id" value="<?=rand()%5000?>" />
<? endif ?>
<input type="hidden" id="latlng" name="latlng" />
<? if ($event->isRecurring()) : ?>
<div id="toolbar-box" class="alert">
<div class="t">
<div class="t">
<div class="t"></div>
</div>
</div>
<div class="m">
<? if ($event->recurringParent) : ?>
<div id="toolbar" class="toolbar alert">
<table class="toolbar alert">
<tbody>
<tr>
<td id="toolbar-about" class="button">
<a class="toolbar" href="<?=@route('view=event&id='.$event->recurringParent)?>">
<span title="About" class="icon-32-about"></span>
<?=@text('OHANAH_EDIT_MASTER')?>
</a>
</td>
<td id="toolbar-about" class="button">
<a class="toolbar" href="<?=@route('view=events&recurringParent='.$event->recurringParent)?>">
<span title="About" class="icon-32-about"></span>
<?=@text('OHANAH_SEE_WHOLE_SERIE')?>
</a>
</td>
<td id="toolbar-about" class="button">
<a class="toolbar" href="#" id="detach-from-serie">
<span title="About" class="icon-32-about"></span>
<?=@text('OHANAH_DETACH_FROM_SERIE')?>
</a>
</td>
</tr>
</tbody>
</table>
</div>
<script>
$jq(function() {
$jq('#detach-from-serie').click(function(){
var input = $jq("<input>").attr("type", "hidden").attr("name", "action").val("removefromrecurringset");
$jq('#edit-form').append($jq(input));
$jq('#edit-form').submit();
});
});
</script>
<div class="header icon-48-alert"><?=@text('OHANAH_PART_OF_SERIES_DESC')?></div>
<? else : ?>
<div id="toolbar" class="toolbar alert">
<table class="toolbar alert">
<tbody>
<tr>
<td id="toolbar-about" class="button">
<a class="toolbar" href="<?=@route('view=events&recurringParent='.$event->id)?>">
<span title="About" class="icon-32-about"></span><?=@text('OHANAH_SEE_WHOLE_SERIE')?>
</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="header icon-48-alert-master"><?=@text('OHANAH_MASTER_OF_SERIES_DESC')?><br><span style="color: red"><? $str = 'OHANAH_MASTER_OF_SERIES_WARNING'; $text = @text($str); echo ($text == "" || $text == $str) ? 'Changing anything in this event will OVERWRITE ALL CHANGES that you made to child events.' : $text; ?></span></div>
<? endif ?>
<div class="clr"></div>
</div>
<div class="b">
<div class="b">
<div class="b"></div>
</div>
</div>
</div>
<? endif; ?>
<div class="clr"></div>
<div id="eventWrapper" class="clearfix">
<div id="panelWrapper">
<div id="adminLeft">
<div class="panel">
<div class="panelContent">
<table>
<tr>
<td style="width:60%;" >
<span class="fieldTitle"><?=@text('OHANAH_TITLE')?></span><br/><input type="text" id="title" name="title" class="text required" value="<?=htmlspecialchars(@$event->title)?>" />
</td>
<td>
<span class="fieldTitle">&nbsp;</span><br/>
<div class="dropdownWrapper">
<div class="dropdown size1">
<?=@helper('com://admin/ohanah.template.helper.listbox.categories', array('name' => 'ohanah_category_id', 'selected' => $event->ohanah_category_id, 'disable' => true)) ?>
</div>
</div>
</td>
</tr>
<? if ($event->id) : ?>
<tr>
<td colspan="2">
<div class="small" id="slugContainer">http://<?=$_SERVER['HTTP_HOST'].KRequest::root()?>/<span class="slug"><?=htmlspecialchars(@$event->slug)?></span> <a href="javascript:" id="slugEdit"><?=@text('OHANAH_EDIT')?></a></div><input type="text" id="slug" name="slug" value="<?=htmlspecialchars(@$event->slug)?>" class="text" style="width:384px">
</td>
</tr>
<? endif ?>
</table>
<table>
<tr>
<td colspan="2"><span class="fieldTitle"><?=@text('OHANAH_DESCRIPTION')?></span><br/>
<? if (isset($params->useStandardJoomlaEditor)) $useStandardJoomlaEditor = $params->useStandardJoomlaEditor; else $useStandardJoomlaEditor = false; ?>
<? if ($useStandardJoomlaEditor) : ?>
<?= @editor( array('height' => '291', 'cols' => '100', 'rows' => '20')); ?>
<? else : ?>
<textarea class="description" name="description" id="description_textarea"><?=$event->description?></textarea>
<? endif ?>
</td>
</tr>
<tr>
<td><span class="fieldTitle"><?=@text('OHANAH_NAME_OF_VENUE')?></span><br/><input type="text" name="venue" id="venue" class="text size5" value="<? if ($event->id) echo htmlspecialchars($this->getService('com://admin/ohanah.model.venues')->id($event->ohanah_venue_id)->getItem()->title)?>" /></td>
<td rowspan="2">
<span class="fieldTitle"><?=@text('OHANAH_MAP')?></span>
<br/>
<?= @template('com://admin/ohanah.view.common.map', array('item' => $event, 'name' => 'event')); ?>
</td>
</tr>
<tr>
<td>
<span class="fieldTitle"><?=@text('OHANAH_ADDRESS')?></span><br/>
<input id="address" name="address" type="text" class="text size5" value="<?=htmlspecialchars(@$event->address)?>" />
</td>
</tr>
<?php
// $edittime=explode(',',$event->start_time);
$editDate=explode(',',$event->date);
$editEndDate=explode(',',$event->end_date);
$edittime=explode(',',$event->start_time);
$editendtime=explode(',',$event->end_time);
if(isset($_REQUEST['id']) && !empty($_REQUEST['id']))
{
$countDate=count($editDate);
$createDate=1;
$editdateshow=0;
for($showDate=1;$showDate<=5;$showDate++)
{
?>
<tr id="event_calender_container_<?php echo $showDate; ?>">
<td class="start">
<span class="fieldTitle"><?=@text('OHANAH_START')?></span><br/>
<? if (is_array($editDate) && !empty($editDate[$editdateshow])) $day = new KDate(new KConfig(array('date' => $editDate[$editdateshow]))); else $day = new KDate()?>
<input name='date[]' type='text' value='<?=$day->getDate('%Y-%m-%d')?>' class='text formDate calendar cal<?php echo $createDate;?> required' id="date_<?php echo $showDate; ?>" style="float:left" />
<? $ampm = "";
if (JComponentHelper::getParams('com_ohanah')->get('timeFormat') == '1') $ampm = "ampm";
?>
<? if ($ampm) : ?>
<div class="dropdownWrapper" id="start_timer_ampm">
<div class="dropdown size3 time <?=$ampm?>" style="float:left;">
<?=@helper('com://admin/ohanah.template.helper.listbox.timeAMPM', array('name' => 'start_time_ampm', 'selected' =>
intval(substr($event->start_time, 0, 2))+1 <= 12 ? "AM" : "PM")) ?>
</div>
</div>
<? endif; ?>
<div class="dropdownWrapper" id="start_timer_m">
<div class="dropdown size3 time <?=$ampm?>" style="float:left; <? if ($ampm) echo "margin-right: 10px;";?>">
<?=@helper('com://admin/ohanah.template.helper.listbox.timeM', array('name' => 'start_time_m_'.$showDate, 'selected' => substr($edittime[$editdateshow], 3, 2))) ?>
</div>
</div>
<div class="dropdownWrapper" id="start_timer_h">
<div class="dropdown size3 time <?=$ampm?>" style="float:left; margin-right: 10px;">
<?
$hour = @helper('com://admin/ohanah.template.helper.datetime.getHour', array('time' => $event->start_time));
?>
<?=@helper('com://admin/ohanah.template.helper.listbox.timeH', array('name' => 'start_time_h_'.$showDate, 'selected' => substr($edittime[$editdateshow], 0, 2))) ?>
</div>
</div>
</td>
<td style="width:340px">
<span class="fieldTitle"><input type="checkbox" name="end_time_enabled_<?php echo $showDate; ?>" value="0" <? if ($event->end_time_enabled == '1') echo 'checked' ?> id="end_time_enabled_<?php echo $showDate; ?>" /> <?=@text('OHANAH_ADD_END_TIME')?></span><br/>
<? //if ($event->end_date) $day = new KDate(new KConfig(array('date' => $event->end_date))); else $day = new KDate()?>
<? if (is_array($editEndDate) && !empty($editEndDate[$editdateshow])) $day = new KDate(new KConfig(array('date' => $editEndDate[$editdateshow]))); else $day = new KDate()?>
<input name='end_date[]' type='text' value='<?=$day->getDate('%Y-%m-%d')?>' class='text formDate calendar cal<?php echo ($createDate+1);?>' id="end_date_<?php echo $showDate; ?>" />
<? $ampm = "";
if (JComponentHelper::getParams('com_ohanah')->get('timeFormat') == '1') $ampm = "ampm";
?>
<? if ($ampm) : ?>
<div class="dropdownWrapper" id="end_timer_ampm_<?php echo $showDate;?>">
<div class="dropdown size3 time <?=$ampm?>" style="float:left;">
<?=@helper('com://admin/ohanah.template.helper.listbox.timeAMPM', array('name' => 'end_time_ampm_'.$showDate, 'selected' =>
intval(substr($event->end_time, 0, 2))+1 <= 12 ? "AM" : "PM")) ?>
</div>
</div>
<? endif; ?>
<div class="dropdownWrapper" id="end_timer_m_<?php echo $showDate; ?>" style="display:none;">
<div class="dropdown size3 time <?=$ampm?>" style="float:left; <? if ($ampm) echo "margin-right: 10px;";?>">
<?=@helper('com://admin/ohanah.template.helper.listbox.timeM', array('name' => 'end_time_m_'.$showDate, 'selected' => substr($editendtime[$editdateshow], 3, 2))) ?>
</div>
</div>
<div class="dropdownWrapper" id="end_timer_h_<?php echo $showDate; ?>" style="display:none;">
<div class="dropdown size3 time <?=$ampm?>" style="float:left; margin-right: 10px;">
<? $hour = @helper('com://admin/ohanah.template.helper.datetime.getHour', array('time' => $event->end_time)); ?>
<?=@helper('com://admin/ohanah.template.helper.listbox.timeH', array('name' => 'end_time_h_'.$showDate, 'selected' => substr($editendtime[$editdateshow], 0, 2))) ?>
</div>
</div>
</td>
</tr>
<?php
$editdateshow++;
}
?>
<script>
jQuery(document).ready(function(){
var editdateshow=<?php echo $countDate; ?>;
jQuery("#end_time_enabled_1").attr('checked',true);
jQuery('#end_date_1').show();jQuery('#end_timer_m_1').show();jQuery('#end_timer_h_1').show();
jQuery('#event_calender_container_2').hide();
jQuery('#event_calender_container_3').hide();
jQuery('#event_calender_container_4').hide();
jQuery('#event_calender_container_5').hide();
if(editdateshow==2)
{
jQuery("#end_time_enabled_2").attr('checked',true);
jQuery('#event_calender_container_2').show();
jQuery('#end_date_2').show();
jQuery('#end_timer_m_2').show();jQuery('#end_timer_h_2').show();
}
if(editdateshow==3)
{
jQuery("#end_time_enabled_2").attr('checked',true);
jQuery("#end_time_enabled_3").attr('checked',true);
jQuery('#event_calender_container_2').show();
jQuery('#event_calender_container_3').show();
jQuery('#end_date_2').show(); jQuery('#end_date_3').show();
jQuery('#end_timer_m_2').show();jQuery('#end_timer_h_2').show();
jQuery('#end_timer_m_3').show();jQuery('#end_timer_h_3').show();
}
if(editdateshow==4)
{
jQuery("#end_time_enabled_2").attr('checked',true);
jQuery("#end_time_enabled_3").attr('checked',true);
jQuery("#end_time_enabled_4").attr('checked',true);
jQuery('#event_calender_container_2').show();
jQuery('#event_calender_container_3').show();
jQuery('#event_calender_container_4').show();
jQuery('#end_date_2').show(); jQuery('#end_date_3').show(); jQuery('#end_date_4').show();
jQuery('#end_timer_m_2').show();jQuery('#end_timer_h_2').show();
jQuery('#end_timer_m_3').show();jQuery('#end_timer_h_3').show();
jQuery('#end_timer_m_4').show();jQuery('#end_timer_h_4').show();
}
if(editdateshow==5)
{
jQuery("#end_time_enabled_2").attr('checked',true);
jQuery("#end_time_enabled_3").attr('checked',true);
jQuery("#end_time_enabled_4").attr('checked',true);
jQuery("#end_time_enabled_5").attr('checked',true);
jQuery('#event_calender_container_2').show();
jQuery('#event_calender_container_3').show();
jQuery('#event_calender_container_4').show();
jQuery('#event_calender_container_5').show();
jQuery('#end_date_2').show(); jQuery('#end_date_3').show(); jQuery('#end_date_4').show(); jQuery('#end_date_5').show();
jQuery('#end_timer_m_2').show();jQuery('#end_timer_h_2').show();
jQuery('#end_timer_m_3').show();jQuery('#end_timer_h_3').show();
jQuery('#end_timer_m_4').show();jQuery('#end_timer_h_4').show();
jQuery('#end_timer_m_5').show();jQuery('#end_timer_h_5').show();
}
jQuery('#clickEvent').click(function(){
if(jQuery('#getClickInfo').val()==4)
{
jQuery('#event_calender_container_5').show();
jQuery('#getClickInfo').val(5);
}
if(jQuery('#getClickInfo').val()==3)
{
jQuery('#event_calender_container_4').show();
jQuery('#getClickInfo').val(4);
}
if(jQuery('#getClickInfo').val()==2)
{
jQuery('#event_calender_container_3').show();
jQuery('#getClickInfo').val(3);
}
if(jQuery('#getClickInfo').val()=='')
{
jQuery('#event_calender_container_2').show();
jQuery('#getClickInfo').val(2);
}
});
});
</script>
<?php
}
else{
$createDate=1;
for($showDate=1;$showDate<=5;$showDate++)
{
?>
<tr id="event_calender_container_<?php echo $showDate; ?>">
<td class="start">
<span class="fieldTitle"><?=@text('OHANAH_START')?></span><br/>
<? if ($event->date) $day = new KDate(new KConfig(array('date' => $event->date))); else $day = new KDate()?>
<input name='date[]' type='text' value='<?=$day->getDate('%Y-%m-%d')?>' class='text formDate calendar cal<?php echo $createDate;?> required' id="date_<?php echo $showDate; ?>" style="float:left" />
<? $ampm = "";
if (JComponentHelper::getParams('com_ohanah')->get('timeFormat') == '1') $ampm = "ampm";
?>
<? if ($ampm) : ?>
<div class="dropdownWrapper" id="start_timer_ampm">
<div class="dropdown size3 time <?=$ampm?>" style="float:left;">
<?=@helper('com://admin/ohanah.template.helper.listbox.timeAMPM', array('name' => 'start_time_ampm_'.$showDate, 'selected' =>
intval(substr($event->start_time, 0, 2))+1 <= 12 ? "AM" : "PM")) ?>
</div>
</div>
<? endif; ?>
<div class="dropdownWrapper" id="start_timer_m">
<div class="dropdown size3 time <?=$ampm?>" style="float:left; <? if ($ampm) echo "margin-right: 10px;";?>">
<?=@helper('com://admin/ohanah.template.helper.listbox.timeM', array('name' => 'start_time_m_'.$showDate, 'selected' => substr($event->start_time, 3, 2))) ?>
</div>
</div>
<div class="dropdownWrapper" id="start_timer_h">
<div class="dropdown size3 time <?=$ampm?>" style="float:left; margin-right: 10px;">
<?
$hour = @helper('com://admin/ohanah.template.helper.datetime.getHour', array('time' => $event->start_time));
?>
<?=@helper('com://admin/ohanah.template.helper.listbox.timeH', array('name' => 'start_time_h_'.$showDate, 'selected' => $hour)) ?>
</div>
</div>
</td>
<td style="width:340px">
<span class="fieldTitle"><input type="checkbox" name="end_time_enabled_<?php echo $showDate; ?>" value="0" <? if ($event->end_time_enabled == '1') echo 'checked' ?> /> <?=@text('OHANAH_ADD_END_TIME')?></span><br/>
<? if ($event->end_date) $day = new KDate(new KConfig(array('date' => $event->end_date))); else $day = new KDate()?>
<input name='end_date[]' type='text' value='<?=$day->getDate('%Y-%m-%d')?>' class='text formDate calendar cal<?php echo ($createDate+1);?>' id="end_date_<?php echo $showDate; ?>" />
<? $ampm = "";
if (JComponentHelper::getParams('com_ohanah')->get('timeFormat') == '1') $ampm = "ampm";
?>
<? if ($ampm) : ?>
<div class="dropdownWrapper" id="end_timer_ampm">
<div class="dropdown size3 time <?=$ampm?>" style="float:left;">
<?=@helper('com://admin/ohanah.template.helper.listbox.timeAMPM', array('name' => 'end_time_ampm_'.$showDate, 'selected' =>
intval(substr($event->end_time, 0, 2))+1 <= 12 ? "AM" : "PM")) ?>
</div>
</div>
<? endif; ?>
<div class="dropdownWrapper" id="end_timer_m_<?php echo $showDate; ?>" style="display:none;">
<div class="dropdown size3 time <?=$ampm?>" style="float:left; <? if ($ampm) echo "margin-right: 10px;";?>">
<?=@helper('com://admin/ohanah.template.helper.listbox.timeM', array('name' => 'end_time_m_'.$showDate, 'selected' => substr($event->end_time, 3, 2))) ?>
</div>
</div>
<div class="dropdownWrapper" id="end_timer_h_<?php echo $showDate; ?>" style="display:none;">
<div class="dropdown size3 time <?=$ampm?>" style="float:left; margin-right: 10px;">
<? $hour = @helper('com://admin/ohanah.template.helper.datetime.getHour', array('time' => $event->end_time)); ?>
<?=@helper('com://admin/ohanah.template.helper.listbox.timeH', array('name' => 'end_time_h_'.$showDate, 'selected' => $hour)) ?>
</div>
</div>
</td>
</tr>
<?php
$createDate=$createDate+2;
}
?>
<script>
jQuery(document).ready(function(){
jQuery('#event_calender_container_2').hide();
jQuery('#event_calender_container_3').hide();
jQuery('#event_calender_container_4').hide();
jQuery('#event_calender_container_5').hide();
// var clickEventHandler=1;
jQuery('#clickEvent').click(function(){
if(jQuery('#getClickInfo').val()==4)
{
jQuery('#event_calender_container_5').show();
jQuery('#getClickInfo').val(5);
}
if(jQuery('#getClickInfo').val()==3)
{
jQuery('#event_calender_container_4').show();
jQuery('#getClickInfo').val(4);
}
if(jQuery('#getClickInfo').val()==2)
{
jQuery('#event_calender_container_3').show();
jQuery('#getClickInfo').val(3);
}
if(jQuery('#getClickInfo').val()=='')
{
jQuery('#event_calender_container_2').show();
jQuery('#getClickInfo').val(2);
}
});
});
</script>
<?php
}
?>
<tr><td colspan="2">
<!-- <a href="javascript:void(0);" onclick="addMoreEventData();">addmore </a> -->
<input type="button" id="clickEvent" value="Add More" style="border:1px solid f8f8f8;padding:6px 40px;">
<input type="hidden" id="getClickInfo" value="">
</td></tr>
</table>
<div class="block">
<? if ($event->isRecurring() && !$event->recurringParent) : ?>
<table>
<tr>
<td>
<span class="fieldTitle"><?=@text('OHANAH_RECURRING_EVENT')?></span><br/>
<div class="dropdownWrapper left">
<div class="dropdown size1">
<select id="recurr" class="disabled" disabled><option value="Yes"><?=@text('OHANAH_YES_EVERY')?></option></select>
</div>
</div>
<input type="text" name="everyNumber" class="text twenty disabled" disabled value="<? echo $event->everyNumber ? $event->everyNumber : ''; ?>" />
</td>
<td>
<span class="fieldTitle">&nbsp;</span><br/>
<div class="dropdownWrapper left">
<div class="dropdown size4">
<select name="everyWhat" disabled class="disabled">
<option value="month"<? if ($event->everyWhat=='month') echo ' selected' ?>><?=@text('OHANAH_MONTHS')?></option>
<option value="week"<? if ($event->everyWhat=='week') echo ' selected' ?>><?=@text('OHANAH_WEEKS')?></option>
<option value="day"<? if ($event->everyWhat=='day') echo ' selected' ?>><?=@text('OHANAH_DAYS')?></option>
<option value="year"<? if ($event->everyWhat=='year') echo ' selected' ?>><?=@text('OHANAH_YEARS')?></option>
</select>
</div>
</div>
<input name='endOnDate' type="text" class="text formDate calendar cal5" value="<? echo $event->endOnDate ? $event->endOnDate : 'until'; ?>" >
</td>
</tr>
</table>
<? elseif (!$event->isRecurring()) : ?>
<table>
<tr>
<td>
<span class="fieldTitle"><?=@text('OHANAH_RECURRING_EVENT')?></span><br/>
<div class="dropdownWrapper left">
<div class="dropdown size1">
<span id="recurr">
<select name="isRecurring" size="1">
<option value="1"><?=@text('OHANAH_YES_EVERY')?></option>
<option value="0" selected="selected"><?=@text('OHANAH_NO')?></option>
</select>
</span>
</div>
</div>
<input type="text" name="everyNumber" id="recurrCount" class="text twenty" value="" />
</td>
<td>
<span class="fieldTitle">&nbsp;</span><br/>
<div class="dropdownWrapper left" id="recurrPeriod">
<div class="dropdown size4">
<select id="everyWhat" name="everyWhat">
<option value="month"><?=@text('OHANAH_MONTHS')?></option>
<option value="week"><?=@text('OHANAH_WEEKS')?></option>
<option value="day"><?=@text('OHANAH_DAYS')?></option>
<option value="year"><?=@text('OHANAH_YEARS')?></option>
</select>
</div>
</div>
<input name='endOnDate' type="text" class="text formDate calendar cal5" value="until" id="recurrEnd">
</td>
</tr>
</table>
<? endif ?>
<br />
</div>
<br />
</div>
</div>
</div>
<div id="adminRight">
<div class="panel">
<div class="panelContent">
<table style="margin-bottom:14px;">
<tr>
<td><span class="fieldTitle"><?=@text('OHANAH_EVENT_PICTURE')?></span><br />
<div id="eventPicture">
</div>
</td>
<input type="hidden" name="picture" id="picture" value="<?=$event->picture?>" />
</tr>
</table>
<table>
<tr>
<td>
<span class="fieldTitle"><?=@text('OHANAH_PHOTOS')?></span><br />
<div id="eventPhotos">
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<? if (!is_null((KRequest::get('get.id', 'int')))) :; ?>
<div class="authorInfo" style="clear:both; padding-left: 30px;">
<div style="float:left; margin-right: 30px;"><span class="fieldTitle">Creation date</span><?=@helper('com://admin/ohanah.template.helper.datetime.formatDate', array('date' => $event->created_on, 'shortMonth' => false))?></div>
<div style="float:left; margin-right: 30px;"><span class="fieldTitle">Created from</span><?=$event->frontend_submitted ? "Frontend" : "Backend"?></div>
<? if ($event->frontend_submitted) : ?>
<div style="float:left; margin-right: 30px;"><span class="fieldTitle">Author name</span><?=$event->created_by_name;?></div>
<div style="float:left; margin-right: 30px;"><span class="fieldTitle">Author email</span><?=$event->created_by_email;?></div>
<? else : ?>
<div style="float:left; margin-right: 30px;"><span class="fieldTitle">Author username</span><?=JFactory::getUser($event->created_by)->username;?></div>
<div style="float:left; margin-right: 30px;"><span class="fieldTitle">Author name</span><?=JFactory::getUser($event->created_by)->name;?></div>
<? endif; ?>
</div>
<? if (isset($params->displaydebug)) $displaydebug = $params->displaydebug; else $displaydebug = false; ?>
<? if ($displaydebug) : ?>
<?
// retreive statistic - since this is only count, we can breach MVC to do this in most efficient way
$db = JFactory::getDBO();
$time = ""; $timestamp = "";
$dst = '';
if ($params->dst == '1')
$dst = '+1';
$now_query = "SELECT NOW()";
$db->setQuery($now_query);
$dbnow = $db->loadResult();
$db_end_query = "SELECT CONCAT_WS(' ', '".$event->end_date."','".$event->end_time."')";
$db->setQuery($db_end_query);
$db_end = $db->loadResult();
$db_timezone_query = "SELECT IF(SUBSTRING('".$event->timezone."', -1) = '0', CONCAT(FLOOR(".$event->timezone.$dst."), ':0:0'), CONCAT(FLOOR(".$event->timezone.$dst."), ':30:0'))";
$db->setQuery($db_timezone_query);
$db_timezone = $db->loadResult();
$db_time_query = "SELECT SUBTIME('".$db_end."','".$db_timezone."')";
$db->setQuery($db_time_query);
$db_time = $db->loadResult();
$timestamp_query = "SELECT UTC_TIMESTAMP()";
$db->setQuery($timestamp_query);
$timestamp = $db->loadResult();
$compare_query = "SELECT '$db_time' < '$timestamp'";
$db->setQuery($compare_query);
$compare = $db->loadResult();
?>
<div class="debug">
<h3>Debug information:</h3>
<span class="">Timezone:</span> <?=$event->timezone;?> ||
<span class="">City:</span> <?=$event->geolocated_city;?> ||
<span class="">Country:</span> <?=$event->geolocated_country;?> ||
<span class="">State:</span> <?=$event->geolocated_state;?> <br>
<br>
<span class="debuglabel">DB NOW():</span> <span class="debugvalue"><?=$dbnow?></span> <span class="debuginfo"><?=$now_query;?> </span><br>
<span class="debuglabel">PHP date:</span> <span class="debugvalue"><?=date('Y-m-d H:i:s')?> </span> <span class="debuginfo"><?="date('Y-m-d H:i:s')"?> </span><br>
<br>
<span class="debuglabel">Event start:</span> <span class="debugvalue"><?=$event->date;?> <?=$event->start_time;?></span> <br>
<span class="debuglabel">Event end:</span> <span class="debugvalue"><?=$event->end_date;?> <?=$event->end_time;?></span> <br>
<br>
<span class="debuglabel">DB end time:</span> <span class="debugvalue"><?=$db_end?> </span> <span class="debuginfo"><?=$db_end_query?></span><br>
<span class="debuglabel">DB timezone:</span> <span class="debugvalue"><?=$db_timezone?> </span> <span class="debuginfo"><?=$db_timezone_query?></span><br>
<span class="debuglabel">DB time:</span> <span class="debugvalue"><?=$db_time?> </span> <span class="debuginfo"><?=$db_time_query?></span><br>
<span class="debuglabel">DB UTC:</span> <span class="debugvalue"><?=$timestamp?> </span> <span class="debuginfo"> <?=$timestamp_query?></span><br>
<span class="debuglabel">Model is past:</span> <span class="debugvalue"><?=$compare?> </span> <span class="debuginfo"><?=$compare_query?></span><br>
<span class="debuglabel">event->isPast():</span> <span class="debugvalue"><?=$event->isPast()? 'true' : 'false'?></span><br>
</div>
<? endif;?>
<? endif; ?>
</div>
</div><br />
<div id="eventWrapper2" class="clearfix">
<div id="panelWrapper">
<div id="adminLeft" class="bottom">
<div class="panel">
<div class="panelContent">
<table>
<tr>
<td>
<span class="fieldTitle"><?=@text('OHANAH_COST_PER_TICKET')?></span><br/>
<input type="text" class="text seventy" name="ticket_cost" value="<?=$event->ticket_cost?>" />
<div class="dropdownWrapper">
<div class="dropdown size3">
<? if (isset($event->payment_currency) && $event->payment_currency) $default = $event->payment_currency; else { if (isset($params->payment_currency)) $default = $params->payment_currency; else $default = 'USD'; } ?>
<?=@helper('com://admin/ohanah.template.helper.listbox.currency', array('selected' => $default)) ?>
<br />
</div>
</div>
</td>
<td>
<span class="fieldTitle"><?=@text('OHANAH_LIMITED_AVAILABILITY_OF_TICKETS')?></span><br/>
<div class="dropdownWrapper left">
<div class="dropdown size4">
<?=@helper('com://admin/ohanah.template.helper.listbox.yes_or_no', array('name' => 'limit_number_of_attendees', 'selected' => $event->limit_number_of_attendees)) ?>
</div>
</div>
<input type="text" class="text" style="width:154px;" id="attendees_limit" name="attendees_limit" value="<?=$event->attendees_limit?>" />
<br />
<? if ($event->allow_only_one_ticket) $default = $event->allow_only_one_ticket; else { if (isset($params->allow_only_one_ticket)) $default = $params->allow_only_one_ticket; else $default = '0'; } ?>
<span class="fieldTitle"><input type="checkbox" name="allow_only_one_ticket" value="0" <? if ($default == 1) echo 'checked' ?> /> <? $str = 'OHANAH_ALLOW_ONLY_ONE_TICKET_PER_REGISTRATION'; echo (@text($str) == $str || @text($str) == "") ? 'Allow only 1 ticket per registration' : @text($str); ?></span><br/>
</td>
</tr>
<tr>
<td>
<span class="fieldTitle"><?=@text('OHANAH_REGISTRATION_SYSTEM')?></span><br/>
<table>
<tr>
<td>
<div class="dropdownWrapper left">
<div class="dropdown size1">
<?
$options = array();
$option = new KObject(); $option->text = @text('OHANAH_BUILT_IN'); $option->value = 'ohanah'; $options[0] = $option;
$option = new KObject(); $option->text = @text('OHANAH_CUSTOM'); $option->value= 'custom'; $options[1] = $option;
?>
<? if ($event->registration_system) $default = $event->registration_system; else { if (isset($params->registration_system)) $default = $params->registration_system; else $default = 'ohanah'; } ?>
<?= @helper('select.optionlist', array('name' => 'registration_system', 'options' => $options, 'selected' => $default)); ?><br />
<script>
$jq(function() {
$jq('select[name="registration_system"]').change(function(){
if ($jq(this).attr('value')=='ohanah') {
$jq('.ohanah-registration-enabled-div').show();
$jq('#ohanah-registration-disabled-div').hide();
}
else {
$jq('.ohanah-registration-enabled-div').hide();
$jq('#ohanah-registration-disabled-div').show();
}
});
<? if ($default == 'ohanah') : ?>
$jq('.ohanah-registration-enabled-div').show();
$jq('#ohanah-registration-disabled-div').hide();
<? else : ?>
$jq('.ohanah-registration-enabled-div').hide();
$jq('#ohanah-registration-disabled-div').show();
<? endif ?>
});
</script>
</div>
</div>
<td>
</tr>
</table>
</td>
<td class="ohanah-registration-enabled-div">
<div>
<span class="fieldTitle"><?=@text('OHANAH_REGISTRATION_FORM_CUSTOM_FIELDS')?> <a id="onemorecustomfield" style="color:#379DE7; cursor:pointer;"><?=@text('OHANAH_ADD_NEW_PARENTHESIS')?></a>
<br /><span style="font-weight: normal"><?=@text('OHANAH_NAME_AND_EMAIL_ALREADY_ASKED')?></span>
</span><br/>
<ul class="registrationfield-list">
<? if ($event->customfields) : ?>
<? $custom_fields = new JRegistry($event->customfields); ?>
<? for ($i = 1; $i <= 10; $i++) : ?>
<? if ($cfvalue = $custom_fields->get('custom_field_label_'.$i)) : ?>
<? if ($cf = $custom_fields->get('cf'.$i) != null) $checked = $cf; else $checked = 0; ?>
<? $mandatory = $custom_fields->get('custom_field_label_'.$i.'_mandatory'); ?>
<li class="customfield">
<img src="media://com_ohanah/v2/ohanah_images/icon-x.png" class="remove_custom_field" />
<input type="hidden" id="custom_field_label_<?=$i?>" name="custom_field_label_<?=$i?>" value="<?=$cfvalue?>" />
<input type="hidden" name="cf<?=$i?>" value="yes" <? if ($checked) echo 'checked'; ?> />
<input type="text" id="custom_field_label_<?=$i?>" name="custom_field_label_<?=$i?>" class="text size5" style="width:150px!important" value="<?=$cfvalue?>" disabled />
<? if (JVersion::isCompatible('3.0')) : ?><br /><? endif ?>
<input type="checkbox" name="custom_field_label_<?=$i?>_mandatory" value="yes" <? if ($mandatory) echo 'checked'; ?> /> <?=@text('OHANAH_MANDATORY')?>
</li>
<? endif; ?>
<? endfor ?>
<? else : ?>
<? for ($i = 1; $i <= 10; $i++) : ?>
<? if ($cfvalue = JComponentHelper::getParams('com_ohanah')->get('custom_field_label_'.$i)) : ?>
<? $mandatory = JComponentHelper::getParams('com_ohanah')->get('custom_field_label_'.$i.'_mandatory'); ?>
<li class="customfield">
<img src="media://com_ohanah/v2/ohanah_images/icon-x.png" class="remove_custom_field" />
<input type="hidden" id="custom_field_label_<?=$i?>" name="custom_field_label_<?=$i?>" value="<?=$cfvalue?>" />
<input type="hidden" name="cf<?=$i?>" value="yes" checked />
<input type="text" id="custom_field_label_<?=$i?>" name="custom_field_label_<?=$i?>" class="text size5" style="width:150px!important" value="<?=$cfvalue?>" disabled />
<? if (JVersion::isCompatible('3.0')) : ?><br /><? endif ?>
<input type="checkbox" name="custom_field_label_<?=$i?>_mandatory" value="yes" <? if ($mandatory) echo 'checked'; ?> /> <?=@text('OHANAH_MANDATORY')?>
</li>
<? endif; ?>
<? endfor ?>
<? endif ?>
<span id="onemorecustomfieldcontent"></span>
</ul>
<script>
var $jq = jQuery.noConflict();
$jq(function() {
if ($jq('.customfield').length >= 10) {
$jq('#onemorecustomfield').hide();
}
});
$jq(function() {
$jq('.remove_custom_field').live('click', function(){
$jq(this).next('input.text').val('');
$jq(this).closest('li').remove();
if ($jq('.customfield').length < 10) {
$jq('#onemorecustomfield').show();
}
});
});
$jq(function() {
$jq('#onemorecustomfield').click(function() {
var i = 1;
for (i = 1; i <= 10; i++) {
if ($jq('#custom_field_label_'+i).length == 0) {
$jq('#onemorecustomfieldcontent').append('<li class="customfield"><img src="media://com_ohanah/v2/ohanah_images/icon-x.png" class="remove_custom_field" /><input type="hidden" name="cf'+i+'" value="yes" checked />&nbsp;<input type="text" id="custom_field_label_'+i+'" name="custom_field_label_'+i+'" class="text size5" style="width:150px!important" value="" /> <? if (JVersion::isCompatible('3.0')) : ?><br /><? endif ?><input type="checkbox" name="custom_field_label_'+i+'_mandatory" value="yes" /> <?=@text('OHANAH_MANDATORY')?></li>');
break;
}
}
if ($jq('.customfield').length >= 10) {
$jq('#onemorecustomfield').hide();
}
});
});
</script>
</div>
</td>
<td id="ohanah-registration-disabled-div">
<span class="fieldTitle"><?=@text('OHANAH_CUSTOM_REGISTRATION_URL')?></span><br/>
<input type="text" class="text size5" name="custom_registration_url" value="<?=$event->custom_registration_url?>" />
</td>
</tr>
<tr class="ohanah-registration-enabled-div">
<td>
<span class="fieldTitle"><?=@text('OHANAH_PAYMENT_GATEWAY')?></span><br/>
<div class="dropdownWrapper left">
<div class="dropdown size1">
<?
$options = array();
$option = new KObject(); $option->text = "PayPal"; $option->value="paypal"; $options[0] = $option;
$option = new KObject(); $option->text = @text('OHANAH_NONE'); $option->value="none"; $options[1] = $option;
$option = new KObject(); $option->text = @text('OHANAH_CUSTOM_2'); $option->value="custom"; $options[2] = $option;
?>
<? if (@$event->payment_gateway) $default = $event->payment_gateway; else { if (isset($params->payment_gateway)) $default = $params->payment_gateway; else $default = 'paypal'; } ?>
<?= @helper('select.optionlist', array('name' => 'payment_gateway', 'options' => $options, 'selected' => $default)); ?><br />
</div>
</div>
<script>
$jq(function() {
$jq('select[name="payment_gateway"]').change(function(){
if ($jq(this).attr('value')=='paypal') {
$jq('#custom-payment-enabled-div').hide();
}
if ($jq(this).attr('value')=='custom') {
$jq('#custom-payment-enabled-div').show();
}
else {
$jq('#custom-payment-enabled-div').hide();
}
});
<? if ($default != 'custom') : ?>
$jq('#custom-payment-enabled-div').hide();
<? endif ?>
});
</script>
</td>
<td id="custom-payment-enabled-div">
<span class="fieldTitle"><?=@text('OHANAH_CUSTOM_PAYMENT_URL')?></span><br/>
<input type="text" class="text size5" name="custom_payment_url" value="<?=$event->custom_payment_url?>" />
</td>
</tr>
</table>
<br />
</div>
</div>
</div>
<div id="adminRight" class="bottom">
<div class="panel">
<div class="panelContent">
<table>
<tr>
<td>
<span class="fieldTitle"><?=@text('OHANAH_WHO_CAN_REGISTER')?></span><br/>
<div class="dropdownWrapper">
<div class="dropdown size2">
<select name="who_can_register">
<?
$everybodySelect = '';
$membersSelect = '';
$nobodySelect = '';
$newEvent = $event->id == null;
if ($event->who_can_register=='1') { // it's members, no doubt it's old event
$membersSelect = "selected";
} elseif ($event->who_can_register == '2') { // it's nobody, no doubt either
$nobodySelect = 'selected';
} else {// $event->who_can_register == '0'
// maybe it's new event and it's default value, or it's old and everybody is selected
if ($event->id == null && $params->disable_registration_by_default == '1') {
// event is new and user want's registration disabled by default
$nobodySelect = 'selected';
} else { // it's either old event or user is OK with everybody as default
$everybodySelect = 'selected';
}
}
?>
<option value='0' <?=$everybodySelect?>><?=@text('OHANAH_EVERYBODY')?></option>
<option value='1' <?=$membersSelect?>><?=@text('OHANAH_SITE_MEMBERS_ONLY')?></option>
<option value='2' <?=$nobodySelect?>><?=@text('OHANAH_NOBODY')?></option>
</select>
</div>
</div>
</td>
<td>
<span class="fieldTitle"><?=@text('OHANAH_CLOSE_REGISTRATIONS_ON')?></span><br/>
<input type="text" name="close_registration_day" class="text formDate calendar cal4" id="enddate2" value="<? echo ($event->close_registration_day != '0000-00-00') ? $event->close_registration_day : 'day'; ?>" style="float:left; width: 91% !important;">
</td>
</tr>
<tr>
<td>
<span class="fieldTitle"><?=@text('OHANAH_EVENT_STATUS')?></span><br/>
<div class="dropdownWrapper">
<div class="dropdown size2">
<?=@helper('com://admin/ohanah.template.helper.listbox.published_or_draft', array('name' => 'enabled', 'selected' => $event->enabled)) ?>
</div>
</div>
</td>
</tr>
<tr>
<td>
<span class="fieldTitle"><?=@text('OHANAH_FEATURED')?></span><br/>
<div class="dropdownWrapper">
<div class="dropdown size2">
<?=@helper('com://admin/ohanah.template.helper.listbox.yes_or_no', array('name' => 'featured', 'selected' => $event->featured)) ?>
</div>
</div>
</td>
</tr>
<? if (isset($params->enableMailchimp)) : ?>
<? if ($params->enableMailchimp && $params->mailchimpApiKey) : ?>
<tr>
<td>
<span class="fieldTitle"><?=@text('OHANAH_MAILCHIMP_LIST_ID')?></span><br/>
<div class="dropdownWrapper">
<div class="dropdown size2">
<input type="text" name="mailchimp_list_id" class="text" id="mailchimp_list_id" value="<?=@$event->mailchimp_list_id?>" style="float:left; width: 91% !important;">
</div>
</div>
</td>
</tr>
<? endif ?>
<? endif ?>
</table>
</div>
</div>
</div>
</div></div></span></td></tr></table></div></div></div></div></div>
<div id="calendarTab">&nbsp;</div>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment