Skip to content

Instantly share code, notes, and snippets.

function heightDetect() {
$(".main_head").css("height", $(window).height());
};
heightDetect();
$(window).resize(function(){
heightDetect();
});
$("body").on("click", ".edit-job", function(){
//validation for all fields
var valid = true;
$('#form-with-customs input').each( function(){
if($.trim($(this).val()) == ''){
valid = false;
}
});
//gist work with time
$res = $this->dbAdapter->query("SELECT location FROM users WHERE user_id=:user_id")->execute([
':user_id'=>$user_id,
])->getResource()->fetchAll();
if(!empty($res)){
$loc = $res[0]['location'];
}
if(!empty($loc)){
if($loc == 'Toronto'){
$x = array('18900','36000');
$res = $this->dbAdapter->query("SELECT location FROM users WHERE user_id=:user_id")->execute([
':user_id'=>$user_id,
])->getResource()->fetchAll();
if(!empty($res)){
$loc = $res[0]['location'];
}
if(!empty($loc)){
if($loc == 'Toronto'){
$x = array(18900, 36000);
//count time
->execute()->getResource()->fetchAll();
<script>
$(document).ready(function(){
//cycle
$(document).find(".na td").each(function () {
//the element length which == 0
var len = $(this).html().trim().length;
if(len == 0) {
//do something
$(this).text("N/A");
$(this).css("background","red");
$(document).ready(function() {
//Clock
var clock;
clock = $('.clock').FlipClock({
clockFace: 'TwelveHourClock',
showSeconds: false
});
//Set Punch In
$(document).on('click', '#punch_in', function(){
$from_time = strtotime($from_date);
$to_time = strtotime($to_date);
$difference = round(abs($to_time - $from_time) / 60); degree on 60 it converts all in minutes
@Maxghp
Maxghp / Example of ajax query
Last active May 23, 2016 11:13
Example of ajax query
//This ajax query is in getpunchtotal.phtml and call /application/index/getpunchadmin view and send user_id and data for
//getpunchadminAction, and that in turn returns.
$('.show-hide').click(function () {
event.preventDefault();
var link = $(this);
var icon = link.find('span');
var table = link.next('table');
var user_id = link.attr('data-user_id');
if (icon.hasClass('glyphicon-plus')) {
icon.addClass('glyphicon-minus').removeClass('glyphicon-plus');