Example #1
0
 public function search(Request $request)
 {
     $results = array();
     $term = $request->get('term');
     $goals = Goal::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $objectives = Objective::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $actions = Action::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $tasks = Task::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $teams = Team::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
     $departments = Department::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
     $users = User::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get()->all();
     foreach (User::where('email', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get() as $matching_user_email) {
         if (in_array($matching_user_email, $users)) {
             continue;
         }
         $users[] = $matching_user_email;
     }
     $notes = Note::where('content', 'like', '%' . $term . '%')->orderBy('content', 'asc')->get();
     $types = [$goals, $objectives, $actions, $tasks, $teams, $departments, $users, $notes];
     foreach ($types as $type) {
         foreach ($type as $result) {
             $results[] = $result;
         }
     }
     return view('search.show')->with('results', $results)->with('term', $term);
 }
Example #2
0
 public function saveNotes()
 {
     $input = \Input::all();
     $user = \App\User::where('email', Session::get('email'))->first();
     $notes = \App\Note::where('user_id', $user->id)->first();
     $note = \input::get('notes');
     $site = null;
     for ($i = 1; $i < count($input); $i++) {
         if (array_key_exists("website" . $i, $input)) {
             if (strlen(\input::get('website' . $i)) > 0) {
                 $site = $site . \input::get('website' . $i);
                 $site = $site . "\r\n";
             }
         }
     }
     $tbd = \input::get('tbd');
     $image = \Input::file('file');
     $file = null;
     if ($image != null) {
         $file = file_get_contents($image);
     }
     if ($notes == null) {
         $notes = Note::create(array('note' => $note, 'website' => $site, 'tbd' => $tbd, 'user_id' => $user->id, 'image1' => $file));
     } else {
         $notes->note = $note;
         $notes->website = $site;
         $notes->tbd = $tbd;
         $notes->user_id = $user->id;
         if ($notes->image1 == null) {
             $notes->image1 = $file;
         } elseif ($notes->image2 == null) {
             $notes->image2 = $file;
         } elseif ($notes->image3 == null) {
             $notes->image3 = $file;
         } elseif ($notes->image4 == null) {
             $notes->image4 = $file;
         }
         $notes->save();
     }
     if (\input::get('delete1') == 1) {
         $notes->image1 = null;
         $notes->save();
     }
     if (\input::get('delete2') == 1) {
         $notes->image2 = null;
         $notes->save();
     }
     if (\input::get('delete3') == 1) {
         $notes->image3 = null;
         $notes->save();
     }
     if (\input::get('delete4') == 1) {
         $notes->image4 = null;
         $notes->save();
     }
     return view('notes')->with('notes', $notes);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $user = Auth::user()->id;
     $categories = Category::where('user_id', '=', $user)->get();
     foreach ($categories as $category) {
         $noteCount = Note::where('category_id', '=', $category->id)->count();
         $category->count = $noteCount;
     }
     return Response::json($categories, 200);
 }
 /**
  * Show the application welcome screen to the user.
  *
  * @return Response
  */
 public function index()
 {
     $actif = 0;
     $preference = Preference::first();
     $notes = Note::where('etat', 1)->orderBy('created_at', 'desc')->paginate(5);
     $contacts = Contact::where('etat', 1)->orderBy('created_at', 'desc')->paginate(5);
     $societes = Societe::where('etat', 1)->orderBy('created_at', 'desc')->paginate(5);
     $devis = Devis::where('etat_devis', 1)->orderBy('created_at', 'desc')->paginate(5);
     return view('accueil', compact('actif', 'preference', 'notes', 'contacts', 'societes', 'devis'));
 }
 public function showPastAuditions()
 {
     $auditionsStatuses = AuditionStatus::where('user_id', Auth::user()->id)->get();
     $auditions = collect();
     foreach ($auditionsStatuses as $audition) {
         $audition_details = Audition::find($audition->audition_id);
         if ($audition_details->ended) {
             $audition_details->status = $audition;
             $audition_details->notes = Note::where('audition_status_id', $audition->id)->get();
             $auditions->push($audition_details);
         }
     }
     return view('past', ['auditions' => $auditions]);
 }
Example #6
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     // $lesson = Lesson::where('user_id', $request->user()->id)->get()->medias;
     if (Auth::user()->group_id != 1) {
         $lessons = Lesson::where('category_id', Auth::user()->category_id)->get();
         $infos = Info::all();
         $notes = Note::where('user_id', Auth::user()->id)->get();
     } else {
         $lessons = Lesson::all();
         $infos = Info::all();
         $notes = Note::where('user_id', Auth::user()->id)->get();
     }
     return view('home.index', compact('lessons', 'infos', 'notes'));
 }
 /**
  * Returns all projects in database
  *
  * This function uses an Eloquent query to return a list of id, user,
  * project, content, created, deadline and completed for all notes stored 
  * in the database.
  *
  * @since 1.1.0
  *
  * @return Response A HTTP Response object formatted as JSON
  */
 public function listNotes()
 {
     try {
         $statusCode = 200;
         $notes = Note::where('removed', 0)->with(['user', 'project'])->orderBy('time_created', 'asc')->get();
         $response = [];
         foreach ($notes as $note) {
             $this_row = array('id' => $note->id, 'user' => $note->user->uname, 'project' => $note->project->pname, 'content' => $note->content, 'completed' => $note->completed, 'created' => $note->time_created, 'deadline' => $note->time_deadline);
             $response[] = $this_row;
         }
     } catch (Exception $e) {
         $statusCode = 400;
     } finally {
         return Response::json($response, $statusCode);
     }
 }
 public function notes()
 {
     $notes = Note::where('states', 1)->orderBy('id', 'desc')->with('user')->paginate(24);
     return view('notes.notes', compact('notes'));
 }
