/** * {@inheritdoc} */ public function loadData($printQuery = false, $logQuery = false) { if (!$this->isLoaded()) { $searchCriteria = $this->getSearchCriteria(); $searchResults = $this->customerRepository->getList($searchCriteria); $this->_totalRecords = $searchResults->getTotalCount(); /** @var CustomerInterface[] $customers */ $customers = $searchResults->getItems(); foreach ($customers as $customer) { $this->_addItem($this->createCustomerItem($customer)); } $this->_setIsLoaded(); } return $this; }
<?php /* * Student Info: Name=Tsai-Chang Mai, ID=10010 * Subject: CS526(C)_HW3 _Spring_2016 * Author: Arvin-tcm * Filename: cutomerList.php * Date and Time: Feb 19, 2016 4:37:29 PM * Project Name: TsaiChangMai_10010_CS526A_HW3 */ include_once "CustomerModel.php"; include_once "CustomerRepository.php"; // Retrieve the data from the model $customerDB = new CustomerRepository($db); $customerList = $customerDB->getCustomers(); // Specify which view to see $customerListView = (include_once "customerList_view.php"); return $customerListView;
* Author: Arvin-tcm * Filename: edit.php * Date and Time: Feb 19, 2016 4:53:21 PM * Project Name: TsaiChangMai_10010_CS526A_HW3 */ include_once "CustomerModel.php"; include_once "CustomerRepository.php"; $editSubmitted = isset($_POST['edit_submitted']); if ($editSubmitted) { $operation = $_POST['edit_submitted']; if ($operation == 'Cancel') { $output = (include_once "customerList.php"); } else { if ($operation == 'Save') { $customer = new Customer($_POST["email"], $_POST["passwd"], $_POST["name"], $_POST["address"], $_POST["city"], $_POST["state"], $_POST["country"], $_POST["zip"], $_POST["phone"]); $customerDB = new CustomerRepository($db); $output = $customerDB->updateCustomer($customer); $pageData->content .= (include_once "customerList.php"); $page = (include_once "page.php"); echo $page; } } } else { //this runs if form was NOT submitted $email = $_GET['email']; $passwd = $_GET['passwd']; $name = $_GET['name']; $address = $_GET['address']; $city = $_GET['city']; $state = $_GET['state']; $country = $_GET['country'];
<?php /* * Student Info: Name=Tsai-Chang Mai, ID=10010 * Subject: CS526(C)_HW3 _Spring_2016 * Author: Arvin-tcm * Filename: delete.php * Date and Time: Feb 19, 2016 4:33:02 PM * Project Name: TsaiChangMai_10010_CS526A_HW3 */ include_once "CustomerModel.php"; include_once "CustomerRepository.php"; $email = $_GET['email']; $customerDB = new CustomerRepository($db); $output = $customerDB->deleteCustomer($email); return $output;
/** * Customer management view (Admin) */ public function dispShopToolManageCustomers() { $extraParams = array(); if ($search = Context::get('search')) $extraParams = array('search' => $search); $cRepo = new CustomerRepository(); $output = $cRepo->getCustomersList($this->site_srl, $extraParams); Context::set('customers_list',$output->customers); Context::set('page_navigation',$output->page_navigation); }