/** * Initialize bootstrap */ public static function init() { $autoload = \Config::get('bootstrap.assets.autoload', false); if (!$autoload) { return; } $path = \Config::get('bootstrap.assets.path', ''); $use_min = \Config::get('bootstrap.assets.use_min', true); $css_file = $path . 'bootstrap'; $js_file = $path . 'bootstrap'; if ($use_min) { $css_file .= '.min'; $js_file .= '.min'; } $css_file .= '.css'; $js_file .= '.js'; // See if Casset package is used. if (\Package::loaded('casset')) { \Casset::css($css_file, !$use_min); \Casset::js($js_file, !$use_min); } else { \Asset::css($css_file); \Asset::js($js_file); } }
public function before() { parent::before(); Casset::css('admin.css'); Casset::js('bootstrap.js'); Casset::js('admin.js'); }
/** * Flushes cached assets in the public directory. * * @return void */ public static function flush() { // Remove all the caches for js/css in casset cache folder. $types = array('js', 'css'); foreach ($types as $type) { $files = glob(DOCROOT . 'public' . DS . \Casset::get_cache_path() . '*.' . $type); foreach ($files as $file) { unlink($file); } } \Cli::write('Flushed: cache', 'green'); // Remove all the app's caches in cache folder. \Cache::delete_all(null, 'file'); }
/** * JS * * Either adds the javascript to the group, or returns the script tag. * * @access public * @param mixed The file name, or an array files. * @param array An array of extra attributes * @param string The asset group name * $raw bool If set to true the result css tags will include the file contents directly instead of via a link tag. * $is_minify bool If set to true minify and combine files at only prod env. * @return string */ public static function js($stylesheets = array(), $attr = array(), $group = NULL, $raw = false, $is_minify = false, $is_use_minified_file = false) { if (Fuel::$env == Fuel::PRODUCTION) { if ($is_minify) { foreach ($stylesheets as $stylesheet) { Casset::js($stylesheet, false, $group); } return; } if ($is_use_minified_file) { $stylesheets = Util_File::convert_filename2min($stylesheets); } } return parent::js($stylesheets, $attr, $group, $raw); }
</div> <!-- Placed at the end of the document so the pages load faster --> <?php Casset::js('jquery.zclip.min.js'); Casset::js('bootstrap.min.js'); Casset::js('sortable.js'); Casset::js('jquery-ui-1.10.3.custom.min.js'); Casset::js('bootstrap-switch.min.js'); Casset::js('base.js'); if (Uri::Current() === Uri::Base() && isset($image_js) === true) { Casset::add_path('image', APPPATH . 'modules/image/'); Casset::js('image::image.js'); } Casset::js('jquery.colorbox-min.js'); echo Casset::render_js(); ?> <script> var text_input = document.getElementById ('urlbox'); if (text_input != null) { text_input.focus (); text_input.select (); } var max_file_size = <?php echo min($max_upload, $max_post); ?> ;
<?php return array('source_dir' => DOCROOT . 'assets/', 'output_dir' => Casset::get_cache_path(), 'casset_path_key' => 'cache');
?> </span> <?php } ?> </h1> <?php } ?> <?php echo View_Helper::alerts(); ?> <?php echo $content; ?> </div> </div> </div> <footer></footer> </div> <?php echo Casset::render_js('base'); echo Casset::render_js('page'); ?> </body> </html>
<?php /** * Created by PhpStorm. * User: aris * Date: 9/22/14 * Time: 12:13 PM */ header("Content-Type:text/html; charset=utf-8"); echo Casset::js('jquery.min.js'); //echo Casset::render_js(); print '----View : ormpractice----<br>print out data only with var_dump : <br><br><br>'; echo '<pre>'; /*structure of value object from controller '_ormGetAllGuest' = Model_DataTrain::Orm_GetAllGuest(), '_ormFindGuest' = Model_DataTrain::Orm_FindGuest('Sunny'), '_crudGetAllGoods' = Model_DataTrain::Crud_GetAllGoods(), '_crudFindGoods' = Model_DataTrain::Crud_FindGoods( 'Toilet' ), */ print '---使用 ORM 存取客戶基本資料 : 全部房客列表<br>'; var_dump($_ormGetAllGuest); print '<br>'; print '---使用 ORM 存取客戶基本資料 : 查找單一客戶Sunny<br>'; var_dump($_ormFindGuest); print '<br>'; print '---使用 model_crud 存取商品基本資料 : 全部商品列表<br>'; var_dump($_crudGetAllGoods); print '<br>'; print '---使用 model_crud 存取商品基本資料 : 查找單一商品Toilet<br>'; var_dump($_crudFindGoods); echo '</pre>';
<?php Casset::less('less/common/chart.less', true, 'page'); if (empty($type)) { $type = 'highcharts'; } Casset::js("libs/highcharts/{$type}.js", true, 'page'); Casset::js('libs/highcharts/modules/exporting.js', true, 'page');
<?php $layout->title = 'Activity'; $layout->pagenav = render('statistics/customers/pagenav'); $layout->leftnav = render('statistics/leftnav'); $layout->breadcrumbs['Statistics'] = 'statistics'; $layout->breadcrumbs['Customers'] = ''; $layout->breadcrumbs['Activity'] = ''; render('common/chart', array('type' => 'highstock')); Casset::js('js/controller/statistics/customers/activity.js', true, 'page'); ?> <div id="chart-customer-activity" style="width:100%; height:400px;" data-url="/api/customers/statistics/activity"></div>
<?php $layout->title = 'Totals'; $layout->pagenav = render('statistics/customers/pagenav'); $layout->leftnav = render('statistics/leftnav'); $layout->breadcrumbs['Statistics'] = 'statistics'; $layout->breadcrumbs['Customers'] = ''; $layout->breadcrumbs['Totals'] = ''; render('common/chart', array('type' => 'highstock')); Casset::js('js/controller/statistics/customers/totals.js', true, 'page'); ?> <div id="chart-customer-totals" style="width:100%; height:400px;" data-url="/api/customers/statistics/totals"></div>
/** * Assets loader * * @access private */ private function _init_assets() { Casset::css('main.css'); Casset::js('main.js'); }
<?php $layout->title = 'Conversion'; $layout->pagenav = render('statistics/customers/pagenav'); $layout->leftnav = render('statistics/leftnav'); $layout->breadcrumbs['Statistics'] = 'statistics'; $layout->breadcrumbs['Customers'] = ''; $layout->breadcrumbs['Conversion'] = ''; render('common/chart'); Casset::js('libs/highcharts/modules/funnel.js', true, 'page'); Casset::js('js/controller/statistics/customers/conversion.js', true, 'page'); ?> <div id="chart-customer-conversion" style="width:600px; height:400px;" data-url="/api/customers/statistics/conversion"></div>