Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 963295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:38:59+00:00 2026-05-16T01:38:59+00:00

I’m building a webapp using the Zend Framework , and I need to model

  • 0

I’m building a webapp using the Zend Framework, and I need to model logic or keep track of some logic that has to do with tracking progress towards a goal.

Let me illustrate with a sample goal.

USER Needs to Complete All Three of the following:
A) Activity One
B) Activity Two
C) Activity Three
USER Needs to Complete One of the following:
D) Activity Four
E) Activity Five
F) Activity Six

After completing all three from the first group and one from the second group the USER has completed that goal. How would I go about modeling this in PHP so that the webapp knows the goal has been completed and how would I store the data in the database?

To be clear, there will be many different types of goals like this, but all of them will be quite similar in nature.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T01:38:59+00:00Added an answer on May 16, 2026 at 1:38 am

    Assuming that A, B & C and D, E, & F will always belong to a specific group within the goal, I would design it thus:

    Goal::isComplete()
    {
      foreach (Group)
      {
        switch (Group::type())
        {
          case "all":
            TRUE if all complete
            break
    
          case "any":
            TRUE if any complete
            break;
        }
      }
    
      if all TRUE
        return TRUE
    }
    

    Or in English…

    You could then store all of your Activities within an Activities table and define the group they are a part of as a simple id reference to the Groups table. When an Activity is complete, it can be marked thus in the DB.

    To check for completed goals, you simply need to look for each Group that is required for the Goal. Each group would either be “all” or “any” (or other such options, like “min-2”), and this would tell the script what to check for with the Activity completions. Each Group can then return TRUE or FALSE depending upon its Activities. Assuming that all Groups are required, the Goal would then easily be identified as Complete or not.

    The database can look like:

    Activities
    - id
    - group_id
    - name
    - completed
    - [details about activitiy]
    
    Groups
    - id
    - goal_id
    - type  (ENUM: 'any', 'all')
    - completed
    - [details about group]
    
    Goals
    - id
    - completed
    - [details about goal]
    

    The Completed values within Groups and Goals would need to be actively updated whenever Activities is updated, or left out and their values always dynamically worked out.

    Does this make sense and do what you are requiring?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 469k
  • Answers 469k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer 1) if you have packages on a media of some… May 16, 2026 at 2:49 am
  • Editorial Team
    Editorial Team added an answer I am afraid that this is not possible using any… May 16, 2026 at 2:49 am
  • Editorial Team
    Editorial Team added an answer If you're doing an actual redirect, you can use TempData… May 16, 2026 at 2:49 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.