CodeIgniter Forums
Ticketing system (sorta) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Ticketing system (sorta) (/showthread.php?tid=31390)



Ticketing system (sorta) - El Forum - 06-17-2010

[eluser]Bionicjoe[/eluser]
I've built the basics of a system to record tickets, but I'm stuck at the updates portion.

A ticket will need to have updates recorded and then displayed in what is basically a blog-comments fashion. I find tutorials on blogs & comments but they are so simple that they're not functional in the real world.

I need a form at the top of the page that shows the ticket info in editable fields that can be updated with a blank 'UPDATE' field.
Below the form I need each previous update listed in non-editable text, like a blog comment.

The form part I got, but I can't put it together with the UPDATE part.

Any good tutorials on this?


Ticketing system (sorta) - El Forum - 06-17-2010

[eluser]Eric Barnes[/eluser]
I am not aware of any tutorials off hand however I recently did something similar for a bug tracker.

For the bug details. priority, version, status I used an ajax edit in place script to make it quick and easy to change. Then for comments / replies just created a simple textarea they fill in.

The update part should be very similar to your insert part. Maybe if you can go into more details we might can help more.


Ticketing system (sorta) - El Forum - 06-18-2010

[eluser]Bionicjoe[/eluser]
What I need to do is run to different queries on two different tables and display the results on the same page.
I can only get my first query to work.

Code:
function displayoutage()
  {
      $id = $this->uri->segment(3);
      
      //Get the info from the outage table
      $this->load->model('outage_model','',TRUE);
      $this->outage_model->getoutage($id);
      $data['row'] = $this->outage_model->getoutage($id)->result();
        
      // Get the info from the Updates table for this outage
      $this->outage_model->listoutageupdates($id);
      $data['update'] = $this->outage_model->listoutageupdates($id); //Adding '->result();' on the end here causes other errors.
        
      // load template view with $data
      $this->load->view('template_view', $data);

  }

The first query result gets dumped into a little table in the view.
The second query should be displayed at the bottom the page like comments on a blog.


Ticketing system (sorta) - El Forum - 06-18-2010

[eluser]Bionicjoe[/eluser]
I solved it!!

Put it all into one big array. (The stupid! It hurts!)

Code:
function displayoutage()
  {

      $this->data = array(
          'row' => $this->outage_model->getoutage($id)->result(),
          'update' => $this->outage_model->listoutageupdates($id),
          'title' => 'Simple Outage View',
        'headline' => 'Simple Outage View',
        'include' => 'outagedisplay_view',
        'footer' => 'Copyright 2010'
          );

    $this->load->view('template_view', $this->data);

However I've hit a new snag. I can only get one item out of my array with a foreach loop. I know the array is good because I did a simple 'print_r($array)', and the loop echos out the HTML once for each item in the array. But I only see the last item.

Code:
print_r($update);

    foreach ($update as $i)
        echo '<hr>';
        echo $i


Sample array from print_r
Code:
Array ( [1] => My first update. [2] => The second update. [3] => Another update. )

The above code spits out a horizontal rule for each item in the array, and then only the last item in the array, in this case 'Another update.'.


Ticketing system (sorta) - El Forum - 06-18-2010

[eluser]Bionicjoe[/eluser]
Oh man it's late.

I just deleted the whole thing & retyped it with a bunch of syntax errors. By the time I was done I had found the {} I left out earlier.

$this->FACEPALM Confusednake: