Phân tích hệ thống

Một phần của tài liệu tìm hiều zend framework 2.0 ,xây dựng website thương mại điện tử (Trang 33 - 51)

3.3.1.Sơ đồ Use Case

Sơ đồ Use Case tổng thể

Hình 3.3.1.1: Sơ đồ Use Case tổng thể Use case cập nhật

Hình 3.3.1.2: Use case cập nhật Phân rã Use case cập nhật sản phẩm.

Hình 3.3.1.3: Phân rã Use case cập nhật sản phẩm Phân rã Use đặt hàng.

Hình 3.3.1.4: Phân rã Use đặt hàng

3.4.Mô hình quan niệm dữ liệu

Hình 3.4.1 :Mô hình quan niệm dữ liệu

3.5.Sơ đồ chức năng

3.6.Cấu hình ứng dụng

Hình 3.5.1: Cấu hình ứng dụng

3.6.1.Một số phương thức cơ bản trong Zend Framework 3.6.1.1.Khởi tạo kết nối database

File: config\application.config.php .

<?php return array(

'modules' => array( 'Application',

'Shopping',

), // Khai báo 2 module được load 'module_listener_options' => array( 'config_glob_paths' => array( 'config/autoload/{,*.}{global,local}.php', ), 'module_paths' => array( './module', './vendor', ), ), ); File : config\autoload\global.php

<?php /**

* Global Configuration Override *

* You can use this file for overridding configuration values from modules, etc. * You would place values in here that are agnostic to the environment and not * sensitive to security.

*

* @NOTE: In practice, this file will typically be INCLUDED in your source * control, so do not include passwords or other sensitive information in this * file. */ return array( 'db' => array( 'driver' => 'Pdo', 'dsn' => 'mysql:dbname=shopping;host=localhost', 'driver_opti ons' => array(

PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'' ), ), 'service_manager' => array( 'factories' => array( 'Zend\D 39

b\Adapter\Adapter' => 'Zend\Db\Adapter\AdapterServiceFactory', ), ), );

3.6.1.2.Cấu hình template

<?php /**

* This makes our life easier when dealing with paths. Everything is relative * to the application root now.

*/

define('PUBLIC_PATH', dirname(__FILE__));

define('TEMPLATE_PATH', PUBLIC_PATH.'/templates'); define('FILES_PATH', PUBLIC_PATH . '/files');

define('TEMPLATE_URL', '/zendstack/public/templates'); //Duong dan den thu muc ung (adsbygoogle = window.adsbygoogle || []).push({});

define('APPLICATION_URL','/zendstack');

define('SRCIPTS_URL', APPLICATION_URL . '/public/scripts'); //Duong dan den thu muc /templates

define('CAPTCHA_URL', APPLICATION_URL . '/public/captcha'); define('FILES_URL', APPLICATION_URL . '/public/files');

chdir(dirname(__DIR__));

// Setup autoloading

include 'init_autoloader.php'; // Run the application!

Zend\Mvc\Application::init(include 'config/application.config.php')->run();

3.6.1.3.Hiển thị danh mục sản phẩm theo mô hình đa cấp

module\Shopping\src\Shopping\View\Helper\BlkCategoryMenu.php

protected $_db;

public function __construct($db) {

$this->_db = $db; }

public function __invoke($name=null,$val=null) { $view = $this->view; $result = $this->_db->listItem(); $cid = ($view->arrParam['id'])?$view->arrParam['id']:0; $strMenu = $this->createMenu($result,0,$view); require_once ('html/default.php'); }

public function createMenu($sourceArr,$parents =0, $viewObj ){ $newMenu = '';

$this->recursiveMenu($sourceArr,$parents = 0,$newMenu,$viewObj); return str_replace('<ul></ul>','',$newMenu);

}

public function recursiveMenu($sourceArr,$parents = 0,&$newMenu, $viewObj){ if(count($sourceArr)>0){

$newMenu .= '<ul >';

foreach ($sourceArr as $key => $value){ $liMenu = 'liMenu_' . $value['id']; if($value['parents'] == $parents){ if($value['parents'] == 0){

$newMenu .= '<li id="'. $liMenu . '"><a >' . $value['name'] . '</a>'; }else{

$link = $viewObj->url('shopping-category',array('action'=>'index', 'id' => $value['id']));

$newMenu .= '<li id="'. $liMenu . '"><a href="' . $link . '">' . $value['name'] . '</a>';

}

$newParents = $value['id']; unset($sourceArr[$key]);

$this->recursiveMenu($sourceArr,$newParents, $newMenu, $viewObj); $newMenu .= '</li>'; } } $newMenu .= '</ul>'; } } 43

3.7.Hình ảnh Website

Hình 3.6.2: Đăng ký

Hình 3.6.3:Chi tiết sản phẩm

Hình 3.6.4:Giỏ hàng

Kết luận (adsbygoogle = window.adsbygoogle || []).push({});

Xây dựng website bán sách qua mạng trên nền Zend Framework 2.0 là một đề tài mới me ̉.Việc xây dựng một hệ thống áp dụng công nghệ mới ít nhiều đã ảnh hưởng tới kết quả của đề tài.Tuy nhiên sau khi hoàn tất ,đề tài này cũng thu được nhưng kết quả như sau:

Hoàn thành các mô hình hệ thống :Sơ đồ Use case,mô hình dữ liệu và cơ sở dữ liệu để phục vụ cho hệ thống

Hoàn thành chức năng xem menu sản phẩm,chi tiết sản phẩm,đăng ký, đăng nhập, giỏ hàng…

Áp dụng Zend Framework 2 vào công việc xây dựng ứng dụng web,dễ dàng nâng cấp và phát triển.

Bên cạnh đó đề tài còn nhiều mặt hạn chế Giao diện khá đơn giản

Các chức năng cho cập nhập ,xóa,sửa sản phẩm cho người quản trị và giỏ hàng chưa hoàn thành

Tài liệu tham khảo:

Diễn đàn Zend Framework Việt Nam: Zend.vn/forum

Luận văn tốt nghiệp đại học “xây dựng hệ thống quản lý sử dụng phòng học trên nền tản Zend Framework “ của Lưu Trường Hải Lân

Mã nguồn Shopping bằng Zend Framework do các học viên khóa học online zendvn hoàn thành download tại http://www.zend.vn/forum/viewtopic.php?f=25&t=1405

Diễn đàn http://www.qhonline.info/forum

---nếu cần code liên hệ facebook “https://www.facebook.com/nam.nguyenhoai.716”---

Một phần của tài liệu tìm hiều zend framework 2.0 ,xây dựng website thương mại điện tử (Trang 33 - 51)