Пример #1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $user = User::findOrFail($id);
     $groups = Group::all(['id', 'name']);
     $categories = Category::all(['id', 'name']);
     return view('users.edit', compact('user', 'groups', 'categories'));
 }
Пример #2
0
 public function ajax()
 {
     //
     $data['groups'] = Group::all();
     $data['groups']->load('manager');
     return $data;
 }
Пример #3
0
 public function dashboard()
 {
     $user = Auth::user();
     //Functional ORM Code For Grabbing Data From Database
     if (Auth::check()) {
         $routes = $user->routes()->get();
         $groups = Group::all();
         $users = User::all();
         $friends = $user->friends()->get();
         $userGroups = $user->groups()->get();
         $ownedGroups = $user->ownedGroups()->get();
         $ownedRoutes = $user->ownedRoutes()->get();
         $friendIds = array();
         foreach ($friends as $friend) {
             array_push($friendIds, $friend->id);
         }
         $groupIds = array();
         foreach ($userGroups as $group) {
             array_push($groupIds, $group->id);
         }
     } else {
         $routes = $groups = $users = $friends = null;
         $ownedGroups = $ownedRoutes = $friendIds = null;
         $groupIds = null;
     }
     // This will route and pass data to the dashboard view
     return view('pages.dashboard', ['user' => $user, 'users' => $users, 'routes' => $routes, 'groups' => $groups, 'friends' => $friends, 'friendIds' => $friendIds, 'groupIds' => $groupIds, 'ownedGroups' => $ownedGroups, 'ownedRoutes' => $ownedRoutes]);
 }
 /**
  * set up start
  */
 public function setUp()
 {
     parent::setUp();
     Session::start();
     // $this->mock = \Mockery::mock('\App\Group');
     $this->id_test = Group::all()->first()->id;
 }
Пример #5
0
 public function delete($group)
 {
     $group->delete();
     $all_groups = \App\Group::all();
     $title = 'Groups';
     $html = view('admin.groups.table', compact('title', 'all_groups'))->render();
     return Admin::view($html);
 }
Пример #6
0
 function listPages()
 {
     $groups = Group::all();
     foreach ($groups as $key => $group) {
         $pages = Group::find($group->id)->getPages;
         $groups[$key]['pages'] = $pages;
     }
     return view('pages', ['groups' => $groups]);
 }
Пример #7
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(General $general)
 {
     $theme = $general->theme();
     $groups = Group::all();
     $count = 1;
     $theme['title'] = 'Groups';
     $theme['description'] = 'description for groups menu';
     return view('admin.group.index', compact('theme', 'groups', 'count'));
 }
 public function create()
 {
     if ($this->currentUser->hasAccess('wts.user.create')) {
         $groups = Group::all();
         $data = ['page_title' => 'Yeni Kullanıcı', 'model' => 'users', 'menu' => 'users', 'groups' => $groups, 'page_description' => 'Sisteme Yeni Bir Kullanıcı Ekleme Sayfasıdır'];
         return view('admin.user-group.user.create', $data);
     } else {
         abort(403, $this->accessForbidden);
     }
 }
Пример #9
0
 public function defaultVotesSet()
 {
     // check that the count of GroupVotes with this voting's id is equal to the count of all groups * number of voting items of this voting
     $groupCount = Group::all()->count();
     $votingItemCount = VotingItem::ofVoting($this->id)->count();
     $correctAmount = $groupCount * $votingItemCount;
     if (GroupVote::ofVoting($this->id)->count() == $correctAmount) {
         return true;
     }
     return false;
 }
Пример #10
0
 public function getGroupList($groupId = 0)
 {
     $groups = Group::all();
     $list = [];
     foreach ($groups as $group) {
         $selected = '';
         if ($group->id == $groupId) {
             $selected = ' selected';
         }
         $list[] = ['id' => $group->id, 'text' => $group->name, 'selected' => $selected];
     }
     return $list;
 }
