当前位置: 首页>>代码示例>>PHP>>正文


PHP Report::save方法代码示例

本文整理汇总了PHP中Report::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::save方法的具体用法?PHP Report::save怎么用?PHP Report::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Report的用法示例。


在下文中一共展示了Report::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
 }
开发者ID:jesposito,项目名称:learninglocker,代码行数:42,代码来源:ReportTest.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $imageurl = '';
     if (Request::get('image') != '') {
         $imageurl = "/images/report/trafficjam_" . time() . ".jpg";
         $base = Request::get('image');
         $binary = base64_decode($base);
         $ifp = fopen($imageurl, "wb");
         fwrite($ifp, $binary);
         fclose($ifp);
         $imageurl = 'http://125.62.200.54/traffic/' . $imageurl;
     }
     $trafficJam = TrafficJam::create(array('user' => Request::get('user'), 'latitude' => Request::get('lat'), 'longitude' => Request::get('lng'), 'clear_by' => RestApi::clearBy(Request::get('status')), 'time' => date('g:iA', time()), 'date' => date('M j', time()), 'status' => Request::get('status'), 'reason' => Request::get('reason'), 'image_url' => $imageurl));
     $report = new Report();
     $report->traffic_jam_id = $trafficJam->id;
     $report->user = Request::get('user');
     $report->latitude = Request::get('lat');
     $report->longitude = Request::get('lng');
     $report->time = date('g:i A', time());
     $report->date = date('M j', time());
     $report->clear_by = RestApi::clearBy(Request::get('status'));
     $report->description = "There is a " . Request::get('status') . " traffic jam at " . RestApi::getaddress(Request::get('lat'), Request::get('lng')) . " due to " . Request::get('reason');
     $report->image_url = $imageurl;
     $report->type = 'Traffic Jam';
     $report->title = RestApi::getaddress(Request::get('lat'), Request::get('lng'));
     $report->save();
     $values = array(Request::get('lat'), Request::get('lng'), '12');
     return RestApi::sendNotification('TJ', $values);
     /*return Response::json(array(
     			'error' => false),
     			200
     		);
     */
 }
开发者ID:vishnu-b,项目名称:traffic_minimal,代码行数:39,代码来源:TrafficJamController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $imageurl = '';
     if (Request::get('image') != '') {
         $imageurl = "public/images/report/trafficjam_" . time() . ".jpg";
         $base = Request::get('image');
         $binary = base64_decode($base);
         $ifp = fopen($imageurl, "wb");
         fwrite($ifp, $binary);
         fclose($ifp);
         $imageurl = 'http://125.62.200.54/traffic/' . $imageurl;
     }
     $roadblock = RoadBlock::create(array('user' => Request::get('user'), 'latitude' => Request::get('lat'), 'longitude' => Request::get('lng'), 'time' => date('g:iA', time()), 'date' => date('M j', time()), 'status' => Request::get('status'), 'reason' => Request::get('reason'), 'image_url' => $imageurl));
     $report = new Report();
     $report->user = Request::get('user');
     $report->latitude = Request::get('lat');
     $report->longitude = Request::get('lng');
     $report->time = date('g:i A', time());
     $report->date = date('M j', time());
     $report->description = "The road is blocked at " . RestApi::getaddress(Request::get('lat'), Request::get('lng')) . " due to " . Request::get('reason');
     $report->image_url = $imageurl;
     $report->type = 'Road Block';
     $report->title = RestApi::getaddress(Request::get('lat'), Request::get('lng'));
     $report->save();
     return RestApi::sendNotification('RB', Request::get('lat'), Request::get('lng'), RestApi::getaddress(Request::get('lat'), Request::get('lng')), '12');
 }
