本文整理汇总了PHP中Report::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::find方法的具体用法?PHP Report::find怎么用?PHP Report::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Report
的用法示例。
在下文中一共展示了Report::find方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editAction
public function editAction()
{
list(, , , $id) = explode('/', $this->getURI());
if (!($report = Report::find(intval($id)))) {
return $this->alert('找不到', '/');
}
$this->view->report = $report;
if ($_POST) {
if ($_POST['sToken'] != Helper::getStoken()) {
return $this->alert('sToken 錯誤', '/');
}
if ($_POST['delete']) {
if (!strval($_POST['deleted_reason'])) {
return $this->alert('請輸入刪除原因', '/index/edit/' . $report->id);
}
}
try {
$this->_checkReportData($_POST);
} catch (Exception $e) {
return $this->alert($e->getMessage(), '/');
}
$old_values = $report->toArray();
$now = time();
$report->update(array('news_title' => strval($_POST['news_title']), 'news_link' => strval($_POST['news_link']), 'report_title' => strval($_POST['report_title']), 'report_link' => strval($_POST['report_link']), 'updated_at' => $now, 'deleted_at' => intval($_POST['delete']) ? $now : 0));
$new_values = $report->toArray();
if ($_POST['delete']) {
$new_values['deleted_reason'] = strval($_POST['deleted_reason']);
}
if ($new_values != $old_values) {
ReportChangeLog::insert(array('report_id' => $report->id, 'updated_at' => $now, 'updated_from' => intval(ip2long($_SERVER['REMOTE_ADDR'])), 'updated_by' => strval($this->view->user->user_id), 'old_values' => json_encode($old_values), 'new_values' => json_encode($new_values)));
}
return $this->alert('修改成功', '/index/log/' . $report->id);
}
}
示例2: testRouterReportCreate
/**
* lrs/{id}/reporting/create
*
* This test case create new reporting and run report
*
* It is ensure reporting work correctly.
* */
public function testRouterReportCreate()
{
for ($i = 0; $i < 7; $i++) {
$vs = $this->defaultStatment();
$this->statements[] = $this->createStatement($vs, $this->lrs);
}
$data = array('description' => \app\locker\helpers\Helpers::getRandomValue(), 'name' => '', 'lrs' => $this->lrs->_id, 'query' => array('statement.actor.mbox' => array("mailto:duy.nguyen@go1.com.au"), 'statement.verb.id' => array("http://adlnet.gov/expapi/verbs/experienced")));
//lrs input validation
$rules['name'] = 'required|alpha_spaces';
$rules['description'] = 'alpha_spaces';
$validator = Validator::make($data, $rules);
$this->assertTrue($validator->fails());
$data['name'] = 'reportabcd';
$data['description'] = 'reportabcd description';
$validator = Validator::make($data, $rules);
$this->assertTrue($validator->passes());
// create report.
$report = new Report();
$report->lrs = $data['lrs'];
$report->query = $data['query'];
$report->name = $data['name'];
$report->description = $data['description'];
$save = $report->save();
$this->assertTrue($save);
// Ensure report show in reporting page.
$crawler = $this->client->request('GET', "/lrs/{$this->lrs->_id}/reporting");
$this->assertGreaterThan(0, $crawler->filter('html:contains("reportabcd")')->count());
$this->assertGreaterThan(0, $crawler->filter('html:contains("reportabcd description")')->count());
$crawler = $this->client->request('GET', "/lrs/{$this->lrs->_id}/reporting/show/{$report->_id}");
$this->assertGreaterThan(0, $crawler->filter('html:contains("Number of statements")')->count());
$this->assertGreaterThan(0, $crawler->filter('html:contains("7")')->count());
// Delete report by router.
$crawler = $this->client->request('DELETE', "/lrs/{$this->lrs->_id}/reporting/delete/{$report->_id}");
$this->assertEquals(Report::find($report->_id), NULL);
}
示例3: index
/**
** Function to plot graphs
***/
public function index()
{
if (isset($_POST) && !empty($_POST['datepickerfrom']) && !empty($_POST['datepickerto'])) {
$datefrom = $_POST['datepickerfrom'];
$dateto = $_POST['datepickerto'];
}
$projectsArray = Project::all();
/**Get all projects from databa se */
$result_array = Report::all();
if (!empty($result_array)) {
foreach ($result_array as $key => $res) {
$project[$key]['name'] = $res['name'];
$projects[$key]['id'] = $res['id'];
}
} else {
echo '<p class="error_msg">No data available in this range</p> <p>Please click <a href="?controller=pages&action=reportdata">Report</a> to select another range</p>';
exit;
}
$date_range = $this->getDatesFromRange($datefrom, $dateto);
$xaxis_data = json_encode($date_range);
for ($rs = 0; $rs < count($project); $rs++) {
foreach ($date_range as $dt) {
$bugs[$rs] = Report::find($projects[$rs]['id'], $dt);
$project[$rs]['data'][] = intval($bugs[$rs][$projects[$rs]['id']]['bugs']);
}
}
$result_array = json_encode($project);
require_once 'views/reports/index.php';
}
示例4: initialize
public function initialize()
{
$this->add(new Text('code', array('maxlength' => 100, 'required' => 'required', 'autofocus' => 'autofocus', 'class' => 'form-control')));
$this->add(new Text('name', array('maxlength' => 100, 'required' => 'required', 'class' => 'form-control')));
$this->add(new TextArea('description', array('maxlength' => 400, 'required' => 'required', 'class' => 'form-control')));
$this->add(new Check('status', array('type' => 'checkbox', 'class' => 'bootstrap-switch')));
$this->add(new Select('reports[]', Report::find(), array('using' => array('idReport', 'name'), 'multiple' => 'multiple', 'class' => 'select2')));
}
示例5: action_do_update
public function action_do_update()
{
$report = Report::find(Input::get('report_id'));
$v = Report::validate(Input::all());
if ($v->fails()) {
return Redirect::to_route('update_report', Input::get('report_id'))->with('user', Auth::user())->with_errors($v)->with_input();
}
$report->date = Input::get('date');
$report->description = Input::get('description');
$report->time_spent = Input::get('time_spent');
$report->project_id = Input::get('project_id');
$report->save();
return Redirect::to_route('update_report', array(Input::get('report_id')));
}
示例6: getReports
public function getReports()
{
return Report::find(['conditions' => ['did' => $this->getId()]]);
}
示例7: function
if ($round == null) {
App::abort(404);
} else {
return $round;
}
});
Route::bind('scenario', function ($key, $route) {
$round = Scenario::find($key);
if ($round == null) {
App::abort(404);
} else {
return $round;
}
});
Route::bind('report', function ($key, $route) {
$report = Report::find($key);
if ($report == null) {
App::abort(404);
} else {
return $report;
}
});
Route::group(array('before' => 'auth'), function () {
Route::get('logout', 'UsersController@logout');
Route::get('tournaments/create', 'TournamentsController@getCreate');
Route::post('tournaments/create', 'TournamentsController@postCreate');
Route::post('tournaments/{tournament}/update', 'TournamentsController@postUpdate');
Route::get('tournaments/{tournament}/delete', 'TournamentsController@delete');
Route::get('maps', 'MapsController@listing');
Route::get('maps/create', 'MapsController@getCreate');
Route::post('maps/create', 'MapsController@postCreate');
示例8: editAction
public function editAction($id)
{
$payment = Paymentplan::findFirst(array("conditions" => "idPaymentplan = ?1", "bind" => array(1 => $id)));
if (!$payment) {
$this->flashSession->warning('El plan de pago que desea editar no existe, por favor valide la información');
return $this->response->redirect('Paymentplan');
}
$form = new PaymentplanForm($payment);
$pxr = Pxr::findByIdPaymentplan($payment->idPaymentplan);
if ($this->request->isPost()) {
$form->bind($this->request->getPost(), $payment);
$reports = $form->getValue('reports');
if ($this->validateReports($reports)) {
$status = $form->getValue('status');
$status = trim($status);
try {
$this->db->begin();
$payment->status = empty($status) || !$status ? 0 : 1;
$payment->updated = time();
if ($form->isValid() && $payment->save()) {
if ($this->deletePxr($pxr)) {
if ($this->savePxr($payment)) {
$this->db->commit();
$this->flashSession->success('Se ha editado el plan de pago exitosamente');
return $this->response->redirect("Paymentplan");
}
}
}
foreach ($payment->getMessages() as $msg) {
$this->flashSession->error($msg)->getMessage();
}
} catch (Exception $ex) {
$this->db->rollback();
$this->logger->log("Exception while creatin payment plan... {$ex}");
$this->flashSession->error("Ha ocurrido un error, por favor contacte al administrador");
}
}
}
$reports = Report::find();
$this->view->PaymentplanForm = $form;
$this->view->setVar("payment", $payment);
$this->view->setVar("reports", $reports);
$this->view->setVar("pxr", $pxr);
}
示例9: adminreportimagesAction
function adminreportimagesAction()
{
$this->_helper->layout->setLayout("layout_admin");
if ($this->_request->getParam('report')) {
$this->_helper->layout->disableLayout();
$reportModel = new Report();
$report = $reportModel->find($this->_request->getParam('report'))->current();
//get new report
$config = Zend_Registry::get('config');
$url = $config->indicate2->home . "/report/showAnswer/accessCode/" . $report['accesscode'];
$this->view->url = $url;
$this->view->url = $url;
die($url);
} else {
$campaignModel = new Campaign();
$campaigns = $campaignModel->fetchAll();
$campaignsArray = array();
foreach ($campaigns as $val) {
$campaignsArray[$val->id] = $val->name;
}
$db = Zend_Registry::get('db');
$select = $db->select();
$select->from('report_images', array('report_images.name as images'));
$select->join('report', 'report.id = report_images.report', array('report.campaign_id as campaign', 'report.id as report'));
$select->join('consumer', 'consumer.id = report_images.consumer', array('consumer.name', 'consumer.email', 'consumer.phone'));
$select->order('report.campaign_id desc');
$this->view->reportImages = $db->fetchAll($select);
$this->view->campaigns = $campaignsArray;
}
}
示例10: populate
public function populate()
{
$reportID = Input::get('reportID');
$editReport = Report::find($reportID);
return $editReport->toJson();
}
示例11: reports
/**
* Get all Law Report types in the System
* @return array
*/
public function reports()
{
return Report::find()->toArray();
}
示例12: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$value = json_decode(Report::find($id)->value);
echo Form::open(array("url" => url("reports/download"), "class" => "form-horizontal", "id" => 'formms'));
foreach ($value as $key => $val) {
?>
<input type="hidden" name="<?php
echo $key;
?>
" value="<?php
echo $val;
?>
"
xmlns="http://www.w3.org/1999/html">
<?php
}
?>
<div class="col-xs-12" style="margin-top: 5px">
<div style="margin: 10px;margin-left: 0px" class="col-md-1 btn btn-default btn-sm" id="records"><img src="<?php
echo asset('table.png');
?>
" style="height: 20px;width: 20px" /> Records</div>
<div style="margin: 10px" class="col-md-1 btn btn-default btn-sm" id="table"><img src="<?php
echo asset('table.png');
?>
" style="height: 20px;width: 20px" /> Table</div>
<div style="margin: 10px" class="col-md-1 btn btn-default btn-sm" id="bar"><img src="<?php
echo asset('bar.png');
?>
" style="height: 20px;width: 20px" /> Bar</div>
<div style="margin: 10px" class="col-md-1 btn btn-default btn-sm" id="line"><img src="<?php
echo asset('line.png');
?>
" style="height: 20px;width: 20px" /> Line</div>
<div style="margin: 10px" class="col-md-1 btn btn-default btn-sm" id="column"><img src="<?php
echo asset('column.png');
?>
" style="height: 20px;width: 20px" /> Column</div>
<div style="margin: 10px" class="col-md-1 btn btn-default btn-sm" id="combined"><img src="<?php
echo asset('combined.jpg');
?>
" style="height: 20px;width: 20px" /> Combined</div>
<button name="records" style="margin: 10px" type="submit" class="col-md-1 btn btn-default btn-sm"><img src="<?php
echo asset('cvs.jpg');
?>
" style="height: 20px;width: 20px" /> Records</button>
<button name='reports' style="margin: 10px" type="submit" class="col-md-1 btn btn-default btn-sm"><img src="<?php
echo asset('cvs.jpg');
?>
" style="height: 20px;width: 20px" /> Reports</button>
</div>
</form>
<div id="chartarea" class="col-xs-12" style="margin-top: 10px"></div>
<script>
//managing chats buttons
$("#table").unbind("click").click(function(){
$(".btn").removeClass("btn-info")
$(this).addClass("btn-info")
$("#chartarea").html("<h3><i class='fa fa-spin fa-spinner '></i><span>Loading...</span><h3>");
$("#formms").ajaxSubmit({
url:"<?php
echo url('report/general/table');
?>
",
target: '#chartarea',
data: {chat:'table'},
success: afterSuccess
});
});
$("#table").trigger("click");
$("#pie").unbind("click").click(function(){
$(".btn").removeClass("btn-info")
$(this).addClass("btn-info")
$("#chartarea").html("<h3><i class='fa fa-spin fa-spinner '></i><span>Loading...</span><h3>");
$("#formms").ajaxSubmit({
url:"<?php
echo url('report/general/pie');
?>
",
target: '#chartarea',
data: {chat:'table'},
success: afterSuccess
});
});
$("#bar").unbind("click").click(function(){
$(".btn").removeClass("btn-info")
$(this).addClass("btn-info")
$("#chartarea").html("<h3><i class='fa fa-spin fa-spinner '></i><span>Loading...</span><h3>");
$("#formms").ajaxSubmit({
url:"<?php
echo url('report/general/bar');
//.........这里部分代码省略.........
示例13: sendStats
private function sendStats()
{
$stats = array();
// Website
$stats['Website']['url'] = Router::url('/', true);
$stats['Website']['version'] = Configure::read('mushraider.version');
$stats['Website']['php'] = phpversion();
$stats['Website']['lang'] = Configure::read('Settings.language');
// Events
App::uses('Event', 'Model');
$EventModel = new Event();
$params = array();
$params['recursive'] = -1;
$params['order'] = array('time_start ASC');
if ($firstEvent = $EventModel->find('first', $params)) {
$stats['Event']['first'] = $firstEvent['Event']['time_start'];
} else {
$stats['Event']['first'] = null;
}
$params['conditions']['time_start <='] = date('Y-m-d');
$params['order'] = array('time_start DESC');
if ($lastEvent = $EventModel->find('first', $params)) {
$stats['Event']['last'] = $lastEvent['Event']['time_start'];
} else {
$stats['Event']['last'] = null;
}
$params = array();
$params['recursive'] = -1;
$params['conditions']['time_start <='] = date('Y-m-d');
$countEvents = $EventModel->find('count', $params);
$stats['Event']['total'] = $countEvents;
// Reports
App::uses('Report', 'Model');
$ReportModel = new Report();
$params = array();
$params['recursive'] = -1;
$countReports = $ReportModel->find('count', $params);
$stats['Report']['total'] = $countReports;
// Users
App::uses('User', 'Model');
$UserModel = new User();
$params = array();
$params['recursive'] = -1;
$countUsers = $UserModel->find('count', $params);
$stats['User']['total'] = $countUsers;
// Characters
App::uses('Character', 'Model');
$CharacterModel = new Character();
$params = array();
$params['recursive'] = -1;
$countCharacters = $CharacterModel->find('count', $params);
$stats['Character']['total'] = $countCharacters;
// Games
App::uses('Game', 'Model');
$GameModel = new Game();
$params = array();
$params['recursive'] = -1;
if ($games = $GameModel->find('all', $params)) {
foreach ($games as $game) {
$stats['Game'][$game['Game']['slug']]['title'] = $game['Game']['title'];
$stats['Game'][$game['Game']['slug']]['imported'] = $game['Game']['import_modified'] > 0 ? 1 : 0;
$params = array();
$params['recursive'] = -1;
$params['conditions']['game_id'] = $game['Game']['id'];
$params['group'] = array('user_id');
$countCharacters = $CharacterModel->find('count', $params);
$stats['Game'][$game['Game']['slug']]['players'] = $countCharacters;
}
}
// Bridge
$bridgeSetting = json_decode($this->SettingModel->getOption('bridge'));
$stats['Bridge']['enabled'] = !empty($bridgeSetting) && $bridgeSetting->enabled ? 1 : 0;
// Widgets
App::uses('Widget', 'Model');
$WidgetModel = new Widget();
$params = array();
$params['recursive'] = -1;
if ($widgets = $WidgetModel->find('all', $params)) {
foreach ($widgets as $widget) {
if (!isset($stats['Widget'][$widget['Widget']['controller']])) {
$stats['Widget'][$widget['Widget']['controller']]['total'] = 1;
} else {
$stats['Widget'][$widget['Widget']['controller']]['total']++;
}
}
}
App::uses('HttpSocket', 'Network/Http');
$this->http = new HttpSocket();
$this->http->post('http://stats.mushraider.com/acquire', $stats);
}
示例14: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$this->report->find($id)->delete();
return Redirect::route('reports.index');
}