address_book Class Reference

modules More...

Inherits AbstractAccount, and InterfaceModule.

List of all members.

Public Member Functions

Static Public Attributes

Static Private Member Functions

  • static form_delete ()
    Form delete entry address book.
  • static form_edit ()
    Form add/edit entry address book.

Detailed Description

modules

Address book for customers

Definition at line 17 of file address_book.php.


Constructor & Destructor Documentation

address_book::__construct (  ) 

script validate js

call js view last time

Definition at line 40 of file address_book.php.

00040                         {
00041     $this->code =__CLASS__;
00042     $this->type ='account';
00043     $this->title = __('module aca address book text title');
00044     $this->description = __('module aca address book text description') ;
00045     $this->sort_order = (defined('MODULE_ACA_ADDRESS_BOOK_SORT_ORDER')) ? MODULE_ACA_ADDRESS_BOOK_SORT_ORDER : 0;
00046     $this->enabled = true;
00047 
00048 
00049     $this->sql_data_array=array();
00050     $this->cInfo = new objectInfo(array());
00051 
00052     $page=page::getInstance();
00053     $page->new_class('javascript');
00054 
00056     $page->javascript->add_framework("ext/jquery/jquery.min.js");
00057     $page->javascript->add_script("ext/jquery/jquery.validate.min.js", array('sort'=>30));
00058 
00060     $file=DIR_WS_INCLUDES.'js/'.__CLASS__.'.js.php';
00061     if( ($file=page::fix_file($file)) && $file !=false ) $page->javascript->add_script($file, array('sort'=>30));
00062   }


Member Function Documentation

address_book::after_check_action ( action  ) 

Definition at line 169 of file address_book.php.

00169                                                {
00170     if($action=='new')  tep_redirect(tep_href_link(FILENAME_ACCOUNT, 'aca_mod='.$this->code.'&aca_type='.$this->type.'&aca_action=display_view', 'SSL'));
00171   }

address_book::check (  ) 

implements InterfaceModule depend

Definition at line 289 of file address_book.php.

00289 {}

address_book::check_action ( action  ) 

Action exe.

Parameters:
$action string la var d'action $cID int recupere le Session[]

use class customer class

force retour error sans session

ADD control addresse defaut

Definition at line 72 of file address_book.php.

