westdc-zf1/application/module/Order/mount/ManagerOperate.php

92 lines
1.7 KiB
PHP
Raw Normal View History

<?php
namespace Order\mount;
use Helpers\View as view;
use Helpers\dbh;
use Mail\Mail;
use Order\Manager\Offlineapp;
//事件中存在的操作
class ManagerOperate implements \Order\listener\ManagerEvents
{
private $db;
private $config;
function __construct($db = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = \Zend_Registry::get('config');
}
//申请成功提交之后
public function received(\Zend_EventManager_Event $e)
{
$id = $e->getParam('id');
try{
$OM = new Offlineapp();
$data = $OM->getOneAppInfo($id);
$emailkeys = array(
"user"=>$data[0]['username'],
"datalist"=>str_replace(";","\n",$data[0]['datalist']),
);
$mail = new Mail();
$mail->loadTemplate("offline-start",$emailkeys);
$mail->addTo($data[0]['email'],$data[0]['username']);
$mail->send();
}catch(Exception $e)
{
return $e->getMessage();
}
return true;
}
//申请表重置
public function appFormReseted(\Zend_EventManager_Event $e)
{
$id = $e->getParam('id');
try{
$OM = new Offlineapp();
$data = $OM->getOneAppInfo($id);
$emailkeys = array(
"user"=>$data[0]['username'],
"link"=> view::getHostLink() . '/data/order/ac/offline2'
);
$mail = new Mail();
$mail->loadTemplate("offline-appformreseted",$emailkeys);
$mail->addTo($data[0]['email'],$data[0]['username']);
$mail->send();
}catch(Exception $e)
{
return $e->getMessage();
}
return true;
}
//专题数据集
public function checkDataSource()
{
}
}