コード例 #1
0
ファイル: SchedulerTable.class.php プロジェクト: rrsc/freemed
 function MainMenuAppointments()
 {
     if (!freemed::acl('schedule', 'view')) {
         return false;
     }
     // Decide if this user is a physician or not...
     if (!is_object($GLOBALS['this_user'])) {
         $GLOBALS['this_user'] = CreateObject('org.freemedsoftware.core.User');
     }
     if ($GLOBALS['this_user']->isPhysician()) {
         // If physician, give links to daily and weekly
         // schedules, as well as a total of appointments
         // Get day that is one week from today
         $begin_date = date("Y-m-d");
         $end_date = $begin_date;
         for ($day = 1; $day < 7; $day++) {
             $end_date = freemed_get_date_next($end_date);
         }
         // Figure out appointments for today
         $day_count = $GLOBALS['sql']->queryOne("SELECT COUNT(*) AS day_count FROM scheduler WHERE " . "caldateof='" . $begin_date . "' AND " . "calphysician='" . $GLOBALS['this_user']->getPhysician() . "'");
         // Figure out appointments for this week
         $week_count = $GLOBALS['sql']->queryOne("SELECT COUNT(*) AS week_count FROM scheduler WHERE " . "caldateof >= '" . $begin_date . "' AND " . "caldateof <= '" . $end_date . "' AND " . "calphysician='" . $GLOBALS['this_user']->getPhysician() . "'");
         return array(__("Patient Scheduler"), sprintf(__("You have %s%d appointment(s) today%s and %s%d appointment(s) this week%s."), "<a href=\"physician_day_view.php?physician=" . urlencode($GLOBALS['this_user']->getPhysician()) . "\">", $day_count, "</a>", "<a href=\"physician_week_view.php?physician=" . urlencode($GLOBALS['this_user']->getPhysician()) . "\">", $week_count, "</a>"), "img/calendar_icon.png");
     } else {
         // If not a physician, give number of appointments
         // for the current facility if there is one
         $day_count = $GLOBALS['sql']->query("SELECT COUNT(*) AS day_count FROM scheduler WHERE " . "caldateof = '" . date('Y-m-d') . "' " . (HTTP_Session2::get('default_facility') ? "AND calfacility='" . addslashes(HTTP_Session2::get('default_facility')) . "' " : ""));
         // Figure out appointments for this week
         return array(__("Patient Scheduler"), sprintf(__("There are %s appointments scheduled for today."), "<b>{$day_count}</b>"), "img/calendar_icon.png");
     }
 }
