2013-07-24 10:11:14 +00:00
|
|
|
|
<?php
|
2013-08-26 02:33:44 +00:00
|
|
|
|
namespace Order\mount;
|
|
|
|
|
|
|
|
|
|
use Helpers\View as view;
|
|
|
|
|
use Helpers\dbh;
|
2013-07-24 10:11:14 +00:00
|
|
|
|
|
|
|
|
|
//事件中存在的操作
|
2013-08-26 02:33:44 +00:00
|
|
|
|
class PdfOperate implements \Order\listener\PdfEvents
|
2013-07-24 10:11:14 +00:00
|
|
|
|
{
|
|
|
|
|
private $db;
|
|
|
|
|
private $config;
|
|
|
|
|
|
|
|
|
|
//!!!!!!important!!!!!
|
|
|
|
|
//不同项目使用时是否要修改此项??
|
|
|
|
|
public $tbl_metadata = "heihemetadata";
|
|
|
|
|
public $tbl_dataorder = "dataorder";
|
|
|
|
|
public $tbl_offlineapp = "offlineapp";
|
|
|
|
|
|
|
|
|
|
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 updateUserInfo(\Zend_EventManager_Event $e)
|
|
|
|
|
{
|
|
|
|
|
//根据pdflink字段,以判断是否已经提交
|
|
|
|
|
//在数据库中创建rules,在更新offlineapp表时同时更新users表中对应的信息
|
|
|
|
|
$formData = $e->getParam('formData');
|
|
|
|
|
$uid = $e->getParam('uid');
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
|
|
|
|
|
$sql="SELECT id FROM ".$this->tbl_offlineapp."
|
|
|
|
|
WHERE userid=? AND (pdflink IS null OR pdflink='') AND (ts_approved IS null)";
|
|
|
|
|
$row = $this->db->fetchRow($sql,array($uid));
|
2013-08-26 02:33:44 +00:00
|
|
|
|
|
|
|
|
|
$dbh = new dbh($this->db);
|
2013-07-24 10:11:14 +00:00
|
|
|
|
$formData['username'] = $formData['realname'];
|
|
|
|
|
unset($formData['realname']);
|
|
|
|
|
unset($formData['save']);
|
2013-08-28 01:41:49 +00:00
|
|
|
|
|
2013-07-24 10:11:14 +00:00
|
|
|
|
if ($row) {
|
|
|
|
|
$s = $dbh->update($this->tbl_offlineapp,$formData," id={$row['id']} ");
|
|
|
|
|
return $s;
|
|
|
|
|
} else {
|
|
|
|
|
$s = $dbh->insert($this->tbl_offlineapp,$formData);
|
|
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}catch(Exception $e)
|
|
|
|
|
{
|
|
|
|
|
return $e->getMessage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|