Пример #1
0
 function get_question($employee_id, $question_no = '')
 {
     $data = array();
     $q = new Question();
     $q->where('employee_id', $employee_id);
     $q->where('question_no', $question_no);
     $q->order_by('question_no');
     $q->get();
     return $q;
 }
 function emaildata($delid)
 {
     $arr = array();
     $ansarr = array();
     $curruser = '';
     $firstpass = true;
     $usersandranking = Supplierrank::where('userid', '=', $delid)->with('supplier')->with('user')->orderBy('userid')->orderBy('rank')->get();
     foreach ($usersandranking as $userrank) {
         if ($curruser != $userrank->user->name) {
             $arr[] = array();
             $arr[] = array('Buyer Company Name', 'Vendor Company Name', 'Buyer Person Name', 'Buyer person designation', 'Rank');
         }
         $answerstable = Question::where('page', '=', 1)->with(array('answers' => function ($query) use($userrank) {
             $query->where('user_id', '=', $userrank->user->id);
         }))->get();
         foreach ($answerstable as $answer) {
             $a = '';
             foreach ($answer->answers as $ans) {
                 $a = $ans->answer_text;
             }
             $ansarr[$answer->question_text] = $a;
         }
         $arr[] = array($ansarr['Company Name'], $userrank->supplier->name, $userrank->user->name, $ansarr['Job Title'], $userrank->rank);
         $curruser = $userrank->user->name;
     }
     return $arr;
 }
