<div class="post-box">
                    <a href="{{ route('timeline.getTimeline', $post->user->id) }}"> <img class="img-rounded" src="{{ $post->user->portrait_large }}" width="50" height="50" alt=""> </a>
                    <div>
                        <h5><a href="{{ route('job.show', $post->slug) }}">{{ $post->title }}</a></h5>
                        <small>{{ date("M d, Y",strtotime($post->created_at)) }}</small>
                    </div>
                </div>
                @endforeach
            </div>
            {{-- /Recent Posts Widget --}}

            {{-- Tags Widget --}}
            <div class="widget">
                <div class="widget-title">
                    <h4>热议主题</h4>
                </div>
                <ul class="widget-tag">
                    <?php 
$categories = JobCategories::where('cat_status', 'open')->orderBy('sort_order')->get();
?>
                    @foreach($categories as $category)
                    <li>
                        <a href="{{ route('job.category', $category->id) }}" class="tag-link">{{ $category->name }}</a>
                    </li>
                    @endforeach
                </ul>
            </div>
            {{-- /Tags Widget --}}
        </div>
    </div>
</div>
 /**
  * Show search result
  * @return response
  */
 public function search()
 {
     $query = $this->model->orderBy('created_at', 'desc');
     $categories = JobCategories::orderBy('sort_order')->get();
     // Get search conditions
     switch (Input::get('target')) {
         case 'title':
             $title = Input::get('like');
             break;
     }
     // Construct query statement
     isset($title) and $query->where('title', 'like', "%{$title}%")->orWhere('content', 'like', "%{$title}%");
     $datas = $query->paginate(6);
     return View::make('job.search')->with(compact('datas', 'categories'));
 }
示例#3
0
 public function updateAction($id = null)
 {
     if ($this->request->isPost()) {
         $id = $this->request->getPost('id');
         $userSession = $this->session->get("userSession");
         $jobs = Jobs::findFirst($id);
         $jobs->modified = date('Y-m-d H:i:s');
         $jobs->member_id = $userSession['id'];
         $jobs->position = $this->request->getPost('position');
         $jobs->job_category_id = $this->request->getPost('job_category_id');
         $jobs->job_description = $this->request->getPost('job_description');
         $jobs->requirements = $this->request->getPost('requirements');
         $jobs->benefits = $this->request->getPost('benefits');
         $jobs->salary_from = $this->request->getPost('salary_from');
         $jobs->salary_to = $this->request->getPost('salary_to');
         $jobs->company = $this->request->getPost('company');
         $jobs->website = $this->request->getPost('website');
         $jobs->telephone = $this->request->getPost('telephone');
         $jobs->email = $this->request->getPost('email');
         $jobs->street = $this->request->getPost('street');
         $jobs->city = $this->request->getPost('city');
         $jobs->country_id = $this->request->getPost('country_id');
         $jobs->how_to_apply = $this->request->getPost('how_to_apply');
         if ($jobs->update()) {
             $id = $jobs->id;
             $this->flash->success('<button type="button" class="close" data-dismiss="alert">×</button>New job has been updated');
             return $this->response->redirect('job/view/' . $id);
         }
     }
     $this->view->setVar('job', Jobs::findFirst($id));
     $countries = Countries::find();
     $this->view->setVar('countries', $countries);
     $jobCategories = JobCategories::find();
     $this->view->setVar('jobCategories', $jobCategories);
 }
