[eluser]Sebish[/eluser]
Model:
Code:
<?php
class Checklists_model extends Model
{
function Checklists_model()
{
parent::Model();
$this->checklists_table = 'checklists';
}
function get_checklists()
{
$this->db->select('id, site_name, date_entered');
$query = $this->db->get($this->checklists_table);
if ($query->num_rows() > 0)
{
return $query->result_array();
}
}
function get_checklist($id)
{
$this->db->select('id, site_name, date_entered, dl_hosting_solution, dl_staging_website, dl_holder_page');
$this->db->where('id', $id);
$query = $this->db->get($this->checklists_table, 1);
if ($query->num_rows() > 0)
{
return $query->row_array();
}
}
function create_checklist()
{
$data = array
(
'site_name' => $this->input->post('site_name'),
'date_entered' => date("Y-m-d"),
);
$this->db->insert($this->checklists_table, $data);
}
function edit_checklist()
{
$data = array
(
'site_name' => $this->input->post('site_name'),
);
$this->db->where('id', $this->input->post('id'));
$this->db->update($this->checklists_table, $data);
}
function update_checklist()
{
$dl_hosting_solution = ($this->input->post('dl_hosting_solution') == 1) ? '1' : '0';
$dl_staging_website = ($this->input->post('dl_staging_website') == 1) ? '1' : '0';
$dl_holder_page = ($this->input->post('dl_holder_page') == 1) ? '1' : '0';
$data = array
(
'dl_hosting_solution' => $dl_hosting_solution,
'dl_staging_website' => $dl_staging_website,
'dl_holder_page' => $dl_holder_page
);
$this->db->where('id', $this->input->post('id'));
$this->db->update($this->checklists_table, $data);
}
function delete_checklist($id)
{
$this->db->where('id', $id);
$this->db->delete($this->checklists_table);
}
}
View:
Code:
<div class="post">
<div class="post_title">
<h1>Development Cycle</h1>
</div>
<div class="post_body">
<p>Manage the development cycle Check List.</p>
<? if ($this->session->flashdata('message')): ?>
<div class="message">
<?=$this->session->flashdata('message');?>
</div>
<? endif; ?>
<table width="100%">
<tr>
<td colspan="2">
<fieldset id="main">
<legend>Update Development Check List</legend>
<table>
<tr>
<?=form_hidden('id', $checklist['site_name']) ?>
<td width="750px">Is the hosting solution setup?</td>
<td><?=form_checkbox('dl_hosting_solution', 0, $this->validation->dl_hosting_solution); ?></td>
</tr>
<tr>
<td width="750px">Is the staging website setup?</td>
<td><?=form_checkbox('dl_staging_website', 0, $this->validation->dl_staging_website); ?></td>
</tr>
<tr>
<td width="750px">Is there a holder page inplace?</td>
<td><?=form_checkbox('dl_holder_page', 0, $this->validation->dl_holder_page); ?></td>
</tr>
<tr>
<td><br /></td>
</tr>
<tr>
<td width="750px">Confirm Changes?</td>
<td><input type="checkbox" name="dl_confirm_change" value="0" /></td>
</tr>
</table>
</fieldset>
</td>
</tr>
<tr>
<td colspan="2">
<?=form_hidden('id', $checklist['id']) ?>
<input type="submit" name="submit" value="<?=lang('button_updatesave');?>" class="styled" />
<?=form_close();?>
</td>
</tr>
</table>
</div>
</div>