Ejemplo n.º 1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     if (Auth::user()->admin) {
         $data['user'] = User::find($id);
         $data['individuals'] = Individual::orderBy('surname')->orderBy('firstname')->get();
         return View::make('users.edit', $data);
     } else {
         return view('shared.unauthorised');
     }
 }
Ejemplo n.º 2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data['parray'] = array('circuit_stewards', 'treasurer', 'superintendent', 'circuit_secretary', 'site_editors', 'supervisor_of_studies', 'local_preachers_secretary');
     $data['setting'] = Setting::where('setting_field', '=', $id)->firstOrFail();
     if (in_array($data['setting']->setting_field, $data['parray'])) {
         $data['chosenind'] = explode(',', $data['setting']->setting_value);
         $data['individuals'] = Individual::orderBy('surname')->orderBy('firstname')->get();
     }
     return View::make('settings.edit', $data);
 }
Ejemplo n.º 3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     if (in_array(Auth::user()->individual_id, explode(',', Helpers::getSetting('site_editors')))) {
         $data['minister'] = Minister::findOrFail($id);
         $data['societies'] = $data['minister']->societies;
         $data['individuals'] = Individual::orderBy('surname')->orderBy('firstname')->get();
         $data['allsocieties'] = Society::orderBy('society')->get();
         return View::make('ministers.edit', $data);
     } else {
         return view('shared.unauthorised');
     }
 }
Ejemplo n.º 4
0
 public function welcome()
 {
     if (!Schema::hasTable('settings')) {
         $data['firsttime'] = "yes";
         return view('firsttime', $data)->with('okmessage', 'Please create a user before you can use Connexion');
     }
     $user = Auth::user();
     if ($user and $user->individual_id) {
         $today = date('d-m-Y');
         $data['tasks'] = Task::where('donedate', '=', '')->where('project_id', '<>', 0)->where('individual_id', $user->individual_id)->orderBy('duedate')->get();
         $data['personal'] = Task::where('donedate', '=', '')->where('project_id', '=', 0)->where('individual_id', $user->individual_id)->orderBy('duedate')->get();
         $data['individuals'] = Individual::orderBy('surname')->get();
         $data['projects'] = Project::with('undonetask')->where('individual_id', $user->individual_id)->orderBy('project')->get();
         $data['projectselect'] = Project::orderBy('project')->lists('project', 'id');
         $data['page_title'] = Helpers::getSetting('circuit_name') . " Circuit";
         $data['page_description'] = "Administrator home page";
         $socs = Permission::where('user_id', '=', $user->id)->select('society_id')->get();
         foreach ($socs as $soc) {
             $thissoc = Society::where('id', '=', $soc->society_id)->get();
             $dum['googleCalendarId'] = $thissoc[0]->society_calendar;
             $dum['color'] = $thissoc[0]->calendar_colour;
             $data['cals'][] = $dum;
         }
         $dum['googleCalendarId'] = Helpers::getSetting('circuit_calendar');
         $dum['color'] = 'black';
         $data['cals'][] = $dum;
         if (Helpers::is_online() and $user->googlecalendar != "") {
             $privatecal = new GoogleCalendar();
             $pcals = $privatecal->getTen($user->googlecalendar);
             foreach ($pcals as $pcal) {
                 $pcal['color'] = $user->calendar_colour;
                 $data['pcals'][] = $pcal;
             }
         } else {
             $data['pcals'] = array();
         }
         if (!count($socs)) {
             $soc = strtolower($user->individual->household->society->society);
             return redirect()->action('SocietiesController@show', $soc);
         } else {
             return view('home', $data);
         }
     } elseif ($user) {
         return view('shared.registered');
     } else {
         return view('landingwebpage');
     }
 }
Ejemplo n.º 5
0
 public function composeMessage($society, $type)
 {
     $today = date('d-m-Y');
     $data['society'] = $society;
     $soc = Society::find($society);
     if ($type == "sms") {
         $username = $soc->sms_username;
         $pword = $soc->sms_password;
         if ($soc->sms_provider == "bulksms") {
             if (Helpers::is_online()) {
                 $data['credits'] = SMSfunctions::BS_get_credits($username, $pword);
             } else {
                 $data['credits'] = "Bulk SMS is offline";
             }
         } elseif ($soc->sms_provider == "smsfactory") {
             if (Helpers::is_online()) {
                 $data['credits'] = intval(SMSfunctions::SF_checkCredits($username, $pword));
             } else {
                 $data['credits'] = "Bulk SMS is offline";
             }
         } else {
             $data['credits'] = "SMS credentials are not set up yet";
         }
         $data['perms'] = Permission::where('user_id', '=', Auth::user()->id)->where('sms', '=', 1)->select('society_id')->get()->toArray();
     } else {
         $data['perms'] = Permission::where('user_id', '=', Auth::user()->id)->where('email', '=', 1)->select('society_id')->get()->toArray();
     }
     foreach ($data['perms'] as $perm) {
         $psoc[] = $perm['society_id'];
     }
     $data['indivs'] = Individual::orderBy('surname')->orderBy('firstname')->get();
     $data['groups'] = Group::with('individual')->wherein('society_id', $psoc)->orderBy('groupname')->get();
     $view = "messages." . $type;
     if ($type == "sms" and (Helpers::perm('admin', $society) or Helpers::perm('sms', $society))) {
         return view('messages.sms', $data);
     } elseif ($type == "email" and (Helpers::perm('admin', $society) or Helpers::perm('email', $society))) {
         return view('messages.email', $data);
     } else {
         return view('shared.unauthorised');
     }
 }
Ejemplo n.º 6
0
 /**
  * Show the form for editing the specified resource.
  * GET /projects/{id}/edit
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($society, $id)
 {
     $project = Project::find($id);
     if (Helpers::perm('admin', $society) or Helpers::perm('edit', $society) or $project->individual_id == Auth::user()->individual_id) {
         $portfolios = Portfolio::orderBy('portfolio')->lists('portfolio', 'id');
         $individuals = Individual::orderBy('surname')->get();
         return View::make('projects.edit')->with('project', $project)->with('individuals', $individuals)->with('portfolios', $portfolios)->with('society', $society);
     } else {
         return view('shared.unauthorised');
     }
 }
Ejemplo n.º 7
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     if (in_array(Auth::user()->individual_id, explode(',', Helpers::getSetting('site_editors'))) or Auth::user()->individual_id == Helpers::getSetting('local_preachers_secretary')) {
         $data['individuals'] = Individual::orderBy('surname')->orderBy('firstname')->get();
         $data['preacher'] = Preacher::find($id);
         $data['societies'] = Society::all();
         return View::make('preachers.edit', $data);
     } else {
         return view('shared.unauthorised');
     }
 }