开发者ID:vishnu-b,项目名称:traffic_minimal,代码行数:31,代码来源:RoadBlockController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $imageurl = '';
     if (Request::get('image') != '') {
         $imageurl = "/images/report/accident_" . time() . ".jpg";
         $base = Request::get('image');
         $binary = base64_decode($base);
         $ifp = fopen($imageurl, "wb");
         fwrite($ifp, $binary);
         fclose($ifp);
         $imageurl = 'http://125.62.200.54/traffic/' . $imageurl;
     }
     $accident = Accident::create(array('user' => Request::get('user'), 'latitude' => Request::get('lat'), 'longitude' => Request::get('lng'), 'time' => date('g:i A', time()), 'date' => date('M j', time()), 'details' => Request::get('details'), 'image_url' => $imageurl));
     $report = new Report();
     $report->traffic_jam_id = $accident->id;
     $report->user = Request::get('user');
     $report->latitude = Request::get('lat');
     $report->longitude = Request::get('lng');
     $report->time = date('g:i A', time());
     $report->date = date('M j', time());
     $report->description = "There has been an accident. " . Request::get('details');
     $report->image_url = $imageurl;
     $report->type = 'Accident';
     $report->title = RestApi::getaddress(Request::get('lat'), Request::get('lng'));
     $report->save();
     //RestApi::sendNotification()
     return Response::json(array('error' => false), 200);
 }
开发者ID:vishnu-b,项目名称:traffic_minimal,代码行数:33,代码来源:AccidentController.php

示例5: createMultiple

 public function createMultiple($gameModel, $gameInputs)
 {
     foreach ($gameInputs as $player) {
         $report = new Report();
         $report->game = $gameModel->id;
         $report->player = $player;
         $report->save();
     }
 }
开发者ID:romainmasc,项目名称:jackmarshall,代码行数:9,代码来源:ReportsController.php

示例6: action_do_create

 public function action_do_create()
 {
     $v = Report::validate(Input::all());
     if ($v->fails()) {
         return Redirect::to_route('create_report')->with('user', Auth::user())->with_errors($v)->with_input();
     }
     $new_report = array('date' => Input::get('date'), 'description' => Input::get('description'), 'time_spent' => Input::get('time_spent'), 'todo_id' => Input::get('todo_id'), 'project_id' => Input::get('project_id'), 'user_id' => Auth::user()->id, 'organization_id' => Auth::user()->organization->id);
     $report = new Report($new_report);
     $report->save();
     return Redirect::to_route('read_customer', array(Input::get('customer_id')));
 }
开发者ID:nigobo,项目名称:laravel-play,代码行数:11,代码来源:report.php

