Introduce modular goal criteria system for users, departments, and products

- Add `goals_criteria` base class implementing customizable goal criteria.
- Introduce interfaces and traits for modular handling of users, departments, and products in goal criteria.
- Include enumeration for goal types (`goals_criteria_type`).
- Implement timeframe and target management through traits.
- Provide initial configuration for enabling the goals module.
This commit is contained in:
Jeppe Bundgaard
2026-01-26 16:01:47 +01:00
parent e1e6d9c911
commit 4bfda5aea4
18 changed files with 658 additions and 0 deletions
@@ -0,0 +1,46 @@
<?php
namespace goals\classes;
use goals\helpers\goals_criteria_type;
use goals\interfaces\goals_criteria_i;
use goals\traits\goals_result_parser_t;
use goals\traits\goals_target_t;
use goals\traits\goals_timeframe_t;
class goals_criteria implements goals_criteria_i
{
use goals_timeframe_t,
goals_target_t,
goals_result_parser_t;
/**
* The users criteria
* @var goals_criteria_users $users
*/
public goals_criteria_users $users;
/**
* The departments criteria
* @var goals_criteria_departments $departments
*/
public goals_criteria_departments $departments;
/**
* Criteria type (products sold, etc.)
* @var goals_criteria_type $type
*/
public goals_criteria_type $type = goals_criteria_type::NONE;
/**
* Products criteria
* @var goals_criteria_products|null $products
*/
public ?goals_criteria_products $products;
/**
* Constructor
*/
public function __construct()
{
$this->users = new goals_criteria_users();
$this->departments = new goals_criteria_departments();
$this->products = new goals_criteria_products();
}
}