本文整理汇总了PHP中Survey::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Survey::find方法的具体用法?PHP Survey::find怎么用?PHP Survey::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Survey
的用法示例。
在下文中一共展示了Survey::find方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public static function update($id)
{
if (!self::check_logged_in()) {
Redirect::to('/login', array('error' => 'You must log in to access this resource.'));
return;
}
$params = $_POST;
$oldsurvey = Survey::find($id);
$user = self::get_user_logged_in();
$attributes = array('person' => $user->id, 'id' => $id, 'description' => $params['description'], 'type' => $oldsurvey->type);
if ($attributes['type'] == 'int-value') {
if ($params['min_value']) {
if (is_numeric($params['min_value'])) {
$attributes['min_value'] = $params['min_value'];
}
}
if ($params['max_value']) {
if (is_numeric($params['max_value'])) {
$attributes['max_value'] = $params['max_value'];
}
}
}
$survey = new Survey($attributes);
$errors = $survey->errors();
if (count($errors) == 0) {
$survey->update();
Redirect::to('/survey/' . $survey->id, array('message' => 'Survey successfully updated!'));
} else {
Redirect::to('/survey/' . $survey->id . '/edit', array('errors' => $errors, 'attributes' => $attributes));
}
}
示例2: sandbox
public static function sandbox()
{
// Testaa koodiasi täällä
$eka = Survey::find(1);
$kaikki = Survey::all();
Kint::dump($eka);
Kint::dump($kaikki);
}
示例3: completePreSurvey
public function completePreSurvey()
{
$input = Input::all();
//$inputSurvey=$input['survey'];
$survey = Survey::find($input['surveyid']);
$group = Group::find($input['groupid']);
$user = Auth::user();
$response = new SurveyResponse();
$response->user_id = $user->id;
$response->group_id = $input['groupid'];
$response->survey_id = $input['surveyid'];
$response->type = "pre";
$response->response = serialize("");
$response->save();
return "";
}
示例4: survey_get
public function survey_get($user_id)
{
$ans = [];
// $Get = $this->request->getGet(['item_id','datemin','datemax','limit']);
$validation = new UserDataValidation();
$messages = $validation->validate($_GET);
foreach ($messages as $message) {
throw new Exception($message, 102);
}
$conditions = 'item = :i_id: AND user_id = :u_id:';
$parameters = ['i_id' => $_GET['item_id'], 'u_id' => $user_id];
if (isset($datemin)) {
$conditions .= 'AND date >= :min: ';
$parameters['min'] = $_GET['datemin'];
}
if (isset($datamax)) {
$conditions .= 'AND date <= :max: ';
$parameters['max'] = $_GET['datemax'];
}
$result = Survey::find([$conditions, 'bind' => $parameters]);
$ans['data'] = [];
$p = 0;
foreach ($result as $item) {
$ans['data'][$p] = ['value' => $item->value, 'date' => $item->date];
$p++;
}
// print_r($ans);
return $ans;
}
示例5: unserialize
@section('content')
<?php
$survey = Survey::find($group->survey);
if (!is_null($survey)) {
$data = unserialize($survey->data);
$fields = json_decode($data[0])->fields;
}
?>
<!-- REMOVED AS PER FEEDBACK -->
<!--<div class="banner">
<img src="{{ asset('images/survey_page_bg.png') }}" alt="banner" width="100%" />
<div class="container-fluid">
<div class="row intro">
<div class="col-md-4"></div>
<div class="front-page-intro col-md-4 col-sm-5">
<span class="intro-frame intro-top">
{{ trans('master.surveypageintrotop') }}
</span>
<span class="intro-frame intro-bottom">
{{ trans('master.surveypageintrobottom') }}
</span>
</div>
</div>
</div>
</div>-->
<div class="clearfix"></div>
@if(!is_null($survey))
<div class="survey-container">
<div class="container">
<div class="row">
<div class="survey-heading col-md-4 col-md-offset-4">
示例6: unserialize
@extends('layouts.master')
@section('content')
@if(!empty($surveyResponse))
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Response</th>
</tr>
@foreach($surveyResponse as $response)
<?php
$survey = Survey::find($response->survey_id);
$user = User::find($response->user_id);
if (!is_null($survey)) {
$data = unserialize($survey->data);
$fields = json_decode($data[0])->fields;
// echo '<pre>';
// print_r($fields);
// echo '</pre>';
// die;
}
?>
<tr>
<td>{{ $user->fullName() }}</td>
<td>{{ $response->type }}</td>
<td>
@foreach(unserialize($response->response) as $key => $val)
@if($key!='_token' && $key!='' && $key!='' && $key!='' )
示例7: surveyMessages
public function surveyMessages($id)
{
$survey = Survey::find($id);
return View::make('survey.prepostmessage')->with('survey', $survey);
}
示例8: unserialize
@section('content')
<?php
$survey = Survey::find($group->postsurvey);
if (!is_null($survey)) {
$data = unserialize($survey->data);
$fields = json_decode($data[0])->fields;
}
?>
<!-- REMOVED AS PER FEEDBACK -->
@if(!is_null($survey))
<div class="clearfix"></div>
<div class="survey-container">
<div class="container">
<div class="row">
<div class="survey-heading col-md-4 col-md-offset-4">
<h3>{{ trans('master.postsurveyhead') }}</h3>
</div>
</div>
<p>{{ $survey->getPostMessage() }}</p>
<div class="row">
<div class="survey-form">
{{ Form::open(['url'=>'survey/response/save','parsley-validate'=>'','id'=>'postsurveyform']) }}
{{ Form::hidden('userid',$user->id) }}
{{ Form::hidden('groupid',$group->id) }}
{{ Form::hidden('surveyid',$survey->id) }}
{{ Form::hidden('type','post') }}
<?php
$count = 0;
?>
@foreach($fields as $field)