| @@ 113-122 (lines=10) @@ | ||
| 110 | * | |
| 111 | * @return array List of all ads | |
| 112 | */ | |
| 113 | public function get_all_ads() | |
| 114 | 	{ | |
| 115 | $sql = 'SELECT ad_id, ad_priority, ad_name, ad_enabled, ad_end_date, ad_views, ad_clicks, ad_views_limit, ad_clicks_limit | |
| 116 | FROM ' . $this->ads_table; | |
| 117 | $result = $this->db->sql_query($sql); | |
| 118 | $data = $this->db->sql_fetchrowset($result); | |
| 119 | $this->db->sql_freeresult($result); | |
| 120 | ||
| 121 | return $data; | |
| 122 | } | |
| 123 | ||
| 124 | /** | |
| 125 | * Get all owner's ads | |
| @@ 130-140 (lines=11) @@ | ||
| 127 | * @param int $user_id Ad owner | |
| 128 | * @return array List of owner's ads | |
| 129 | */ | |
| 130 | public function get_ads_by_owner($user_id) | |
| 131 | 	{ | |
| 132 | $sql = 'SELECT ad_id, ad_name, ad_enabled, ad_end_date, ad_views, ad_views_limit, ad_clicks, ad_clicks_limit | |
| 133 | FROM ' . $this->ads_table . ' | |
| 134 | WHERE ad_owner = ' . (int) $user_id; | |
| 135 | $result = $this->db->sql_query($sql); | |
| 136 | $data = $this->db->sql_fetchrowset($result); | |
| 137 | $this->db->sql_freeresult($result); | |
| 138 | ||
| 139 | return $data; | |
| 140 | } | |
| 141 | ||
| 142 | /** | |
| 143 | * Increment views for specified ads | |
| @@ 18-29 (lines=12) @@ | ||
| 15 | /** | |
| 16 | 	 * {@inheritDoc} | |
| 17 | */ | |
| 18 | public function effectively_installed() | |
| 19 | 	{ | |
| 20 | $sql = 'SELECT module_id | |
| 21 | FROM ' . $this->table_prefix . "modules | |
| 22 | WHERE module_class = 'acp' | |
| 23 | AND module_langname = 'ACP_PHPBB_ADS_TITLE'"; | |
| 24 | $result = $this->db->sql_query($sql); | |
| 25 | 		$module_id = (int) $this->db->sql_fetchfield('module_id'); | |
| 26 | $this->db->sql_freeresult($result); | |
| 27 | ||
| 28 | return $module_id; | |
| 29 | } | |
| 30 | ||
| 31 | /** | |
| 32 | 	 * {@inheritDoc} | |