00072                                         {
00073 
00074 //     if ($action != 'process') return false;
00075     if (!tep_session_is_registered('customer_id')) return false;
00076 
00077     global $page;
00078     $customer_id=$page->the_var('customer_id');
00079 
00080     switch ($action) {
00081 
00082       case 'update':
00083       case 'new':
00087         $custo=customer::getInstance();
00089         customer::definePostMess(0);
00090 
00091 
00092         if ( ($resul=$custo->CheckDataAddressBook($_POST, 'addressbook')) && $resul !=false && is_array($resul)) {
00093 
00094         if (_cst_bool('CUSTOMER_FORCE_UCWORDS')) {
00095           $resul['lastname']=ucwords($resul['lastname']);
00096           $resul['firstname']=ucwords($resul['firstname']);
00097         }
00098         if (_cst_bool('CUSTOMER_FORCE_STRTOUPPER')) {
00099           $resul['lastname']=strtoupper($resul['lastname']);
00100         }
00101 
00102         if (_cst_bool('CUSTOMER_CITY_FORCE_STRTOUPPER')) {
00103           $resul['city']=strtoupper($resul['city']);
00104         }
00105 
00106           $sql_data_array = array('entry_firstname' => $resul['firstname'],
00107                                   'entry_lastname' => $resul['lastname'],
00108                                   'entry_street_address' => $resul['street_address'],
00109                                   'entry_postcode' => $resul['postcode'],
00110                                   'entry_city' => $resul['city'],
00111                                   'entry_country_id' => (int)$resul['country']);
00112 
00113           if (_cst_bool('ACCOUNT_GENDER')) $sql_data_array['entry_gender'] = $resul['gender'];
00114           if (_cst_bool('ACCOUNT_COMPANY')){
00115             $sql_data_array['entry_company'] = $resul['company'];
00116             $sql_data_array['entry_company_tax_id'] = $resul['company_tax_id'];
00117           }
00118           if (_cst_bool('ACCOUNT_SUBURB')) $sql_data_array['entry_suburb'] = $resul['suburb'];
00119           if (_cst_bool('ACCOUNT_STATE')) {
00120             if (isset($resul['zone_id']) && $resul['zone_id'] > 0) {
00121               $sql_data_array['entry_zone_id'] = (int)$resul['zone_id'];
00122               $sql_data_array['entry_state'] = '';
00123             } else {
00124               $sql_data_array['entry_zone_id'] = '0';
00125               $sql_data_array['entry_state'] = $resul['state'];
00126             }
00127           }
00128 
00129           if ($action == 'update') {
00130             tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "address_book_id = '" . (int)$_GET['edit'] . "' and customers_id ='" . (int)$customer_id . "'");
00131              $new_address_book_id= (int)$_GET['edit'];
00132           } else {
00133             $sql_data_array['customers_id'] = (int)$customer_id;
00134             tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
00135 
00136 
00137             $cs_s=tep_db_query("select address_book_id from " . TABLE_ADDRESS_BOOK . "  where customers_id='".$customer_id."' ORDER BY address_book_id DESC");
00138             $cs=tep_db_fetch_array($cs_s);
00139             $new_address_book_id=$cs['address_book_id'];
00140           }
00141 
00142             if (isset($_POST['primary']) && ($_POST['primary'] == 'on')) {
00143               $sql_data_array=array();
00144               $sql_data_array['customers_default_address_id'] = $new_address_book_id;
00145 
00146               tep_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . (int)$customer_id . "'");
00147             }
00148 
00149 
00150           $page->messageStack->add('addressbook', __('SUCCESS_ADDRESS_BOOK_ENTRY_UPDATED'), 'success');
00151         }
00152         break;
00153 
00154         case 'deleteconfirm':
00155           if(!isset($_GET['delete']) || !is_numeric($_GET['delete'])  ) return false;
00158           tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where address_book_id = '" . (int)$_GET['delete'] . "' and customers_id = '" . (int)$customer_id . "'");
00159 
00160           $page->messageStack->add_session('addressbook', __('SUCCESS_ADDRESS_BOOK_ENTRY_DELETED'), 'success');
00161         break;
00162     }
00163 
00164     return true;
00165   }

address_book::display_view ( pID = ''  ) 

Affiche Block edit/modif reviews.

Parameters:
$pID int id products $customer_id int current

Reimplemented from AbstractAccount.

Definition at line 238 of file address_book.php.

00238                                        {
00239     global $page;
00240     $customer_id=$page->the_var('customer_id');
00241     $this->load_db_values($customer_id);
00242     self::$account = $page->_call('customer','the_customer');
00243     self::$adress_book=$this->cInfo->adress_book;
00244     self::$count=$this->cInfo->the_count;
00245 
00246     return new objectInfo(array('title'=>__("Carnet d'adresses personnel"),'content'=> tep_output_string_protected(tep_get_include_contents(__CLASS__.'.'.__FUNCTION__),false,true) ) );
00247   }

address_book::display_view_form (  ) 

select function for display

Definition at line 253 of file address_book.php.

00253                                      {
00254     global $page,$language, $navigation,$entry;
00255 
00256     $customer_id=$page->the_var('customer_id');
00257     $this->load_db_values($customer_id);
00258     self::$account = $page->_call('customer','the_customer');
00259 
00260     if (isset($_GET['edit'])) $entry=(!isset($_POST['firstname']))? $this->cInfo->adress_book[$_GET['edit']] : $_POST;
00261     elseif(isset($_POST['firstname']))$entry= $_POST;
00262 
00263     if (isset($_GET['delete'])) $s= self::form_delete();
00264     else $s= self::form_edit();
00265 
00266     return new objectInfo(array('title'=>self::$display_view_form_title,'content'=>tep_output_string_protected($s,false,true))) ;
00267   }

address_book::display_view_min_listMyAccount ( cID  ) 

List des element du block my account.

Definition at line 224 of file address_book.php.

00224                                                       {
00225     global  $page;
00226 
00227     $v['title']=__("Afficher ou modifier des entrées dans mon carnet d'adresses.");
00228     $v['href_link']= tep_href_link(FILENAME_ACCOUNT, 'aca_mod='.$this->code.'&aca_type='.$this->type.'&aca_action=display_view', 'SSL');
00229     return array(new objectInfo($v));
00230   }