示例7: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Report();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Report'])) {
         $model->attributes = $_POST['Report'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:nguyenhuyhoangbkhn,项目名称:laptrinhweb,代码行数:17,代码来源:ReportController.php

示例8: report

 /**
  *  Handles User Report
  *
  * @return Response
  */
 public function report()
 {
     $r = new Report();
     if ($r->save()) {
         $user = new User();
         $user->email = 'noel@musicequity.com';
         $target = User::find($r->user);
         $m = new Mailer();
         $m->send($user, 'emails.report', array('report' => $r, 'target' => $target), array('subject' => 'Music Equity Account Report', 'from' => 'reports@musicequity.com'));
         return Response::json(['success' => true]);
     } else {
         return Response::json($r->errors());
     }
 }
开发者ID:centaurustech,项目名称:musicequity,代码行数:19,代码来源:ArtistsController.php

示例9: store

 /**
  * Store a newly created report in storage.
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::all();
     Report::setRules('store');
     if (!Report::canCreate()) {
         return $this->_access_denied();
     }
     $report = new Report();
     $report->fill($data);
     if (!$report->save()) {
         return $this->_validation_error($report);
     }
     if (Request::ajax()) {
         return Response::json($report, 201);
     }
     return Redirect::action('ReportsController@index')->with('notification:success', $this->created_message);
 }
开发者ID:k4ml,项目名称:laravel-base,代码行数:22,代码来源:ReportsController.php

示例10: createReport

 public static function createReport($input)
 {
     $rules = array('message' => 'required|min:10', 'subject_code' => 'required', 'type_name' => 'required', 'type_id' => 'required');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         return $validator->errors()->all();
     } else {
         try {
             $report = new Report();
             $report->fill($input);
             $report->save();
             return "ok";
         } catch (Exception $e) {
             return "no";
         }
     }
 }
开发者ID:whiterun,项目名称:bagikasih-v2,代码行数:17,代码来源:Report.php

示例11: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($id, $iduser)
 {
     $model = new Report();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Report'])) {
         $model->attributes = $_POST['Report'];
         if ($model->save()) {
             $this->redirect(array('site/index'));
         }
     }
     $criteria = new CDbCriteria();
     $criteria->compare('author_id', $iduser);
     $criteria->compare('status', '1');
     $criteria = Post::model()->findAll($criteria);
     $this->render('create', array('model' => $model, 'id' => $id, 'criteria' => $criteria));
 }
开发者ID:hongha,项目名称:traodoidocu,代码行数:21,代码来源:ReportController.php

示例12: reporting

 public function reporting()
 {
     // $pet_ad_id = Input::get('petad-id');
     $subject = Input::get('subject');
     $name = Input::get('name');
     $email = Input::get('email');
     $message = Input::get('message');
     $viewmore_id = Input::get('viewmore_id');
     $reason = Input::get('reason');
     $report = new Report();
     $report->petad_id = $viewmore_id;
     $report->name = $name;
     $report->email = $email;
     $report->message = $message;
     $report->reason = $message;
     $report->save();
     return Redirect::to('/viewmore?id=' . $viewmore_id)->with(array('welcome_back' => 'Thanks for reporting, we will look into this issue.'));
 }
开发者ID:udemethegrtman,项目名称:popibay-s3,代码行数:18,代码来源:ViewmoreController.php

示例13: addReport

 private function addReport($options, $connection)
 {
     $report = new Report();
     $report->setDescription(self::generateDescription());
     $report->setTitle(implode(', ', array_keys($options['queries'])));
     $report->save();
     foreach ($options['queries'] as $key => $value) {
         $query = new Query();
         $query->setQuery($key);
         $query->save();
         $report_query = new ReportQuery();
         $report_query->setQuery($query);
         $report_query->setTitle($key);
         $report_query->setReport($report);
         $report_query->save();
         $date_start = strtotime($options['start_date']);
         $date_end = strtotime($options['end_date']);
         $start = $value['rand_start'];
         while ($date_start < $date_end) {
             if (rand(0, 100) > $value['rand']) {
                 $query_result = new QueryResultBulk();
                 $query_result->setQuery($query);
                 $start += rand($value['rand_min'], $value['rand_max']) * $value['rand_diff'];
                 $query_result->setResultSize($start);
                 $query_result->setCreatedAt($date_start);
                 $query_result->save();
             }
             $date_start = strtotime(date('Y-m-d', $date_start) . ' +1 days');
         }
         $sql = "DELETE FROM %s where date(%s) = '%s' and %s = %s";
         $sql = sprintf($sql, QueryResultPeer::TABLE_NAME, QueryResultPeer::RESULT_DATE, date('Y-m-d'), QueryResultPeer::QUERY_ID, $query->getId());
         $statement = $connection->prepareStatement($sql);
         $statement->executeQuery();
     }
     $tags = self::generateTags();
     foreach ($tags as $tag) {
         $tag->setReport($report);
         $tag->save();
     }
 }
开发者ID:hoydaa,项目名称:googlevolume.com,代码行数:40,代码来源:TestDataTask.class.php

示例14: testDelete

 public function testDelete()
 {
     $rep = new Report();
     $now = date("Y-m-d H:i:s");
     $rep->setDescription("tester");
     $rep->setInvolvementKindID(2);
     $rep->setReportKindID(1);
     $rep->setLocationID(1);
     $rep->setPersonID(1);
     $rep->setDepartmentID(2);
     $rep->setDateTime($now);
     $rep->setStatusID(2);
     $rep->setActionTaken("nothing");
     $rep->save();
     $this->assertTrue(Report::reportExists($rep->getPersonID(), $rep->getDateTime()) != false);
     $rep->delete();
     $this->assertTrue(!Report::reportExists($rep->getPersonID(), $rep->getDateTime()));
 }
开发者ID:JakeDawkins,项目名称:NiceCatch,代码行数:18,代码来源:reportTest.php

示例15: array

 function add_custom_report()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     tpl_assign('url', get_url('reporting', 'add_custom_report'));
     $report_data = array_var($_POST, 'report');
     if (is_array($report_data)) {
         tpl_assign('report_data', $report_data);
         $conditions = array_var($_POST, 'conditions');
         if (!is_array($conditions)) {
             $conditions = array();
         }
         tpl_assign('conditions', $conditions);
         $columns = array_var($_POST, 'columns');
         if (is_array($columns) && count($columns) > 0) {
             tpl_assign('columns', $columns);
             $newReport = new Report();
             $member_ids = json_decode(array_var($_POST, 'members'));
             if (!is_array($member_ids) || count($member_ids) == 0) {
                 flash_error(lang('must choose at least one member'));
                 ajx_current("empty");
                 return;
             }
             $members = Members::findAll(array("conditions" => array("`id` IN(?)", $member_ids)));
             if (!$newReport->canAdd(logged_user(), $members)) {
                 flash_error(lang('no access permissions'));
                 ajx_current("empty");
                 return;
             }
             // if
             $newReport->setObjectName($report_data['name']);
             $newReport->setDescription($report_data['description']);
             $newReport->setReportObjectTypeId($report_data['report_object_type_id']);
             $newReport->setOrderBy($report_data['order_by']);
             $newReport->setIsOrderByAsc($report_data['order_by_asc'] == 'asc');
             try {
                 DB::beginWork();
                 $newReport->save();
                 $allowed_columns = $this->get_allowed_columns($report_data['report_object_type_id'], true);
                 foreach ($conditions as $condition) {
                     if ($condition['deleted'] == "1") {
                         continue;
                     }
                     foreach ($allowed_columns as $ac) {
                         if ($condition['field_name'] == $ac['id']) {
                             $newCondition = new ReportCondition();
                             $newCondition->setReportId($newReport->getId());
                             $newCondition->setCustomPropertyId($condition['custom_property_id']);
                             $newCondition->setFieldName($condition['field_name']);
                             $newCondition->setCondition($condition['condition']);
                             $condValue = array_key_exists('value', $condition) ? $condition['value'] : '';
                             if ($condition['field_type'] == 'boolean') {
                                 $newCondition->setValue(array_key_exists('value', $condition));
                             } else {
                                 if ($condition['field_type'] == 'date') {
                                     if ($condValue != '') {
                                         $dtFromWidget = DateTimeValueLib::dateFromFormatAndString(user_config_option('date_format'), $condValue);
                                         $newCondition->setValue(date("m/d/Y", $dtFromWidget->getTimestamp()));
                                     }
                                 } else {
                                     $newCondition->setValue($condValue);
                                 }
                             }
                             $newCondition->setIsParametrizable(isset($condition['is_parametrizable']));
                             $newCondition->save();
                         }
                     }
                 }
                 asort($columns);
                 //sort the array by column order
                 foreach ($columns as $column => $order) {
                     if ($order > 0) {
                         $newColumn = new ReportColumn();
                         $newColumn->setReportId($newReport->getId());
                         if (is_numeric($column)) {
                             $newColumn->setCustomPropertyId($column);
                         } else {
                             $newColumn->setFieldName($column);
                         }
                         $newColumn->save();
                     }
                 }
                 $object_controller = new ObjectController();
                 $object_controller->add_to_members($newReport, $member_ids);
                 DB::commit();
                 flash_success(lang('custom report created'));
                 ajx_current('back');
             } catch (Exception $e) {
                 DB::rollback();
                 flash_error($e->getMessage());
                 ajx_current("empty");
             }
         }
     }
     $selected_type = array_var($_GET, 'type', '');
     $types = array(array("", lang("select one")));
     $object_types = ObjectTypes::getAvailableObjectTypes();
//.........这里部分代码省略.........
开发者ID:rorteg,项目名称:fengoffice,代码行数:101,代码来源:ReportingController.class.php


注:本文中的Report::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。