Skip to content

Instantly share code, notes, and snippets.

View taleeb35's full-sized avatar

taleeb35

  • United Arab Emirates
View GitHub Profile
@taleeb35
taleeb35 / CheckBox
Created January 3, 2015 16:35
Increment Value
<html>
<input type="checkbox" class="check"> Smart Survical<br>
<input type="checkbox" class="check"> Smart Survical<br>
<a href="" name="WIS" id="udpate-text">Cart</a>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
var count = 0;
@taleeb35
taleeb35 / json
Last active August 29, 2015 14:12
JSON
public function get_assigned_task_list() {
$user_id = $this->Auth->User('id');
$task_list = $this->Control->find('all',array('conditions' => array('owner_id' => $user_id)));
foreach ($task_list as $list) {
$id = $list['Control']['id'] . '<br>';
$name = $list['Control']['name'] . '<br>';
$desc = $list['Control']['description'] . '<br>';
{"posts":[{"Post":{"id":"1","title":"Understanding Containable","body":"Post body","created":"2014-12-30 22:08:17","modified":"2014-12-30 22:08:17"}},{"Post":{"id":"2","title":"Creating your first test case","body":"Post body","created":"2014-12-30 22:08:17","modified":"2014-12-30 22:08:17"}},{"Post":{"id":"3","title":"Using bake to start an application","body":"Post body","created":"2014-12-30 22:08:17","modified":"2014-12-30 22:08:17"}},{"Post":{"id":"4","title":"Creating your first helper","body":"Post body","created":"2014-12-30 22:08:17","modified":"2014-12-30 22:08:17"}},{"Post":{"id":"5","title":"Adding indexes","body":"Post body","created":"2014-12-30 22:08:17","modified":"2014-12-30 22:08:17"}}]}
<?php if($this->request->data['Control']['control_frequency_id'] == 4) { ?>
<?php $db_day_number = $control['Control']['day_number']; ?>
<?php if($db_day_number <= 30) { ?>
<div id="quarterly" style="margin-left: -10px;">
<?php echo $this->Form->input('select_quarter_month',array('type' => 'select', 'options' => $quarter_month, 'selected' => 'Month 1'));
echo $this->Form->input('select_quarter_date' ,array('type' => 'select', 'options' => $month_days_quarter, 'selected' => $db_day_number)); ?>
</div>
<?php } elseif($db_day_number > 30 && $db_day_number <= 60) { ?>
<div id="quarterly" style="margin-left: -10px;">
<?php echo $this->Form->input('select_quarter_month',array('type' => 'select', 'options' => $quarter_month, 'selected' => 'Month 2'));
$(document).ready(function() {
$('#weekly,#monthly,#quarterly,#annualy').hide();
if($("#frequency").val() === "2") {
$('#weekly').show();
} else if($("#frequency").val() === "3") {
$('#monthly').show();
} else if($("#frequency").val() === "4") {
$('#quarterly').show();
} else if($("#frequency").val() === "6") {
$('#annualy').show();
@taleeb35
taleeb35 / gist:bda717e1c403fb86c802
Created December 25, 2014 02:51
Add.ctp (Form)
<div class="controls form">
<?php echo $this->Form->create('Control'); ?>
<?php $week_days = array(1 => "Monday", 2 => "Tuesday", 3 => "Wednesday", 4 => "Thursday", 5 => "Friday", 6 => "Saturday", 7 => "Sunday"); ?>
<?php $month_days = array(01 => 01, 02 => 02, 03 => 03, 04 => 04, 05 => 05, 06 => 06, 07 => 07, 08 => 08, 09 => 09, 10 => 10, 11 => 11, 12 => 12, 13 => 13,
14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 18, 19 => 19, 20 => 20, 21 => 21, 22 => 22, 23 => 23, 24 => 24,
25 => 25, 26 => 26, 27 => 27, 28 => 28, 29 => 29, 30 => 30, 31 => 31); ?>
<?php $month_days_quarter = array(01 => 01, 02 => 02, 03 => 03, 04 => 04, 05 => 05, 06 => 06, 07 => 07, 08 => 08, 09 => 09, 10 => 10, 11 => 11, 12 => 12, 13 => 13,
14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 18, 19 => 19, 20 => 20, 21 => 21, 22 => 22, 23 => 23, 24 => 24,
25 => 25, 26 => 26, 27 => 27, 28 => 28, 29 => 29, 30 => 30); ?>
<?php $quarter_mo
// This is my add function that save different value when different frequency is selected in form
if($this->request->data['Control']['control_frequency_id'] == 6) { // If Frequency is Annualy
$current_month = $this->request->data['Control']['select_month'];
$month= implode($current_month, ",");
$current_day = $this->request->data['Control']['select_date'];
$current_year = Date("Y");
$days = date("z", mktime(0,0,0,$month,$current_day,$current_year)); // Calculate the days
$this->request->data['Control']['day_number'] = $days; // Save the Days in database
<?php if ($this->request->data['Control']['control_frequency_id'] == 2) { ?>
<div id="weekly" style="margin-left: -10px;">
<?php echo $this->Form->input('day_of_week',array('type' => 'select','options' => $days)); ?>
</div>
<?php } ?>
<?php elseif ($this->request->data['Control']['control_frequency_id'] == 3) { ?>
<div id="weekly" style="margin-left: -10px;">
<?php echo $this->Form->input('day_of_week',array('type' => 'select','options' => $days)); ?>
</div>
<?php } ?>
<div class="controls form">
<?php echo $this->Form->create('Control'); ?>
<?php $days = array(1 => "Monday", 2 => "Tuesday", 3 => "Wednesday", 4 => "Thursday", 5 => "Friday", 6 => "Saturday", 7 => "Sunday"); ?>
<?php $month_days = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13,
14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 18, 19 => 19, 20 => 20, 21 => 21, 22 => 22, 23 => 23, 24 => 24,
25 => 25, 26 => 26, 27 => 27, 28 => 28, 29 => 29, 30 => 30, 31 => 31); ?>
<fieldset>
<legend><?php echo __('Add Control'); ?></legend>
<?php
echo $this->Form->input('name',array('label' => 'Task Title'));
<td <?php if ($current_date > $dateTarget) { echo "style='background-color:red;'"; } ?>>
<?php echo $this->Html->link($issue['Issue']['name'], array('controller' => 'issues', 'action' => 'select', $issue['Issue']['id'])); ?>&nbsp;</td>