Esempio n. 1
0
 public function expert($id)
 {
     if (isset($id)) {
         $expert = Expert::find($id)->with('specialties')->with('memberships')->with('qualifications')->with('achievements')->with('services')->with('socials')->first();
         if (isset($expert)) {
             if (isset($expert->image_name)) {
                 $expertPic = asset('public/uploads/experts/' . $expert->id . '/' . $expert->image_name);
                 $fileLocation = public_path() . '\\uploads\\experts\\' . $expert->id . '\\' . $expert->image_name;
                 if (!file_exists($fileLocation)) {
                     $expertPic = asset('public/images/expert.jpg');
                 }
             } else {
                 $expertPic = asset('public/images/expert.jpg');
             }
             $expertTitle = 'Mr';
             if (strtolower($expert->gender) == 'female') {
                 $expertTitle = 'Ms';
             }
             $expertName = $expert->first_name . ' ' . $expert->last_name;
             return View::make('expert.detail')->with('expert', $expert)->with('expertPic', $expertPic)->with('expertTitle', $expertTitle)->with('expertName', $expertName);
         } else {
             return Redirect::to('/');
         }
     } else {
         return Redirect::to('/');
     }
 }
Esempio n. 2
0
 function isExpert()
 {
     $repo = $this->requireRepository();
     $user = $this->getConnectedUser();
     $expert = $this->Expert->find('first', array('conditions' => array('repository_id' => $repo['Repository']['id'], 'user_id' => $user['User']['id']), 'recursive' => -1));
     if (empty($expert)) {
         return false;
     }
     return true;
 }
Esempio n. 3
0
 function dataGetExpert($id)
 {
     $expert = Expert::find($id);
     return $expert;
 }
 public function updateExpert()
 {
     $adminId = Session::get('admin_id');
     if (!isset($adminId)) {
         return json_encode(array('message' => 'done'));
     }
     $currentExpertId = Session::get('current_expert_id');
     if (!isset($currentExpertId)) {
         return json_encode(array('message' => 'invalid'));
     }
     $email = Input::get('email');
     if ($this->isDuplicateExpert($email) === 'no') {
         $expert = Expert::find($currentExpertId);
         if (isset($expert)) {
             $password = Input::get('password');
             $expert->name = Input::get('name');
             $expert->contact_number = Input::get('contact_number');
             $expert->email = Input::get('email');
             if (strlen(trim($password)) > 0) {
                 $expert->password = md5(Input::get('password'));
             }
             $expert->gender = Input::get('gender');
             $expert->highest_qualification = Input::get('highest_qualification');
             $expert->save();
             return json_encode(array('message' => 'done'));
         } else {
             return json_encode(array('message' => 'invalid'));
         }
     } else {
         return json_encode(array('message' => 'duplicate'));
     }
 }
 public function sendExpertEmail()
 {
     ini_set('max_execution_time', 3600);
     if (is_null(Session::get('expert_id'))) {
         return View::make('static.index');
     } else {
         $id = Session::get('expert_id');
         $expert = Expert::find($id);
         $data = array('name' => $expert->email);
         Mail::send('emails.expert-register-mail', $data, function ($message) use($expert) {
             $message->to($expert->email, $expert->first_name . ' ' . $expert->last_name)->subject('Welcome to ..');
         });
     }
     return View::make('authentication.expert-saved')->with('expert_email', $expert->email);
 }