本文整理汇总了PHP中Reply::createRow方法的典型用法代码示例。如果您正苦于以下问题:PHP Reply::createRow方法的具体用法?PHP Reply::createRow怎么用?PHP Reply::createRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reply
的用法示例。
在下文中一共展示了Reply::createRow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adminreportbatchreplysendAction
function adminreportbatchreplysendAction()
{
$this->_helper->layout->setLayout("layout_admin");
ini_set('display_errors', 1);
$frontController = Zend_Controller_Front::getInstance();
$frontController->throwExceptions(true);
if ($this->_request->isPost()) {
$form = new ReplyReportForm();
$formData = $this->_request->getPost();
if ($form->isValid($formData)) {
//print_r($formData);die;
$reportSource = $this->_request->getParam('report_source');
// sms report:
if ($reportSource == 'sms') {
$db = Zend_Registry::get('db');
$select = $db->select();
$select->from('consumer', '*');
$select->where('id = ?', $this->_request->getParam('consumer_id'));
$consumer = $db->fetchAll($select);
// 1.send reply
$msmStr = $form->getValue('message');
$len = strlen($msmStr);
for ($i = 0, $msmStrLen = 0; $i < $len; $i++, $msmStrLen++) {
if (ord($msmStr[$i]) >= 128) {
$i = $i + 2;
}
}
if ($msmStrLen > 70) {
$this->view->batchId = $formData['batch_id'];
$this->view->showMessage = 'Reply fail: The sms should be short then 70 characters.';
return;
}
include_once 'sms.inc.php';
$newclient = new SMS();
$apitype = 0;
$msg = iconv("UTF-8", "GB2312", $form->getValue('message'));
$respxml = $newclient->sendSMS($form->getValue('email'), $msg, date("Y-m-d H:i:s"), $apitype);
// 2.save reply
$replyModel = new Reply();
$reply = $replyModel->fetchRow('report_id = ' . $this->_request->getParam('report_id'));
//check reply condition!
if ($reply != null && $reply->status == 'SENT') {
$this->view->showMessage = "Reply fail: the reply has been sent!";
return;
}
if ($reply == null) {
$replyModel = new Reply();
$reply = $replyModel->createRow();
}
$currentTime = date("Y-m-d H:i:s");
$reply->date = $currentTime;
$reply->subject = $form->getValue('subject');
$reply->content = $form->getValue('message');
$reply->from = $config->smtp->report->mail->username;
$reply->campaign_id = $formData['campaign_id'];
$reply->report_id = $formData['report_id'];
$reply->to = $form->getValue('email');
$reply->status = 'SENT';
//2011-04-08 ham.bao separate the sessions with admin
$reply->admin_id = $this->_currentAdmin->id;
//$reply->usetime =$formData['usetime'];
$reply->save();
// 3.grade
$report_id = (int) $this->_request->getParam('report_id');
$this->saveReportReward($report_id, $form->getValue('grade'));
// 4.update notes for report
//$this->saveTags($report_id,$formData ['report_id']);
$this->saveTags($report_id, $formData['note']);
$this->view->batchId = $formData['batch_id'];
$this->updateBatchTotaltime($formData['batch_id'], $addtive);
$this->view->showMessage = $this->view->translate('Admin_Reply_the_report_successfully');
return;
}
// email report:
//1. config
$config = Zend_Registry::get('config');
/*
$smtpSender = new Zend_Mail_Transport_Smtp(
$config->smtp->report->mail->server,
array(
'username'=> $config->smtp->report->mail->username,
'password'=> $config->smtp->report->mail->password,
'auth'=> $config->smtp->report->mail->auth,
'ssl' => $config->smtp->report->mail->ssl,
'port' => $config->smtp->report->mail->port));
Zend_Mail::setDefaultTransport($smtpSender);
$mail = new Zend_Mail('utf-8');
*/
$db = Zend_Registry::get('db');
$select = $db->select();
$select->from('consumer', '*');
$select->where('email = ?', $form->getValue('email'));
$consumer = $db->fetchAll($select);
if ($consumer[0] != null) {
/*
//2.get "Your story" from report
$reportId = $formData['report_id'];
$reportModel = new Report();
$report = $reportModel->find($reportId)->current();
$config = Zend_Registry::get('config');
//.........这里部分代码省略.........