Welcome Guest, Not a member yet? Register   Sign In
Need help with creating view..
#1

[eluser]Shaileen[/eluser]
I am done with my model and controller and partial view..

Below are the details :
Controller :
<?php
class T1_orders_active extends MY_Controller
{
function index()
{
$this->load->model('steve', '', true);
$this->load->model('t1_orders_active_model', '', true);
$username = $this->session->userdata('username');
$data['username'] = $username;
$data['title'] = "T1 Order Tracking";
$data['subtitle'] = "List Active Orders";

$this->load->view('header_main', $data);
$this->load->view('showmenu', $data);
$this->load->view('t1_orders_active_view',$data);
$this->load->view('footer_main');
$this->load->helper('cookie');

$AUTH = $this->steve->get_menu($username);

if ($AUTH->tick28 == 1)
{
$inyc_limit = " AND inyc = 1";
}
else
{
$inyc_limit = "";
}

if($AUTH->tick2 == 1)
{
$data['admin'] = $this->t1_orders_active_model->one($AUTH->user_id, $inyc_limit);
}
elseif($AUTH->tick2 == 2)
{
$data['admin'] = $this->t1_orders_active_model->two($AUTH->user_id, $inyc_limit);

}

elseif($AUTH->tick2 == 3)
{
$data['admin'] = $this->t1_orders_active_model->three($AUTH->user_id, $inyc_limit);
}
}
}

model :

<?php
class T1_orders_active_model extends Model
{
function T1_orders_active()
{
parent::Model();
}

function one($x,$y)
{
$this->db->select('mydsl_auth.username, t1_admin.refid, t1_admin.admin_date_activated, t1_eu.eu_company, t1_eu.eu_contact, t1_admin.quote_id, t1_order.main_email, t1_order.bandwidth_id');
$this->db->from('mydsl_auth, t1_admin, t1_eu, t1_order ');
$this->db->where('t1_admin.admin_active =', '1');
$this->db->where('t1_admin.admin_deleted =', '0');
$this->db->where('t1_admin.admin_cancelled =', '0');
$this->db->where('t1_admin.admin_order_sent =','1');
$this->db->where('t1_eu.seqid = t1_admin.refid');
$this->db->where('mydsl_auth.user_id = t1_admin.salesperson');
$this->db->where('order.refid = t1_eu.seqid ');
$this->db->where('t1_admin.salesperson', $x);
$find_admin = $this->db->get();

foreach($find_admin->result() as $row)
{
list($person, $refid, $admin_date_activated,$eu_company, $eu_contact, $quote_id, $email, $bandwidth_id) = $row;
}
return $find_admin;

}

function two($x,$y)
{
$this->db->select('mydsl_auth.username, t1_admin.refid, t1_admin.admin_date_activated, t1_eu.eu_company, t1_eu.eu_contact, t1_admin.quote_id, t1_order.main_email, t1_order.bandwidth_id ');
$this->db->from('mydsl_auth, t1_admin, t1_eu, t1_order ');
$this->db->where('t1_admin.admin_active =', '1');
$this->db->where('t1_admin.admin_deleted =', '0');
$this->db->where('t1_admin.admin_cancelled =', '0');
$this->db->where('t1_admin.admin_order_sent =','1');
$this->db->where('t1_eu.seqid = t1_admin.refid');
$this->db->where('mydsl_auth.user_id = t1_admin.salesperson');
$this->db->where('t1_order.refid = t1_eu.seqid');
$this->db->or_where("t1_admin.salesperson = $x");
$this->db->or_where('mydsl_auth.agent_manager', $x);
$find_admin = $this->db->get();

foreach($find_admin->result() as $row)
{
list($person, $refid, $admin_date_activated,$eu_company, $eu_contact, $quote_id, $email, $bandwidth_id) = $row;
}
return $find_admin;

}

}
VIEW :I created partial view. Can you help me to get the values in my view.How can i get them through the controller and model?
Please help.
<div id = "t1_active_orders">
<table border = 0 >
<tr>
<td width = "25">
ID
</td>
<td width = "25">
Q
</td>
<td width = "450">
Company Name
</td>
<td width = "200">
Contact Name
</td>
<td width = "300">
Email
</td>
<td width = "25">

</td>
<td width = "25">

</td>
<td width = "200">
Bandwidth
</td>
<td width = "200">
Rackspace
</td>
<td width = "75">
SP
</td>
<td width = "25">
Active
</td>
</tr>
#2

[eluser]danmontgomery[/eluser]
http://ellislab.com/codeigniter/user-gui...views.html
#3

[eluser]dark_lord[/eluser]
It seems that you are not passing any data array in you view that is why it isn't retrieving any array values, try to place the loading of the view after the model referencing.


Code:
$this->load->helper(‘cookie’);
      $data['admin'] = '';
      $AUTH = $this->steve->get_menu($username);
      
          if ($AUTH->tick28 == 1)
          {
                $inyc_limit = ” AND inyc = 1”;
          }
          else
          {
            $inyc_limit = “”;
          }
        
        if($AUTH->tick2 == 1)
        {
        $data[‘admin’] = $this->t1_orders_active_model->one($AUTH->user_id, $inyc_limit);    
        }
        elseif($AUTH->tick2 == 2)
        {
        $data[‘admin’] = $this->t1_orders_active_model->two($AUTH->user_id, $inyc_limit);
        
        }
        
        elseif($AUTH->tick2 == 3)
        {  
        $data[‘admin’] = $this->t1_orders_active_model->three($AUTH->user_id, $inyc_limit);
        }        
$this->load->view(‘t1_orders_active_view’,$data);
$this->load->view(‘footer_main’);

Then on the view try this:

Code:
foreach($admin->result() as $row)
{
    echo $row->fieldname;
}




Theme © iAndrew 2016 - Forum software by © MyBB