Пример #11
0
 public function GET_updateUserForm($id)
 {
     $theme = Theme::uses('notebook')->layout('default');
     $theme->setMenu('user.user');
     $user = User::find($id);
     $ugroups = $user->getGroups();
     $user_groups = array();
     foreach ($ugroups as $key => $usergrp) {
         $user_groups[$usergrp->id] = $usergrp->name;
     }
     $groups = Group::all();
     $params = array('user' => $user, 'groups' => $groups, 'user_groups' => $user_groups);
     return $theme->scope('user.update', $params)->render();
 }
Пример #12
0
 /**
  * Returns a view for editing various details about a specific user
  *
  * @param $name Node 'name' label to match when editing a user
  * @return $this
  */
 public function edit($name)
 {
     $user = User::whereName($name)->first();
     $groups = Group::all(['id', 'name']);
     $groupList = array();
     foreach ($groups as $group) {
         $groupList[$group->id] = $group->name;
     }
     $countries = Country::all(['id', 'name']);
     $countryList = array();
     foreach ($countries as $country) {
         $countryList[$country->id] = $country->name;
     }
     return view('admin.users.edit', compact('user'))->with('groupList', $groupList)->with('countryList', $countryList);
 }
Пример #13
0
 public function show()
 {
     $bp = BusinessPlan::all();
     $idbp = count($bp);
     $bpPlans = DB::select("select * from (select  null as userId, null as progress, null as date, null as successMeasured, null as budget, null as collaborators, goals.group, goals. id, null as description, goals.name, goals.ident from goals ,business_plans where business_plans.id = goals.bpid and business_plans.id = '" . $idbp . "' union all select null as userId, null as progress, null as date, null as successMeasured, null as budget, null as collaborators, objectives.group, objectives.id, null as description, objectives.name, objectives.ident from objectives, goals, business_plans where goals.id = objectives.goal_id and business_plans.id = goals.bpid and business_plans.id = '" . $idbp . "' union all select actions.userId, actions.progress, actions.date, actions.successMeasured, actions.budget, actions.collaborators, actions.group, actions.id, actions.description, null as name, actions.ident from actions, objectives, goals, business_plans where objectives.id = actions.objective_id and goals.id = objectives.goal_id and business_plans.id = goals.bpid and business_plans.id = '" . $idbp . "' union all select tasks.userId, tasks.progress, tasks.date, tasks.successMeasured, tasks.budget, tasks.collaborators, tasks.group, tasks.id, tasks.description, null as name, tasks.ident from tasks, actions, objectives, goals, business_plans where actions.id = tasks.action_id and objectives.id = actions.objective_id and goals.id = objectives.goal_id and business_plans.id = goals.bpid and business_plans.id = '" . $idbp . "')a order by ident");
     $users = User::all();
     $groups = Group::all();
     $filters = null;
     $nameBP = $bp[$idbp - 1]->name;
     //$users[$bp->userId - 1]->name
     $html = View::make('businessPlan.printBP', compact('users', 'groups', 'bpPlans', 'idbp', 'filters', 'nameBP'))->render();
     $pdf = App::make('dompdf.wrapper');
     $pdf->loadHTML($html);
     return $pdf->stream();
 }
Пример #14
0
 public function groups()
 {
     $bp = BusinessPlan::all();
     $bpid = count($bp);
     $groups = Group::all();
     $tasks = array();
     $actions = array();
     foreach (BusinessPlan::all() as $x) {
         array_push($tasks, DB::select("select t.* from tasks t, actions a, objectives o, goals g, business_plans b where t.action_id = a.id and a.objective_id = o.id and o.goal_id = g.id and g.bpid = b.id and b.id = {$x->id}"));
         array_push($actions, DB::select("select a.* from actions a, objectives o, goals g, business_plans b where a.objective_id = o.id and o.goal_id = g.id and g.bpid = b.id and b.id = {$x->id}"));
     }
     $users = User::all();
     $rosters = Roster::all();
     $businessPlans = BusinessPlan::lists('name', 'id');
     return view('groups', compact('groups', 'actions', 'tasks', 'users', 'rosters', 'businessPlans', 'bpid'));
 }
