var $date_format = null; // Date format.
var $time_format = null; // Time format.
var $week_start = 0; // Week start day.
- var $show_holidays = 0; // Whether to show holidays in calendar.
var $tracking_mode = 0; // Tracking mode.
var $project_required = 0; // Whether project selection is required on time entires.
var $task_required = 0; // Whether task selection is required on time entires.
$this->configHelper = new ttConfigHelper($val['config']);
// Set user config options.
- $this->show_holidays = $this->configHelper->getDefinedValue('show_holidays');
$this->punch_mode = $this->configHelper->getDefinedValue('punch_mode');
$this->allow_overlap = $this->configHelper->getDefinedValue('allow_overlap');
$this->future_entries = $this->configHelper->getDefinedValue('future_entries');
return ($this->behalfGroup ? $this->behalfGroup->time_format : $this->time_format);
}
+ // getWeekStart returns week start day for active group.
+ function getWeekStart() {
+ return ($this->behalfGroup ? $this->behalfGroup->week_start : $this->week_start);
+ }
+
// getTrackingMode returns tracking mode for active group.
function getTrackingMode() {
return ($this->behalfGroup ? $this->behalfGroup->tracking_mode : $this->tracking_mode);
return ($this->behalfGroup ? $this->behalfGroup->configHelper->getConfig() : $this->configHelper->getConfig());
}
+ // getConfigHelper returns ttConfigHelper instance for active group.
+ function getConfigHelper() {
+ return ($this->behalfGroup ? $this->behalfGroup->configHelper : $this->configHelper);
+ }
+
// getConfigOption returns true if an option is defined for group.
// This helps us keeping a set of user attributes smaller.
// We determine whether the option is set only on pages that need to know.
return $groups;
}
+ // getGroupsForDropdown2 obtains an array of groups to populate the "Group" dropdown.
+ // It consists of the entire tree starting from user home group down.
+ // Group name is prefixed with additional characters to indicate subgroups level.
+ function getGroupsForDropdown2() {
+ global $user;
+
+ // Start with user home group.
+ $groups = array();
+ $subgroup_level = 0;
+ $group_id = $user->group_id;
+
+ $this->addGroup($groups, $group_id, $subgroup_level);
+ return $groups;
+ }
+
+ // addGroup is a recursive function to populate a tree of groups.
+ function addGroup(&$groups, $group_id, $subgroup_level) {
+ // Add indentation markup to indicate subdirectory level.
+ for ($i = 0; $i < $subgroup_level; $i++) {
+ $name .= '🛑'; // Unicode stop sign.
+ }
+ if ($subgroup_level) $name .= ' '; // Add an extra space.
+ $name .= ttGroupHelper::getGroupName($group_id);
+
+ $groups[] = array('id'=>$group_id, 'name'=>$name);
+
+ $subgroups = $this->getSubgroups($group_id);
+ foreach($subgroups as $subgroup) {
+ $this->addGroup($groups, $subgroup['id'], $subgroup_level+1);
+ }
+ }
+
// getSubgroups obtains a list of immediate subgroups.
function getSubgroups($group_id = null) {
$mdb2 = getConnection();