示例#4
0
 public function updateAction($id = null)
 {
     if ($this->request->isPost()) {
         $id = $this->request->getPost('id');
         $userSession = $this->session->get("userSession");
         $jobs = Jobs::findFirst($id);
         $jobs->modified = date('Y-m-d H:i:s');
         $jobs->member_id = $userSession['id'];
         $jobs->position = $this->request->getPost('position');
         $jobs->job_category_id = $this->request->getPost('job_category_id');
         $jobs->job_description = $this->request->getPost('job_description');
         $jobs->requirements = $this->request->getPost('requirements');
         $jobs->benefits = $this->request->getPost('benefits');
         $jobs->salary_from = $this->request->getPost('salary_from');
         $jobs->salary_to = $this->request->getPost('salary_to');
         $jobs->company = $this->request->getPost('company');
         $jobs->website = $this->request->getPost('website');
         $jobs->telephone = $this->request->getPost('telephone');
         $jobs->email = $this->request->getPost('email');
         $jobs->street = $this->request->getPost('street');
         $jobs->city = $this->request->getPost('city');
         $jobs->country_id = $this->request->getPost('country_id');
         $jobs->how_to_apply = $this->request->getPost('how_to_apply');
         if ($jobs->update()) {
             $this->flash->success('<button type="button" class="close" data-dismiss="alert">×</button>New job has been updated');
             if ($this->request->hasFiles() == true) {
                 set_time_limit(1200);
                 $uploads = $this->request->getUploadedFiles();
                 $isUploaded = false;
                 #do a loop to handle each file individually
                 foreach ($uploads as $upload) {
                     #define a “unique” name and a path to where our file must go
                     $fileName = $upload->getname();
                     $fileInfo = new SplFileInfo($fileName);
                     $fileExt = $fileInfo->getExtension();
                     $fileExt = strtolower($fileExt);
                     $newFileName = substr(md5(uniqid(rand(), true)), 0, 10) . date('ymdhis') . '.' . $fileExt;
                     //$fileExt = $upload->getExtension();
                     $fileImageExt = array('jpeg', 'jpg', 'png');
                     //error_log("File Extension :".$fileExt, 0);
                     $fileType = '';
                     $filePath = '';
                     $path = '';
                     //$path = ''.$newFileName;
                     if (in_array($fileExt, $fileImageExt)) {
                         $path = 'img/job/' . $newFileName;
                         $filePath = 'img/job/';
                         //$fileType = 'Image';
                     }
                     #move the file and simultaneously check if everything was ok
                     $upload->moveTo($path) ? $isUploaded = true : ($isUploaded = false);
                 }
                 #if any file couldn't be moved, then throw an message
                 if ($isUploaded) {
                     $jobLogo = JobLogos::findFirst('job_id="' . $id . '"');
                     if ($jobLogo) {
                         //delete previous logo first
                         unlink($jobLogo->file_path . $jobLogo->filename);
                         $jobLogo->created = date('Y-m-d H:i:s');
                         $jobLogo->modified = date('Y-m-d H:i:s');
                         $jobLogo->member_id = $userSession['id'];
                         $jobLogo->job_id = $id;
                         $jobLogo->file_path = $filePath;
                         $jobLogo->filename = $newFileName;
                         if ($jobLogo->update()) {
                         }
                         //before saving the new one
                     } else {
                         $jobLogo = new JobLogos();
                         $jobLogo->created = date('Y-m-d H:i:s');
                         $jobLogo->modified = date('Y-m-d H:i:s');
                         $jobLogo->member_id = $userSession['id'];
                         $jobLogo->job_id = $id;
                         $jobLogo->file_path = $filePath;
                         $jobLogo->filename = $newFileName;
                         if ($jobLogo->create()) {
                         }
                     }
                 }
             }
             return $this->response->redirect('job/view/' . $id);
         }
     }
     $this->view->setVar('job', Jobs::findFirst($id));
     $countries = Countries::find();
     $this->view->setVar('countries', $countries);
     $jobCategories = JobCategories::find();
     $this->view->setVar('jobCategories', $jobCategories);
     $jobLogo = JobLogos::findFirst('job_id="' . $id . '"');
     if ($jobLogo) {
         $jobLogo = $jobLogo->file_path . $jobLogo->filename;
     } else {
         $jobLogo = 'http://placehold.it/200x200';
     }
     $this->view->setVar('jobLogo', $jobLogo);
 }
示例#5
0
 /**
  * Resource edit view
  * GET         /resource/{id}/edit
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data = $this->model->find($id);
     $categoryLists = JobCategories::lists('name', 'id');
     $job = $this->model->where('slug', $data->slug)->first();
     return View::make($this->resourceView . '.edit')->with(compact('data', 'categoryLists', 'job'));
 }