public function getMyprofile()
 {
     $id = Auth::user()->id;
     $alumni_id = null;
     $sql = "SELECT * FROM alumni WHERE account_id = ?";
     $prof = DB::select($sql, array($id));
     if ($prof != null) {
         $alumni_id = $prof[0]->id;
     }
     $sql2 = "SELECT * FROM degree WHERE alumni_id = ?";
     $deg = DB::select($sql2, array($alumni_id));
     $sql3 = "SELECT * FROM work_experience WHERE alumni_id = ?";
     $wrk_exp = DB::select($sql3, array($alumni_id));
     $sql4 = "SELECT * FROM certificate WHERE alumni_id = ?";
     $certificate = DB::select($sql4, array($alumni_id));
     // $sql5 = "SELECT * FROM alumni_tracer WHERE alumni_id = ?";
     $sql5 = "SELECT at.*, sq.question, sc.choice\n\t\t\t\tFROM alumni_tracer AS at\n\t\t\t\tINNER JOIN survey_questions AS sq\n\t\t\t\tON sq.id = at.question_id\n\t\t\t\tINNER JOIN survey_choices AS sc\n\t\t\t\tON sc.id = at.choice_id\n\t\t\t\tWHERE at.alumni_id = ?\n\t\t\t\tORDER BY at.question_id";
     $a_tracer = DB::select($sql5, array($alumni_id));
     $dept = Department::all();
     $region = Region::all();
     $province = Province::all();
     $occupation = Occupation::all();
     $company = Company::all();
     $deg_title = DegreeTitle::all();
     $school = School::all();
     $jobs = Job::all();
     $field = Field::all();
     $questions = DB::select("SELECT * FROM survey_questions");
     $civil_status = DB::select("SELECT * FROM civil_status");
     return View::make('user.profile')->with('company', $company)->with('field', $field)->with('occupation', $occupation)->with('work_exp', $wrk_exp)->with('degree', $deg)->with('a_tracer', $a_tracer)->with('certificate', $certificate)->with('school', $school)->with('deg_title', $deg_title)->with('profile', $prof)->with('dept', $dept)->with('region', $region)->with('province', $province)->with('civil_status', $civil_status)->with('questions', $questions)->with('jobs', $jobs);
 }
Esempio n. 2
0
 /**
  * Execute the console command
  *
  * @return void
  */
 public function fire()
 {
     // Check for a list option
     $list = $this->option('list');
     $job_name = $this->argument('jobname');
     if (empty($list) && !empty($job_name)) {
         $inputController = new InputController();
         list($collection_uri, $name) = $inputController->getParts($job_name);
         // Check if the job exists
         $job = \Job::where('name', '=', $name)->where('collection_uri', '=', $collection_uri)->first();
         if (empty($job)) {
             $this->error("The job with identified by: {$job_name} could not be found.\n");
             exit;
         }
         $this->info('The job has been found.');
         // Configure a log handler if configured
         $this->addLogHandler();
         $startDate = new Carbon();
         $iso8601 = $startDate->toISo8601String();
         \Log::info("Executing job {$name} at {$iso8601}");
         try {
             $job_exec = new JobExecuter($job, $this);
             $job_exec->execute();
         } catch (\Exception $ex) {
             $endDate = new Carbon();
             $iso8601 = $endDate->toISO8601String();
             \Log::error("The job {$job_name} has failed at {$iso8601}");
             \Log::error($ex->getMessage());
             \Log::error($ex->getTraceAsString());
         }
         $endDate = new Carbon();
         $iso8601 = $endDate->toISO8601String();
         $job->date_executed = time();
         $job->added_to_queue = false;
         $job->save();
         \Log::info("The job has ended at {$iso8601}");
     } else {
         $jobs = \Job::all(['name', 'collection_uri'])->toArray();
         if (!empty($jobs)) {
             $this->info("=== Job names ===");
             foreach ($jobs as $job) {
                 $this->info($job['collection_uri'] . '/' . $job['name']);
             }
         } else {
             $this->info("No jobs found.");
         }
     }
 }
Esempio n. 3
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $queue = $this->argument('queue') ? $this->argument('queue') : \Config::get('queue.connections.beanstalkd.queue');
     $this->info(sprintf('Clearing queue: %s', $queue));
     $pheanstalk = \Queue::getPheanstalk();
     $pheanstalk->useTube($queue);
     $pheanstalk->watch($queue);
     while ($job = $pheanstalk->reserve(0)) {
         $pheanstalk->delete($job);
     }
     // Set the flag of the jobs
     $jobs = \Job::all();
     foreach ($jobs as $job) {
         $job->added_to_queue = false;
         $job->save();
     }
     $this->info('The Beankstalk queue has been cleared.');
 }