Пример #3
0
 public function postQuestion($id)
 {
     $note = 0;
     $qcm_student = [];
     $nb_choices = Choice::where('question_id', $id)->count();
     for ($i = 0; $i < $nb_choices; $i++) {
         array_push($qcm_student, Input::get("status{$i}"));
     }
     $qcm_teacher = [];
     $choices = Choice::where('question_id', $id)->get();
     foreach ($choices as $choice) {
         array_push($qcm_teacher, $choice->status);
     }
     for ($i = 0; $i < count($qcm_teacher); $i++) {
         if ($qcm_teacher[$i] == $qcm_student[$i]) {
             $note++;
         }
     }
     $test_score = DB::table('scores')->where('user_id', '=', Auth::user()->id)->where('question_id', '=', Question::where('id', $id)->first()->id)->first();
     if (!is_null($test_score)) {
         //echo "fait";
         Session::flash('message_error', 'Vous avez déjà fait ce QCM');
         return Redirect::to('/student');
     } else {
         $score = new Score();
         $score->user_id = Auth::user()->id;
         $score->question_id = Question::where('id', $id)->first()->id;
         $score->status_question = 'fait';
         $score->note = $note;
         $score->save();
         Session::flash('message_success', 'Votre score a bien été enregistré');
         return Redirect::to('/student');
     }
     return Redirect::to('/student');
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($classId, $subjectId)
 {
     $user = \Auth::user();
     $term = 'First Term';
     if ($_GET['class']) {
         $this->class = $_GET['class'];
         $this->subject = $_GET['subject'];
         \Session::put('class', $_GET['class']);
         \Session::put('subject', $_GET['subject']);
     }
     $classe_id = Classe::where('name', $classId)->first()->id;
     $subject_id = Subject::where('name', $this->subject)->first()->id;
     $classeName = Classe::where('name', $this->class)->first()->name;
     $subjectName = Subject::where('name', $this->subject)->first()->name;
     //dd($classe_id);
     $count = 1;
     $questions = Question::where('classe_id', $classId)->where('subject_id', $subjectId)->orderBy(\DB::raw('RAND()'))->get();
     $totals = Question::where('classe_id', $classId)->where('subject_id', $subjectId)->paginate(1);
     $checked_items = [];
     if (\Session::has('checked_items')) {
         $checked_items = \Session::get('checked_items');
     }
     // $checked_items = array_merge($checked_items, \Input::get('abc'));
     \Session::flash('checked_items', $checked_items);
 }
Пример #5
0
 public function questions()
 {
     $questionsNonLues = Question::where('lue', '=', '0')->get();
     $questionsLues = Question::where('lue', '=', '1')->get();
     $countNonLues = $questionsNonLues->count();
     $countLues = $questionsLues->count();
     return View::make('private.pages.questions')->with('countNonLues', $countNonLues)->with('countLues', $countLues)->with('questionsNonLues', $questionsNonLues)->with('questionsLues', $questionsLues);
 }
Пример #6
0
 public function getActivity()
 {
     $data['user'] = User::find(Auth::user()->id);
     $data['userQustions'] = Question::where('user_id', '=', User::find(Auth::user()->id)->id)->orderBy('created_at', 'desc')->get();
     $data['questionsCount'] = $data['userQustions']->count();
     $data['userAnswers'] = Answer::where('user_id', '=', User::find(Auth::user()->id)->id)->orderBy('created_at', 'desc')->get();
     $data['answersCount'] = $data['userAnswers']->count();
     return View::make('profile.activity')->with($data);
 }
 public function questions()
 {
     if (Auth::user()->correct_answers_count < 3) {
         $result = Question::where('type', 0)->get();
     } else {
         if (Auth::user()->correct_answers_count == 3) {
             $result = Question::where('type', 1)->get();
         } else {
             return Redirect::to('confirme');
         }
     }
     $rand = rand(0, count($result) - 1);
     $question = Question::with('answers')->find($result[$rand]->id);
     return View::make('user.questions')->with('question', $question);
 }
Пример #8
0
 /**
  * Create new question for the test
  *
  * @param $id test id
  *
  * @return mixed
  */
 public function createAction($id)
 {
     $test = Test::find($id);
     if (is_null($test)) {
         return Redirect::route('tests.index')->with('error', 'Incorrect test id');
     }
     /**
      * Check if we have results already
      */
     if (count(Result::where('test_id', $id)->get())) {
         return Redirect::route('tests.index')->with('error', 'Нельзя редактировать тест, на который есть ответы');
     }
     $question = new Question();
     $question->test_id = $id;
     $question->number = Question::where('test_id', $id)->max('number') + 1;
     return View::make('question.create', ['test' => $test, 'question' => $question]);
 }
Пример #9
0
 public function run()
 {
     DB::table('users')->delete();
     DB::table('users')->insert([['username' => 'alexandre', 'password' => Hash::make('admin'), 'role' => 'teacher'], ['username' => 'abel', 'password' => Hash::make('abel'), 'role' => 'first_class'], ['username' => 'al', 'password' => Hash::make('al'), 'role' => 'first_class'], ['username' => 'alan', 'password' => Hash::make('alan'), 'role' => 'first_class'], ['username' => 'arthur', 'password' => Hash::make('arthur'), 'role' => 'first_class'], ['username' => 'carl', 'password' => Hash::make('carl'), 'role' => 'first_class'], ['username' => 'blaise', 'password' => Hash::make('blaise'), 'role' => 'first_class'], ['username' => 'steve', 'password' => Hash::make('steve'), 'role' => 'first_class'], ['username' => 'alfred', 'password' => Hash::make('alfred'), 'role' => 'final_class'], ['username' => 'brenda', 'password' => Hash::make('brenda'), 'role' => 'final_class'], ['username' => 'tom', 'password' => Hash::make('tom'), 'role' => 'final_class'], ['username' => 'rasmus', 'password' => Hash::make('rasmus'), 'role' => 'final_class']]);
     $this->command->info('remplissage des uttilisateurs : ok');
     DB::table('posts')->delete();
     DB::table('posts')->insert([['user_id' => User::where('username', '=', 'alexandre')->first(), 'title' => 'les suites récurentes', 'content' => $content = "L'étude des suites récurentes linéaires d'ordre supérieur se ramène à un problème d'algèbre linéaire.", 'abstract' => Str::words($content, 20, '...'), 'url_thumbnail' => 'http://www.enpc.fr/sites/default/files/images/Maths_dullhunk_flickr_20111202_cc.jpg'], ['user_id' => User::where('username', '=', 'alexandre')->first(), 'title' => 'développez factorisez', 'content' => $content = "développez, factorisez, Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reiciendis neque quam impedit quasi quas facere aspernatur perspiciatis, animi perferendis suscipit.", 'abstract' => Str::words($content, 20, '...'), 'url_thumbnail' => 'http://www.rts.ch/2013/02/14/10/11/4660368.image?w=517'], ['user_id' => User::where('username', '=', 'alexandre')->first(), 'title' => 'triangles trigonométriques', 'content' => $content = "Ma quande lingues coalesce, li grammatica del resultant lingue es plu simplic e regulari quam ti del coalescent lingues. Li nov lingua franca va esser plu simplic e regulari quam li existent Europan lingues. It va esser tam simplic quam Occidental: in fact, it va esser Occidental. A un Angleso it va semblar un simplificat Angles, quam un skeptic Cambridge amico dit me que Occidental es.", 'abstract' => Str::words($content, 20, '...'), 'url_thumbnail' => 'http://recit.cssamares.qc.ca/tm/images/imagesweb/Academique/MatieresRegulieres/MATH/Math7.jpg'], ['user_id' => User::where('username', '=', 'alexandre')->first(), 'title' => 'les intégrales', 'content' => $content = "Ma quande lingues coalesce, li grammatica del resultant lingue es plu simplic e regulari quam ti del coalescent lingues. Li nov lingua franca va esser plu simplic e regulari quam li existent Europan lingues. It va esser tam simplic quam Occidental: in fact, it va esser Occidental. A un Angleso it va semblar un simplificat Angles, quam un skeptic Cambridge amico dit me que Occidental es.", 'abstract' => Str::words($content, 20, '...'), 'url_thumbnail' => 'http://recit.cssamares.qc.ca/tm/images/imagesweb/Academique/MatieresRegulieres/MATH/Math7.jpg'], ['user_id' => User::where('username', '=', 'alexandre')->first(), 'title' => 'Probabilités', 'content' => $content = "Ma quande lingues coalesce, li grammatica del resultant lingue es plu simplic e regulari quam ti del coalescent lingues. Li nov lingua franca va esser plu simplic e regulari quam li existent Europan lingues. It va esser tam simplic quam Occidental: in fact, it va esser Occidental. A un Angleso it va semblar un simplificat Angles, quam un skeptic Cambridge amico dit me que Occidental es.", 'abstract' => Str::words($content, 20, '...'), 'url_thumbnail' => 'http://recit.cssamares.qc.ca/tm/images/imagesweb/Academique/MatieresRegulieres/MATH/Math7.jpg']]);
     $this->command->info('remplissage des posts : ok');
     DB::table('comments')->delete();
     DB::table('comments')->insert([['user_id' => User::where('username', '=', 'tom')->first()->id, 'post_id' => Post::where('title', '=', 'Probabilités')->first()->id, 'title' => 'Un commentaire', 'content' => 'Lorem ipsum dolor sit amet']]);
     $this->command->info('remplissage des commentaires : ok');
     DB::table('questions')->delete();
     DB::table('questions')->insert([$machineTuring = ['title' => 'la machine de Turing', 'content' => 'la machine de Turing c\'est quoi ?', 'class_level' => 'premiere'], $javaScript = ['title' => 'javaScript', 'content' => 'language de programation', 'class_level' => 'terminale']]);
     $this->command->info('remplissage des questions : ok');
     DB::table('choices')->delete();
     DB::table('choices')->insert([['question_id' => Question::where('title', $machineTuring['title'])->first()->id, 'content' => 'une machine à laver', 'status' => 'no'], ['question_id' => Question::where('title', $machineTuring['title'])->first()->id, 'content' => 'une machine à voyager dans le temps', 'status' => 'no'], ['question_id' => Question::where('title', $machineTuring['title'])->first()->id, 'content' => 'un modèle abstrait de fonctionnement des appareils mécaniques de calcul', 'status' => 'yes'], ['question_id' => Question::where('title', $javaScript['title'])->first()->id, 'content' => 'un language de programation compilé', 'status' => 'no'], ['question_id' => Question::where('title', $javaScript['title'])->first()->id, 'content' => 'est utilisable uniquement sur navigateur', 'status' => 'no'], ['question_id' => Question::where('title', $javaScript['title'])->first()->id, 'content' => 'sert principalement à rendre le contenu plus intéractif', 'status' => 'yes']]);
     $this->command->info('remplissage des reponses : ok');
 }
Пример #10
0
 public function voteDownQuestion($qid)
 {
     $dbCheck = Vote::where('user_id', '=', Auth::user()->user_id)->where('question_id', '=', $qid)->first();
     if ($dbCheck) {
         return Redirect::route('single-question', $qid)->with('global', 'Sorry, you Previously vote this question');
     } else {
         $vote = new Vote();
         $vote->user_id = Auth::user()->user_id;
         $vote->question_id = $qid;
         $vote->vote = 0;
         $vote->save();
         /*Insert point to the Vote user*/
         $insertPoint = User::find(Auth::user()->user_id);
         $insertPoint->points = $insertPoint->points - 1;
         $insertPoint->save();
         /*Insert point to the Question user*/
         $questionuser = Question::where('id', '=', $qid)->first();
         $insertPoint = User::find($questionuser->user_id);
         $insertPoint->points = $insertPoint->points - 2;
         $insertPoint->save();
         return Redirect::route('single-question', $qid)->with('global', 'Your Successfully vote down this question');
     }
 }
 public function getThankyou()
 {
     $page1data = Question::where('event', '=', Session::get('event'))->where('page', '=', 1)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
         $query->where('user_id', '=', Session::get('userid'));
     }))->get();
     $page2data = Question::where('event', '=', Session::get('event'))->where('input_type', 'checkbox')->where('page', '=', 2)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
         $query->where('user_id', '=', Session::get('userid'));
     }))->get();
     foreach ($page2data as $x) {
         $project_checkbox_group[$x->question_group] = array();
         foreach ($x->answers as $answer) {
             $a = $answer->answer_text;
             $aid = $answer->id;
         }
         array_push($project_checkbox_group[$x->question_group], $a);
     }
     //dd($project_checkbox_group);
     $page3data = Question::where('event', '=', Session::get('event'))->where('page', '=', 3)->orderBy('order')->orderBy('question_group')->with('choices')->with(array('answers' => function ($query) {
         $query->where('user_id', '=', Session::get('userid'));
     }))->get();
     $page4data = Question::where('event', '=', Session::get('event'))->where('page', '=', 4)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
         $query->where('user_id', '=', Session::get('userid'));
     }))->get();
     $page5data = Question::where('event', '=', Session::get('event'))->where('page', '=', 4)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
         $query->where('user_id', '=', Session::get('userid'));
     }))->get();
     $page6data = Question::where('event', '=', Session::get('event'))->where('page', '=', 4)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
         $query->where('user_id', '=', Session::get('userid'));
     }))->get();
     // $page1data = Question::where('page','=',1)->orderBy('order')->with('choices')
     // ->with(array('answers'=>function($query){
     // 		$query->where('user_id','=',Session::get('userid'));
     // }))->get();
     // $page2data = Question::where('page','=',2)->orderBy('order')->with('choices')
     // ->with(array('answers'=>function($query){
     // 		$query->where('user_id','=',Session::get('userid'));
     // }))->get();
     // $page3data = Question::where('page','=',3)->orderBy('order')->orderBy('question_group')->with('choices')
     // ->with(array('answers'=>function($query){
     // 		$query->where('user_id','=',Session::get('userid'));
     // }))->get();
     // $page4data = Question::where('page','=',4)->orderBy('order')->with('choices')
     // ->with(array('answers'=>function($query){
     // 		$query->where('user_id','=',Session::get('userid'));
     // }))->get();
     $vendorsstring = '';
     // $pdf = PDF::loadView('reviewsendpdf',$data)->setPaper('a4')->setWarnings(false);
     // return $pdf->download('test.pdf');
     if (Session::get('event') == 'Healthscape series 2015') {
         $html22 = View::make('forms.healthcare.reviewsendpdf')->with(array('page1data' => $page1data, 'page2data' => $page2data, 'page3data' => $page3data, 'page4data' => $page4data, 'page5data' => $page4data, 'page6data' => $page4data));
     } else {
         $html22 = View::make('reviewsendpdf')->with(array('page1data' => $page1data, 'page2data' => $page2data, 'page3data' => $page3data, 'page4data' => $page4data, 'page5data' => $page4data, 'page6data' => $page4data));
     }
     $html1 = "<h1>adsfadsfasdf</h1>";
     // dd($html22);
     require_once app_path() . '/libs/html2pdf/html2pdf.class.php';
     $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0));
     $html2pdf->pdf->SetDisplayMode('fullpage');
     $html2pdf->WriteHTML($html22);
     $htmltosend = $html2pdf->Output('', 'S');
     // dd($htmltosend);
     /* EMAIL NOTIFICATION FOR FILLED QUESTIONNAIRES */
     $emaillists = Emaillist::where('event', '=', Auth::user()->event)->first();
     $emls = explode(',', $emaillists->emails);
     $emails = array();
     foreach ($emls as $eml) {
         $emails[$eml] = '';
     }
     //dd(Session::get('userid'));
     $fileTblObj = fileHandler::where('user_id', '=', Session::get('userid'))->where('formPage', '=', 3)->first();
     if ($fileTblObj != NULL) {
         $p3path = $fileTblObj->filePath . $fileTblObj->fileName;
     } else {
         $p3path = NULL;
     }
     $fileTblObj4 = fileHandler::where('user_id', '=', Session::get('userid'))->where('formPage', '=', 4)->get();
     $filesp4 = array();
     foreach ($fileTblObj4 as $val) {
         $filesp4[] = $val->filePath . $val->fileName;
     }
     //$files = File::get($p3path);
     //dd($p3path);
     // $emails = array(
     // 				'*****@*****.**' => 'Ashwin',
     // 				//'*****@*****.**' => 'Ashwin',
     // 				//'*****@*****.**' => 'Suresh',
     // 	//'*****@*****.**' => 'Ravi',
     // 	//'*****@*****.**' => 'Ganesh',
     // 	//'*****@*****.**' => 'Sandhya',
     // 	//'*****@*****.**' => 'Bikash',
     // 			);
     $data1 = array('asdf' => '');
     Mail::send('emails.questionnairefilled', $data1, function ($message) use($htmltosend, $emails, $filesp4, $p3path) {
         $message->to($emails)->from('*****@*****.**')->subject(Auth::user()->name . ', ' . Auth::user()->event . '- Questionnaire completed')->attachData($htmltosend, Auth::user()->name . '_questionnaire.pdf', array('mime' => 'application/pdf', 'Content-Disposition' => 'attachment'));
         if ($p3path != NULL) {
             $message->attach($p3path);
         }
         if (count($filesp4) > 0) {
             foreach ($filesp4 as $val) {
                 $message->attach($val);
             }
         }
     });
     // Mail::send('emails.questionnairefilled', $data1 , function($message) use ( $htmltosend, $emails, $filesp4, $p3path) {
     // 	$message->to($emails)
     // 			->from('*****@*****.**')
     // 			->subject(Auth::user()->name.', '.Auth::user()->event.'- Questionnaire completed')
     // 			->attachData($htmltosend,Auth::user()->name.'_questionnaire.pdf',array('mime'=>'application/pdf','Content-Disposition'=>'attachment'))
     // 			->attach($p3path);
     // 			foreach($filesp4 as $val)
     // 			$message->attach($val);
     // });
     /*******************************************/
     // $pdf = App::make('dompdf');
     // $pdf->loadHTML($html)->setPaper('a4')->setWarnings(false);
     // return $pdf->stream();
     return View::make('forms.thankyou');
 }
