PageRenderTime 26ms CodeModel.GetById 13ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 1ms

/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// ------------------------------------------------------------------------
18
19class Tickets_model extends Model {
20
21	var $siteID;
22	
23	function Tickets_model()
24	{
25		parent::Model();
26
27		// get siteID, if available
28		if (defined('SITEID'))
29		{
30			$this->siteID = SITEID;
31		}
32	}
33
34	function get_all_web_forms()
35	{
36		$this->db->where('siteID', $this->siteID);
37		$this->db->where('deleted', 0);	
38
39		$this->db->order_by('formName');	
40			
41		$query = $this->db->get('web_forms');
42
43		if ($query->num_rows() > 0)
44		{
45			return $query->result_array();
46		}
47		else
48		{
49			return FALSE;
50		}
51	}
52
53	function get_web_form($formID = '')
54	{
55		$this->db->where('siteID', $this->siteID);
56		$this->db->where('deleted', 0);	
57
58		$this->db->where('formID', $formID);
59			
60		$query = $this->db->get('web_forms', 1);
61
62		if ($query->num_rows() > 0)
63		{
64			return $query->row_array();
65		}
66		else
67		{
68			return FALSE;
69		}
70	}
71
72	function view_ticket($ticketID)
73	{
74		$this->db->set('viewed', '1');
75		$this->db->where('ticketID', $ticketID);
76		$this->db->where('siteID', $this->siteID);
77		$this->db->update('tickets');
78	}
79	
80}