static address_book::form_delete (  )  [static, private]

Form delete entry address book.

Definition at line 272 of file address_book.php.

00272                                        {
00273     self::$display_view_form_title=__('HEADING_TITLE_DELETE_ENTRY');
00274     return tep_get_include_contents(__CLASS__.'.'.__FUNCTION__);
00275   }

static address_book::form_edit (  )  [static, private]

Form add/edit entry address book.

Definition at line 281 of file address_book.php.

Referenced by display_view_form().

00281                                      {
00282     if (isset($_GET['edit'])) self::$display_view_form_title=__('HEADING_TITLE_MODIFY_ENTRY');
00283     else  self::$display_view_form_title=__('HEADING_TITLE_ADD_ENTRY');
00284 
00285     return tep_get_include_contents(__CLASS__.'.'.__FUNCTION__);
00286   }

address_book::get_header ( action = ''  ) 

Reimplemented from AbstractAccount.

Definition at line 64 of file address_book.php.

00064 {}

address_book::install (  ) 

Definition at line 290 of file address_book.php.

00290 {}

address_book::keys (  ) 

Definition at line 292 of file address_book.php.

00292 {}

address_book::load_db_address ( cID  ) 

Definition at line 200 of file address_book.php.

00200                                         {
00201     $entry_query = tep_db_query("select entry_gender, entry_company, entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, entry_zone_id, entry_country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$cID . "' and address_book_id = '" . (int)$_GET['edit'] . "'");
00202 
00203     if (!tep_db_num_rows($entry_query)) {
00204       $page->messageStack->add_session('addressbook', __('ERROR_NONEXISTING_ADDRESS_BOOK_ENTRY'));
00205 
00206       tep_redirect(tep_href_link(FILENAME_ACCOUNT, 'aca_mod='.$this->code.'&aca_type='.$this->type.'&aca_action=display_view', 'SSL'));
00207     }
00208     $this->cInfo->objectInfo(array('entry_adress_book'=>tep_db_fetch_array($entry_query)));
00209   }

address_book::load_db_values ( cID  ) 

Reimplemented from AbstractAccount.

Definition at line 186 of file address_book.php.

Referenced by display_view(), and display_view_form().

00186                                        {
00187     $cpt=0;
00188     $addresses_query = tep_db_query("select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company as company,entry_company_tax_id as company_tax_id, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$cID . "' order by firstname, lastname");
00189     while ($addresses = tep_db_fetch_array($addresses_query)){
00190        $addr[$addresses['address_book_id']]=$addresses;
00191        $cpt++;
00192     }
00193 
00194      $this->cInfo->objectInfo(
00195         array('adress_book'=>$addr,
00196               'the_count'=>$cpt
00197         ) );
00198   }

address_book::remove (  ) 

Definition at line 291 of file address_book.php.

00291 {}

address_book::repost_values (  ) 

Definition at line 213 of file address_book.php.

00213                                    {
00214     // Repost all values that are not arrays
00215     foreach ($this->pInfo as $key=>$val) {
00216       if (!is_array($this->pInfo[$key]))  echo "\n".tep_draw_hidden_field($this->code .'['.$key.']', stripslashes($val))."\n";
00217 
00218     }
00219   }

address_book::update_table_account (  ) 

This function returns an array with variables to update into TABLE_ADDRESS_BOOK

Definition at line 175 of file address_book.php.

00175                                           {
00176 
00178     $sql_data_array=$this->sql_data_array;
00179     tep_db_perform(TABLE_ADDRESS_BOOK, $this->cInfo->sql_data_array, 'update', "customers_id = '" . (int)$_GET['cID'] . "' and address_book_id = '" . (int)$this->cInfo->customers_default_address_id . "'");
00180 
00181     return array();
00182   }


Member Data Documentation

address_book::$account [static]

Definition at line 24 of file address_book.php.

address_book::$adress_book [static]

Definition at line 28 of file address_book.php.

address_book::$count [static]

Definition at line 32 of file address_book.php.

address_book::$display_view_form_title [static]

Definition at line 36 of file address_book.php.


The documentation for this class was generated from the following file: