规范文件名和namespace命名,修改小心为大些,增加Application类用来处理申请相关事务

This commit is contained in:
Li Jianxuan 2013-11-05 03:57:01 +00:00
parent 8c3d9cf760
commit ff2f657cb6
15 changed files with 144 additions and 28 deletions

View File

@ -0,0 +1,7 @@
<?php
namespace Application\Event;
interface ApplicationEvent
{
//public function appCheckParam(\Zend_EventManager_Event $e);
}

View File

@ -0,0 +1,36 @@
<?php
namespace Application\Handler;
use \Helpers\View as view;
use \Helpers\dbh;
use \Helpers\Table;
use \Files\Files;
class ApplicationHandler implements \Application\Event\ApplicationEvent
{
private $db; //传入PDO对象误
private $config; //全局配置
public $table;
function __construct($db = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = \Zend_Registry::get('config');
$this->table = new Table();
}
public function applicationCheckParam(\Zend_EventManager_Event $e)
{
$data = $e->getParam('data');
return true;
}
}

View File

@ -0,0 +1,48 @@
<?php
namespace Order\Manager;
use \Helpers\View as view;
use \Helpers\dbh;
use Order\Listener\ApplicationListener as Listener;
class Application
{
public $config;
public $db;
public $table;
public $checkFiled = array('phone','realname','unit','address');
public function __construct($db = NULL,$auth = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = \Zend_Registry::get('config');
$Listener = new Listener();
@$this->events()->attachAggregate($Listener);
$this->table = new \Helpers\Table();
}
public function events(\Zend_EventManager_EventCollection $events = NULL)
{
if ($events !== NULL) {
$this->events = $events;
} elseif ($this->events === NULL) {
$this->events = new \Zend_EventManager_EventManager(__CLASS__);
}
return $this->events;
}
//已经通过的所有申请
public function passed()
{
}
}

View File

@ -1,10 +1,10 @@
<?php
namespace Order;
use Helpers\View as view;
use Mail\Mail;
use Order\listener\OrderListener;
use Files\Output;
use \Helpers\View as view;
use \Mail\Mail;
use \Order\Listener\OrderListener;
use \Files\Output;
class Order
{

View File

@ -0,0 +1,25 @@
<?php
namespace Order\Listener;
use \Order\Handler\ApplicationHandler as Handler;
class ApplicationListener implements \Zend_EventManager_ListenerAggregate
{
private $event;
function __construct()
{
$this->event = new \Zend_EventManager_EventManager();
}
public function attach(\Zend_EventManager_EventCollection $events)
{
$Handler = new Handler();
//$events->attach('app.checkParam', array($Handler, 'appCheckParam'), 100);
}
public function detach(\Zend_EventManager_EventCollection $events)
{
}
}

View File

@ -1,5 +1,5 @@
<?php
namespace Order\listener;
namespace Order\Listener;
//接口 需要实现的Listener中的方法
interface ManagerEvents
{

View File

@ -1,7 +1,7 @@
<?php
namespace Order\listener;
namespace Order\Listener;
use Order\mount\ManagerOperate;
use Order\Mount\ManagerOperate;
//侦听
class ManagerListener implements \Zend_EventManager_ListenerAggregate

View File

@ -1,5 +1,5 @@
<?php
namespace Order\listener;
namespace Order\Listener;
//接口 需要实现的Listener中的方法
interface OrderEvents
{

View File

@ -1,9 +1,9 @@
<?php
namespace Order\listener;
namespace Order\Listener;
use Order\mount\OrderOperate;
use Order\mount\PdfForm;
use Order\mount\PdfOperate;
use Order\Mount\OrderOperate;
use Order\Mount\PdfForm;
use Order\Mount\PdfOperate;
//侦听
class OrderListener implements \Zend_EventManager_ListenerAggregate

View File

@ -1,5 +1,5 @@
<?php
namespace Order\listener;
namespace Order\Listener;
//接口 需要实现的Listener中的方法
interface PdfEvents
{

View File

@ -1,5 +1,5 @@
<?php
namespace Order\listener;
namespace Order\Listener;
//接口 需要实现的Listener中的方法
interface PdfFormEvents
{

View File

@ -1,5 +1,5 @@
<?php
namespace Order\mount;
namespace Order\Mount;
use Helpers\View as view;
use Helpers\dbh;
@ -7,7 +7,7 @@ use Mail\Mail;
use Order\Manager\Offlineapp;
//事件中存在的操作
class ManagerOperate implements \Order\listener\ManagerEvents
class ManagerOperate implements \Order\Listener\ManagerEvents
{
private $db;
private $config;

View File

@ -1,10 +1,10 @@
<?php
namespace Order\mount;
namespace Order\Mount;
use Helpers\View as view;
use \Helpers\View as view;
//事件中存在的操作
class OrderOperate implements \Order\listener\OrderEvents
class OrderOperate implements \Order\Listener\OrderEvents
{
private $db;
private $config;
@ -49,7 +49,7 @@ class OrderOperate implements \Order\listener\OrderEvents
}
}catch(Exception $e)
{
\view::Dump($e->getMessage());
view::Dump($e->getMessage());
}
return true;

View File

@ -1,10 +1,10 @@
<?php
namespace Order\mount;
namespace Order\Mount;
use Helpers\View as view;
use \Helpers\View as view;
//事件中存在的操作
class PdfForm implements \Order\listener\PdfFormEvents
class PdfForm implements \Order\Listener\PdfFormEvents
{
private $db;
private $config;

View File

@ -1,12 +1,12 @@
<?php
namespace Order\mount;
namespace Order\Mount;
use Helpers\View as view;
use Helpers\dbh;
use Mail\Mail;
use \Helpers\View as view;
use \Helpers\dbh;
use \Mail\Mail;
//事件中存在的操作
class PdfOperate implements \Order\listener\PdfEvents
class PdfOperate implements \Order\Listener\PdfEvents
{
private $db;
private $config;