[ Index ] |
PHP Cross Reference of osCMax 2.0.4 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 $Id: affiliate_affiliates.php 14 2006-07-28 17:42:07Z user $ 4 5 OSC-Affiliate 6 7 Contribution based on: 8 9 osCMax Power E-Commerce 10 http://oscdox.com 11 12 Copyright 2006 osCMax 13 14 Released under the GNU General Public License 15 */ 16 17 require ('includes/application_top.php'); 18 19 require (DIR_WS_CLASSES . 'currencies.php'); 20 $currencies = new currencies(); 21 22 if ($HTTP_GET_VARS['action']) { 23 switch ($HTTP_GET_VARS['action']) { 24 case 'update': 25 $affiliate_id = tep_db_prepare_input($HTTP_GET_VARS['acID']); 26 $affiliate_gender = tep_db_prepare_input($HTTP_POST_VARS['affiliate_gender']); 27 $affiliate_firstname = tep_db_prepare_input($HTTP_POST_VARS['affiliate_firstname']); 28 $affiliate_lastname = tep_db_prepare_input($HTTP_POST_VARS['affiliate_lastname']); 29 $affiliate_dob = tep_db_prepare_input($HTTP_POST_VARS['affiliate_dob']); 30 $affiliate_email_address = tep_db_prepare_input($HTTP_POST_VARS['affiliate_email_address']); 31 $affiliate_company = tep_db_prepare_input($HTTP_POST_VARS['affiliate_company']); 32 $affiliate_company_taxid = tep_db_prepare_input($HTTP_POST_VARS['affiliate_company_taxid']); 33 $affiliate_payment_check = tep_db_prepare_input($HTTP_POST_VARS['affiliate_payment_check']); 34 $affiliate_payment_paypal = tep_db_prepare_input($HTTP_POST_VARS['affiliate_payment_paypal']); 35 $affiliate_payment_bank_name = tep_db_prepare_input($HTTP_POST_VARS['affiliate_payment_bank_name']); 36 $affiliate_payment_bank_branch_number = tep_db_prepare_input($HTTP_POST_VARS['affiliate_payment_bank_branch_number']); 37 $affiliate_payment_bank_swift_code = tep_db_prepare_input($HTTP_POST_VARS['affiliate_payment_bank_swift_code']); 38 $affiliate_payment_bank_account_name = tep_db_prepare_input($HTTP_POST_VARS['affiliate_payment_bank_account_name']); 39 $affiliate_payment_bank_account_number = tep_db_prepare_input($HTTP_POST_VARS['affiliate_payment_bank_account_number']); 40 $affiliate_street_address = tep_db_prepare_input($HTTP_POST_VARS['affiliate_street_address']); 41 $affiliate_suburb = tep_db_prepare_input($HTTP_POST_VARS['affiliate_suburb']); 42 $affiliate_postcode=tep_db_prepare_input($HTTP_POST_VARS['affiliate_postcode']); 43 $affiliate_city = tep_db_prepare_input($HTTP_POST_VARS['affiliate_city']); 44 $affiliate_country_id=tep_db_prepare_input($HTTP_POST_VARS['affiliate_country_id']); 45 $affiliate_telephone=tep_db_prepare_input($HTTP_POST_VARS['affiliate_telephone']); 46 $affiliate_fax=tep_db_prepare_input($HTTP_POST_VARS['affiliate_fax']); 47 $affiliate_homepage=tep_db_prepare_input($HTTP_POST_VARS['affiliate_homepage']); 48 $affiliate_state = tep_db_prepare_input($HTTP_POST_VARS['affiliate_state']); 49 $affiliatey_zone_id = tep_db_prepare_input($HTTP_POST_VARS['affiliate_zone_id']); 50 $affiliate_commission_percent = tep_db_prepare_input($HTTP_POST_VARS['affiliate_commission_percent']); 51 if ($affiliate_zone_id > 0) $affiliate_state = ''; 52 // If someone uses , instead of . 53 $affiliate_commission_percent = str_replace (',' , '.' , $affiliate_commission_percent); 54 55 $sql_data_array = array('affiliate_firstname' => $affiliate_firstname, 56 'affiliate_lastname' => $affiliate_lastname, 57 'affiliate_email_address' => $affiliate_email_address, 58 'affiliate_payment_check' => $affiliate_payment_check, 59 'affiliate_payment_paypal' => $affiliate_payment_paypal, 60 'affiliate_payment_bank_name' => $affiliate_payment_bank_name, 61 'affiliate_payment_bank_branch_number' => $affiliate_payment_bank_branch_number, 62 'affiliate_payment_bank_swift_code' => $affiliate_payment_bank_swift_code, 63 'affiliate_payment_bank_account_name' => $affiliate_payment_bank_account_name, 64 'affiliate_payment_bank_account_number' => $affiliate_payment_bank_account_number, 65 'affiliate_street_address' => $affiliate_street_address, 66 'affiliate_postcode' => $affiliate_postcode, 67 'affiliate_city' => $affiliate_city, 68 'affiliate_country_id' => $affiliate_country_id, 69 'affiliate_telephone' => $affiliate_telephone, 70 'affiliate_fax' => $affiliate_fax, 71 'affiliate_homepage' => $affiliate_homepage, 72 'affiliate_commission_percent' => $affiliate_commission_percent, 73 'affiliate_agb' => '1'); 74 75 if (ACCOUNT_DOB == 'true') $sql_data_array['affiliate_dob'] = tep_date_raw($affiliate_dob); 76 if (ACCOUNT_GENDER == 'true') $sql_data_array['affiliate_gender'] = $affiliate_gender; 77 if (ACCOUNT_COMPANY == 'true') { 78 $sql_data_array['affiliate_company'] = $affiliate_company; 79 $sql_data_array['affiliate_company_taxid'] = $affiliate_company_taxid; 80 } 81 if (ACCOUNT_SUBURB == 'true') $sql_data_array['affiliate_suburb'] = $affiliate_suburb; 82 if (ACCOUNT_STATE == 'true') { 83 $sql_data_array['affiliate_state'] = $affiliate_state; 84 $sql_data_array['affiliate_zone_id'] = $affiliate_zone_id; 85 } 86 87 $sql_data_array['affiliate_date_account_last_modified'] = 'now()'; 88 89 tep_db_perform(TABLE_AFFILIATE, $sql_data_array, 'update', "affiliate_id = '" . tep_db_input($affiliate_id) . "'"); 90 91 tep_redirect(tep_href_link(FILENAME_AFFILIATE, tep_get_all_get_params(array('acID', 'action')) . 'acID=' . $affiliate_id)); 92 break; 93 case 'deleteconfirm': 94 $affiliate_id = tep_db_prepare_input($HTTP_GET_VARS['acID']); 95 96 affiliate_delete(tep_db_input($affiliate_id)); 97 98 tep_redirect(tep_href_link(FILENAME_AFFILIATE, tep_get_all_get_params(array('acID', 'action')))); 99 break; 100 } 101 } 102 ?> 103 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 104 <html <?php echo HTML_PARAMS; ?>> 105 <head> 106 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 107 <title><?php echo TITLE; ?></title> 108 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 109 <script language="javascript" src="includes/general.js"></script> 110 <?php 111 if ($HTTP_GET_VARS['action'] == 'edit') { 112 ?> 113 <script language="javascript"><!-- 114 function resetStateText(theForm) { 115 theForm.affiliate_state.value = ''; 116 if (theForm.affiliate_zone_id.options.length > 1) { 117 theForm.affiliate_state.value = '<?php echo JS_STATE_SELECT; ?>'; 118 } 119 } 120 121 function resetZoneSelected(theForm) { 122 if (theForm.affiliate_state.value != '') { 123 theForm.affiliate_zone_id.selectedIndex = '0'; 124 if (theForm.affiliate_zone_id.options.length > 1) { 125 theForm.affiliate_state.value = '<?php echo JS_STATE_SELECT; ?>'; 126 } 127 } 128 } 129 130 function update_zone(theForm) { 131 var NumState = theForm.affiliate_zone_id.options.length; 132 var SelectedCountry = ''; 133 134 while(NumState > 0) { 135 NumState--; 136 theForm.affiliate_zone_id.options[NumState] = null; 137 } 138 139 SelectedCountry = theForm.affiliate_country_id.options[theForm.affiliate_country_id.selectedIndex].value; 140 141 <?php echo tep_js_zone_list('SelectedCountry', 'theForm', 'affiliate_zone_id'); ?> 142 143 resetStateText(theForm); 144 } 145 146 function check_form() { 147 var error = 0; 148 var error_message = "<?php echo JS_ERROR; ?>"; 149 150 var affiliate_firstname = document.affiliate.affiliate_firstname.value; 151 var affiliate_lastname = document.affiliate.affiliate_lastname.value; 152 <?php if (ACCOUNT_COMPANY == 'true') echo 'var affiliate_company = document.affiliate.affiliate_company.value;' . "\n"; ?> 153 var affiliate_email_address = document.affiliate.affiliate_email_address.value; 154 var affiliate_street_address = document.affiliate.affiliate_street_address.value; 155 var affiliate_postcode = document.affiliate.affiliate_postcode.value; 156 var affiliate_city = document.affiliate.affiliate_city.value; 157 var affiliate_telephone = document.affiliate.affiliate_telephone.value; 158 159 <?php if (ACCOUNT_GENDER == 'true') { ?> 160 if (document.affiliate.affiliate_gender[0].checked || document.affiliate.affiliate_gender[1].checked) { 161 } else { 162 error_message = error_message + "<?php echo JS_GENDER; ?>"; 163 error = 1; 164 } 165 <?php } ?> 166 167 if (affiliate_firstname = "" || affiliate_firstname.length < <?php echo ENTRY_FIRST_NAME_MIN_LENGTH; ?>) { 168 error_message = error_message + "<?php echo JS_FIRST_NAME; ?>"; 169 error = 1; 170 } 171 172 if (affiliate_lastname = "" || affiliate_lastname.length < <?php echo ENTRY_LAST_NAME_MIN_LENGTH; ?>) { 173 error_message = error_message + "<?php echo JS_LAST_NAME; ?>"; 174 error = 1; 175 } 176 177 if (affiliate_email_address = "" || affiliate_email_address.length < <?php echo ENTRY_EMAIL_ADDRESS_MIN_LENGTH; ?>) { 178 error_message = error_message + "<?php echo JS_EMAIL_ADDRESS; ?>"; 179 error = 1; 180 } 181 182 if (affiliate_street_address = "" || affiliate_street_address.length < <?php echo ENTRY_STREET_ADDRESS_MIN_LENGTH; ?>) { 183 error_message = error_message + "<?php echo JS_ADDRESS; ?>"; 184 error = 1; 185 } 186 187 if (affiliate_postcode = "" || affiliate_postcode.length < <?php echo ENTRY_POSTCODE_MIN_LENGTH; ?>) { 188 error_message = error_message + "<?php echo JS_POST_CODE; ?>"; 189 error = 1; 190 } 191 192 if (affiliate_city = "" || affiliate_city.length < <?php echo ENTRY_CITY_MIN_LENGTH; ?>) { 193 error_message = error_message + "<?php echo JS_CITY; ?>"; 194 error = 1; 195 } 196 197 <?php if (ACCOUNT_STATE == 'true') { ?> 198 if (document.affiliate.affiliate_zone_id.options.length <= 1) { 199 if (document.affiliate.affiliate_state.value == "" || document.affiliate.affiliate_state.length < 4 ) { 200 error_message = error_message + "<?php echo JS_STATE; ?>"; 201 error = 1; 202 } 203 } else { 204 document.affiliate.affiliate_state.value = ''; 205 if (document.affiliate.affiliate_zone_id.selectedIndex == 0) { 206 error_message = error_message + "<?php echo JS_ZONE; ?>"; 207 error = 1; 208 } 209 } 210 <?php } ?> 211 212 if (document.affiliate.affiliate_country_id.value == 0) { 213 error_message = error_message + "<?php echo JS_COUNTRY; ?>"; 214 error = 1; 215 } 216 217 if (affiliate_telephone = "" || affiliate_telephone.length < <?php echo ENTRY_TELEPHONE_MIN_LENGTH; ?>) { 218 error_message = error_message + "<?php echo JS_TELEPHONE; ?>"; 219 error = 1; 220 } 221 222 if (error == 1) { 223 alert(error_message); 224 return false; 225 } else { 226 return true; 227 } 228 } 229 //--></script> 230 <?php 231 } 232 ?> 233 </head> 234 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();"> 235 <!-- header //--> 236 <?php require (DIR_WS_INCLUDES . 'header.php'); ?> 237 <!-- header_eof //--> 238 239 <!-- body //--> 240 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 241 <tr> 242 <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> 243 <!-- left_navigation //--> 244 <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?> 245 <!-- left_navigation_eof //--> 246 </table></td> 247 <!-- body_text //--> 248 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 249 <?php 250 if ($HTTP_GET_VARS['action'] == 'edit') { 251 $affiliate_query = tep_db_query("select * from " . TABLE_AFFILIATE . " where affiliate_id = '" . $HTTP_GET_VARS['acID'] . "'"); 252 $affiliate = tep_db_fetch_array($affiliate_query); 253 $aInfo = new objectInfo($affiliate); 254 ?> 255 <tr> 256 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 257 <tr> 258 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 259 <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 260 </tr> 261 </table></td> 262 </tr> 263 <tr> 264 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 265 </tr> 266 <tr><?php echo tep_draw_form('affiliate', FILENAME_AFFILIATE, tep_get_all_get_params(array('action')) . 'action=update', 'post', 'onSubmit="return check_form();"'); ?> 267 <td class="formAreaTitle"><?php echo CATEGORY_PERSONAL; ?></td> 268 </tr> 269 <tr> 270 <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> 271 <?php 272 if (ACCOUNT_GENDER == 'true') { 273 ?> 274 <tr> 275 <td class="main"><?php echo ENTRY_GENDER; ?></td> 276 <td class="main"><?php echo tep_draw_radio_field('affiliate_gender', 'm', false, $aInfo->affiliate_gender) . ' ' . MALE . ' ' . tep_draw_radio_field('affiliate_gender', 'f', false, $aInfo->affiliate_gender) . ' ' . FEMALE; ?></td> 277 </tr> 278 <?php 279 } 280 ?> 281 <tr> 282 <td class="main"><?php echo ENTRY_FIRST_NAME; ?></td> 283 <td class="main"><?php echo tep_draw_input_field('affiliate_firstname', $aInfo->affiliate_firstname, 'maxlength="32"', true); ?></td> 284 </tr> 285 <tr> 286 <td class="main"><?php echo ENTRY_LAST_NAME; ?></td> 287 <td class="main"><?php echo tep_draw_input_field('affiliate_lastname', $aInfo->affiliate_lastname, 'maxlength="32"', true); ?></td> 288 </tr> 289 <tr> 290 <td class="main"><?php echo ENTRY_EMAIL_ADDRESS; ?></td> 291 <td class="main"><?php echo tep_draw_input_field('affiliate_email_address', $aInfo->affiliate_email_address, 'maxlength="96"', true); ?></td> 292 </tr> 293 </table></td> 294 </tr> 295 <tr> 296 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 297 </tr> 298 <?php 299 if (AFFILATE_INDIVIDUAL_PERCENTAGE == 'true') { 300 ?> 301 <tr> 302 <td class="formAreaTitle"><?php echo CATEGORY_COMMISSION; ?></td> 303 </tr> 304 <tr> 305 <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> 306 <tr> 307 <td class="main"><?php echo ENTRY_AFFILIATE_COMMISSION; ?></td> 308 <td class="main"><?php echo tep_draw_input_field('affiliate_commission_percent', $aInfo->affiliate_commission_percent, 'maxlength="5"'); ?></td> 309 </tr> 310 </table></td> 311 </tr> 312 <tr> 313 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 314 </tr> 315 <?php 316 } 317 ?> 318 <tr> 319 <td class="formAreaTitle"><?php echo CATEGORY_COMPANY; ?></td> 320 </tr> 321 <tr> 322 <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> 323 <tr> 324 <td class="main"><?php echo ENTRY_COMPANY; ?></td> 325 <td class="main"><?php echo tep_draw_input_field('affiliate_company', $aInfo->affiliate_company, 'maxlength="32"'); ?></td> 326 </tr> 327 <tr> 328 <td class="main"><?php echo ENTRY_AFFILIATE_COMPANY_TAXID; ?></td> 329 <td class="main"><?php echo tep_draw_input_field('affiliate_company_taxid', $aInfo->affiliate_company_taxid, 'maxlength="64"'); ?></td> 330 </tr> 331 </table></td> 332 </tr> 333 <tr> 334 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 335 </tr> 336 <tr> 337 <td class="formAreaTitle"><?php echo CATEGORY_PAYMENT_DETAILS; ?></td> 338 </tr> 339 <tr> 340 <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> 341 <?php 342 if (AFFILIATE_USE_CHECK == 'true') { 343 ?> 344 <tr> 345 <td class="main"><?php echo ENTRY_AFFILIATE_PAYMENT_CHECK; ?></td> 346 <td class="main"><?php echo tep_draw_input_field('affiliate_payment_check', $aInfo->affiliate_payment_check, 'maxlength="100"'); ?></td> 347 </tr> 348 <?php 349 } 350 if (AFFILIATE_USE_PAYPAL == 'true') { 351 ?> 352 <tr> 353 <td class="main"><?php echo ENTRY_AFFILIATE_PAYMENT_PAYPAL; ?></td> 354 <td class="main"><?php echo tep_draw_input_field('affiliate_payment_paypal', $aInfo->affiliate_payment_paypal, 'maxlength="64"'); ?></td> 355 </tr> 356 <?php 357 } 358 if (AFFILIATE_USE_BANK == 'true') { 359 ?> 360 <tr> 361 <td class="main"><?php echo ENTRY_AFFILIATE_PAYMENT_BANK_NAME; ?></td> 362 <td class="main"><?php echo tep_draw_input_field('affiliate_payment_bank_name', $aInfo->affiliate_payment_bank_name, 'maxlength="64"'); ?></td> 363 </tr> 364 <tr> 365 <td class="main"><?php echo ENTRY_AFFILIATE_PAYMENT_BANK_BRANCH_NUMBER; ?></td> 366 <td class="main"><?php echo tep_draw_input_field('affiliate_payment_bank_branch_number', $aInfo->affiliate_payment_bank_branch_number, 'maxlength="64"'); ?></td> 367 </tr> 368 <tr> 369 <td class="main"><?php echo ENTRY_AFFILIATE_PAYMENT_BANK_SWIFT_CODE; ?></td> 370 <td class="main"><?php echo tep_draw_input_field('affiliate_payment_bank_swift_code', $aInfo->affiliate_payment_bank_swift_code, 'maxlength="64"'); ?></td> 371 </tr> 372 <tr> 373 <td class="main"><?php echo ENTRY_AFFILIATE_PAYMENT_BANK_ACCOUNT_NAME; ?></td> 374 <td class="main"><?php echo tep_draw_input_field('affiliate_payment_bank_account_name', $aInfo->affiliate_payment_bank_account_name, 'maxlength="64"'); ?></td> 375 </tr> 376 <tr> 377 <td class="main"><?php echo ENTRY_AFFILIATE_PAYMENT_BANK_ACCOUNT_NUMBER; ?></td> 378 <td class="main"><?php echo tep_draw_input_field('affiliate_payment_bank_account_number', $aInfo->affiliate_payment_bank_account_number, 'maxlength="64"'); ?></td> 379 </tr> 380 <?php 381 } 382 ?> 383 </table></td> 384 </tr> 385 <tr> 386 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 387 </tr> 388 <tr> 389 <td class="formAreaTitle"><?php echo CATEGORY_ADDRESS; ?></td> 390 </tr> 391 <tr> 392 <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> 393 <tr> 394 <td class="main"><?php echo ENTRY_STREET_ADDRESS; ?></td> 395 <td class="main"><?php echo tep_draw_input_field('affiliate_street_address', $aInfo->affiliate_street_address, 'maxlength="64"', true); ?></td> 396 </tr> 397 <?php 398 if (ACCOUNT_SUBURB == 'true') { 399 ?> 400 <tr> 401 <td class="main"><?php echo ENTRY_SUBURB; ?></td> 402 <td class="main"><?php echo tep_draw_input_field('affiliate_suburb', $aInfo->affiliate_suburb, 'maxlength="64"', false); ?></td> 403 </tr> 404 <?php 405 } 406 ?> 407 <tr> 408 <td class="main"><?php echo ENTRY_CITY; ?></td> 409 <td class="main"><?php echo tep_draw_input_field('affiliate_city', $aInfo->affiliate_city, 'maxlength="32"', true); ?></td> 410 </tr> 411 <tr> 412 <td class="main"><?php echo ENTRY_POST_CODE; ?></td> 413 <td class="main"><?php echo tep_draw_input_field('affiliate_postcode', $aInfo->affiliate_postcode, 'maxlength="8"', true); ?></td> 414 </tr> 415 <tr> 416 <td class="main"><?php echo ENTRY_COUNTRY; ?></td> 417 <td class="main"><?php echo tep_draw_pull_down_menu('affiliate_country_id', tep_get_countries(), $aInfo->affiliate_country_id, 'onChange="update_zone(this.form);"'); ?></td> 418 </tr> 419 <?php 420 if (ACCOUNT_STATE == 'true') { 421 ?> 422 <tr> 423 <td class="main"><?php echo ENTRY_STATE; ?></td> 424 <td class="main"><?php echo tep_draw_pull_down_menu('affiliate_zone_id', tep_prepare_country_zones_pull_down($aInfo->affiliate_country_id), $aInfo->affiliate_zone_id, 'onChange="resetStateText(this.form);"'); ?></td> 425 </tr> 426 <tr> 427 <td class="main"> </td> 428 <td class="main"><?php echo tep_draw_input_field('affiliate_state', $aInfo->affiliate_state, 'maxlength="32" onChange="resetZoneSelected(this.form);"'); ?></td> 429 </tr> 430 <?php 431 } 432 ?> 433 </table></td> 434 </tr> 435 <tr> 436 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 437 </tr> 438 <tr> 439 <td class="formAreaTitle"><?php echo CATEGORY_CONTACT; ?></td> 440 </tr> 441 <tr> 442 <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> 443 <tr> 444 <td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td> 445 <td class="main"><?php echo tep_draw_input_field('affiliate_telephone', $aInfo->affiliate_telephone, 'maxlength="32"'); ?></td> 446 </tr> 447 <tr> 448 <td class="main"><?php echo ENTRY_FAX_NUMBER; ?></td> 449 <td class="main"><?php echo tep_draw_input_field('affiliate_fax', $aInfo->affiliate_fax, 'maxlength="32"'); ?></td> 450 </tr> 451 <tr> 452 <td class="main"><?php echo ENTRY_AFFILIATE_HOMEPAGE; ?></td> 453 <td class="main"><?php echo tep_draw_input_field('affiliate_homepage', $aInfo->affiliate_homepage, 'maxlength="64"', true); ?></td> 454 </tr> 455 </table></td> 456 </tr> 457 <tr> 458 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 459 </tr> 460 <tr> 461 <td align="right" class="main"><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_AFFILIATE, tep_get_all_get_params(array('action'))) .'">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';?></td> 462 </tr></form> 463 <?php 464 } else { 465 ?> 466 <tr> 467 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 468 <tr><?php echo tep_draw_form('search', FILENAME_AFFILIATE, '', 'get'); ?> 469 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 470 <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td> 471 <td class="smallText" align="right"><?php echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('search'); ?></td> 472 </form></tr> 473 </table></td> 474 </tr> 475 <tr> 476 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 477 <tr> 478 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 479 <tr class="dataTableHeadingRow"> 480 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_AFFILIATE_ID; ?></td> 481 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_LASTNAME; ?></td> 482 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_FIRSTNAME; ?></td> 483 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_COMMISSION; ?></td> 484 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_USERHOMEPAGE; ?></td> 485 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> 486 </tr> 487 <?php 488 $search = ''; 489 if ( ($HTTP_GET_VARS['search']) && (tep_not_null($HTTP_GET_VARS['search'])) ) { 490 $keywords = tep_db_input(tep_db_prepare_input($HTTP_GET_VARS['search'])); 491 $search = " where affiliate_id like '" . $keywords . "' or affiliate_firstname like '" . $keywords . "' or affiliate_lastname like '" . $keywords . "' or affiliate_email_address like '" . $keywords . "'"; 492 } 493 $affiliate_query_raw = "select * from " . TABLE_AFFILIATE . $search . " order by affiliate_lastname"; 494 $affiliate_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, 495 $affiliate_query_raw, $affiliate_query_numrows); 496 $affiliate_query = tep_db_query($affiliate_query_raw); 497 while ($affiliate = tep_db_fetch_array($affiliate_query)) { 498 $info_query = tep_db_query("select affiliate_commission_percent, affiliate_date_account_created as date_account_created, affiliate_date_account_last_modified as date_account_last_modified, affiliate_date_of_last_logon as date_last_logon, affiliate_number_of_logons as number_of_logons from " . TABLE_AFFILIATE . " where affiliate_id = '" . $affiliate['affiliate_id'] . "'"); 499 $info = tep_db_fetch_array($info_query); 500 501 if (((!$HTTP_GET_VARS['acID']) || (@$HTTP_GET_VARS['acID'] == $affiliate['affiliate_id'])) && (!$aInfo)) { 502 $country_query = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . $affiliate['affiliate_country_id'] . "'"); 503 $country = tep_db_fetch_array($country_query); 504 505 $affiliate_info = array_merge($country, $info); 506 507 $aInfo_array = array_merge($affiliate, $affiliate_info); 508 $aInfo = new objectInfo($aInfo_array); 509 } 510 511 if ( (is_object($aInfo)) && ($affiliate['affiliate_id'] == $aInfo->affiliate_id) ) { 512 echo ' <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_AFFILIATE, tep_get_all_get_params(array('acID', 'action')) . 'acID=' . $aInfo->affiliate_id . '&action=edit') . '\'">' . "\n"; 513 } else { 514 echo ' <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_AFFILIATE, tep_get_all_get_params(array('acID')) . 'acID=' . $affiliate['affiliate_id']) . '\'">' . "\n"; 515 } 516 if (substr($affiliate['affiliate_homepage'],0,7) != "http://") $affiliate['affiliate_homepage']="http://".$affiliate['affiliate_homepage']; 517 ?> 518 <td class="dataTableContent"><?php echo $affiliate['affiliate_id']; ?></td> 519 <td class="dataTableContent"><?php echo $affiliate['affiliate_lastname']; ?></td> 520 <td class="dataTableContent"><?php echo $affiliate['affiliate_firstname']; ?></td> 521 <td class="dataTableContent" align="right"><?php if($affiliate['affiliate_commission_percent'] > AFFILIATE_PERCENT) echo $affiliate['affiliate_commission_percent']; else echo AFFILIATE_PERCENT; ?> %</td> 522 <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE, tep_get_all_get_params(array('acID', 'action')) . 'acID=' . $affiliate['affiliate_id'] . '&action=edit') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a>'; echo '<a href="' . $affiliate['affiliate_homepage'] . '" target="_blank">' . $affiliate['affiliate_homepage'] . '</a>'; ?></td> 523 <td class="dataTableContent" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE_STATISTICS, tep_get_all_get_params(array('acID')) . 'acID=' . $affiliate['affiliate_id']) . '">' . tep_image(DIR_WS_ICONS . 'statistics.gif', ICON_STATISTICS) . '</a> '; if ( (is_object($aInfo)) && ($affiliate['affiliate_id'] == $aInfo->affiliate_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_AFFILIATE, tep_get_all_get_params(array('acID')) . 'acID=' . $affiliate['affiliate_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td> 524 </tr> 525 <?php 526 } 527 ?> 528 <tr> 529 <td colspan="6"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 530 <tr> 531 <td class="smallText" valign="top"><?php echo $affiliate_split->display_count($affiliate_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_AFFILIATES); ?></td> 532 <td class="smallText" align="right"><?php echo $affiliate_split->display_links($affiliate_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y', 'acID'))); ?></td> 533 </tr> 534 <?php 535 if (tep_not_null($HTTP_GET_VARS['search'])) { 536 ?> 537 <tr> 538 <td align="right" colspan="2"><?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE) . '">' . tep_image_button('button_reset.gif', IMAGE_RESET) . '</a>'; ?></td> 539 </tr> 540 <?php 541 } 542 ?> 543 </table></td> 544 </tr> 545 </table></td> 546 <?php 547 $heading = array(); 548 $contents = array(); 549 switch ($HTTP_GET_VARS['action']) { 550 case 'confirm': 551 $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_CUSTOMER . '</b>'); 552 553 $contents = array('form' => tep_draw_form('affiliate', FILENAME_AFFILIATE, tep_get_all_get_params(array('acID', 'action')) . 'acID=' . $aInfo->affiliate_id . '&action=deleteconfirm')); 554 $contents[] = array('text' => TEXT_DELETE_INTRO . '<br><br><b>' . $aInfo->affiliate_firstname . ' ' . $aInfo->affiliate_lastname . '</b>'); 555 $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_AFFILIATE, tep_get_all_get_params(array('acID', 'action')) . 'acID=' . $aInfo->affiliate_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 556 break; 557 default: 558 if (is_object($aInfo)) { 559 $heading[] = array('text' => '<b>' . $aInfo->affiliate_firstname . ' ' . $aInfo->affiliate_lastname . '</b>'); 560 561 $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_AFFILIATE, tep_get_all_get_params(array('acID', 'action')) . 'acID=' . $aInfo->affiliate_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_AFFILIATE, tep_get_all_get_params(array('acID', 'action')) . 'acID=' . $aInfo->affiliate_id . '&action=confirm') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_AFFILIATE_CONTACT, 'selected_box=affiliate&affiliate=' . $aInfo->affiliate_email_address) . '">' . tep_image_button('button_email.gif', IMAGE_EMAIL) . '</a>'); 562 563 $affiliate_sales_raw = "select count(*) as count, sum(affiliate_value) as total, sum(affiliate_payment) as payment from " . TABLE_AFFILIATE_SALES . " a left join " . TABLE_ORDERS . " o on (a.affiliate_orders_id=o.orders_id) where o.orders_status >= " . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . " and affiliate_id = '" . $aInfo->affiliate_id . "'"; 564 $affiliate_sales_values = tep_db_query($affiliate_sales_raw); 565 $affiliate_sales = tep_db_fetch_array($affiliate_sales_values); 566 567 $contents[] = array('text' => '<br>' . TEXT_DATE_ACCOUNT_CREATED . ' ' . tep_date_short($aInfo->date_account_created)); 568 $contents[] = array('text' => '' . TEXT_DATE_ACCOUNT_LAST_MODIFIED . ' ' . tep_date_short($aInfo->date_account_last_modified)); 569 $contents[] = array('text' => '' . TEXT_INFO_DATE_LAST_LOGON . ' ' . tep_date_short($aInfo->date_last_logon)); 570 $contents[] = array('text' => '' . TEXT_INFO_NUMBER_OF_LOGONS . ' ' . $aInfo->number_of_logons); 571 $contents[] = array('text' => '' . TEXT_INFO_COMMISSION . ' ' . $aInfo->affiliate_commission_percent . ' %'); 572 $contents[] = array('text' => '' . TEXT_INFO_COUNTRY . ' ' . $aInfo->countries_name); 573 $contents[] = array('text' => '' . TEXT_INFO_NUMBER_OF_SALES . ' ' . $affiliate_sales['count'],''); 574 $contents[] = array('text' => '' . TEXT_INFO_SALES_TOTAL . ' ' . $currencies->display_price($affiliate_sales['total'],'')); 575 $contents[] = array('text' => '' . TEXT_INFO_AFFILIATE_TOTAL . ' ' . $currencies->display_price($affiliate_sales['payment'],'')); 576 } 577 break; 578 } 579 580 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { 581 echo ' <td width="25%" valign="top">' . "\n"; 582 583 $box = new box; 584 echo $box->infoBox($heading, $contents); 585 586 echo ' </td>' . "\n"; 587 } 588 ?> 589 </tr> 590 </table></td> 591 </tr> 592 <?php 593 } 594 ?> 595 </table></td> 596 <!-- body_text_eof //--> 597 </tr> 598 </table> 599 <!-- body_eof //--> 600 601 <!-- footer //--> 602 <?php require (DIR_WS_INCLUDES . 'footer.php'); ?> 603 <!-- footer_eof //--> 604 <br> 605 </body> 606 </html> 607 <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Jan 1 13:43:16 2010 | Cross-referenced by PHPXref 0.7 |