Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $validation = Validator::make($input, Report::$rules);
     if ($validation->passes()) {
         $this->report->create($input);
         return Redirect::route('reports.index');
     }
     return Redirect::route('reports.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.');
 }
Ejemplo n.º 2
0
 public function run()
 {
     DB::table('reports')->delete();
     Report::create(array('user' => 'police', 'date' => 'May 24', 'time' => '11:58 AM', 'type' => 'Accident', 'title' => 'Heavy Traffic Jam at Paradise', 'description' => 'A heavy traffic jam has been created at paradise circle due to some accident.', 'image_url' => 'lerablog.org/wp-content/uploads/2013/08/lorry-accident-1024x680.jpg'));
     Report::create(array('user' => 'user', 'date' => 'May 28', 'time' => '12:54 PM', 'type' => 'Road Block', 'title' => 'Ecil Bus Depot', 'description' => 'Near ECIL Bus depot minor delays are possible due to roadwork. Expect frequent roadblocks till 6 PM', 'image_url' => 'http://frylake.com/wp-content/uploads/2008/07/road-work-july-2008-008.jpg'));
     Report::create(array('user' => 'user', 'date' => 'May 29', 'time' => '1:40 PM', 'type' => 'Traffic Jam', 'title' => 'Safilguda Gate', 'description' => 'Near Safilguda railway gate there is a heavy traffic jam. Expect slow moving traffic till 2:10 PM', 'image_url' => 'http://frylake.com/wp-content/uploads/2008/07/road-work-july-2008-008.jpg'));
 }
Ejemplo n.º 3
0
 public function show($config)
 {
     if (empty($config['view'])) {
         throw new \Exception(__METHOD__ . '. View parameter not defined.');
     }
     // ca sa pot transmite si alte informatii catre datatable index
     $other_info = array_key_exists('other-info', $config) ? $config['other-info'] : [];
     $this->layout->title = strip_tags($config['caption']);
     $this->layout->content = \View::make($config['view'])->with(['rpt' => Report::create($config), 'form' => $config['form'] ? $config['form']::make()->other_info($other_info) : NULL] + $other_info);
 }
Ejemplo n.º 4
0
function report_create_form_submit($data)
{
    $error = report_validate($data);
    if (!empty($error)) {
        return FALSE;
    }
    $report = new Report();
    $response = $report->create($data);
    if ($response['id'] > 0) {
        return report_list($response['id']);
    } else {
        return false;
    }
}
Ejemplo n.º 5
0
 public function run()
 {
     Report::create(array('reportType' => 1, 'reportName' => 'Fatal Accident between two 4-seaters', 'reportedBy' => 'John Tan', 'contactNo' => 98597484, 'location' => 'BUKIT BATOK EAST AVENUE 2', 'status' => 1, 'assignedTo' => 2));
     Report::create(array('reportType' => 1, 'reportName' => 'Minor Accident between two 7-seaters', 'reportedBy' => 'Mary Tan', 'contactNo' => 98598984, 'location' => 'BOON LAY AVENUE', 'status' => 3, 'assignedTo' => 2));
     Report::create(array('reportType' => 1, 'reportName' => 'Fatal Accident between two 4-seaters', 'reportedBy' => 'John Tan', 'contactNo' => 98597484, 'location' => 'HILLVIEW AVENUE', 'status' => 1, 'assignedTo' => 2));
     Report::create(array('reportType' => 1, 'reportName' => 'Minor Accident between two 4-seaters', 'reportedBy' => 'Mac Tan', 'contactNo' => 98337484, 'location' => 'BUKIT BATOK STREET 33', 'status' => 1, 'assignedTo' => 2));
     Report::create(array('reportType' => 1, 'reportName' => 'Minor Accident between two buses', 'reportedBy' => 'Sophia Tan', 'contactNo' => 98598114, 'location' => 'BOON LAY AVENUE', 'status' => 2, 'assignedTo' => 2));
     Report::create(array('reportType' => 1, 'reportName' => 'Fatal Accident between two motocyclist', 'reportedBy' => 'William Goh', 'contactNo' => 98197484, 'location' => 'DEPOT ROAD', 'status' => 1, 'assignedTo' => 2));
     Report::create(array('reportType' => 2, 'reportName' => 'Multiple dengue outbreaks in the HDB block 706', 'reportedBy' => 'KK Hospital', 'contactNo' => 65668555, 'location' => '706 CLEMENTI WEST STREET 2', 'status' => 2, 'assignedTo' => 1));
     Report::create(array('reportType' => 1, 'reportName' => 'Accident along the road between cyclist and van', 'reportedBy' => 'Philip Goh', 'contactNo' => 81598984, 'location' => 'BUKIT BATOK WEST AVENUE 3', 'status' => 2, 'assignedTo' => 2));
     Report::create(array('reportType' => 2, 'reportName' => 'Multiple dengue outbreaks in the HDB block 601', 'reportedBy' => 'KK Hospital', 'contactNo' => 65668555, 'location' => '601 CLEMENTI WEST STREET 1', 'status' => 2, 'assignedTo' => 1));
     Report::create(array('reportType' => 2, 'reportName' => 'Multiple dengue outbreaks in the HDB block 221', 'reportedBy' => 'KK Hospital', 'contactNo' => 65668555, 'location' => '221 BUKIT BATOK EAST AVENUE 3', 'status' => 3, 'assignedTo' => 2));
     Report::create(array('reportType' => 2, 'reportName' => 'Multiple dengue outbreaks in the HDB block 506', 'reportedBy' => 'KK Hospital', 'contactNo' => 65668555, 'location' => '506 BISHAN STREET 11', 'status' => 1, 'assignedTo' => 1));
     Report::create(array('reportType' => 2, 'reportName' => 'Multiple dengue outbreaks in the HDB block 510', 'reportedBy' => 'KK Hospital', 'contactNo' => 65668555, 'location' => '510 BISHAN STREET 13', 'status' => 3, 'assignedTo' => 1));
 }
