| @@ 44-54 (lines=11) @@ | ||
| 41 | * @param int $ad_id Advertisement ID |
|
| 42 | * @return array Advertisement data |
|
| 43 | */ |
|
| 44 | public function get_ad($ad_id) |
|
| 45 | { |
|
| 46 | $sql = 'SELECT * |
|
| 47 | FROM ' . $this->ads_table . ' |
|
| 48 | WHERE ad_id = ' . (int) $ad_id; |
|
| 49 | $result = $this->db->sql_query($sql); |
|
| 50 | $data = $this->db->sql_fetchrow($result); |
|
| 51 | $this->db->sql_freeresult($result); |
|
| 52 | ||
| 53 | return $data; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * Get one ad per every location |
|
| @@ 87-96 (lines=10) @@ | ||
| 84 | * |
|
| 85 | * @return array List of all ads |
|
| 86 | */ |
|
| 87 | public function get_all_ads() |
|
| 88 | { |
|
| 89 | $sql = 'SELECT ad_id, ad_name, ad_enabled |
|
| 90 | FROM ' . $this->ads_table; |
|
| 91 | $result = $this->db->sql_query($sql); |
|
| 92 | $data = $this->db->sql_fetchrowset($result); |
|
| 93 | $this->db->sql_freeresult($result); |
|
| 94 | ||
| 95 | return $data; |
|
| 96 | } |
|
| 97 | ||
| 98 | /** |
|
| 99 | * Insert new advertisement to the database |
|
| @@ 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_ADMANAGEMENT_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} |
|