Last active
October 3, 2015 01:27
-
-
Save c4y/2362278 to your computer and use it in GitHub Desktop.
Contao 3.2 cal_mini.html5 Ajax Script (Mootools)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table class="minicalendar"> | |
<thead> | |
<tr> | |
<th class="head previous"><?php if ($this->prevHref): ?><a href="<?php echo $this->prevHref; ?>" rel="nofollow" title="<?php echo $this->prevTitle; ?>"><?php echo $this->prevLabel; ?></a><?php else: ?> <?php endif; ?></th> | |
<th colspan="5" class="head current"><?php echo $this->current; ?></th> | |
<th class="head next"><?php if ($this->nextHref): ?><a href="<?php echo $this->nextHref; ?>" rel="nofollow" title="<?php echo $this->nextTitle; ?>"><?php echo $this->nextLabel; ?></a><?php else: ?> <?php endif; ?></th> | |
</tr> | |
<tr> | |
<?php foreach ($this->days as $i=>$day): ?> | |
<th class="label<?php echo $day['class']; ?>"><?php echo utf8_substr($day['name'], 0, $this->substr); ?><span class="invisible"><?php echo utf8_substr($day['name'], $this->substr); ?></span></th> | |
<?php endforeach; ?> | |
</tr> | |
</thead> | |
<tbody> | |
<?php foreach ($this->weeks as $class=>$week): ?> | |
<tr class="<?php echo $class; ?>"> | |
<?php foreach ($week as $day): ?> | |
<?php if ($day['href']): ?> | |
<td class="<?php echo $day['class']; ?>"><a href="<?php echo $day['href']; ?>" title="<?php echo $day['title']; ?>"><?php echo $day['label']; ?></a></td> | |
<?php else: ?> | |
<td class="<?php echo $day['class']; ?>"><?php echo $day['label']; ?></td> | |
<?php endif; ?> | |
<?php endforeach; ?> | |
</tr> | |
<?php endforeach; ?> | |
</tbody> | |
</table> | |
<script type="text/javascript"> | |
(function($) { | |
function registerLink() | |
{ | |
document.getElements('.mod_calendar .head a').addEvent('click', function(event) | |
{ | |
var month = event.target.get('href').match('month=[0-9]{6}'); | |
new Request.JSON({ | |
method:'get', | |
data:'g=1&action=cte&id=94&' + month, | |
url:'ajax.php', | |
onComplete: function(responseText){ | |
event.target.getParent('.mod_calendar').set('html', responseText.content); | |
registerLink(); | |
} | |
}).send(); | |
return false; | |
}); | |
} | |
window.addEvent('domready', function() { | |
registerLink(); | |
}); | |
}) | |
(document.id); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment