shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

activity.php (8319B)


      1 <?php
      2 class ControllerEventActivity extends Controller {
      3 	// model/account/customer/addCustomer/after
      4 	public function addCustomer(&$route, &$args, &$output) {
      5 		if ($this->config->get('config_customer_activity')) {
      6 			$this->load->model('account/activity');
      7 
      8 			$activity_data = array(
      9 				'customer_id' => $output,
     10 				'name'        => $args[0]['firstname'] . ' ' . $args[0]['lastname']
     11 			);
     12 
     13 			$this->model_account_activity->addActivity('register', $activity_data);
     14 		}
     15 	}
     16 	
     17 	// model/account/customer/editCustomer/after
     18 	public function editCustomer(&$route, &$args, &$output) {
     19 		if ($this->config->get('config_customer_activity')) {
     20 			$this->load->model('account/activity');
     21 
     22 			$activity_data = array(
     23 				'customer_id' => $this->customer->getId(),
     24 				'name'        => $this->customer->getFirstName() . ' ' . $this->customer->getLastName()
     25 			);
     26 
     27 			$this->model_account_activity->addActivity('edit', $activity_data);
     28 		}
     29 	}
     30 	
     31 	// model/account/customer/editPassword/after
     32 	public function editPassword(&$route, &$args, &$output) {
     33 		if ($this->config->get('config_customer_activity')) {
     34 			$this->load->model('account/activity');
     35 			
     36 			if ($this->customer->isLogged()) {
     37 				$activity_data = array(
     38 					'customer_id' => $this->customer->getId(),
     39 					'name'        => $this->customer->getFirstName() . ' ' . $this->customer->getLastName()
     40 				);
     41 	
     42 				$this->model_account_activity->addActivity('password', $activity_data);
     43 			} else {
     44 				$customer_info = $this->model_account_customer->getCustomerByEmail($args[0]);
     45 		
     46 				if ($customer_info) {
     47 					$activity_data = array(
     48 						'customer_id' => $customer_info['customer_id'],
     49 						'name'        => $customer_info['firstname'] . ' ' . $customer_info['lastname']
     50 					);
     51 	
     52 					$this->model_account_activity->addActivity('reset', $activity_data);
     53 				}
     54 			}	
     55 		}
     56 	}
     57 
     58 		
     59 	// model/account/customer/deleteLoginAttempts/after
     60 	public function login(&$route, &$args, &$output) {
     61 		if (isset($this->request->get['route']) && ($this->request->get['route'] == 'account/login' || $this->request->get['route'] == 'checkout/login/save') && $this->config->get('config_customer_activity')) {
     62 			$customer_info = $this->model_account_customer->getCustomerByEmail($args[0]);
     63 
     64 			if ($customer_info) {
     65 				$this->load->model('account/activity');
     66 	
     67 				$activity_data = array(
     68 					'customer_id' => $customer_info['customer_id'],
     69 					'name'        => $customer_info['firstname'] . ' ' . $customer_info['lastname']
     70 				);
     71 	
     72 				$this->model_account_activity->addActivity('login', $activity_data);
     73 			}
     74 		}	
     75 	}
     76 	
     77 	// model/account/customer/editCode/after
     78 	public function forgotten(&$route, &$args, &$output) {
     79 		if (isset($this->request->get['route']) && $this->request->get['route'] == 'account/forgotten' && $this->config->get('config_customer_activity')) {
     80 			$this->load->model('account/customer');
     81 			
     82 			$customer_info = $this->model_account_customer->getCustomerByEmail($args[0]);
     83 
     84 			if ($customer_info) {
     85 				$this->load->model('account/activity');
     86 
     87 				$activity_data = array(
     88 					'customer_id' => $customer_info['customer_id'],
     89 					'name'        => $customer_info['firstname'] . ' ' . $customer_info['lastname']
     90 				);
     91 
     92 				$this->model_account_activity->addActivity('forgotten', $activity_data);
     93 			}
     94 		}	
     95 	}
     96 	
     97 	// model/account/customer/addTransaction/after
     98 	public function addTransaction(&$route, &$args, &$output) {
     99 		if ($this->config->get('config_customer_activity')) {
    100 			$this->load->model('account/customer');
    101 			
    102 			$customer_info = $this->model_account_customer->getCustomer($args[0]);
    103 
    104 			if ($customer_info) {
    105 				$this->load->model('account/activity');
    106 	
    107 				$activity_data = array(
    108 					'customer_id' => $customer_info['customer_id'],
    109 					'name'        => $customer_info['firstname'] . ' ' . $customer_info['lastname'],
    110 					'order_id'    => $args[3]
    111 				);
    112 	
    113 				$this->model_account_activity->addActivity('transaction', $activity_data);
    114 			}
    115 		}
    116 	}	
    117 	
    118 	// model/account/customer/addAffiliate/after
    119 	public function addAffiliate(&$route, &$args, &$output) {
    120 		if ($this->config->get('config_customer_activity')) {
    121 			$this->load->model('account/activity');
    122 
    123 			$activity_data = array(
    124 				'customer_id' => $output,
    125 				'name'        => $args[1]['firstname'] . ' ' . $args[1]['lastname']
    126 			);
    127 
    128 			$this->model_account_activity->addActivity('affiliate_add', $activity_data);
    129 		}
    130 	}	
    131 	
    132 	// model/account/customer/editAffiliate/after
    133 	public function editAffiliate(&$route, &$args, &$output) {
    134 		if ($this->config->get('config_customer_activity') && $output) {
    135 			$this->load->model('account/activity');
    136 
    137 			$activity_data = array(
    138 				'customer_id' => $this->customer->getId(),
    139 				'name'        => $this->customer->getFirstName() . ' ' . $this->customer->getLastName()
    140 			);
    141 
    142 			$this->model_account_activity->addActivity('affiliate_edit', $activity_data);
    143 		}
    144 	}
    145 	
    146 	// model/account/address/addAddress/after
    147 	public function addAddress(&$route, &$args, &$output) { 
    148 		if ($this->config->get('config_customer_activity')) {
    149 			$this->load->model('account/activity');
    150 
    151 			$activity_data = array(
    152 				'customer_id' => $this->customer->getId(),
    153 				'name'        => $this->customer->getFirstName() . ' ' . $this->customer->getLastName()
    154 			);
    155 
    156 			$this->model_account_activity->addActivity('address_add', $activity_data);
    157 		}	
    158 	}
    159 	
    160 	// model/account/address/editAddress/after
    161 	public function editAddress(&$route, &$args, &$output) { 
    162 		if ($this->config->get('config_customer_activity')) {
    163 			$this->load->model('account/activity');
    164 
    165 			$activity_data = array(
    166 				'customer_id' => $this->customer->getId(),
    167 				'name'        => $this->customer->getFirstName() . ' ' . $this->customer->getLastName()
    168 			);
    169 
    170 			$this->model_account_activity->addActivity('address_edit', $activity_data);
    171 		}	
    172 	}
    173 	
    174 	// model/account/address/deleteAddress/after
    175 	public function deleteAddress(&$route, &$args, &$output) {
    176 		if ($this->config->get('config_customer_activity')) {
    177 			$this->load->model('account/activity');
    178 
    179 			$activity_data = array(
    180 				'customer_id' => $this->customer->getId(),
    181 				'name'        => $this->customer->getFirstName() . ' ' . $this->customer->getLastName()
    182 			);
    183 			
    184 			$this->model_account_activity->addActivity('address_delete', $activity_data);
    185 		}
    186 	}
    187 	
    188 	// model/account/return/addReturn/after
    189 	public function addReturn(&$route, &$args, &$output) {
    190 		if ($this->config->get('config_customer_activity') && $output) {
    191 			$this->load->model('account/activity');
    192 
    193 			if ($this->customer->isLogged()) {
    194 				$activity_data = array(
    195 					'customer_id' => $this->customer->getId(),
    196 					'name'        => $this->customer->getFirstName() . ' ' . $this->customer->getLastName(),
    197 					'return_id'   => $output
    198 				);
    199 
    200 				$this->model_account_activity->addActivity('return_account', $activity_data);
    201 			} else {
    202 				$activity_data = array(
    203 					'name'      => $args[0]['firstname'] . ' ' . $args[0]['lastname'],
    204 					'return_id' => $output
    205 				);
    206 
    207 				$this->model_account_activity->addActivity('return_guest', $activity_data);
    208 			}
    209 		}
    210 	}	
    211 	
    212 	// model/checkout/order/addOrderHistory/before
    213 	public function addOrderHistory(&$route, &$args) {	
    214 		if ($this->config->get('config_customer_activity')) {
    215 			// If last order status id is 0 and new order status is not then record as new order
    216 			$this->load->model('checkout/order');
    217 			
    218 			$order_info = $this->model_checkout_order->getOrder($args[0]);
    219 
    220 			if ($order_info && !$order_info['order_status_id'] && $args[1]) {
    221 				$this->load->model('account/activity');
    222 	
    223 				if ($order_info['customer_id']) {
    224 					$activity_data = array(
    225 						'customer_id' => $order_info['customer_id'],
    226 						'name'        => $order_info['firstname'] . ' ' . $order_info['lastname'],
    227 						'order_id'    => $args[0]
    228 					);
    229 	
    230 					$this->model_account_activity->addActivity('order_account', $activity_data);
    231 				} else {
    232 					$activity_data = array(
    233 						'name'     => $order_info['firstname'] . ' ' . $order_info['lastname'],
    234 						'order_id' => $args[0]
    235 					);
    236 	
    237 					$this->model_account_activity->addActivity('order_guest', $activity_data);
    238 				}
    239 			}
    240 		}
    241 	}
    242 }