本文整理汇总了PHP中Report::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::update方法的具体用法?PHP Report::update怎么用?PHP Report::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Report
的用法示例。
在下文中一共展示了Report::update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: report_edit_form_submit
function report_edit_form_submit($data)
{
$error = report_validate($data);
if (!empty($error)) {
return FALSE;
} else {
$report = new Report();
$update = $report->update($data);
if ($update['code'] == 200) {
return report_list($data['id']);
}
}
}
示例2: admincreatebatchAction
function admincreatebatchAction()
{
$this->_helper->layout->setLayout("layout_admin");
$db = Zend_Registry::get('db');
$this->view->adminid = $this->_currentAdmin->id;
if ($this->_request->isPost()) {
// validate report_id
$displayedreport_ids = $report_ids = $this->_request->getParam('reportInBatch');
$campaignId = $this->_request->getParam('id');
$reportBatchModel = new ReportBatch();
$len = count($report_ids);
for ($i = 0; $i < $len; $i++) {
$reportBatch = $reportBatchModel->fetchRow("report_ids like '%," . $report_ids[$i] . ",%'");
if ($reportBatch != null) {
// unset($report_ids[$i]);
$this->_flashMessenger->addMessage("The Selected report conflicted, choose again please!");
$this->_helper->redirector('adminindex', 'report');
// return;
}
}
if (count($report_ids) > 0) {
$currentTime = date("Y-m-d H:i:s");
// create batch record
$reportBatchModel = new ReportBatch();
$reportBatch = $reportBatchModel->createRow();
$reportBatch->start_datetime = $currentTime;
//2011-04-08 ham.bao separate the sessions with admin
$reportBatch->admin_id = $this->_currentAdmin->id;
$reportBatch->report_ids = "," . implode(",", $report_ids) . ",";
$reportBatch->state = 'NEW';
$reportBatch->campaign_id = $campaignId;
$reportBatch->save();
$this->view->batchId = $reportBatch->id;
//rock selected reports
$reportModel = new Report();
$db2 = $reportModel->getAdapter();
$set = array('state' => 'LOCKED');
$where = $db2->quoteInto('id in (' . implode(',', $report_ids) . ')');
$rows_affected = $reportModel->update($set, $where);
}
} else {
$batch_id = $this->_request->getParam('batch_id');
$reportBatchModel = new ReportBatch();
$reportBatch = $reportBatchModel->fetchRow('id = ' . $batch_id);
$displayedreport_ids = explode(',', substr($reportBatch['report_ids'], 1, strlen($reportBatch['report_ids']) - 2));
$campaignId = $reportBatch['campaign_id'];
$this->view->batchId = $reportBatch['id'];
}
// Zend_Debug::dump($this->view->batchId);
if (count($displayedreport_ids) == 0) {
return;
}
//campagin
$campaignModel = new Campaign();
$this->view->campaign = $campaignModel->fetchRow('id = ' . $campaignId);
// show the selected reports
$select = $db->select();
$select->from('report', 'report.*');
$select->join('consumer', 'report.consumer_id = consumer.id', array('consumer.email', 'consumer.login_phone', 'consumer.name'));
$select->join('campaign_invitation', 'campaign_invitation.consumer_id = report.consumer_id and report.campaign_id = campaign_invitation.campaign_id', 'campaign_invitation.state as cistate');
$select->where('report.id in (' . implode(',', $displayedreport_ids) . ')');
$select->order('report.create_date desc');
$this->view->AllReports = $db->fetchAll($select);
// 2011-09-21 bruce.liu show selected reports and admin_name (who approved the report )
$num = 0;
foreach ($this->view->AllReports as $rep) {
$select_admin = $db->select();
$select_admin->from('report_batch', 'report_batch.admin_id');
$select_admin->join('admin', 'admin.id = report_batch.admin_id', 'admin.name');
$select_admin->where('FIND_IN_SET(' . $rep['id'] . ',report_batch.report_ids) > 0');
$this->admin_name = $db->fetchAll($select_admin);
$this->view->AllReports[$num]['name'] = $this->admin_name[0]['name'];
$num++;
}
//get report amount for each member
$selectReportAmount = $db->select();
$selectReportAmount->from('report', array('count(*)', 'consumer_id'))->group('consumer_id');
$reportAmounts = $db->fetchAll($selectReportAmount);
$this->view->reportAmountArray = array();
foreach ($reportAmounts as $reportAmonut) {
$i = $reportAmonut["consumer_id"];
$this->view->reportAmountArray[$i] = $reportAmonut["count(*)"];
}
$selectReportAmount->where("campaign_id = ?", $campaignId);
$reportCampaignAmonuts = $db->fetchAll($selectReportAmount);
$this->view->reportCampaignAmountArray = array();
foreach ($reportCampaignAmonuts as $reportCampaignAmonut) {
$i = $reportCampaignAmonut["consumer_id"];
$this->view->reportCampaignAmountArray[$i] = $reportCampaignAmonut["count(*)"];
}
//get report point
$select2 = $db->select();
$select2->from('reward_point_transaction_record', 'reward_point_transaction_record.*');
$select2->where('reward_point_transaction_record.transaction_id = 1');
$AllRecords = $db->fetchAll($select2);
$recordsArray = array();
foreach ($AllRecords as $record) {
$i = $record["id"];
$recordsArray[$i] = $record["point_amount"];
}
//.........这里部分代码省略.........
示例3: trim
}
if ($exists && isset($_POST['report_edit'])) {
$p_message = trim(strip_tags($_POST['message']));
$success = true;
$errors = array();
if ($p_message == '') {
$success = false;
array_push($errors, "The message field is required!");
}
if ($p_message != '' && !preg_match('/^[\\s\\S]{0,200}$/u', $p_message)) {
$success = false;
array_push($errors, "The message must be no more than 200 character long.");
}
if ($success) {
$update = array('message' => $p_message);
Report::update($g_id, $update);
$report = Report::get_one($g_id);
}
}
include "page-header.php";
?>
<div id="wrapper">
<?php
include "page-left.php";
?>
<div id="content">
<form name="form_report_edit" id="form_report_edit" method="post" enctype='application/x-www-form-urlencoded' accept-charset="UTF-8" class="form">