public function getDetail($id)
 {
     $_id = new MongoId($id);
     $history = History::where('historyObject._id', $_id)->where('historyObjectType', 'asset')->orderBy('historyTimestamp', 'desc')->orderBy('historySequence', 'desc')->get();
     $diffs = array();
     foreach ($history as $h) {
         $h->date = date('Y-m-d H:i:s', $h->historyTimestamp->sec);
         $diffs[$h->date][$h->historySequence] = $h->historyObject;
     }
     $history = History::where('historyObject._id', $_id)->where('historyObjectType', 'asset')->where('historySequence', 0)->orderBy('historyTimestamp', 'desc')->get();
     $tab_data = array();
     foreach ($history as $h) {
         $apv_status = Assets::getApprovalStatus($h->approvalTicket);
         if ($apv_status == 'pending') {
             $bt_apv = '<span class="btn btn-info change-approval ' . $h->approvalTicket . '" data-id="' . $h->approvalTicket . '" >' . $apv_status . '</span>';
         } else {
             if ($apv_status == 'verified') {
                 $bt_apv = '<span class="btn btn-success" >' . $apv_status . '</span>';
             } else {
                 $bt_apv = '';
             }
         }
         $d = date('Y-m-d H:i:s', $h->historyTimestamp->sec);
         $tab_data[] = array($d, $h->historyAction, $h->historyObject['itemDescription'], $h->historyAction == 'new' ? 'NA' : $this->objdiff($diffs[$d]), $bt_apv);
     }
     $header = array('Modified', 'Event', 'Name', 'Diff', 'Approval');
     $attr = array('class' => 'table', 'id' => 'transTab', 'style' => 'width:100%;', 'border' => '0');
     $t = new HtmlTable($tab_data, $attr, $header);
     $itemtable = $t->build();
     $asset = Asset::find($id);
     Breadcrumbs::addCrumb('Ad Assets', URL::to(strtolower($this->controller_name)));
     Breadcrumbs::addCrumb('Detail', URL::to(strtolower($this->controller_name) . '/detail/' . $asset->_id));
     Breadcrumbs::addCrumb($asset->SKU, URL::to(strtolower($this->controller_name)));
     return View::make('history.table')->with('a', $asset)->with('title', 'Asset Detail ' . $asset->itemDescription)->with('table', $itemtable);
 }
 public function index()
 {
     if (!Auth::check()) {
         return Redirect::to('/');
     }
     $user = Auth::user();
     if (Scheduler::where('uid', '=', $user->id)->count() > 0) {
         return Redirect::to('/inline');
     }
     $count_matches = History::where('uid', '=', $user->id)->count();
     //return Scheduler::where('uid', '=', $user->id)->count();
     return View::make('sessions.index', ['count' => $count_matches]);
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $log = new Process();
     $log->name = "make-history";
     $log->status = "running";
     $log->save();
     $today = Carbon::today();
     $topToday = array();
     $newspapers = Newspaper::select('id')->get();
     $tags = Tag::select('id')->get();
     foreach ($newspapers as $key => $n) {
         $top = $this->getTopLink($today, $n->id, false);
         if ($top) {
             $topToday[] = $top;
         }
     }
     foreach ($tags as $key => $t) {
         $top = $this->getTopLink($today, false, $t->id);
         if ($top) {
             $topToday[] = $top;
         }
     }
     $topToday = array_unique($topToday);
     //Remove links for today
     History::where('date', '=', $today)->delete();
     //Save history
     foreach ($topToday as $key => $t) {
         $this->info($t->title);
         try {
             $h = new History();
             $h->id_ref = $t->id;
             unset($t->id);
             $h->fill($t->toArray());
             $h->date = $today;
             $h->save();
         } catch (Exception $e) {
         }
     }
     $log->status = "finished";
     $log->save();
 }
