Exemplo n.º 1
0
 public function singleSms($society, $id)
 {
     if (Helpers::perm('admin', $society) or Helpers::perm('sms', $society)) {
         $soc = Society::find($society);
         $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['indiv'] = Individual::find($id);
         $data['society'] = $society;
         return View::make('messages.singlesms', $data);
     } else {
         return view('shared.unauthorised');
     }
 }
Exemplo n.º 2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $today = date('Y-m-d');
     $indivs = Task::with('individual')->select('individual_id')->groupBy('individual_id')->get();
     foreach ($indivs as $ind) {
         if ($ind->individual->slack != "") {
             $society = $ind->individual->household->society->society . " Methodist Church";
             $otasks = Task::with('project')->where('individual_id', '=', $ind->individual->id)->where('donedate', '=', '')->where('duedate', '<', $today)->orderBy('duedate')->get();
             $itasks = Task::with('project')->where('individual_id', '=', $ind->individual->id)->where('donedate', '=', '')->where('duedate', '=', $today)->orderBy('duedate')->get();
             $projects = Project::with('task')->where('individual_id', '=', $ind->individual->id)->get();
             if (count($itasks) or count($otasks)) {
                 $msg = "Good morning, " . $ind->individual->firstname . "\n\nHere is a list of your overdue/upcoming project tasks:\n\n";
                 if (count($otasks)) {
                     $msg .= "*Overdue tasks*\n\n";
                 }
                 foreach ($otasks as $ot) {
                     $msg .= "_" . $ot->project->project . ":_ " . $ot->description . " (Due: *" . $ot->duedate . "*)\n";
                 }
                 $msg .= "\n";
                 if (count($itasks)) {
                     $msg .= "*Tasks due today*\n\n";
                 }
                 foreach ($itasks as $it) {
                     $msg .= $it->project->project . ": " . $it->description . "\n";
                 }
                 if (count($projects)) {
                     $msg .= "*Summary of your projects*\n\n";
                     foreach ($projects as $project) {
                         $tot = 0;
                         $ovd = 0;
                         foreach ($project->task as $task) {
                             if ($task->donedate == '') {
                                 if ($task->duedate < $today) {
                                     $ovd++;
                                 }
                                 $tot++;
                             }
                         }
                         if ($tot != 0) {
                             $msg .= $project->project . " [Total tasks: " . $tot . "] Overdue: " . round($ovd / $tot * 100) . "%\n";
                         } else {
                             $msg .= $project->project . " [No tasks set yet]\n";
                         }
                     }
                 }
                 $msg .= "\nThank you for the part you are playing in making this happen :)\n\n_" . $society . "_";
                 Helpers::slackmessage($msg, '@' . $ind->individual->slack);
             }
         }
     }
 }
Exemplo n.º 3
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');
     }
 }
Exemplo n.º 4
0
 public function welcome()
 {
     $data['fin'] = json_encode(array_merge(json_decode(Helpers::mapme('organisation')), json_decode(Helpers::mapme('project'))));
     return view('home', $data);
 }
Exemplo n.º 5
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $data['fin'] = Helpers::mapme('organisation');
     $data['organisations'] = Organisation::orderBy('organisationtype')->orderBy('organisation')->get();
     return view('organisations.index', $data);
 }
Exemplo n.º 6
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $data['fin'] = Helpers::mapme('project');
     $data['projects'] = Project::orderBy('project')->get();
     return view('projects.index', $data);
 }