<div class="row"> <div class="col-xs-6 MyDate"> <span class="col-xs-12 datepicker-date"> <?php $arr = array('class' => 'datebutton-input datepicker', 'placeholder' => 'dd/mm/yyyy', 'name' => 'date[]', 'value' => isset($row_data) ? remove_time($row_data->date) : NULL); echo form_input($arr); ?> </span> </div> <div class="col-xs-6"> <a href="#" class="btn btn-danger pull-right datebutton"> <span class="glyphicon glyphicon-calendar"></span> Choose Date</a> </div> </div>
function update_holidays($start_id = NULL, $finish_id = NULL, $hol_id = false, $staff_id = false) { /* * Get Staff Members Name * */ if ($staff_id > 0) { $staff_name = $this->staff_model->staff_name($staff_id); } /* * If the holiday we are going to get the data to edit * * */ if ($hol_id == false) { /* * Create an array of ids * */ $ids = array($start_id, $finish_id); /* * Loop the ids to build a dates array from db query * */ foreach ($ids as $i) { /* * We just get the date back here but we need to first remove the time before we can display * */ $dates[] = remove_time($this->staff_model->get_row('date', 'id', $i)->date); } /* * Return a json array to display data in the model * */ echo json_encode(array_merge($dates, $ids)); return false; } else { /* * we are deleting data so we need to create an array * * here we are inserting into same table twice, so add numeric value to key and remove again with substr * */ $vars = array('date1' => $start_id, 'date2' => $finish_id, 'holidays3' => $hol_id); /* * Loop them and delete the data as requested * * */ foreach ($vars as $table => $id) { $this->staff_model->delete($id, 'id', substr($table, 0, -1)); } /** * Private Alert function * * @param $staff_id * * @param $event * */ $this->addAlert($staff_id, $this->data['data']->first_name . ' ' . $this->data['data']->last_name . sprintf($this->lang->line('holdiday_deny_event'), $staff_name->first_name . ' ' . $staff_name->last_name)); /* * Return confirmation message that all has been deleted. * */ echo json_encode(array('message' => 'Holiday Deleted')); return false; } }