/halogy/application/modules/webforms/models/tickets_model.php

https://bitbucket.org/haloweb/halogy-1.0/ · PHP · 80 lines · 49 code · 15 blank · 16 comment · 3 complexity · 2566182f5a5bc7fbce17b0618a7f78ce MD5 · raw file

  1. <?php
  2. /**
  3. * Halogy
  4. *
  5. * A user friendly, modular content management system for PHP 5.0
  6. * Built on CodeIgniter - http://codeigniter.com
  7. *
  8. * @package Halogy
  9. * @author Haloweb Ltd.
  10. * @copyright Copyright (c) 2008-2011, Haloweb Ltd.
  11. * @license http://halogy.com/license
  12. * @link http://halogy.com/
  13. * @since Version 1.0
  14. * @filesource
  15. */
  16. // ------------------------------------------------------------------------
  17. class Tickets_model extends Model {
  18. var $siteID;
  19. function Tickets_model()
  20. {
  21. parent::Model();
  22. // get siteID, if available
  23. if (defined('SITEID'))
  24. {
  25. $this->siteID = SITEID;
  26. }
  27. }
  28. function get_all_web_forms()
  29. {
  30. $this->db->where('siteID', $this->siteID);
  31. $this->db->where('deleted', 0);
  32. $this->db->order_by('formName');
  33. $query = $this->db->get('web_forms');
  34. if ($query->num_rows() > 0)
  35. {
  36. return $query->result_array();
  37. }
  38. else
  39. {
  40. return FALSE;
  41. }
  42. }
  43. function get_web_form($formID = '')
  44. {
  45. $this->db->where('siteID', $this->siteID);
  46. $this->db->where('deleted', 0);
  47. $this->db->where('formID', $formID);
  48. $query = $this->db->get('web_forms', 1);
  49. if ($query->num_rows() > 0)
  50. {
  51. return $query->row_array();
  52. }
  53. else
  54. {
  55. return FALSE;
  56. }
  57. }
  58. function view_ticket($ticketID)
  59. {
  60. $this->db->set('viewed', '1');
  61. $this->db->where('ticketID', $ticketID);
  62. $this->db->where('siteID', $this->siteID);
  63. $this->db->update('tickets');
  64. }
  65. }