Ejemplo n.º 6
0
 /**
  * Report nasty behaviour from the site
  * @return json Success
  */
 private function report()
 {
     Base::requireLogged();
     $ret = array('status' => 0);
     $attacker = $_GET['id'];
     $type = $_GET['type'];
     $properType = in_array($type, array('user', 'playlist', 'track'), 1) && ctype_lower($type);
     if (!Validate::id($attacker) || !$properType) {
         return $ret;
     }
     $attacker = (int) $attacker;
     $victim = LOGGED;
     $report = Report::select('id')->where('attacker', $attacker)->where('victim', $victim)->where('type', $type)->findOne();
     if (!$report) {
         $report = Report::create();
         $report->attacker = $attacker;
         $report->victim = $victim;
         $report->type = $type;
         $report->save();
     }
     $ret['status'] = 1;
     return $ret;
 }
Ejemplo n.º 7
0
 public function create()
 {
     $reportName = Input::get('reportName');
     $location = Input::get('location');
     $reportType = Input::get('reportType');
     $contactNo = Input::get('contactNo');
     $reportedBy = Input::get('reportedBy');
     $assignedTo = Input::get('assignedTo');
     $description = Input::get('description');
     $input = Input::all();
     $rules = array('reportName' => 'required|min:1|max:100', 'location' => 'required|max:100', 'reportType' => 'required|numeric', 'assignedTo' => 'required|numeric', 'contactNo' => 'required|numeric|digits_between:3,11', 'reportedBy' => 'required|max:50', 'description' => 'max:255');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         $error_messages = $validator->messages();
         $error_response = array('error' => array('message' => $error_messages->first(), 'type' => 'Exception', 'code' => 425));
         return Response::json($error_response, 425)->setCallback(Input::get('callback'));
     } else {
         $item = Report::create(array('reportName' => "{$reportName}", 'reportType' => "{$reportType}", 'location' => "{$location}", 'contactNo' => "{$contactNo}", 'reportedBy' => "{$reportedBy}", "status" => 1, 'assignedTo' => "{$assignedTo}", 'description' => "{$description}"));
         $new_record = $this->getReportDetails($item->reportID)[0];
         $this->notify(null, $new_record);
         return "Report Created.";
     }
 }
Ejemplo n.º 8
0
$r_id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
$exists = Ad::exists($r_id, array("active" => 1));
if ($exists) {
    $ad = Ad::get_one($r_id);
    if (isset($_POST['send']) && User::is_logged_in()) {
        $success = true;
        $errors = array();
        $p_message = strip_tags($_POST['message']);
        if ($p_message == '') {
            $success = false;
            array_push($errors, "Please enter your message.");
        }
        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) {
            $userid = USER::get_id();
            $username = USER::get_name();
            $adid = $r_id;
            $report = $p_message;
            Report::create(array('ad_id' => $adid, 'user_id' => $userid, 'message' => $report));
            $content = StaticContent::get_content('abuse-report');
            eval("\$content = \"{$content}\";");
            print "content: " . $content;
            global $admin_mail;
            mail($admin_mail, 'Abuse report', $content, "From: " . $noreply);
        }
    }
}
include "./templates/ad-report.php";
 /**
  * Store a newly created resource in storage.
  * POST /reports
  *
  * @return Response
  */
 public function store()
 {
     return $reports = Report::create(Input::all());
 }
Ejemplo n.º 10
0
<?php

require_once "lib/init.php";
redirect("edit_report.php", array("report_id" => Report::create()->id, "section" => 1));
Ejemplo n.º 11
0
 public function postAddfavorite()
 {
     $user_id = Auth::user()->id;
     $title_id = Input::get('title_id');
     $action = Input::get('action');
     $user = User::find($user_id);
     if ($action == "add") {
         $alreadyFavorited = Favorite::where('title_id', '=', $title_id)->where('user_id', '=', $user_id)->get()->toArray();
         if (count($alreadyFavorited) > 0) {
             return $this->makeSuccessArray(true, array("msg" => "This title is already in your favorites", "alreadyfaved" => true));
         }
         $id = DB::table('favorites')->insertGetId(array('title_id' => $title_id, 'user_id' => $user_id));
         $report = Report::create(array('date' => time(), 'action_type' => 2, 'action_user_id' => $user_id, 'object_id' => $title_id, 'report_type' => 1, 'aux_object' => $user['region_id']));
         $report = Report::create(array('date' => time(), 'action_type' => 2, 'action_user_id' => $user_id, 'object_id' => $title_id, 'report_type' => 3, 'aux_object' => $user['region_id']));
     } else {
         $id = $affectedRows = Favorite::where('title_id', '=', $title_id)->where('user_id', '=', $user_id)->delete();
     }
     if ($id) {
         return $this->makeSuccessArray(true, array("alreadyfaved" => false));
     } else {
         return $this->makeSuccessArray(false, array("msg" => "There was a temporary glitch while favoriting/unfavoriting title, please try again in a moment", "alreadyfaved" => false, "db_log" => DB::getQueryLog()));
     }
 }
Ejemplo n.º 12
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     Report::create(array("name" => Input::get("name"), "value" => json_encode(Input::all())));
 }
 public function postReport($workorderId)
 {
     $report = array_merge(Input::only('data', 'user_id'), ['workorder_id' => $workorderId]);
     if (Input::get('reportId', false)) {
         return Report::where('id', Input::get('reportId'))->update(Input::only('data'));
     }
     return Report::create($report);
 }