/[drupal]/contributions/modules/emailmarketer/emailmarketer.inc
ViewVC logotype

Contents of /contributions/modules/emailmarketer/emailmarketer.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Sun Sep 2 17:27:19 2007 UTC (2 years, 2 months ago) by claudiucristea
Branch: MAIN
CVS Tags: DRUPAL-5--0-1, HEAD
File MIME type: text/x-php
Publish to repository
1 <?php
2 /* $Id$ */
3
4
5 /**
6 *
7 */
8 function emailmarketer_list($list = NULL, $rights = FALSE) {
9 global $user;
10 $where = $lists = array();
11 $order = ' ORDER BY email ASC, name ASC';
12 if (is_numeric($list)) {
13 $where[] = 'eid = %d';
14 }
15 if (is_string($list)) {
16 $where[] = "email_subscribe = '%s'";
17 }
18 if ($rights && !user_access('administer email marketer')) {
19 $like = array();
20 foreach ($user->roles as $rid => $role) {
21 $like[] = "roles LIKE '%|" . $rid . "|%'";
22 }
23 if (!empty($like)) {
24 $where[] = '(' . implode(' OR ', $like) . ')';
25 }
26 }
27
28 $where = empty($where) ? '' : ' WHERE ' . implode(' AND ', $where);
29 $sql = "SELECT * FROM {" . EMAILMARKETER_TABLE . "}" . $where . $order;
30
31 $result = db_query($sql, $list);
32 while ($row = db_fetch_array($result)) {
33 $lists[$row['eid']] = $row;
34 }
35 return $lists;
36 }
37
38 function emailmarketer_fields() {
39 $countries = array("" => "[...]", "AF" => t("Afghanistan"), "AL" => t("Albania"), "DZ" => t("Algeria"), "AS" => t("American Samoa"), "AD" => t("Andorra"), "AO" => t("Angola"), "AI" => t("Anguilla"), "AQ" => t("Antarctica"), "AG" => t("Antigua and Barbuda"), "AR" => t("Argentina"), "AM" => t("Armenia"), "AW" => t("Aruba"), "AU" => t("Australia"), "AT" => t("Austria"), "AZ" => t("Azerbaijan"), "BS" => t("Bahamas"), "BH" => t("Bahrain"), "BD" => t("Bangladesh"), "BB" => t("Barbados"), "BY" => t("Belarus"), "BE" => t("Belgium"), "BZ" => t("Belize"), "BJ" => t("Benin"), "BM" => t("Bermuda"), "BT" => t("Bhutan"), "BO" => t("Bolivia"), "BA" => t("Bosnia and Herzegovina"), "BW" => t("Botswana"), "BV" => t("Bouvet Island"), "BR" => t("Brazil"), "IO" => t("British Indian Ocean"), "BN" => t("Brunei"), "BG" => t("Bulgaria"), "BF" => t("Burkina Faso"), "BI" => t("Burundi"), "KH" => t("Cambodia"), "CM" => t("Cameroon"), "CA" => t("Canada"), "CV" => t("Cape Verde"), "KY" => t("Cayman Islands"), "CF" => t("Central African Republic"), "TD" => t("Chad"), "CL" => t("Chile"), "CN" => t("China"), "CX" => t("Christmas Island"), "CC" => t("Cocos (Keeling) Islands"), "CO" => t("Colombia"), "KM" => t("Comoros"), "CG" => t("Congo"), "CK" => t("Cook Islands"), "CR" => t("Costa Rica"), "CI" => t("C&ocirc;te d'Ivoire"), "HR" => t("Croatia (Hrvatska)"), "CU" => t("Cuba"), "CY" => t("Cyprus"), "CZ" => t("Czech Republic"), "CD" => t("Congo (DRC)"), "DK" => t("Denmark"), "DJ" => t("Djibouti"), "DM" => t("Dominica"), "DO" => t("Dominican Republic"), "TP" => t("East Timor"), "EC" => t("Ecuador"), "EG" => t("Egypt"), "SV" => t("El Salvador"), "GQ" => t("Equatorial Guinea"), "ER" => t("Eritrea"), "EE" => t("Estonia"), "ET" => t("Ethiopia"), "FK" => t("Falkland Islands (Islas Malvinas)"), "FO" => t("Faroe Islands"), "FJ" => t("Fiji Islands"), "FI" => t("Finland"), "FR" => t("France"), "GF" => t("French Guiana"), "PF" => t("French Polynesia"), "TF" => t("French Southern and Antarctic Lands"), "GA" => t("Gabon"), "GM" => t("Gambia"), "GE" => t("Georgia"), "DE" => t("Germany"), "GH" => t("Ghana"), "GI" => t("Gibraltar"), "GR" => t("Greece"), "GL" => t("Greenland"), "GD" => t("Grenada"), "GP" => t("Guadeloupe"), "GU" => t("Guam"), "GT" => t("Guatemala"), "GN" => t("Guinea"), "GW" => t("Guinea-Bissau"), "GY" => t("Guyana"), "HT" => t("Haiti"), "HM" => t("Heard Island and McDonald Islands"), "HN" => t("Honduras"), "HK" => t("Hong Kong SAR"), "HU" => t("Hungary"), "IS" => t("Iceland"), "IN" => t("India"), "ID" => t("Indonesia"), "IR" => t("Iran"), "IQ" => t("Iraq"), "IE" => t("Ireland"), "IL" => t("Israel"), "IT" => t("Italy"), "JM" => t("Jamaica"), "JP" => t("Japan"), "JO" => t("Jordan"), "KZ" => t("Kazakhstan"), "KE" => t("Kenya"), "KI" => t("Kiribati"), "KR" => t("Korea"), "KW" => t("Kuwait"), "KG" => t("Kyrgyzstan"), "LA" => t("Laos"), "LV" => t("Latvia"), "LB" => t("Lebanon"), "LS" => t("Lesotho"), "LR" => t("Liberia"), "LY" => t("Libya"), "LI" => t("Liechtenstein"), "LT" => t("Lithuania"), "LU" => t("Luxembourg"), "MO" => t("Macao SAR"), "MK" => t("Macedonia, Former Yugoslav Republic of"), "MG" => t("Madagascar"), "MW" => t("Malawi"), "MY" => t("Malaysia"), "MV" => t("Maldives"), "ML" => t("Mali"), "MT" => t("Malta"), "MH" => t("Marshall Islands"), "MQ" => t("Martinique"), "MR" => t("Mauritania"), "MU" => t("Mauritius"), "YT" => t("Mayotte"), "MX" => t("Mexico"), "FM" => t("Micronesia"), "MD" => t("Moldova"), "MC" => t("Monaco"), "MN" => t("Mongolia"), "MS" => t("Montserrat"), "MA" => t("Morocco"), "MZ" => t("Mozambique"), "MM" => t("Myanmar"), "NA" => t("Namibia"), "NR" => t("Nauru"), "NP" => t("Nepal"), "NL" => t("Netherlands"), "AN" => t("Netherlands Antilles"), "NC" => t("New Caledonia"), "NZ" => t("New Zealand"), "NI" => t("Nicaragua"), "NE" => t("Niger"), "NG" => t("Nigeria"), "NU" => t("Niue"), "NF" => t("Norfolk Island"), "KP" => t("North Korea"), "MP" => t("Northern Mariana Islands"), "NO" => t("Norway"), "OM" => t("Oman"), "PK" => t("Pakistan"), "PW" => t("Palau"), "PA" => t("Panama"), "PG" => t("Papua New Guinea"), "PY" => t("Paraguay"), "PE" => t("Peru"), "PH" => t("Philippines"), "PN" => t("Pitcairn Islands"), "PL" => t("Poland"), "PT" => t("Portugal"), "PR" => t("Puerto Rico"), "QA" => t("Qatar"), "RE" => t("Reunion"), "RO" => t("Romania"), "RU" => t("Russia"), "RW" => t("Rwanda"), "WS" => t("Samoa"), "SM" => t("San Marino"), "ST" => t("S&atilde;o Tom¨¦ and Pr¨Şncipe"), "SA" => t("Saudi Arabia"), "SN" => t("Senegal"), "YU" => t("Serbia and Montenegro"), "SC" => t("Seychelles"), "SL" => t("Sierra Leone"), "SG" => t("Singapore"), "SK" => t("Slovakia"), "SI" => t("Slovenia"), "SB" => t("Solomon Islands"), "SO" => t("Somalia"), "ZA" => t("South Africa"), "GS" => t("South Georgia and the South Sandwich Islands"), "ES" => t("Spain"), "LK" => t("Sri Lanka"), "SH" => t("St. Helena"), "KN" => t("St. Kitts and Nevis"), "LC" => t("St. Lucia"), "PM" => t("St. Pierre and Miquelon"), "VC" => t("St. Vincent and the Grenadines"), "SD" => t("Sudan"), "SR" => t("Suriname"), "SJ" => t("Svalbard and Jan Mayen"), "SZ" => t("Swaziland"), "SE" => t("Sweden"), "CH" => t("Switzerland"), "SY" => t("Syria"), "TW" => t("Taiwan"), "TJ" => t("Tajikistan"), "TZ" => t("Tanzania"), "TH" => t("Thailand"), "TG" => t("Togo"), "TK" => t("Tokelau"), "TO" => t("Tonga"), "TT" => t("Trinidad and Tobago"), "TN" => t("Tunisia"), "TR" => t("Turkey"), "TM" => t("Turkmenistan"), "TC" => t("Turks and Caicos Islands"), "TV" => t("Tuvalu"), "UG" => t("Uganda"), "UA" => t("Ukraine"), "AE" => t("United Arab Emirates"), "UK" => t("United Kingdom"), "US" => t("United States"), "UM" => t("United States Minor Outlying Islands"), "UY" => t("Uruguay"), "UZ" => t("Uzbekistan"), "VU" => t("Vanuatu"), "VA" => t("Vatican City"), "VE" => t("Venezuela"), "VN" => t("Viet Nam"), "VG" => t("Virgin Islands (British)"), "VI" => t("Virgin Islands"), "WF" => t("Wallis and Futuna"), "YE" => t("Yemen"), "ZM" => t("Zambia"), "ZW" => t("Zimbabwe"));
40 return array(
41 'FullName' => array(
42 '#type' => 'textfield',
43 '#title' => t('Full name'),
44 '#maxlength' => 255
45 ),
46 'FirstName' => array(
47 '#type' => 'textfield',
48 '#title' => t('First name'),
49 '#maxlength' => 255
50 ),
51 'LastName' => array(
52 '#type' => 'textfield',
53 '#title' => t('Last name'),
54 '#maxlength' => 255
55 ),
56 'NickName' => array(
57 '#type' => 'textfield',
58 '#title' => t('Nickname'),
59 '#maxlength' => 255
60 ),
61 'Email2' => array(
62 '#type' => 'textfield',
63 '#title' => t('Additional e-mail'),
64 '#maxlength' => 255
65 ),
66 'Identity' => array(
67 '#type' => 'textfield',
68 '#title' => t('Identity'),
69 '#maxlength' => 255
70 ),
71 'Gender' => array(
72 '#type' => 'select',
73 '#title' => t('Gender'),
74 '#options' => array('M' => t('Male'), 'F' => t('Female'))
75 ),
76 'Birthday' => array(
77 '#type' => 'date',
78 '#title' => t('Birthday'),
79 ),
80 'Marriage' => array(
81 '#type' => 'select',
82 '#title' => t('Marriage status'),
83 '#options' => array('0' => t('No'), '1' => t('Yes'), '2' => t('Unknown'))
84 ),
85 'Mobile' => array(
86 '#type' => 'textfield',
87 '#title' => t('Mobile'),
88 '#maxlength' => 255
89 ),
90 'Company' => array(
91 '#type' => 'textfield',
92 '#title' => t('Company'),
93 '#maxlength' => 255
94 ),
95 'Country' => array(
96 '#type' => 'select',
97 '#title' => t('Business country'),
98 '#options' => $countries
99 ),
100 'State' => array(
101 '#type' => 'textfield',
102 '#title' => t('Business state'),
103 '#maxlength' => 255
104 ),
105 'City' => array(
106 '#type' => 'textfield',
107 '#title' => t('Business city'),
108 '#maxlength' => 255
109 ),
110 'Address' => array(
111 '#type' => 'textfield',
112 '#title' => t('Business address'),
113 '#maxlength' => 255
114 ),
115 'Zipcode' => array(
116 '#type' => 'textfield',
117 '#title' => t('Business zip code'),
118 '#maxlength' => 255
119 ),
120 'Tel' => array(
121 '#type' => 'textfield',
122 '#title' => t('Business phone'),
123 '#maxlength' => 255
124 ),
125 'Fax' => array(
126 '#type' => 'textfield',
127 '#title' => t('Business fax'),
128 '#maxlength' => 255
129 ),
130 'Homepage' => array(
131 '#type' => 'textfield',
132 '#title' => t('Business homepage'),
133 '#maxlength' => 255
134 ),
135 'Title' => array(
136 '#type' => 'textfield',
137 '#title' => t('Title'),
138 '#maxlength' => 255
139 ),
140 'Occupation' => array(
141 '#type' => 'select',
142 '#title' => t('Occupation'),
143 '#options' => array('A' => t('Accounting/Finance'), 'I' => t('Computer related (other)'), 'W' => t('Computer related (Internet)'), 'C' => t('Consulting'), 'V' => t('Customer service/support'), 'T' => t('Education/training'), 'E' => t('Engineering'), 'O' => t('Executive/senior management'), 'G' => t('General administrative/supervisory'), 'X' => t('Government/military'), 'H' => t('Homemaker'), 'M' => t('Manufacturing/production/operations'), 'P' => t('Professional (medical, legal, etc.)'), 'R' => t('Research and development'), 'F' => t('Retired'), 'S' => t('Sales/marketing/advertising'), 'L' => t('Self-employed/owner'), 'D' => t('Student'), 'B' => t('Tradesman/craftsman'), 'U' => t('Unemployed/between jobs'), '9' => t('Other'))
144 ),
145 'Department' => array(
146 '#type' => 'textfield',
147 '#title' => t('Department'),
148 '#maxlength' => 255
149 ),
150 'Country2' => array(
151 '#type' => 'select',
152 '#title' => t('Home country'),
153 '#options' => $countries
154 ),
155 'State2' => array(
156 '#type' => 'textfield',
157 '#title' => t('Home state'),
158 '#maxlength' => 255
159 ),
160 'City2' => array(
161 '#type' => 'textfield',
162 '#title' => t('Home city'),
163 '#maxlength' => 255
164 ),
165 'Address2' => array(
166 '#type' => 'textfield',
167 '#title' => t('Home address'),
168 '#maxlength' => 255
169 ),
170 'Zipcode2' => array(
171 '#type' => 'textfield',
172 '#title' => t('Home zip code'),
173 '#maxlength' => 255
174 ),
175 'Tel2' => array(
176 '#type' => 'textfield',
177 '#title' => t('Home phone'),
178 '#maxlength' => 255
179 ),
180 'Fax2' => array(
181 '#type' => 'textfield',
182 '#title' => t('Home fax'),
183 '#maxlength' => 255
184 ),
185 'Homepage2' => array(
186 '#type' => 'textfield',
187 '#title' => t('Personal homepage'),
188 '#maxlength' => 255
189 )
190 );
191
192 }

  ViewVC Help
Powered by ViewVC 1.1.2