Example #9
0
 public function noteCount($user)
 {
     return Note::where('creator', $user->id)->count();
 }
Example #10
0
 private function _isOwner()
 {
     $userId = $this->_getUserId(Input::get('api_key'));
     if (!$userId) {
         response()->json(array('status' => 'failed'));
     }
     $isOwner = Note::where('id', Input::get('id'))->where('user_id', $userId)->count();
     if (!$isOwner) {
         return response()->json(array('status' => 'failed'));
     }
     return true;
 }
Example #11
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $user = JWTAuth::parseToken()->authenticate();
     $note = Note::where('user_id', $user->id)->find($id);
     if (Gate::denies('show-note', $note)) {
         abort(403);
     }
     if ($note) {
         return response()->json($note);
     }
 }
 public function displayNotes()
 {
     $notes = Note::where('availability', 'public')->get();
     return view('pages.home', compact('notes'));
 }
Example #13
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $notes = Note::where('user', '=', Auth::id())->orderBy('updated_at', 'desc')->get();
     return view('notes', compact('notes'));
 }
Example #14
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $user = Auth::user()->id;
     $notes = Note::where('user_id', '=', $user)->where('category_id', '=', $id)->get();
     return Response::json($notes, 200);
 }
Example #15
0
 public function getNumberNotes()
 {
     return Note::where('tag_ids', 'like', "%," . $this->id . ",%")->count();
 }
Example #16
0
 /**
  *  Returns matches in the note table for the given term
  *
  *  @param   string  $term  The search term
  *
  *  @return  mixed         Response or Collection depending on validation
  */
 public function getNoteSearch($term)
 {
     // TODO: implement a "good" fulltext search.
     $notes = Note::where('content', 'LIKE', '%' . $term . '%')->orWhere('title', 'LIKE', '%' . $term . '%')->limit(15)->get(['content', 'title', 'id']);
     // Do we have a search result?
     if (!$notes) {
         return response()->json(['message', 'No search results'], 404);
     } else {
         foreach ($notes as $note) {
             $note->content = strip_tags(Markdown::convertToHtml(str_limit($note->content, 120, '&hellip;')));
         }
         return $notes;
     }
 }
 public function notes($id)
 {
     $notes = Note::where('creator', $id)->orderBy('id', 'desc')->get();
     $user = User::findOrFail($id);
     return view('space.notes', compact('notes', 'user'));
 }
Example #18
0
 public function getNotesPerso($year)
 {
     $match = ['etat' => 1, 'id_user_destination' => Auth::user()->id];
     $notes = Note::where($match)->get();
     return $notes;
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $notes = Note::where('user_id', '=', Auth::User()->id)->get();
     return view('notes.index', compact('notes'));
 }
