Welcome Guest, Not a member yet? Register   Sign In
Message: Undefined variable [Resolved]
#2

[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>
                
            &lt;? if ($this->session->flashdata('message')): ?&gt;
                <div class="message">
                &lt;?=$this->session->flashdata('message');?&gt;
                </div>
            &lt;? endif; ?&gt;
      
                <table width="100%">
                <tr>
                     <td colspan="2">
                         <fieldset id="main">
                             <legend>Update Development Check List</legend>
                             <table>
                                 <tr>
                                     &lt;?=form_hidden('id', $checklist['site_name']) ?&gt;
                                    <td width="750px">Is the hosting solution setup?</td>
                                     <td>&lt;?=form_checkbox('dl_hosting_solution', 0, $this->validation->dl_hosting_solution); ?&gt;</td>
                                 </tr>
                                <tr>
                                    <td width="750px">Is the staging website setup?</td>
                                     <td>&lt;?=form_checkbox('dl_staging_website', 0, $this->validation->dl_staging_website); ?&gt;</td>
                                 </tr>
                                <tr>
                                    <td width="750px">Is there a holder page inplace?</td>
                                     <td>&lt;?=form_checkbox('dl_holder_page', 0, $this->validation->dl_holder_page); ?&gt;</td>
                                 </tr>
                                <tr>
                                    <td><br /></td>
                                </tr>
                                <tr>
                                    <td width="750px">Confirm Changes?</td>
                                    <td>&lt;input type="checkbox" name="dl_confirm_change" value="0" /&gt;&lt;/td>
                                </tr>
                             </table>
                         </fieldset>
                     </td>
                </tr>
                <tr>
                    <td colspan="2">
                        &lt;?=form_hidden('id', $checklist['id']) ?&gt;
                        &lt;input type="submit" name="submit" value="&lt;?=lang('button_updatesave');?&gt;" class="styled" /&gt;
                        &lt;?=form_close();?&gt;
                    </td>
                </tr>
                </table>
        </div>
</div>


Messages In This Thread
Message: Undefined variable [Resolved] - by El Forum - 01-29-2009, 07:36 PM
Message: Undefined variable [Resolved] - by El Forum - 01-29-2009, 07:37 PM
Message: Undefined variable [Resolved] - by El Forum - 01-29-2009, 11:00 PM
Message: Undefined variable [Resolved] - by El Forum - 01-30-2009, 12:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB