[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/doc generate-class-country.php
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] phpgwapi/doc generate-class-country.php |
Date: |
Wed, 27 Sep 2006 02:45:28 +0000 |
CVSROOT: /cvsroot/phpgwapi
Module name: phpgwapi
Changes by: Dave Hall <skwashd> 06/09/27 02:45:28
Modified files:
doc : generate-class-country.php
Log message:
merge in changes from head version of class
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/doc/generate-class-country.php?cvsroot=phpgwapi&r1=1.1&r2=1.2
Patches:
Index: generate-class-country.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/doc/generate-class-country.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- generate-class-country.php 27 Sep 2006 02:33:28 -0000 1.1
+++ generate-class-country.php 27 Sep 2006 02:45:28 -0000 1.2
@@ -9,6 +9,10 @@
*
* Usage:
* $ /path/to/phpgroupware/phpgwapi/doc/generate-class-country.php >
/path/to/phpgroupware/phpgwapi/inc/class.country.inc.php
+ *
+ * @auhtor Dave Hall skwashd at phpGroupWare.org
+ * @copyright Portions Copyright (C) 2006 Free Software Foundation
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
*/
echo"<?php\n";
?>
@@ -16,12 +20,13 @@
* Countries
* @author Mark Peters <address@hidden>
* @auhtor Dave Hall skwashd at phpGroupWare.org
- * @copyright Portions Copyright (C) 2001 - 2006 Free Software
Foundation http://www.fsf.org/
+ * @author Bettine Gille ceb at phpGroupWare.org
+ * @copyright Copyright (C) 2001 - 2006 Free Software Foundation
http://www.fsf.org/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
* @interal do not edit, edit and run
phpgwapi/doc/generate-class-country.php to regenerate this class
* @package phpgwapi
* @subpackage contacts
- * @version $Id: generate-class-country.php,v 1.1 2006/09/27 02:33:28
skwashd Exp $
+ * @version $Id: generate-class-country.php,v 1.2 2006/09/27 02:45:28
skwashd Exp $
*/
/**
@@ -32,6 +37,11 @@
*/
class country
{
+
+ /**
+ * @var array $continent_array a list of continents
+ */
+ var $continent_array = array();
<?php
// Do not change this, it ensures we are using utf-8 :)
setlocale(LC_ALL, 'en_US.UTF-8');
@@ -64,6 +74,16 @@
*/
function country()
{
+ $this->continent_array = array
+ (
+ 'africa' => lang('africa'),
+ 'antarctica' => lang('antarctica'),
+ 'asia' => lang('asia'),
+ 'australia' => lang('australia'),
+ 'europe' => lang('europe'),
+ 'northamerica' => lang('northamerica'),
+ 'southamerica' => lang('southamerica')
+ );
}
/**
@@ -103,5 +123,63 @@
}
return '';
}
+
+ /**
+ * Create an array of continents suitable for use with the XSLT
template engine
+ *
+ * @param string $selected the currently selected country
+ * @param string $select_name the name of the select box element
in the form
+ * @return array list of continents
+ */
+ function xslt_continent_select($selected = '',$select_name='')
+ {
+ $GLOBALS['phpgw']->xslttpl->add_file('countries');
+
+ foreach($this->continent_array as $cname => $ctitle)
+ {
+ $carray[] = array
+ (
+ 'continent_name' => $cname,
+ 'continent_title' => $ctitle,
+ 'selected' =>
$cname == $selected ? 'selected' : ''
+ );
+ }
+
+ return array
+ (
+ 'select_name' =>
$select_name,
+ 'continent_list' =>
$carray,
+ 'lang_continent_statustext' => lang('select
a continent')
+ );
+ }
+
+ /**
+ * Create an array of countries suitable for use with the XSLT
template engine
+ *
+ * @param string $selected the currently selected country
+ * @param string $select_name the name of the select box element
in the form
+ * @return array list of countries
+ */
+ function xslt_country_select($selected = '', $select_name='')
+ {
+ $GLOBALS['phpgw']->xslttpl->add_file('countries');
+
+ foreach($this->country_array as $ccode => $cname)
+ {
+ $carray[] = array
+ (
+ 'country_code' => $ccode,
+ 'country_name' => lang($cname),
+ 'selected' => $ccode ==
$selected ? 'selected' : ''
+ );
+ }
+
+ return array
+ (
+ 'select_name' =>
$select_name,
+ 'country_list' =>
$carray,
+ 'lang_country_statustext' => lang('select
a country')
+ );
+ }
}
<?php echo '?>';?>