Пример #15
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     foreach (\App\Group::all() as $group) {
         $this->info('Checking if there is something to convert for group ' . $group->name . ' (' . $group->id . ')');
         foreach ($group->files as $file) {
             if ($file->isFile()) {
                 if (Storage::disk('local')->has($file->path)) {
                     $source = Storage::disk('local')->get($file->path);
                     Storage::disk('public')->put('groups/' . $group->id . '/' . $file->name, $source);
                     $this->info('Copied file ' . $file->name);
                 } else {
                     $this->info('File not found ' . $file->name);
                 }
             }
         }
     }
 }
Пример #16
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     // Create the user.
     $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
     // we want to assign new users to the 'unauthenticated' user group, but
     // the find() method only works for ids, which could change during data
     // migration. This is a messy, but working work-around to map new users
     // to the correct group upon sign-up.
     $groups = Group::all(['id', 'name']);
     foreach ($groups as $group) {
         if ('Unauthenticated' == $group->name) {
             $id = $group->id;
         }
     }
     // Create the relation for the user to the correct group.
     $defaultGroup = Group::find($id);
     $user->group()->attach($defaultGroup);
     return $user;
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     /*$groups = Group::all();
             $events = Event::all()->toArray();
     
             foreach ($groups as $group) {
     
                 foreach($faker->randomElements($events,$faker->randomDigit) as $event){
                     $group->events()->attach($event['id']);
                 }
             }*/
     $groups = Group::all()->toArray();
     $events = Event::all();
     foreach ($events as $event) {
         foreach ($faker->randomElements($groups, $faker - randomDigit) as $group) {
             $event->group = $group;
         }
     }
 }
 public function showActivityEventPlannerView()
 {
     $activitiesIds = session('activities');
     $activities = [];
     foreach ($activitiesIds as $id) {
         array_push($activities, Activity::find($id));
     }
     $eventPatternIds = session('eventPatterns');
     $eventPatterns = [];
     foreach ($eventPatternIds as $id) {
         array_push($eventPatterns, EventPattern::find($id));
     }
     $groupId = session('group');
     $group = Group::find($groupId);
     $groups = Group::all();
     $events2 = EventOccurrence::with('activities')->get();
     $events = $events2->filter(function ($item) use($groupId) {
         return $item->group->id === $groupId;
     });
     return view('ActivityPlanning/activityEventPlanner', compact('activities', 'eventPatterns', 'groups', 'group', 'events', 'groupId'));
 }
Пример #19
0
 public function handle()
 {
     $groupname = $this->argument('groupname');
     if ($groupname == '*') {
         $groups = Group::all();
     } else {
         $groups = Group::where('name', '=', $groupname)->get();
     }
     $pattern = $this->argument('pattern');
     foreach ($groups as $group) {
         foreach ($group->users as $user) {
             $files = Cloud::getContents($user->username, false);
             foreach ($files as $file) {
                 $filename = basename($file);
                 if (preg_match($pattern, $filename)) {
                     Cloud::deleteFile($user->username, $filename);
                     echo "Rimosso {$file}\n";
                 }
             }
         }
     }
 }
 public function editTaskFromComments($id, Requests\EditTaskRequest $request)
 {
     $progress = ['0' => 'Not Started', '1' => 'In Progress', '2' => 'Done'];
     $model = new Task();
     $task = Task::findOrFail($id);
     $groups = Group::lists('name', 'id');
     $users = User::lists('name', 'id');
     $bpid = $model->getBpIdFromTask($id);
     $action = Action::find($task->action_id)->description;
     $names = explode(', ', $task->collaborators);
     $selectedUsers = array();
     $selectedGroups = array();
     foreach ($names as $name) {
         if (count(User::all()->where('name', $name)) > 0) {
             array_push($selectedUsers, User::all()->where('name', $name)->first()->id);
         }
         if (count(Group::all()->where('name', $name)) > 0) {
             array_push($selectedGroups, Group::all()->where('name', $name)->first()->id);
         }
     }
     return view('editTaskComments', compact('task', 'action', 'groups', 'users', 'bpid', 'selectedUsers', 'selectedGroups', 'progress'));
 }
 public function editActionFromComments($id, Requests\EditActionRequest $request)
 {
     $progress = ['0' => 'Not Started', '1' => 'In Progress', '2' => 'Done'];
     $model = new Action();
     $action = Action::findOrFail($id);
     $bpid = $model->getBpIdFromAction($id);
     $objective = Objective::find($action->objective_id)->name;
     $groups = Group::lists('name', 'id');
     $users = User::lists('name', 'id');
     $names = explode(', ', $action->collaborators);
     $selectedUsers = array();
     $selectedGroups = array();
     foreach ($names as $name) {
         if (count(User::all()->where('name', $name)) > 0) {
             array_push($selectedUsers, User::all()->where('name', $name)->first()->id);
         }
         if (count(Group::all()->where('name', $name)) > 0) {
             array_push($selectedGroups, Group::all()->where('name', $name)->first()->id);
         }
     }
     return view('editActionComments', compact('action', 'objective', 'groups', 'users', 'bpid', 'selectedUsers', 'selectedGroups', 'progress'));
 }