コード例 #2
0
ファイル: UserInterface.class.php プロジェクト: rrsc/freemed
 public function checkUtilitiesMenu(&$userLeftNavigationMenu)
 {
     //Tools stuff
     $toolsRead = freemed::acl('Tools', 'read') ? 1 : 0;
     $toolsWrite = freemed::acl('Tools', 'write') ? 1 : 0;
     $toolsModify = freemed::acl('Tools', 'modify') ? 1 : 0;
     $tools = $this->getShowBit($toolsRead, $toolsWrite, $toolsModify);
     //Admin stuff
     $adminRead = freemed::acl('admin', 'read') ? 1 : 0;
     $adminWrite = freemed::acl('admin', 'write') ? 1 : 0;
     $adminDelete = freemed::acl('admin', 'delete') ? 1 : 0;
     $adminModify = freemed::acl('admin', 'modify') ? 1 : 0;
     $admin = $this->getShowBit($adminRead, $adminWrite, $adminDelete, $adminModify);
     //ACL stuff
     $aclRead = freemed::acl('acl', 'read') ? 1 : 0;
     $aclWrite = freemed::acl('acl', 'write') ? 1 : 0;
     $aclDelete = freemed::acl('acl', 'delete') ? 1 : 0;
     $aclModify = freemed::acl('acl', 'modify') ? 1 : 0;
     $acl = $this->getShowBit($aclRead, $aclWrite, $aclDelete, $aclModify);
     if ($tools || $admin || $acl) {
         $UtilitiesAccessOptionsDB = $userLeftNavigationMenu['Tools'];
         $UtilitiesAccessOptions['Tools'] = $tools;
         if (!$UtilitiesAccessOptions['Tools']) {
             unset($UtilitiesAccessOptions['Tools']);
         }
         $UtilitiesAccessOptions['Support Data'] = $admin;
         if (!$UtilitiesAccessOptions['Support Data']) {
             unset($UtilitiesAccessOptions['Support Data']);
         }
         $UtilitiesAccessOptions['Field Checker'] = $admin;
         if (!$UtilitiesAccessOptions['Field Checker']) {
             unset($UtilitiesAccessOptions['Field Checker']);
         }
         $UtilitiesAccessOptions['User Management'] = $admin;
         if (!$UtilitiesAccessOptions['User Management']) {
             unset($UtilitiesAccessOptions['User Management']);
         }
         $UtilitiesAccessOptions['System Configuration'] = $admin;
         if (!$UtilitiesAccessOptions['System Configuration']) {
             unset($UtilitiesAccessOptions['System Configuration']);
         }
         $UtilitiesAccessOptions['DB Administration'] = $admin;
         if (!$UtilitiesAccessOptions['DB Administration']) {
             unset($UtilitiesAccessOptions['DB Administration']);
         }
         $UtilitiesAccessOptions['ACL'] = $acl;
         if (!$UtilitiesAccessOptions['ACL']) {
             unset($UtilitiesAccessOptions['ACL']);
         }
         if (strlen(serialize($UtilitiesAccessOptions)) != strlen(serialize($UtilitiesAccessOptionsDB)) - 13) {
             $userLeftNavigationMenu['Utilities'] = $UtilitiesAccessOptions;
         }
     } else {
         unset($userLeftNavigationMenu['Utilities']);
     }
 }
コード例 #3
0
ファイル: SupportModule.class.php プロジェクト: rrsc/freemed
 protected function acl_access($type)
 {
     return freemed::acl($this->acl_category, $type);
 }
コード例 #4
0
ファイル: SystemConfig.class.php プロジェクト: rrsc/freemed
 function SetValue($var, $val)
 {
     freemed::acl_enforce('admin', 'write');
     if (!freemed::acl('admin', 'write')) {
         syslog(LOG_INFO, "Attempted SystemConfig.SetValue without authorization");
         return false;
     }
     // Perform search (to decide if it's insert or update)
     $query = "SELECT * FROM config WHERE c_option=" . $GLOBALS['sql']->quote($var);
     $result = $GLOBALS['sql']->queryRow($query);
     if ($result['c_option']) {
         $res = $GLOBALS['sql']->query($GLOBALS['sql']->update_query("config", array("c_value" => $val), array("c_option" => $var)));
         return $res == true;
     } else {
         $res = $GLOBALS['sql']->query($GLOBALS['sql']->insert_query("config", array("c_value" => $val)));
         return $res == true;
     }
 }
コード例 #5
0
ファイル: API.php プロジェクト: rrsc/freemed
 public static function module_check_acl($module, $permission = '')
 {
     // Get meta value for acl
     $m_acl = freemed::module_get_meta($module, 'acl');
     if (!is_array($m_acl)) {
         // By default if there are no restrictions, allow
         return true;
     } else {
         // Check each individual ACL specified, if any work, ok
         foreach ($m_acl as $__grbge => $v) {
             if (!$permission) {
                 switch ($v) {
                     case 'bill':
                         $p = 'menu';
                         break;
                     default:
                         $p = 'view';
                         break;
                 }
             } else {
                 $p = $permission;
             }
             if (freemed::acl($v, $p)) {
                 return true;
             }
         }
         // end foreach m_acl
         // If nothing passes, we fail
         return false;
     }
     // end if not array
 }