コード例 #1
0
 /**
  * Load required assets
  */
 static function chassets()
 {
     // check if already loaded
     $app = self::getApp();
     if (isset($app->chclient->assets)) {
         return;
     }
     // config
     $config = self::getConfig();
     // chclient assets
     CHAssets::script('chclient', 'chclient.min.js');
     CHAssets::style('chclient', 'chclient.min.css');
     // credit card validator
     CHAssets::script('chclient/jquery-creditcardvalidator', 'jquery.creditCardValidator.min.js');
     // required uikit components
     CHAssets::uikit_component('accordion');
     CHAssets::uikit_component('datepicker');
     CHAssets::uikit_component('form-select');
     CHAssets::uikit_component('notify');
     CHAssets::uikit_component('sticky');
     CHAssets::uikit_component('tooltip');
     // optional components
     if ($config->settings_uikit_form_advanced) {
         CHAssets::uikit_component('form-advanced');
     }
     // javascript options
     $localeconv = CHLibDisplay::getLocaleconv();
     $js = (object) [];
     $js->string_error = self::string('error_occurred');
     $js->string_check_form = self::string('error_check_form');
     $js->string_people = self::string('people');
     $js->money_decimal = $localeconv['mon_decimal_point'];
     $js->money_thousands = $localeconv['mon_thousands_sep'];
     $js->datepicker_i18n = self::datePickerLocale();
     $js->datepicker_min_date = CHLibDate::getDate()->format(CHLibDate::dateLocale());
     $js->datepicker_format = str_replace('Y', 'YYYY', str_replace('m', 'MM', str_replace('d', 'DD', CHLibDate::dateLocale())));
     $js->datepicker_weekstart = CHLibDate::weekStart();
     $js->bootstrap_adapter = (int) $config->settings_bootstrap_adapter;
     CHAssets::script_declaration('window.chclient_options = ' . json_encode($js) . ';');
     $app->chclient->assets = true;
 }