Пример #22
0
 public function GET_assignGroupForm()
 {
     $theme = Theme::uses('notebook')->layout('default');
     $theme->asset()->container('post-scripts')->usePath()->add('laravel', 'js/laravel.js');
     $theme->setMenu('user.group');
     $routes = Route::getRoutes();
     $groups = Group::all();
     $permits = array();
     if ($groups) {
         foreach ($groups as $group) {
             $findGroup = Group::find($group->id);
             $permissions = json_decode($findGroup->permissions);
             $permits[$group->name] = array();
             if ($permissions) {
                 foreach ($permissions as $key => $permission) {
                     $permits[$group->name][] = $key;
                 }
             }
         }
     }
     $params = array('routes' => $routes, 'groups' => $groups, 'permits' => $permits);
     return $theme->scope('user.group-assign', $params)->render();
 }
Пример #23
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $groups = Group::all();
     return view('layouts.group.index', ['groups' => $groups, 'my_permissions' => $this->my_permissions]);
 }
Пример #24
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $groups = Group::all();
     return view('group-table', ['groups' => $groups]);
 }
Пример #25
0
 /**
  * Opent het scherm met het overzicht van de groepen
  */
 public function listGroups()
 {
     $groups = Group::all();
     return view('groups', ['groups' => $groups]);
 }
 public function editTask($idbp, $id)
 {
     $bp = BusinessPlan::findOrFail($idbp);
     $task = Task::findOrFail($id);
     $actions = Action::lists('description');
     $user = User::lists('name');
     $groups = Group::lists('name', 'id');
     $users = User::lists('name', 'id');
     $names = explode(', ', $task->collaborators);
     $selectedUsers = array();
     $selectedGroups = array();
     foreach ($names as $name) {
         if (count(User::all()->where('name', $name)) > 0) {
             array_push($selectedUsers, User::all()->where('name', $name)->first()->id);
         }
         if (count(Group::all()->where('name', $name)) > 0) {
             array_push($selectedGroups, Group::all()->where('name', $name)->first()->id);
         }
     }
     $progress = ['0' => 'Not Started', '1' => 'In Progress', '2' => 'Done'];
     return view('businessPlan.editTask', compact('task', 'actions', 'groups', 'user', 'idbp', 'users', 'selectedUsers', 'selectedGroups', 'progress'));
 }
Пример #27
0
 /**
  * Display a list of all groups
  *
  * @return Response
  */
 public function index()
 {
     $groups = Group::all();
     // Get groups for the list
     return view('groups.index', compact('groups'));
 }
Пример #28
0
<?php

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(App\User::class, function (Faker\Generator $faker) {
    return ['name' => $faker->name, 'active' => rand(0, 1), 'group_id' => \App\Group::all()->random()->id, 'email' => $faker->email, 'password' => bcrypt(str_random(10)), 'remember_token' => str_random(10)];
});
$factory->define(App\Group::class, function (Faker\Generator $faker) {
    return ['name' => $faker->name];
});
 public function viewGroups()
 {
     $data = ['groups' => \App\Group::all()];
     return view('pages.view-groups', $data);
 }
Пример #30
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     return view('group.index', ['groups' => Group::all()]);
 }