public function update_names() { $file = fopen(public_path() . "/media/ITSP2015/final_team_details.csv", "r"); while (!feof($file)) { $csv = fgetcsv($file); $team = ITSP::find($csv[1]); try { $team->team_name = $csv[2]; $team->project_name = $csv[3]; $team->save(); } catch (Exception $e) { print $csv[1] . " " . $csv[2] . " " . $csv[3] . "<br>"; } } fclose($file); }
<?php $auth = 0; $user = NULL; $by = 1; $data = NULL; if (Auth::check()) { $user = Auth::User()->id; } else { $user = "******"; } if (isset($_GET['id'])) { $data = ITSP::find($_GET['id']); if ($data == NULL) { echo "No team found"; return; } $data = $data->toArray(); $by = $data['user_id']; $by2 = $data['user_id2']; $by3 = $data['user_id3']; $by4 = $data['user_id4']; $by5 = $data['user_id5']; if ($by == $user || $by2 == $user || $by3 == $user || $by4 == $user || $by5 == $user) { $auth = 1; } else { $auth = 0; } // echo $auth." ".$by." ".$user; } else { echo "invalid url. Try www.stab-iitb.org/itsp/documentation?id={your itsp id}";
/** * Demo for bubble sort * * Demo for binary search */ public static function demo() { /** * Demo data: * * $arr = []; * for($i=0; $i<100; $i++) * $arr[] = $i; * shuffle($arr); */ $arr = [1, 3, 5, 2, 9, 10, 1]; $new = ITSP::mergeSort($arr); var_dump($new); exit; $new = ITSP::insertSort($arr); var_dump($new); exit; $new = ITSP::selectSort($arr); var_dump($new); exit; $new = ITSP::bubbleSort($arr); $count = count($new); var_dump($new); $val = 5; print self::binarySearch($new, $val, 0, $count - 1); $val = 7; print self::binaerSearchIterative($new, $val, 0, $count - 1); }