Пример #12
0
		<?php 
    if (is_authen('admin_meetings')) {
        ?>
		<a href="meetings/report/<?php 
        echo $meeting->id;
        ?>
" class="btn">ดูรายงาน</a><br /><br />
		<?php 
    }
    ?>
		<?php 
    if (mysql_to_unix($meeting->close_date) > time()) {
        ?>
		<?php 
        $question = new Question();
        $question->where('meeting_id', $meeting->id);
        $question->where('(user_id = ' . $this->session->userdata('id') . ' or r_id = ' . $this->session->userdata('id') . ')');
        $question->get();
        if (!$question->exists()) {
            ?>
		<a href="questions/form/<?php 
            echo $meeting->id;
            ?>
" class="btn">ลงทะเบียน</a>
			<?php 
        }
        ?>
		<?php 
    }
    ?>
  </td>
 public function getThankyou()
 {
     // $page1data = Question::where('event','=',Session::get('event'))->where('page','=',1)->orderBy('order')->with('choices')
     // ->with(array('answers'=>function($query){
     // 		$query->where('user_id','=',Session::get('userid'));
     // }))->get();
     // $page2data = Question::where('event','=',Session::get('event'))->where('page','=',2)->orderBy('order')->with('choices')
     // ->with(array('answers'=>function($query){
     // 		$query->where('user_id','=',Session::get('userid'));
     // }))->get();
     // $page3data = Question::where('event','=',Session::get('event'))->where('page','=',3)->orderBy('order')->orderBy('question_group')->with('choices')
     // ->with(array('answers'=>function($query){
     // 		$query->where('user_id','=',Session::get('userid'));
     // }))->get();
     // $page4data = Question::where('event','=',Session::get('event'))->where('page','=',4)->orderBy('order')->with('choices')
     // ->with(array('answers'=>function($query){
     // 		$query->where('user_id','=',Session::get('userid'));
     // }))->get();
     $page1data = Question::where('page', '=', 1)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
         $query->where('user_id', '=', Session::get('userid'));
     }))->get();
     $page2data = Question::where('page', '=', 2)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
         $query->where('user_id', '=', Session::get('userid'));
     }))->get();
     $page3data = Question::where('page', '=', 3)->orderBy('order')->orderBy('question_group')->with('choices')->with(array('answers' => function ($query) {
         $query->where('user_id', '=', Session::get('userid'));
     }))->get();
     $page4data = Question::where('page', '=', 4)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
         $query->where('user_id', '=', Session::get('userid'));
     }))->get();
     $categoryvendoranswers = Categoryvendoranswer::where('user_id', '=', Session::get('userid'))->with('categoryvendor')->get();
     $vendorsstring = '';
     if (!$categoryvendoranswers->isEmpty()) {
         foreach ($categoryvendoranswers as $cva) {
             if ($cva->answer == 'yes') {
                 $vendorsstring = $vendorsstring . $cva->categoryvendor->vendorname . ', ';
                 // dd($vendorsstring);
             }
         }
     }
     // $pdf = PDF::loadView('reviewsendpdf',$data)->setPaper('a4')->setWarnings(false);
     // return $pdf->download('test.pdf');
     $html22 = View::make('reviewsendpdf')->with(array('page1data' => $page1data, 'page2data' => $page2data, 'page3data' => $page3data, 'page4data' => $page4data, 'vendorsstring' => $vendorsstring));
     $html1 = "<h1>adsfadsfasdf</h1>";
     // dd($html22);
     require_once app_path() . '/libs/html2pdf/html2pdf.class.php';
     $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0));
     $html2pdf->pdf->SetDisplayMode('fullpage');
     $html2pdf->WriteHTML($html22);
     $htmltosend = $html2pdf->Output('', 'S');
     // dd($htmltosend);
     /* EMAIL NOTIFICATION FOR FILLED QUESTIONNAIRES */
     $emaillists = Emaillist::where('event', '=', Auth::user()->event)->first();
     $emls = explode(',', $emaillists->emails);
     $emails = array();
     foreach ($emls as $eml) {
         $emails[$eml] = '';
     }
     // $emails = array(
     // 				'*****@*****.**' => 'Ashwin',
     // 				//'*****@*****.**' => 'Ashwin',
     // 				//'*****@*****.**' => 'Suresh',
     // 	//'*****@*****.**' => 'Ravi',
     // 	//'*****@*****.**' => 'Ganesh',
     // 	//'*****@*****.**' => 'Sandhya',
     // 	//'*****@*****.**' => 'Bikash',
     // 			);
     $data1 = array('asdf' => '');
     Mail::send('emails.questionnairefilled', $data1, function ($message) use($htmltosend, $emails) {
         $message->to($emails)->from('*****@*****.**')->subject(Auth::user()->name . ', ' . Auth::user()->event . '- Questionnaire completed')->attachData($htmltosend, Auth::user()->name . '_questionnaire.pdf', array('mime' => 'application/pdf', 'Content-Disposition' => 'attachment'));
     });
     /*******************************************/
     // $pdf = App::make('dompdf');
     // $pdf->loadHTML($html)->setPaper('a4')->setWarnings(false);
     // return $pdf->stream();
     return View::make('forms.thankyou');
 }
