$term) { if (trim($term['terms']) == '') { continue; } $out .= ''; } return $out; } private static function getUnvalidated($home = false) { $terms = array(); $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); if ( ! $home) { $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); } foreach ($appbox->get_databoxes() as $databox) { try { $cgus = $databox->get_cgus(); if ( ! isset($cgus[Session_Handler::get_locale()])) throw new Exception('No CGus for this locale'); $name = $databox->get_viewname(); $update = $cgus[Session_Handler::get_locale()]['updated_on']; $value = $cgus[Session_Handler::get_locale()]['value']; $userValidation = true; if ( ! $home) { if ( ! $user->ACL()->has_access_to_sbas($databox->get_sbas_id())) { continue; } $userValidation = ($user->getPrefs('terms_of_use_' . $databox->get_sbas_id()) !== $update && trim($value) !== ''); } if ($userValidation) $terms[$name] = array('sbas_id' => $databox->get_sbas_id(), 'terms' => $value, 'date' => $update); } catch (Exception $e) { } } return $terms; } public static function getHome() { $terms = self::getUnvalidated(true); $out = ''; foreach ($terms as $name => $term) { if (trim($term['terms']) == '') continue; if ($out != '') $out .= '
'; $out .= '

' . str_replace('"', '"', sprintf(_('cgus:: CGUs de la base %s'), $name)) . '

'; $out .= '
' . $term['terms'] . '
'; $out .= '
'; } return $out; } }