/**
  * set activity default field values
  */
 protected function setDefaultFieldValues()
 {
     $defaultFieldValues = $this->settingsModel->where('organization_id', $this->orgId)->first()->default_field_values;
     $this->activityData['default_field_values'] = $defaultFieldValues;
     $this->activityData['collaboration_type'] = $defaultFieldValues[0]['default_collaboration_type'];
     $this->activityData['default_flow_type'] = $defaultFieldValues[0]['default_flow_type'];
     $this->activityData['default_finance_type'] = $defaultFieldValues[0]['default_finance_type'];
     $this->activityData['default_aid_type'] = $defaultFieldValues[0]['default_aid_type'];
     $this->activityData['default_tied_status'] = $defaultFieldValues[0]['default_tied_status'];
 }
 /**
  * return default field groups
  * @return mixed
  */
 public function get()
 {
     $orgId = Activity::find(request()->route()->activity)->organization_id;
     $settings = Settings::where('organization_id', $orgId)->first();
     $defaultFieldGroups = $settings->default_field_groups[0];
     $identification = isset($defaultFieldGroups['Identification']) ? $defaultFieldGroups['Identification'] : [];
     $defaultFieldGroup['Identification'] = array_merge(['reporting_organization' => 'Reporting Organization', 'iati_identifier' => 'Activity Identifier'], $identification);
     $defaultFieldGroups = $defaultFieldGroup + $defaultFieldGroups;
     return $defaultFieldGroups;
 }
Пример #3
0
 public function postSave(Request $request)
 {
     $Input = $request->all();
     try {
         foreach ($Input as $key => $value) {
             if ($key != 'user_decoded') {
                 Settings::where('key', $key)->update(['value' => $value]);
             }
         }
     } catch (Exception $e) {
         $this->error = true;
         return $this->ResponseData([]);
     }
     return $this->ResponseData([]);
 }
 /**
  * @param $organization_id
  * @return mixed
  */
 public function getSettings($organization_id)
 {
     return $this->settings->where('organization_id', $organization_id)->first();
 }
 /**
  * Deletes favicon
  * 
  * @return Response
  */
 public function getDeleteFavicon()
 {
     Session::put('settings_tab', 'favicon');
     $path = public_path(Settings::getFavicon());
     file_exists($path) ? unlink($path) : null;
     Settings::where('param', 'favicon')->update(['value' => null]);
     Cache::flush('settings');
     flash()->success(trans('settings.favicon_deleted'));
     return redirect()->back();
 }
Пример #6
0
 public function signupNewuser()
 {
     $rules = array('fname' => 'required', 'email' => 'required|email', 'password' => 'required|min:4|confirmed', 'password_confirmation' => 'required|min:4');
     $input = \Input::all();
     $valid = Validator::make($input, $rules);
     if ($valid->fails()) {
         //return $valid->getMessageBag()->toArray();
         return Redirect::back()->with('error', $valid);
     } else {
         $status = 'active';
         $admin_status = \App\models\Settings::where('setting_name', 'todo_validation')->first();
         if ($admin_status->setting_value == 0) {
             $status = 'block';
         }
         $password = \Hash::make($input['password']);
         $user = new User();
         $user->fname = $input['fname'];
         $user->lname = $input['lname'];
         $user->email = $input['email'];
         $user->password = $password;
         $user->address = $input['address'];
         $user->status = $status;
         $user->roll_id = 2;
         $user->save();
     }
 }
Пример #7
0
 /**
  * Handle a login request to the application.
  *
  * @param Request|\Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function postLogin(Request $request)
 {
     $this->validate($request, ['login' => 'required', 'password' => 'required']);
     $login = $request->input('login');
     $field = filter_var($login, FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
     $request->merge([$field => $login]);
     $credentials = $request->only($field, 'password');
     try {
         if ($this->requiresPasswordReset($credentials)) {
             $this->resetPassword($credentials['password']);
         }
         if (Auth::attempt($credentials, $request->has('remember'))) {
             if (!Auth::user()->enabled) {
                 Auth::logout();
                 return redirect('/auth/login')->withErrors("Your account has been disabled. Please contact us at <a href='mailto:support@aidstream.org'>support@aidstream.org</a> ");
             }
             $user = Auth::user();
             Session::put('role_id', $user->role_id);
             Session::put('org_id', $user->org_id);
             Session::put('admin_id', $user->id);
             $settings = Settings::where('organization_id', $user->org_id)->first();
             $settings_check = isset($settings);
             $version = $settings_check ? $settings->version : config('app.default_version');
             Session::put('current_version', $version);
             $versions_db = $this->database->table('versions')->get();
             $versions = [];
             foreach ($versions_db as $ver) {
                 $versions[] = $ver->version;
             }
             $versionKey = array_search($version, $versions);
             $next_version = end($versions) == $version ? null : $versions[$versionKey + 1];
             Session::put('next_version', $next_version);
             $version = 'V' . str_replace('.', '', $version);
             Session::put('version', $version);
             $redirectPath = $user->role_id == 1 || $user->role_id == 2 ? config('app.admin_dashboard') : config('app.super_admin_dashboard');
             $intendedUrl = Session::get('url.intended');
             !(($user->role_id == 3 || $user->role_id == 4) && strpos($intendedUrl, '/admin') === false) ?: ($intendedUrl = url('/'));
             !($intendedUrl == url('/')) ?: Session::set('url.intended', $redirectPath);
             return redirect()->intended($redirectPath);
         }
         return redirect($this->loginPath())->withInput($request->only($field, 'remember'))->withErrors([$field => $this->getFailedLoginMessage()]);
     } catch (\Exception $exception) {
         return redirect()->back()->withErrors($exception->getMessage());
     }
 }
 public function putAvatar(Request $request)
 {
     Session::put('settings_tab', 'avatars');
     Settings::where('param', 'use_avatars')->update(['value' => $request->input('use_avatars') ? true : null]);
     Cache::flush('settings');
     flash()->success(trans('settings.avatars_updated'));
     return redirect()->back();
 }