X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttGroupHelper.class.php;h=b77edf21a0ca5a040d76375606d1ce3e64e417a7;hb=fe8af9a04f7170a0623915f31610c6c4c3df4058;hp=762fffb69f91df0a5367d3740e2f6ce5d7f59893;hpb=ff088165333067ad603805039778e9bc56671b89;p=timetracker.git diff --git a/WEB-INF/lib/ttGroupHelper.class.php b/WEB-INF/lib/ttGroupHelper.class.php index 762fffb6..b77edf21 100644 --- a/WEB-INF/lib/ttGroupHelper.class.php +++ b/WEB-INF/lib/ttGroupHelper.class.php @@ -518,6 +518,48 @@ class ttGroupHelper { return $result; } + // getActiveTemplates - returns an array of active templates for a group. + static function getActiveTemplates() + { + global $user; + $mdb2 = getConnection(); + + $group_id = $user->getGroup(); + $org_id = $user->org_id; + + $sql = "select id, name, description, content from tt_templates". + " where group_id = $group_id and org_id = $org_id and status = 1 order by upper(name)"; + $res = $mdb2->query($sql); + $result = array(); + if (!is_a($res, 'PEAR_Error')) { + while ($val = $res->fetchRow()) { + $result[] = $val; + } + } + return $result; + } + + // getInactiveTemplates - returns an array of active templates for a group. + static function getInactiveTemplates() + { + global $user; + $mdb2 = getConnection(); + + $group_id = $user->getGroup(); + $org_id = $user->org_id; + + $sql = "select id, name, description from tt_templates". + " where group_id = $group_id and org_id = $org_id and status = 0 order by upper(name)"; + $res = $mdb2->query($sql); + $result = array(); + if (!is_a($res, 'PEAR_Error')) { + while ($val = $res->fetchRow()) { + $result[] = $val; + } + } + return $result; + } + // validateCheckboxGroupInput - validates user input in a group of checkboxes // in context of a specific database table. //