Пример #14
0
 public function adminBearbeite()
 {
     $qid = Input::get("qid");
     $questions = Question::where('questionnaire_id', '=', $qid)->get();
     foreach ($questions as $q) {
         $q->questionnaire_id = $qid;
         $fieldname = "field" . $q->id;
         $q->question = Input::get($fieldname);
         $q->save();
         if ($q->question == "x") {
             $q->delete();
         }
     }
     $questions = Question::where('questionnaire_id', '=', $qid)->get();
     return Redirect::to('adminstart/admin');
 }
Пример #15
0
 public static function userQuestionCount($uid)
 {
     $qCount = Question::where('user_id', '=', $uid);
     return $qCount->count();
 }
Пример #16
0
 /**
  * Delete the test
  *
  * @param $id
  */
 public function deleteAction($id)
 {
     $test = Test::find($id);
     if (is_null($test)) {
         return Redirect::route('tests.index')->with('error', 'Incorrect test id');
     }
     /**
      * Get the list of answers
      */
     $questions = Question::where('test_id', $id)->get();
     foreach ($questions as $q) {
         DB::table('answer')->where('question_id', $q->id)->delete();
     }
     DB::table('token')->where('test_id', $id)->delete();
     DB::table('result')->where('test_id', $id)->delete();
     DB::table('question')->where('test_id', $id)->delete();
     DB::table('test')->where('id', $id)->delete();
     return Redirect::route('tests.index');
 }