Example #20
0
 public function FiltreCategorie($cat)
 {
     $actif = 'notes';
     //
     if ($cat == 'afaire') {
         $note_past = Note::where('etat', '1')->where('categorie', 'A faire')->where('echeance', '<', Carbon::today())->orderBy('updated_at', 'desc')->paginate(15);
         $note_futur = Note::where('etat', '1')->where('categorie', 'A faire')->where('echeance', '>', Carbon::today())->orderBy('updated_at', 'desc')->paginate(15);
         $note_auj = Note::where('etat', '1')->where('categorie', 'A faire')->where('echeance', '=', Carbon::today())->orderBy('updated_at', 'desc')->paginate(15);
     } elseif ($cat == 'tel') {
         $note_past = Note::where('etat', '1')->where('categorie', 'Appel téléphonique')->where('echeance', '<', Carbon::today())->orderBy('updated_at', 'desc')->paginate(15);
         $note_futur = Note::where('etat', '1')->where('categorie', 'Appel téléphonique')->where('echeance', '>', Carbon::today())->orderBy('updated_at', 'desc')->paginate(15);
         $note_auj = Note::where('etat', '1')->where('categorie', 'Appel téléphonique')->where('echeance', '=', Carbon::today())->orderBy('updated_at', 'desc')->paginate(15);
     } elseif ($cat == 'email') {
         $note_past = Note::where('etat', '1')->where('categorie', 'E-mail')->where('echeance', '<', Carbon::today())->orderBy('updated_at', 'desc')->paginate(15);
         $note_futur = Note::where('etat', '1')->where('categorie', 'E-mail')->where('echeance', '>', Carbon::today())->orderBy('updated_at', 'desc')->paginate(15);
         $note_auj = Note::where('etat', '1')->where('categorie', 'E-mail')->where('echeance', '=', Carbon::today())->orderBy('updated_at', 'desc')->paginate(15);
     } elseif ($cat == 'reunion') {
         $note_past = Note::where('etat', '1')->where('categorie', 'Réunion')->where('echeance', '<', Carbon::today())->orderBy('updated_at', 'desc')->paginate(15);
         $note_futur = Note::where('etat', '1')->where('categorie', 'Réunion')->where('echeance', '>', Carbon::today())->orderBy('updated_at', 'desc')->paginate(15);
         $note_auj = Note::where('etat', '1')->where('categorie', 'Réunion')->where('echeance', '=', Carbon::today())->orderBy('updated_at', 'desc')->paginate(15);
     } elseif ($cat == 'autre') {
         $note_past = Note::where('etat', '1')->where('categorie', 'Autre')->where('echeance', '<', Carbon::today())->orderBy('updated_at', 'desc')->paginate(15);
         $note_futur = Note::where('etat', '1')->where('categorie', 'Autre')->where('echeance', '>', Carbon::today())->orderBy('updated_at', 'desc')->paginate(15);
         $note_auj = Note::where('etat', '1')->where('categorie', 'Autre')->where('echeance', '=', Carbon::today())->orderBy('updated_at', 'desc')->paginate(15);
     }
     return view('notes.index', compact('note_auj', 'note_futur', 'note_past', 'note_auj', 'actif'));
 }
 public function checkNotes(Request $request)
 {
     $query = Note::where('states', '=', 0);
     return view('admin.notes.cnotes', $this->getNotesQuery($request, $query));
 }
Example #22
0
 /**
  *  Runs a comparision between notes on text basis
  *
  *  @param   Note     $note  The note, for which related notes should be returned
  *
  *  @return  array         An array containing the IDs and relevancy of related notes
  */
 function textAnalysis(Note $note)
 {
     // For a text analysis we need to reduce this note and
     // reduce all possible related notes to a small index.
     // TODO: Implement an indexing function.
     // explode note contents and title by words
     $title = explode(" ", $note->title);
     $tmp = strip_tags(preg_replace('/[^a-zA-Z0-9[:space:]\\p{L}]/u', '', $note->content));
     $tmp = str_replace(["\n", "\r"], " ", $tmp);
     $content = explode(" ", $tmp);
     // Remove duplicates and reset array keys to Zero-based
     $content = array_values(array_unique($content));
     $suggestedNotes = [];
     $rel = [];
     // Now suggest tags for all words with > 3 letters
     for ($i = 0; $i < count($content); $i++) {
         if (strlen($content[$i]) > 3) {
             // I guess above 300+ notes this will be one of the slowest
             // functions in this whole app. Let's see if it breaks the
             // 60sec wall of the server ...
             $notes = Note::where('content', 'LIKE', '%' . $content[$i] . '%')->get();
             if (count($notes) > 0) {
                 foreach ($notes as $index => $n) {
                     // Compare the arrays to determine the relevancy
                     $suggestedNotes[$index] = $n->id;
                     $tmp = strip_tags(preg_replace('/[^a-zA-Z0-9[:space:]\\p{L}]/u', '', $n->content));
                     $tmp = str_replace(["\n", "\r"], " ", $tmp);
                     $suggestContent = explode(" ", $tmp);
                     // Remove duplicates and reset array keys to Zero-based
                     $suggestContent = array_values(array_unique($suggestContent));
                     $relevancy = count(array_intersect($content, $suggestContent));
                     $rel[$index] = $relevancy;
                 }
             }
         }
     }
     // Remove potential duplicate notes
     $suggestedNotes = array_values(array_unique($suggestedNotes));
     // now write the index of relevancy into the remaining $suggestedNotes
     unset($tmp);
     $tmp = [];
     foreach ($suggestedNotes as $index => $id) {
         $tmp[$index]['id'] = $id;
         $tmp[$index]['relevancy'] = $rel[$index];
     }
     $suggestedNotes = $tmp;
     return $suggestedNotes;
 }
 public function liveUser($id, $auditionStatus)
 {
     if (Auth::user()->user_role == 2) {
         return redirect()->route('live-view', [$id]);
     }
     $audition = Audition::find($id);
     $auditionDetails = AuditionDetails::where('audition_id', $id)->first();
     $auditioner = AuditionStatus::find($auditionStatus);
     $auditioner->seen = true;
     $auditioner->save();
     return view('audition.live', ['audition' => $audition, 'details' => $auditionDetails, 'auditioner' => $auditioner->user, 'notes' => Note::where('audition_status_id', $auditioner->id)->where('user_id', Auth::user()->id)->orderBy('id', 'desc')->get(), 'auditionStatusId' => $auditioner->id]);
 }
Example #24
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($device)
 {
     //
     $note = Note::where('device_id', $device->id)->where('past', 0)->first();
     return view('devices.edit', compact('device', 'note'));
 }