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