Пример #17
0
 public static function percentageClassd()
 {
     $number1 = Auth::user()->correctQuestions()->where('category', '=', 'classd')->count();
     $number2 = Question::where('category', '=', 'classd')->count();
     if ($number2 == 0) {
         $finalNumber = 100;
     } else {
         $quotient = $number1 / $number2;
         $finalNumber = $quotient * 100;
     }
     return round($finalNumber);
 }
Пример #18
0
Route::controller('design_mission_south_africa_2016/login', 'LoginController');
Route::controller('design_mission_turkey_2016/login', 'LoginController');
Route::controller('design_mission_asia_2016/login', 'LoginController');
Route::controller('design_mission_russia_2016/login', 'LoginController');
Route::controller('healthscape_series_2016/login', 'LoginController');
Route::get('pdftest', function () {
    $page1data = Question::where('event', '=', Session::get('event'))->where('page', '=', 1)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
        $query->where('user_id', '=', Session::get('userid'));
    }))->get();
    $page2data = Question::where('event', '=', Session::get('event'))->where('page', '=', 2)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
        $query->where('user_id', '=', Session::get('userid'));
    }))->get();
    $page3data = Question::where('event', '=', Session::get('event'))->where('page', '=', 3)->orderBy('order')->orderBy('question_group')->with('choices')->with(array('answers' => function ($query) {
        $query->where('user_id', '=', Session::get('userid'));
    }))->get();
    $page4data = Question::where('event', '=', Session::get('event'))->where('page', '=', 4)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
        $query->where('user_id', '=', Session::get('userid'));
    }))->get();
    return View::make('reviewsendpdf')->with(array('page1data' => $page1data, 'page2data' => $page2data, 'page3data' => $page3data, 'page4data' => $page4data));
});
Route::get('mailtest', function () {
    $data = array();
    //dd(public_path().'imges/design_mission_turkey.png');
    $file = public_path('images/design_mission_turkey.png');
    // /dd(toString(public_path('images/design_mission_turkey.png')));
    Mail::queue('emails.questionnairefilled', $data, function ($message) use($file) {
        $message->to('*****@*****.**', 'Ashwin')->from('*****@*****.**')->subject('Test mail');
        $message->attach($file, array('as' => 'blah.png'));
    });
});
Route::get('login', function () {
 public function postExporttopdf()
 {
     $validator = Validator::make(Input::all(), array('delid' => 'required'));
     $event = Session::get('tempevenname');
     /* Check if Sales login user has access to posted event*/
     $currsalesuser = User::where('id', '=', Auth::user()->id)->with('salesloginevent')->get();
     foreach ($currsalesuser as $sl) {
         if ($sl->salesloginevent->isEmpty()) {
             return Redirect::to('sales/exporttopdfpre')->with('createusermessage', 'You cannot view users for this event');
         } else {
             $chec = '';
             foreach ($sl->salesloginevent as $sle) {
                 if ($event == $sle->event) {
                     $chec = 'ok';
                 }
             }
         }
         if ($chec != 'ok') {
             return Redirect::to('sales/exporttopdfpre')->with('createusermessage', 'You cannot view users for this event');
         }
     }
     /********************************************************/
     if ($validator->passes()) {
         $uid1 = Input::get('delid');
         $username = User::find(Input::get('delid'))->name;
         $page1data = Question::where('page', '=', 1)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
             $query->where('user_id', '=', Input::get('delid'));
         }))->get();
         $page2data = Question::where('page', '=', 2)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
             $query->where('user_id', '=', Input::get('delid'));
         }))->get();
         $page3data = Question::where('page', '=', 3)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
             $query->where('user_id', '=', Input::get('delid'));
         }))->get();
         $page4data = Question::where('page', '=', 4)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
             $query->where('user_id', '=', Input::get('delid'));
         }))->get();
         //dd($page2data);
         $categoryvendoranswers = Categoryvendoranswer::where('user_id', '=', Input::get('delid'))->with('categoryvendor')->get();
         $vendorsstring = '';
         if (!$categoryvendoranswers->isEmpty()) {
             foreach ($categoryvendoranswers as $cva) {
                 if ($cva->answer == 'yes') {
                     $vendorsstring = $vendorsstring . $cva->categoryvendor->vendorname . ', ';
                     // dd($vendorsstring);
                 }
             }
         }
         //dd($vendorsstring);
         $html = View::make('reviewsendpdf')->with(array('page1data' => $page1data, 'page2data' => $page2data, 'page3data' => $page3data, 'page4data' => $page4data, 'event' => $event, 'vendorsstring' => $vendorsstring));
         require_once app_path() . '/libs/html2pdf/html2pdf.class.php';
         $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0));
         $html2pdf->pdf->SetDisplayMode('fullpage');
         $html2pdf->WriteHTML($html);
         $html2pdf->Output($username . '_questionnaire.pdf', 'D');
     } else {
         return Redirect::to('sales/exporttopdf')->with('message', 'Select a user and event');
     }
 }
