Jump to content

User and project management approach


sins7ven
 Share

Recommended Posts

Hi community,
I have been thinking about a project lately and was wondering if this is something I can accomplish with Processwire. I know the platform is pretty much capable of getting everything done but tbh I am not sure on this one.

I want to create a site which only has a login. The logins and details are pre-made and been sent to the user before. So there is no need for registration. After the login, the user can see his own kind of dashboard and a dropdown where he can select "projects". Each project has a number of properties or data values, for example:

Project 1:
    - time to finish: 30 days
    - time spent: [amount per user]
    - project budget: 100.000 $
    - money earned per user: [amount per user]

Project 2:
    - time to finish: 40 days
    - time spent: [amount per user]
    - project budget: 50.000 $
    - money earned per user: [amount per user]

The fields are just an example. The goal is to assign users to the projects and set the value as per example above so when the user sees his dashboard and selects a project from a dropdown, he only sees his values. Projects of course can and will have multiple users.

In addition to that, there should be some project-relevant documents to download but these permissions can be set up by roles and that would be the problem here. My question is, what would be the best approach here? From my thinking I would set up the projects as pages and define the values with fields. But how can I set up the users to assign them to projects? Maybe creating the users also as pages or is there another way? The users should also only see their own data and not the data from the other guys. So meaning that once the user is logged in he only sees his dashboard and a dropdown. 

I know this example sounds a bit abstract but it should only visualise what a common approach would be to this problem. Would love to hear your thoughts!

Link to comment
Share on other sites

Who is maintaining projects and users? Can users create new projects or only browse projects assigned to them?

If the users do not need to access the backend, you'll not even need roles to realize that (access will be controlled from your PHP code then).

Since users are managed by pages, the admin may add fields to the user templates as required. This could be a simple page select which holds the projects assigned to the particular user. Or you place a page select on your project template which selects the users assigned to that project (no need to modify the user template in this case).

 

Link to comment
Share on other sites

2 hours ago, Sergio said:

I agree with Autofahrn, it seems that the logic should stay in the frontend as it will be easier to control and maintain. 

I strongly disagree. The admin is built exactly for such tasks. It's a content MANAGEMENT SYSTEM. So why should it not be capable of managing projects? You have all you need in the admin: Access control, forms, hooks, fields, conditional fields, several listing tools (*hint* RockGrid *hint*), etc.

That would be a LOT of work to rebuild on the frontend!

I know it feels hard in the beginning, but it just makes a lot of sense to use the tools we already have instead of rebuilding it from scratch. You'll learn a lot of useful stuff for other PW projects and you'll build modules that you can reuse (or share).

 

 

  • Like 2
Link to comment
Share on other sites

I agree with you @bernhard, but I said so because it seems the specs are for a simple page (more like a read-only executive report), as far as I understand it. 

But for the case you mentioned, the admin page is the way to go! And thank you for the article, I'll be using its lessons to build a dashboard in the near future. ?

  • Like 1
Link to comment
Share on other sites

Ok, I understand ?  But even then I'd say it's easier to build in the backend than in the frontend:

TWaSPoi.png

And that's all the code that is needed:

public function ___execute() {
  /** @var InputfieldForm $form */
  $form = $this->modules->get('InputfieldForm');

  $form->add([
    'credit' => [
      'type' => 'markup',
      'label' => 'Guthaben',
      'value' => $this->files->render(__DIR__ . '/markup/credit'),
      'columnWidth' => 25,
    ],
    'trainings' => [
      'type' => 'markup',
      'label' => 'Trainings',
      'value' => $this->files->render(__DIR__ . '/markup/trainings'),
      'columnWidth' => 25,
    ],
    'shop' => [
      'type' => 'markup',
      'label' => 'Buchung',
      'value' => $this->files->render(__DIR__ . '/markup/shop'),
      'columnWidth' => 50,
    ],
    'dashboard_history' => [
      'type' => 'RockGrid',
      'label' => 'Verlauf',
      'ajax' => false,
    ],
  ]);

  return $form->render();
}

 

  • Like 4
Link to comment
Share on other sites

Thanks a lot for your input guys. I didn't know about the possibility to do this also with a dashboard in the admin area but I think I will go with the frontend route this time as there is really only showing and displaying content and not letting the users create or modify anything.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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