Esempio n. 4
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (!Auth::check()) {
         return Redirect::to('/');
     }
     $user = Auth::user();
     if (Scheduler::where('uid', '=', $user->id)->count() > 0) {
         return Redirect::to('/inline');
     }
     $zipcode = Session::get('zipcode');
     $gender = Session::get('gender');
     if (!isset($zipcode) || !isset($gender)) {
         return Redirect::route('sessions.index');
     }
     $query = "search?location=" . $zipcode[0] . "&term=";
     $cuisines = Session::get('cuisines');
     for ($i = 0; $i < count($cuisines); $i++) {
         $query = $query . $cuisines[$i] . "+";
     }
     $query = $query . "food";
     //return $query;
     $results = Shareameal\Yelp\Yelp::search($query);
     if (!isset($results)) {
         return Redirect::to('/404error');
     }
     //Get relevant information and send to view
     $businesses_id = array_fetch($results['businesses'], 'id');
     $businesses_name = array_fetch($results['businesses'], 'name');
     $businesses_locations = array_fetch($results['businesses'], 'location.address');
     $businesses_url = array_fetch($results['businesses'], 'url');
     $waiting = [];
     for ($j = 0; $j < count($businesses_id); $j++) {
         $count = Scheduler::where('rid', '=', $businesses_id[$j])->count();
         if ($count >= 1) {
             $sch = Scheduler::where('rid', '=', $businesses_id[$j])->firstorFail();
             //$waiting[] = $sch;
             $scheduler_user = User::find($sch->uid);
             if ($gender[0] == "either" || $scheduler_user->gender == $gender[0]) {
                 //Gender Test Passed on Current User
                 if ($sch->gender == "either" || $sch->gender == $user->gender) {
                     // Gender Test Passed on user in Scheduler
                     #return History::where('uid', '=' ,$user->id)->where('matched_id', '=',$scheduler_user->id)->where('ban', '=', 'yes')->count();
                     if (History::where('uid', '=', $user->id)->where('matched_id', '=', $scheduler_user->id)->where('ban', '=', 'yes')->count() == 0 && History::where('uid', '=', $scheduler_user->id)->where('matched_id', '=', $user->id)->where('ban', '=', 'yes')->count() == 0) {
                         //Not on each others ban list
                         array_push($waiting, $sch);
                         // Then add this restaurant to the waiting restaurants
                     }
                 }
             }
             // Remove this restaurant from the list
             unset($businesses_id[$j]);
             unset($businesses_name[$j]);
             unset($businesses_locations[$j]);
             unset($businesses_url[$j]);
             $businesses_id = array_values($businesses_id);
             $businesses_name = array_values($businesses_name);
             $businesses_locations = array_values($businesses_locations);
             $businesses_url = array_values($businesses_url);
             $j--;
         }
     }
     return View::make('results.show', ['waiting' => $waiting, 'rest_id' => $businesses_id, 'rest_name' => $businesses_name, 'rest_locations' => $businesses_locations, 'rest_url' => $businesses_url]);
 }
Esempio n. 5
0
 public function history()
 {
     $searchcontent = Input::get('searchcontent');
     $createdtime = Input::get('registration_date');
     $data = History::where('assetcode', $searchcontent)->where('created_at', '>', $createdtime)->get();
     return view('history', compact('data'));
 }
Esempio n. 6
0
      <td><strong><?php 
echo $this->t('user_edits');
?>
</strong></td>
      <td><?php 
echo $this->linkTo(History::where(['user_id' => $this->user->id])->count(), array('history#index', 'search' => 'user:'******'user_tag_edits');
?>
</strong></td>
      <td><?php 
echo $this->linkTo(History::where(['user_id' => $this->user->id, 'group_by_table' => 'posts'])->count(), array('history#index', 'search' => 'type:post user:'******'user_note_edits');
?>
</strong></td>
      <td><?php 
echo $this->linkTo(NoteVersion::where(['user_id' => $this->user->id])->count(), array('note#history', 'user_id' => $this->user->id));
?>
</td>
    </tr>
    <tr>
      <td><strong><?php 
Esempio n. 7
0
 public function renderHistoryView()
 {
     $user = Auth::user();
     $history = History::where('uid', '=', $user->id)->get();
     return View::make('history.index', ['history' => $history]);
 }