Пример #20
0
 /**
  * Remove the specified resource from storage.
  * DELETE /questions/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Question::where('id', '>', 0)->delete();
     return [];
 }
Пример #21
0
 public static function otherProfileTrail()
 {
     $karmacircleFeed = Karmafeed::select('message_type As type', 'id_type', 'receiver_id', 'giver_id', 'updated_at')->get();
     foreach ($karmacircleFeed as $karmaFeed) {
         $receiverId = $karmaFeed->receiver_id;
         $giverId = $karmaFeed->giver_id;
         $karmaFeedMessage = $karmaFeed->type;
         $karmaFeedId = $karmaFeed->id_type;
         $karmaFeedDate = $karmaFeed->updated_at;
         if (!empty($receiverId)) {
             $receiverData = User::where('id', '=', $receiverId)->select('fname As receiverFirstName', 'lname As receiverLastName', 'piclink As receiverPic')->first();
         }
         if (!empty($giverId)) {
             $giverData = User::where('id', '=', $giverId)->select('fname As giverFirstName', 'lname As giverLastName', 'piclink As giverPic')->first();
         }
         if ($karmaFeedMessage == 'KarmaNote') {
             $getKarmaNoteDetails = Karmanote::where('id', '=', $karmaFeedId)->select(array('karmanotes.details As description'))->first();
             $karmaNoteFeed[] = array_merge($karmaFeed->toArray(), $getKarmaNoteDetails->toArray(), $giverData->toArray(), $receiverData->toArray());
         } else {
             $karmacircleFeedCount = DB::table('users_karmafeeds')->where('message_type', '=', 'KarmaNote')->count();
             if ($karmacircleFeedCount < 1) {
                 $karmaNoteFeed = array();
             }
         }
         if ($karmaFeedMessage == 'Group') {
             $getGroupDetails = Group::where('id', '=', $karmaFeedId)->select(array('groups.name As name', 'groups.description As description'))->first();
             $groupFeed[] = array_merge($karmaFeed->toArray(), $getGroupDetails->toArray(), $receiverData->toArray());
         } else {
             $karmacircleGroupCount = DB::table('users_karmafeeds')->where('message_type', '=', 'Group')->count();
             if ($karmacircleGroupCount < 1) {
                 $groupFeed = array();
             }
         }
         if ($karmaFeedMessage == 'KarmaQuery') {
             $getQueryDetails = Question::where('id', '=', $karmaFeedId)->select(array('questions.queryStatus As queryStatus', 'questions.description As description'))->first();
             $queryFeed[] = array_merge($karmaFeed->toArray(), $getQueryDetails->toArray(), $receiverData->toArray());
         } else {
             $karmacircleQueryCount = DB::table('users_karmafeeds')->where('message_type', '=', 'Question')->count();
             if ($karmacircleQueryCount < 1) {
                 $queryFeed = array();
             }
         }
         if ($karmaFeedMessage == 'OfferHelpTo') {
             $getOfferHelpDetails = Question::where('id', '=', $karmaFeedId)->select(array('questions.queryStatus As queryStatus', 'questions.description As description'))->first();
             $getOfferHelpCount = Questionwillingtohelp::has('id')->where('user_id', '=', $receiverId)->where('question_id', '=', $karmaFeedId)->count();
             $offerHelpToFeed[] = array_merge($karmaFeed->toArray(), $getOfferHelpDetails->toArray(), $receiverData->toArray(), $giverData->toArray());
         } else {
             $offerHelpToFeedCount = DB::table('users_karmafeeds')->where('message_type', '=', 'OfferHelpTo')->count();
             if ($offerHelpToFeedCount < 1) {
                 $offerHelpToFeed = array();
             }
         }
     }
     $feed = array_merge($karmaNoteFeed, $groupFeed, $queryFeed);
     $sort = array();
     foreach ($feed as $k => $v) {
         $sort['updated_at'][$k] = $v['updated_at'];
     }
     array_multisort($sort['updated_at'], SORT_DESC, $feed);
     echo "<pre>";
     print_r($arr);
     die;
     echo '<pre>';
     print_r($feed);
     die;
 }
 public function getIndex()
 {
     $data['pageTitle'] = "Quizzler | Dashboard";
     $data['urlAddBack'] = "backends/dashboard";
     $questions = Question::orderBy('id', 'desc')->get();
     //Remove Question that don't have answer
     foreach ($questions as $question) {
         if (!$question->correct_answer) {
             Question::where('id', $question->id)->delete();
         }
     }
     //end remove question
     $data['questions'] = Question::orderBy('id', 'desc')->get();
     $data['activeD'] = 'active';
     $data['viewResult'] = false;
     if (isset($_GET['keyword']) == 'quizz') {
         $data['btnAddBack'] = '<i class="icon-reply"></i><span>Back<span>';
         $data['labelPage'] = "The Quizzler Result";
         $data['formOrigin'] = $_GET['keyword'];
         $total = number_format($_GET['total'], 2, '.', '');
         $total = substr($total, -2);
         if ($total == "00") {
             $total = number_format($_GET['total'], 0, ',', '.');
         } else {
             $total = number_format($_GET['total'], 2, ',', '.');
         }
         $result = Results::find($_GET['resultId']);
         $result->score = $total;
         $result->save();
         if ($result->score >= 50) {
             $data['resultScore'] = " Your scored " . $result->score . " %, You Passed.";
         } else {
             $data['resultScore'] = " Your scored " . $result->score . " %, You Failed.";
         }
         $data['resultQuestionId'] = json_decode($result->question_quizzler_answer);
         $data['resultActive'] = 1;
         if (Auth::user()->user_role_id != 2) {
             $result = Results::where('user_id', Auth::user()->id)->first();
             $result = Results::find($result['id']);
             $result->active = 0;
             $result->save();
             $data['resultActive'] = $result->active;
         }
         return View::make('backends.dashboard.result', $data);
     } else {
         $result = Results::where('user_id', Auth::user()->id)->first();
         $result = Results::find($result['id']);
         if (isset($result)) {
             $data['viewResult'] = true;
             if ($result->active != 1) {
                 $data['urlAddBack'] = "backends";
                 $data['btnAddBack'] = '<i class="icon-reply"></i><span>Back<span>';
                 $data['labelPage'] = "The Quizzler Result";
                 $data['formOrigin'] = 'quizz';
                 $result = Results::where('user_id', Auth::user()->id)->first();
                 $result = Results::find($result['id']);
                 $data['resultActive'] = $result->active;
                 if ($result->score >= 50) {
                     $data['resultScore'] = " Your scored " . $result->score . " %, You Passed.";
                 } else {
                     $data['resultScore'] = " Your scored " . $result->score . " %, You Failed.";
                 }
                 $data['resultQuestionId'] = json_decode($result->question_quizzler_answer);
                 return View::make('backends.dashboard.result', $data);
             } else {
                 $data['urlAddBack'] = "backends/quizz/add";
                 $data['btnAddBack'] = '<i class="icon-plus"></i><span>Create Question<span>';
                 $data['labelPage'] = "The Quizzler Challenge";
                 $data['formOrigin'] = "dashboard";
                 return View::make('backends.dashboard.dashboard', $data);
             }
         } else {
             $data['urlAddBack'] = "backends/quizz/add";
             $data['btnAddBack'] = '<i class="icon-plus"></i><span>Create Question<span>';
             $data['labelPage'] = "The Quizzler Challenge";
             $data['formOrigin'] = "dashboard";
             return View::make('backends.dashboard.dashboard', $data);
         }
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $data = array('question' => Question::where('id', '=', $id)->first());
 }
// Add some data
//***************************************************************************************
$arr = array();
$ansarr = array();
$curruser = '';
$firstpass = true;
//$usersandranking = User::where('event','=',$exceleve)->with('userandrank')->get();
$usersandranking = Supplierrank::where('userid', '=', $delid)->with('supplier')->with('user')->orderBy('userid')->orderBy('rank')->get();
foreach ($usersandranking as $userrank) {
    //dd($userrank);
    // $arr[]=array('Buyer Company Name','Vendor Company Name','Buyer Person Name','Buyer person designation','Rank',);
    if ($curruser != $userrank->user->name) {
        $arr[] = array();
        $arr[] = array('Buyer Company Name', 'Vendor Company Name', 'Buyer Person Name', 'Buyer person designation', 'Rank');
    }
    $answerstable = Question::where('page', '=', 1)->with(array('answers' => function ($query) use($userrank) {
        $query->where('user_id', '=', $userrank->user->id);
    }))->get();
    foreach ($answerstable as $answer) {
        $a = '';
        //dd($answer->question_text);
        // dd($answer->answers);
        foreach ($answer->answers as $ans) {
            // dd($ans->answer_text);
            $a = $ans->answer_text;
        }
        $ansarr[$answer->question_text] = $a;
    }
    // dd($ansarr);
    $arr[] = array($ansarr['Company Name'], $userrank->supplier->name, $userrank->user->name, $ansarr['Job Title'], $userrank->rank);
    // echo $userrank->supplier->name;
Пример #25
0
    $data['user'] = User::find($id);
    $data['userQustions'] = Question::where('user_id', '=', $id)->orderBy('created_at', 'desc')->paginate(4);
    $data['questionsCount'] = $data['userQustions']->count();
    $data['userAnswers'] = Answer::where('user_id', '=', $id)->orderBy('created_at', 'desc')->paginate(4);
    $data['answersCount'] = $data['userAnswers']->count();
    return View::make('profile.activity')->with($data);
});
Route::get('unanswer', function () {
    $data['users'] = User::all();
    $data['unanswer'] = Question::where('status', '=', NULL)->orderBy('created_at', 'desc')->paginate(10);
    $data['count'] = $data['unanswer']->count();
    return View::make('site.unansweredquestions')->with($data);
});
Route::get('search', function () {
    $data['users'] = User::all();
    $data['searchResults'] = Question::where('description', 'like', '%' . Input::get('search') . '%')->paginate(10);
    $data['count'] = $data['searchResults']->count();
    return View::make('site.searchresults')->with($data);
});
Route::get('contact_us', function () {
    return Redirect::back();
});
Route::get('privacy_policy', function () {
    return Redirect::back();
});
/*
|--------------------------------------------------------------------------
| Session Controller Routes
|--------------------------------------------------------------------------
|
| Routes to handle session things
 public function postExporttopdf()
 {
     $validator = Validator::make(Input::all(), array('delid' => 'required'));
     $event = Session::get('tempevenname');
     //dd(Session::get('tempevenname'));
     if ($validator->passes()) {
         $uid1 = Input::get('delid');
         $username = User::find(Input::get('delid'))->name;
         $page1data = Question::where('event', '=', $event)->where('page', '=', 1)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
             $query->where('user_id', '=', Input::get('delid'));
         }))->get();
         $page2data = Question::where('event', '=', $event)->where('page', '=', 2)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
             $query->where('user_id', '=', Input::get('delid'));
         }))->get();
         $page3data = Question::where('event', '=', $event)->where('page', '=', 3)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
             $query->where('user_id', '=', Input::get('delid'));
         }))->get();
         $page4data = Question::where('event', '=', $event)->where('page', '=', 4)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
             $query->where('user_id', '=', Input::get('delid'));
         }))->get();
         $categoryvendoranswers = Categoryvendoranswer::where('user_id', '=', Input::get('delid'))->with('categoryvendor')->get();
         $vendorsstring = '';
         if (!$categoryvendoranswers->isEmpty()) {
             foreach ($categoryvendoranswers as $cva) {
                 if ($cva->answer == 'yes') {
                     $vendorsstring = $vendorsstring . $cva->categoryvendor->vendorname . ', ';
                     // dd($vendorsstring);
                 }
             }
         }
         //dd($vendorsstring);
         // // dd($page1data);
         // $html = View::make('reviewsendpdf')->with(array(
         // 					'page1data'=>$page1data,
         // 					'page2data'=>$page2data,
         // 					'page3data'=>$page3data,
         // 					'page4data'=>$page4data,
         // 					'event'=>$event,
         // 					'vendorsstring'=>$vendorsstring
         // 				));
         if ($event == 'Healthscape series 2016') {
             $html22 = View::make('forms.healthcare.reviewsendpdf')->with(array('page1data' => $page1data, 'page2data' => $page2data, 'page3data' => $page3data, 'page4data' => $page4data, 'event' => $event));
         } else {
             $html22 = View::make('reviewsendpdf')->with(array('page1data' => $page1data, 'page2data' => $page2data, 'page3data' => $page3data, 'page4data' => $page4data));
         }
         require_once app_path() . '/libs/html2pdf/html2pdf.class.php';
         $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0));
         $html2pdf->pdf->SetDisplayMode('fullpage');
         $html2pdf->WriteHTML($html22);
         ob_end_clean();
         $html2pdf->Output($username . '_questionnaire.pdf', 'D');
     } else {
         return Redirect::to('admin/exporttopdf')->with('message', 'Select a user and event');
     }
 }
Пример #27
0
 public function deletequery()
 {
     $id = Input::get('queryId');
     $deleteQuestionwillingtohelp = Questionwillingtohelp::where('question_id', '=', $id)->delete();
     $deleteGroupQuestion = Groupquestion::where('question_id', '=', $id)->delete();
     $deleteQuestion = Question::where('id', '=', $id)->delete();
     $deleteKarmafeed = Karmafeed::where('id_type', '=', $id)->whereIn('message_type', array('KarmaQuery', 'OfferHelpTo'))->delete();
     $deleteMykarma = Mykarma::where('entry_id', '=', $id)->whereIn('users_role', array('PostedQuery', 'OfferedHelp'))->delete();
     echo "Question " . $id . " deleted";
 }