X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/e61ac06c8cef6425af27ee29a0cd0ca908108eb2..8492dc052ad85039e0bbe11c7c3e1b8554907f64:/WEB-INF/lib/ttOrgHelper.class.php diff --git a/WEB-INF/lib/ttOrgHelper.class.php b/WEB-INF/lib/ttOrgHelper.class.php new file mode 100644 index 00000000..2cf04506 --- /dev/null +++ b/WEB-INF/lib/ttOrgHelper.class.php @@ -0,0 +1,65 @@ +query($sql); + $result = array(); + if (!is_a($res, 'PEAR_Error')) { + while ($val = $res->fetchRow()) { + $val['date'] = substr($val['created'], 0, 10); // Strip the time. + $result[] = $val; + } + return $result; + } + return false; + } + + // The getName function returns organization name (which is a name of its top group). + static function getName($org_id) { + $mdb2 = getConnection(); + + $sql = "select name from tt_groups where id = $org_id and (status = 1 or status = 0) and parent_id is NULL"; + $res = $mdb2->query($sql); + + if (!is_a($res, 'PEAR_Error')) { + $val = $res->fetchRow(); + return $val['name']; + } + return false; + } +}