Completed
Push — master ( 76b4a1...141e43 )
by Michael
06:17 queued 02:44
created

class/xfgbformselectcountry.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
// $Id: xfgbformselectcountry.php,v 1.2 2005/08/10 Exp $
3
//  ------------------------------------------------------------------------ //
4
//             XF Guestbook                                                  //
5
// ------------------------------------------------------------------------- //
6
//  This program is free software; you can redistribute it and/or modify     //
7
//  it under the terms of the GNU General Public License as published by     //
8
//  the Free Software Foundation; either version 2 of the License, or        //
9
//  (at your option) any later version.                                      //
10
//                                                                           //
11
//  You may not change or alter any portion of this comment or credits       //
12
//  of supporting developers from this source code or any supporting         //
13
//  source code which is considered copyrighted (c) material of the          //
14
//  original comment or credit authors.                                      //
15
//                                                                           //
16
//  This program is distributed in the hope that it will be useful,          //
17
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
18
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
19
//  GNU General Public License for more details.                             //
20
//                                                                           //
21
//  You should have received a copy of the GNU General Public License        //
22
//  along with this program; if not, write to the Free Software              //
23
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
24
//  ------------------------------------------------------------------------ //
25
26
include_once dirname(dirname(dirname(__DIR__))) . '/class/xoopsform/formselect.php';
27
28
/**
29
 * Class XfgbFormSelectCountry
30
 */
31
class XfgbFormSelectCountry extends XoopsFormSelect
32
{
33
    /**
34
     * XfgbFormSelectCountry constructor.
35
     * @param      $caption
36
     * @param      $name
37
     * @param null $value
38
     * @param int  $size
39
     * @param bool $nullopt
40
     * @return XfgbFormSelectCountry
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
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_XFGB_OTHER);
52
        while ($myrow = $db->fetchArray($result)) {
53
            $this->addOption($myrow['country_code'], $myrow['country_name']);
54
        }
55
    }
56
}
57