Jump to content

Child care centre website help


Marty Walker
 Share

Recommended Posts

Hi,

I have a series of sites I'm building which are, for the most part, reasonably straight-forward. But there's an element to each one that I'd rather give to someone else to work out for me.

The site is for a day care centre (part of this service) which has 3 'rooms' - one room for each age group (o-2, 2-3 & 3-5 years). In each room there are approximately 30-35 children. The task I've been set is to give the parent of each child a unique login with which to view their child's portfolio at the end of the year (it might be a PDF or a gallery of jpegs, I'm not sure yet). Additionally each room has a daily 'diary' and if you're the parent of a child in that room you can also see a gallery of images for that day.

Home
- Rooms
- 2013
-- Room A
--- John Johnson
--- Frank Smith
--- Bertie Jones
--- etc
-- Room B
--- Mark Smith
--- Ted Nelson
--- etc

- Daily Diary
-- 2013
--- Room A
---- 29 March
---- 30 March
---- etc
--- Room B
---- 29 March
---- 30 March
--- Room C
---- 29 March
---- 30 March

In the PW admin I need a straight-forward admin page that the administrator of each section can:
a. Create a username & password - and be able email it when necessary to that parent.
b. Assign selected pages (most likely just the diary page and their child's page - they may have more than one child at the centre) to that user so that only they can see it
c. Help with template code and code for login forms & password reminders
 

At this stage I'm happy to be guided by the bigger PW-brained people as to how best to achieve this - and how much it'll cost of course. The crucial thing is having the user admin be easy to use as the folk using it haven't used ProcessWire before.

Regards

Marty

  • Like 1
Link to comment
Share on other sites

I can kinda see how you could do the parents' own logins & permissions relying on pages & page fields for management of what users can see rather than extending the actual PW user system. But maybe I'm a bit inexperienced with ways of incorporating actual user accounts with a template in ways that a back-end editor with no interest in PHP could manage. That's why I'm thinking so much about page fields here. I think something like this could be helpful perhaps--once somebody registers, they are a new user and that user gets its own corresponding page. Then you let editors add that page to page fields to basically white-list the kid's mom for areas where she should get access.

But what I really want to say is, I'm interested to know what others think. ;-)

Link to comment
Share on other sites

I think Marc has it pretty much right, that's certainly one way of doing it.


Essentially if you want an easy life you'll probably want to take advantage of the built-in $user so you end up with the options detailed in Marc's link:

I think in many ways this may be simpler than all that as the user role in this case will just serve to give someone access to a certain page/pages.

If you want to have the administrator's use PW's backend then you'll want to create a module which uses a page hook so that on page save of type "student", a corresponding user gets added. This will mean the administrator doesn't have to remember to add a user each time and make sure the names match up.

In your template, you could then either use page reference fields to match a parent (user) to a student page or alternatively redirect the parent on login to the page where the $student->name == $user->name.

This could all equally be achieved in front-end forms (as I have done in the past, for a similar case to yours) and you'd have the advantage of styling them how you wish.

Link to comment
Share on other sites

You can add a page field to the user template and a role parent. Then you can give them access to their children pages with (all code written in the browser):

if ($user->hasRole("parent") && $user->kids->has($page)) {
    //show the page
} else {
   // redirect to a general page or show 404
}

and to the room page like this:

if ( $user->hasRole("parent") && count($user->kids->find("parent=$page")) > 0) { // <- tricky hein? here we had to check if any of the kids of this user has this page as parent
    //show the room page
} else {
   // redirect to a general page or show 404
}

To link to the pages from the entry page you can:

// show the kids pages and room
foreach($user->kids as $p) {
    echo "<a href={$p->url}>{$p->title}'s page</a>";
    echo " and ";
    echo "<a href={$p->parent->url}>his room</a>";
}

Doesn't help that we are talking about real children and real parents while writing PW code :D

  • Like 5
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...