Esempio n. 4
0
File: Export.php Progetto: tdt/input
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     // Get the file option from the command line
     $filename = $this->option('file');
     if (empty($filename)) {
         $filename = self::getExportFile();
     }
     // Get the jobid, if none is provided, return all of the jobs by default
     $jobid = $this->argument('jobid');
     $content = null;
     if (empty($jobid)) {
         $jobs = \Job::all();
         $content = array();
         foreach ($jobs as $job) {
             $content[$job->collection_uri . '/' . $job->name] = $job->getAllProperties();
         }
         $content = json_encode($content);
     } else {
         $job = InputController::get($jobid);
         if (empty($job)) {
             $this->error("No input job has been found with the given identifer ({$jobid}).");
             die;
         }
         $content[$job->collection_uri . '/' . $job->name] = $job->getAllProperties();
         $content = json_encode($content);
     }
     try {
         // Write to file
         $fs = new Filesystem();
         if ($fs->exists($filename)) {
             $fs->put($filename, $content);
         } else {
             $handle = fopen($filename, "w");
             if (!$handle) {
                 \App::abort('Could not open/create the file ' . $filename);
             }
             fwrite($handle, $content);
         }
         $this->info("The export has been written to the file '{$filename}'.");
     } catch (Exception $e) {
         $this->error("The contents could not be written to the file '{$filename}'.");
         die;
     }
 }
Esempio n. 5
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     // Get the file option from the command line
     $filename = $this->option('file');
     if (empty($file)) {
         $file = self::getExportFile();
     }
     // Get the jobid, if none is provided, return all of the jobs by default
     $jobid = $this->argument('jobid');
     $content = null;
     if (empty($jobid)) {
         $jobs = \Job::all();
         $content = array();
         foreach ($jobs as $job) {
             $content[$job->collection_uri . '/' . $job->name] = $job->getAllProperties();
         }
         $content = json_encode($content);
     } else {
         $job = InputController::get($jobid);
         if (empty($job)) {
             $this->error("No input job has been found with the given identifer ({$jobid}).");
             die;
         }
         $content[$job->collection_uri . '/' . $job->name] = $job->getAllProperties();
         $content = json_encode($content);
     }
     // Output
     if (empty($filename)) {
         // Print to console
         echo $content;
     } else {
         try {
             // Write to file
             file_put_contents($filename, $content);
             $this->info("The export has been written to the file '{$filename}'.");
         } catch (Exception $e) {
             $this->error("The contents could not be written to the file '{$filename}'.");
             die;
         }
     }
 }
Esempio n. 6
0
 /**
  * Return a list of jobs
  *
  * @return \View
  */
 private function listJobs()
 {
     // Get list of jobs
     $jobs = \Job::all();
     return \View::make('input::ui.jobs.list')->with('title', 'Jobs management | The Datatank')->with('jobs', $jobs);
 }
Esempio n. 7
0
    }
    $app->response->body($pros->toJson());
});
//---------------------------//
//------JOBS FUNCTIONS-------//
/*
 * Get Jobs(all) - OK
 * Job details - OK
 * New Job - OK
 * Edit Job - OK
 * Delete Job - OK
 * Take offer -
 */
//Job by any condition
$app->get("/jobs", function () use($app) {
    $app->response->body(Job::all()->toJson());
});
//Job Details
$app->get("/job/:job_id", function ($job_id) use($app) {
    $job = Job::find($job_id);
    $app->response->body($job->toJson());
});
//New job
$app->post('/job/new/', function () use($app) {
    $params = $app->request()->params();
    //Get all aprameters
    $r = Job::new_job($params);
    $app->response->body($r);
});
//Edit Job
$app->post('/job/update', function () use($app) {
 public function feed()
 {
     $jobs = Job::all()->toArray();
     return Response::json(['data' => $jobs], 200);
 }
Esempio n. 9
0
 /**
  * GET a job based on the uri provided
  *
  * @return \Response
  */
 private function getJob()
 {
     $uri = $this->getUri();
     // If the uri is nothing, return a list of all the jobs
     if ($uri == '/') {
         $jobs = \Job::all();
         $input_document = array();
         foreach ($jobs as $job) {
             $input_document[$job->collection_uri . '/' . $job->name] = $job->getAllProperties();
         }
         return $this->makeResponse(str_replace('\\/', '/', json_encode($input_document)), 200);
     }
     if (!$this->exists($uri)) {
         \App::abort(404, "No job has been found with the uri {$uri}");
     }
     // Get Definition object based on the given uri
     $job = $this->get($uri);
     $job = $job->getAllProperties();
     return $this->makeResponse(str_replace('\\/', '/', json_encode($job)), 200);
 }
Esempio n. 10
0
 /**
  * Display a listing of jobs
  *
  * @return Response
  */
 public function index()
 {
     $jobs = Job::all();
     return View::make('jobs.index', compact('jobs'));
 }