本文整理汇总了PHP中CMS_Asset::compile_js方法的典型用法代码示例。如果您正苦于以下问题:PHP CMS_Asset::compile_js方法的具体用法?PHP CMS_Asset::compile_js怎么用?PHP CMS_Asset::compile_js使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMS_Asset
的用法示例。
在下文中一共展示了CMS_Asset::compile_js方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="{{ site_favicon }}">
<!-- Le styles -->
<?php
$asset = new CMS_Asset();
$asset->add_themes_css('style.css', 'minimal', 'default');
$asset->add_themes_css('bootstrap.min.css', 'minimal', 'default');
echo $asset->compile_css();
$asset->add_cms_js("bootstrap/js/bootstrap.min.js");
$asset->add_cms_js('validate/js/number.js');
$asset->add_themes_js('script.js', 'minimal', 'default');
echo $asset->compile_js(TRUE);
?>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="{{ site_favicon }}">
</head>
<body>
{{ widget_name:quicklink }}
<!--{{ widget_name:quicklink }}-->
<div class="container">
示例2:
$asset->add_themes_css('css/material.min.css', '{{ used_theme }}', 'default');
$asset->add_themes_css('css/ripples.min.css', '{{ used_theme }}', 'default');
echo $asset->compile_css();
?>
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="{{ site_favicon }}">
<style type="text/css">{{ widget_name:section_custom_style }}</style>
</head>
<body>
<?php
echo $template['js'];
$asset->add_cms_js("bootstrap/js/bootstrap.min.js");
$asset->add_themes_js('js/ripples.min.js', '{{ used_theme }}', 'default');
$asset->add_themes_js('js/material.min.js', '{{ used_theme }}', 'default');
$asset->add_themes_js('script.js', '{{ used_theme }}', 'default');
echo $asset->compile_js();
?>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript">{{ widget_name:section_custom_script }}</script>
{{ widget_name:section_top_fix }}
{{ widget_name:static_accessories_slideshow }}
<div class="container">
<div class="row-fluid">
<div>
<div id="__section-left-and-content" class="col-md-12">
<div>{{ navigation_path }}</div><hr />
<div id="__section-content" class="col-md-12"><?php
echo $template['body'];
示例3: cms_widgets
/**
* @author goFrendiAsgard
* @param parent_id, max_menu_depth
* @desc return navigation child if parent_id specified, else it will return root navigation
*/
public final function cms_widgets()
{
$user_name = $this->cms_username();
$user_id = $this->cms_userid();
$not_login = !$user_name ? "TRUE" : "FALSE";
$login = $user_name ? "TRUE" : "FALSE";
$super_user = $user_id == 1 ? "TRUE" : "FALSE";
$query = $this->db->query("SELECT \n \t\t\twidget_id, widget_name, is_static, title, \n \t\t\tdescription, url, slug, static_content \n FROM cms_widget AS w WHERE\n ( \n (authorization_id = 1) OR\n (authorization_id = 2 AND {$not_login}) OR\n (authorization_id = 3 AND {$login}) OR\n (\n (authorization_id = 4 AND {$login}) AND \n (\n (SELECT COUNT(*) FROM cms_group_user AS gu WHERE gu.group_id=1 AND gu.user_id ='" . addslashes($user_id) . "')>0\n OR {$super_user} OR\n (SELECT COUNT(*) FROM cms_group_widget AS gw\n WHERE \n gw.widget_id=w.widget_id AND\n gw.group_id IN \n (SELECT group_id FROM cms_group_user WHERE user_id = '" . addslashes($user_id) . "')\n )>0\n )\n )\n ) AND active=1");
$result = array();
foreach ($query->result() as $row) {
// generate widget content
$content = '';
if ($row->is_static == 1) {
$content = $this->cms_parse_keyword($row->static_content);
} else {
// url
$url = $row->url;
if (!strpos(strtolower($url), 'http')) {
$url = base_url($url);
}
// script
$script = '$.ajax({';
$script .= 'url:"' . $url . '",';
$script .= 'data:{_only_content:true},';
$script .= 'success:function(response){';
$script .= '$("div#_cms_widget_' . $row->widget_id . '").html(response);';
$script .= '}';
$script .= '});';
// asset
$asset = new CMS_Asset();
$asset->add_cms_js('nocms/js/jquery.js');
$asset->add_string_js($script);
// content
$content .= '<div id="_cms_widget_' . $row->widget_id . '">';
$content .= $asset->compile_js(true);
$content .= '</div>';
}
// make widget based on slug
if (!isset($result[$row->slug])) {
$result[$row->slug] = array();
}
$result[$row->slug][] = array("widget_id" => $row->widget_id, "widget_name" => $row->widget_name, "title" => $this->cms_lang($row->title), "description" => $row->description, "content" => $content);
}
return $result;
}
示例4: index
//.........这里部分代码省略.........
// $crud->unset_add();
// $crud->unset_edit();
// $crud->unset_list();
// $crud->unset_back_to_list();
// $crud->unset_print();
// $crud->unset_export();
// set model
// $crud->set_model($this->cms_module_path().'/grocerycrud_main_language_model');
// adjust groceryCRUD's language to No-CMS's language
$crud->set_language($this->cms_language());
// table name
$crud->set_table(cms_table_name('main_language'));
// set subject
$crud->set_subject('Language');
// displayed columns on list
$crud->columns('name', 'code', 'iso_code', 'translations');
// displayed columns on edit operation
$crud->edit_fields('name', 'code', 'iso_code', 'translations');
// displayed columns on add operation
$crud->add_fields('name', 'code', 'iso_code', 'translations');
// caption of each columns
$crud->display_as('name', 'Name');
$crud->display_as('iso_code', 'ISO Code');
$crud->display_as('translations', 'Translations');
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// HINT: Put required field validation codes here
// (documentation: http://www.grocerycrud.com/documentation/options_functions/required_fields)
// eg:
// $crud->required_fields( $field1, $field2, $field3, ... );
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$crud->required_fields('name', 'code');
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// HINT: Put required field validation codes here
// (documentation: http://www.grocerycrud.com/documentation/options_functions/unique_fields)
// eg:
// $crud->unique_fields( $field1, $field2, $field3, ... );
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$crud->unique_fields('name', 'code', 'iso_code');
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// HINT: Put field validation codes here
// (documentation: http://www.grocerycrud.com/documentation/options_functions/set_rules)
// eg:
// $crud->set_rules( $field_name , $caption, $filter );
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// HINT: Put set relation (lookup) codes here
// (documentation: http://www.grocerycrud.com/documentation/options_functions/set_relation)
// eg:
// $crud->set_relation( $field_name , $related_table, $related_title_field , $where , $order_by );
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// HINT: Put set relation_n_n (detail many to many) codes here
// (documentation: http://www.grocerycrud.com/documentation/options_functions/set_relation_n_n)
// eg:
// $crud->set_relation_n_n( $field_name, $relation_table, $selection_table, $primary_key_alias_to_this_table,
// $primary_key_alias_to_selection_table , $title_field_selection_table, $priority_field_relation );
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// HINT: Put custom field type here
// (documentation: http://www.grocerycrud.com/documentation/options_functions/field_type)
// eg:
// $crud->field_type( $field_name , $field_type, $value );
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// HINT: Put callback here
// (documentation: httm://www.grocerycrud.com/documentation/options_functions)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$crud->callback_before_insert(array($this, '_before_insert'));
$crud->callback_before_update(array($this, '_before_update'));
$crud->callback_before_delete(array($this, '_before_delete'));
$crud->callback_after_insert(array($this, '_after_insert'));
$crud->callback_after_update(array($this, '_after_update'));
$crud->callback_after_delete(array($this, '_after_delete'));
$crud->callback_column('translations', array($this, '_callback_column_translations'));
$crud->callback_field('translations', array($this, '_callback_field_translations'));
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// HINT: Put custom error message here
// (documentation: httm://www.grocerycrud.com/documentation/set_lang_string)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// $crud->set_lang_string('delete_error_message', 'Cannot delete the record');
// $crud->set_lang_string('update_error', 'Cannot edit the record' );
// $crud->set_lang_string('insert_error', 'Cannot add the record' );
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// render
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$output = $crud->render();
// prepare css & js, add them to config
$config = array();
$asset = new CMS_Asset();
foreach ($output->css_files as $file) {
$asset->add_css($file);
}
$config['css'] = $asset->compile_css();
foreach ($output->js_files as $file) {
$asset->add_js($file);
}
$config['js'] = $asset->compile_js();
// show the view
$this->view($this->cms_module_path() . '/language/manage_main_language_view', $output, $this->cms_complete_navigation_name('main_language_management'), $config);
}
示例5: config
public function config()
{
$this->cms_guard_page('main_config_management');
$crud = $this->new_crud();
$crud->unset_jquery();
$crud->set_table(cms_table_name('main_config'));
$crud->set_subject($this->cms_lang('Configuration'));
$crud->unique_fields('config_name');
$crud->unset_read();
$crud->unset_delete();
$crud->columns('config_name', 'value');
$crud->edit_fields('config_name', 'value', 'description');
$crud->add_fields('config_name', 'value', 'description');
$crud->display_as('config_name', 'Configuration Key')->display_as('value', 'Configuration Value')->display_as('description', 'Description');
$crud->unset_texteditor('description');
$crud->unset_texteditor('value');
$operation = $crud->getState();
if ($operation == 'edit' || $operation == 'update' || $operation == 'update_validation') {
$crud->field_type('config_name', 'readonly');
$crud->field_type('description', 'readonly');
} else {
if ($operation == 'add' || $operation == 'insert' || $operation == 'insert_validation') {
//$crud->set_rules('config_name', 'Configuration Key', 'required');
$crud->required_fields('config_name');
}
}
$crud->callback_after_insert(array($this, 'after_insert_config'));
$crud->callback_after_update(array($this, 'after_update_config'));
$crud->callback_before_delete(array($this, 'before_delete_config'));
$crud->set_language($this->cms_language());
$output = $crud->render();
// prepare css & js, add them to config
$config = array();
$asset = new CMS_Asset();
foreach ($output->css_files as $file) {
$asset->add_css($file);
}
$config['css'] = $asset->compile_css();
foreach ($output->js_files as $file) {
$asset->add_js($file);
}
$config['js'] = $asset->compile_js();
// show the view
$this->view('main/main_config', $output, 'main_config_management', $config);
}
示例6: index
public function index()
{
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// initialize groceryCRUD
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$crud = $this->new_crud();
$crud->unset_jquery();
$crud->unset_print();
$crud->unset_export();
// set model
// $crud->set_model($this->cms_module_path().'/grocerycrud_category_model');
// adjust groceryCRUD's language to No-CMS's language
$crud->set_language($this->cms_language());
// table name
$crud->set_table($this->cms_complete_table_name('category'));
// set subject
$crud->set_subject('Category');
// displayed columns on list
$crud->columns('category_name', 'description', 'articles');
// displayed columns on edit operation
$crud->edit_fields('category_name', 'description', 'articles');
// displayed columns on add operation
$crud->add_fields('category_name', 'description', 'articles');
// required field
$crud->required_fields('category_name');
$crud->unique_fields('category_name');
$crud->unset_read();
// caption of each columns
$crud->display_as('category_name', 'Category Name');
$crud->display_as('description', 'Description');
$crud->display_as('articles', 'Articles');
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// HINT: Put set relation (lookup) codes here
// (documentation: http://www.grocerycrud.com/documentation/options_functions/set_relation)
// eg:
// $crud->set_relation( $field_name , $related_table, $related_title_field , $where , $order_by );
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// HINT: Put set relation_n_n (detail many to many) codes here
// (documentation: http://www.grocerycrud.com/documentation/options_functions/set_relation_n_n)
// eg:
// $crud->set_relation_n_n( $field_name, $relation_table, $selection_table, $primary_key_alias_to_this_table,
// $primary_key_alias_to_selection_table , $title_field_selection_table, $priority_field_relation );
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$crud->set_relation_n_n('articles', $this->cms_complete_table_name('category_article'), $this->cms_complete_table_name('article'), 'category_id', 'article_id', 'article_title', NULL);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// HINT: Put custom field type here
// (documentation: http://www.grocerycrud.com/documentation/options_functions/field_type)
// eg:
// $crud->field_type( $field_name , $field_type, $value );
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$crud->unset_texteditor('description');
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// HINT: Put callback here
// (documentation: httm://www.grocerycrud.com/documentation/options_functions)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$crud->callback_before_insert(array($this, 'before_insert'));
$crud->callback_before_update(array($this, 'before_update'));
$crud->callback_before_delete(array($this, 'before_delete'));
$crud->callback_after_insert(array($this, 'after_insert'));
$crud->callback_after_update(array($this, 'after_update'));
$crud->callback_after_delete(array($this, 'after_delete'));
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// render
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$output = $crud->render();
// prepare css & js, add them to config
$config = array();
$asset = new CMS_Asset();
foreach ($output->css_files as $file) {
$asset->add_css($file);
}
$config['css'] = $asset->compile_css();
foreach ($output->js_files as $file) {
$asset->add_js($file);
}
$config['js'] = $asset->compile_js();
// show the view
$this->view($this->cms_module_path() . '/manage_category_view', $output, $this->cms_complete_navigation_name('manage_category'), $config);
}
示例7: video
public function video()
{
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// initialize groceryCRUD
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$crud = $this->new_crud();
$crud->unset_edit();
$crud->unset_jquery();
$crud->unset_print();
$crud->unset_export();
// adjust groceryCRUD's language to No-CMS's language
$crud->set_language($this->cms_language());
// table name
$crud->set_table($this->cms_complete_table_name('video'));
// set subject
$crud->set_subject('Video');
// displayed columns on list
$crud->columns('nama', 'link');
// displayed columns on add operation
$crud->add_fields('nama');
$crud->required_fields('nama');
$crud->unset_read();
// caption of each columns
$crud->display_as('nama', 'File Video');
$crud->callback_after_delete(array($this, 'after_delete'));
$crud->callback_column('nama', array($this, 'callback_column_nama'));
$crud->callback_column('link', array($this, 'callback_column_link'));
$crud->set_field_upload('nama', 'modules/blog/assets/uploads/video');
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// render
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$output = $crud->render();
// prepare css & js, add them to config
$config = array();
$asset = new CMS_Asset();
foreach ($output->css_files as $file) {
$asset->add_css($file);
}
$config['css'] = $asset->compile_css();
foreach ($output->js_files as $file) {
$asset->add_js($file);
}
$config['js'] = $asset->compile_js();
// show the view
$this->view($this->cms_module_path() . '/manage_video_view', $output, $this->cms_complete_navigation_name('manage_video'), $config);
}