|
1
|
|
|
<?php namespace XoopsModules\Xfguestbook\Form; |
|
2
|
|
|
|
|
3
|
|
|
// |
|
4
|
|
|
// ------------------------------------------------------------------------ // |
|
5
|
|
|
// XF Guestbook // |
|
6
|
|
|
// ------------------------------------------------------------------------- // |
|
7
|
|
|
// This program is free software; you can redistribute it and/or modify // |
|
8
|
|
|
// it under the terms of the GNU General Public License as published by // |
|
9
|
|
|
// the Free Software Foundation; either version 2 of the License, or // |
|
10
|
|
|
// (at your option) any later version. // |
|
11
|
|
|
// // |
|
12
|
|
|
// You may not change or alter any portion of this comment or credits // |
|
13
|
|
|
// of supporting developers from this source code or any supporting // |
|
14
|
|
|
// source code which is considered copyrighted (c) material of the // |
|
15
|
|
|
// original comment or credit authors. // |
|
16
|
|
|
// // |
|
17
|
|
|
// This program is distributed in the hope that it will be useful, // |
|
18
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|
19
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|
20
|
|
|
// GNU General Public License for more details. // |
|
21
|
|
|
// // |
|
22
|
|
|
// You should have received a copy of the GNU General Public License // |
|
23
|
|
|
// along with this program; if not, write to the Free Software // |
|
24
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
|
25
|
|
|
// ------------------------------------------------------------------------ // |
|
26
|
|
|
|
|
27
|
|
|
require_once dirname(dirname(dirname(dirname(__DIR__)))) . '/class/xoopsform/formselect.php'; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Class FormSelectCountry |
|
31
|
|
|
*/ |
|
32
|
|
|
class FormSelectCountry extends \XoopsFormSelect |
|
33
|
|
|
{ |
|
34
|
|
|
/** |
|
35
|
|
|
* FormSelectCountry constructor. |
|
36
|
|
|
* @param $caption |
|
37
|
|
|
* @param $name |
|
38
|
|
|
* @param null $value |
|
|
|
|
|
|
39
|
|
|
* @param int $size |
|
40
|
|
|
* @param bool $nullopt |
|
41
|
|
|
*/ |
|
42
|
|
|
public function __construct($caption, $name, $value = null, $size = 1, $nullopt = false) |
|
43
|
|
|
{ |
|
44
|
|
|
$db = \XoopsDatabaseFactory::getDatabaseConnection(); |
|
45
|
|
|
parent::__construct($caption, $name, $value, $size); |
|
46
|
|
|
$sql = 'SELECT country_code, country_name FROM ' . $db->prefix('xfguestbook_country') . ' ORDER BY country_name'; |
|
47
|
|
|
$result = $db->query($sql); |
|
48
|
|
|
if ($nullopt) { |
|
49
|
|
|
$this->addOption('', '-'); |
|
50
|
|
|
} |
|
51
|
|
|
$this->addOption('other', MI_XFGUESTBOOK_OTHER); |
|
52
|
|
|
while (false !== ($myrow = $db->fetchArray($result))) { |
|
53
|
|
|
$this->addOption($myrow['country_code'], $myrow['country_name']); |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|