本文整理汇总了PHP中Assets::package方法的典型用法代码示例。如果您正苦于以下问题:PHP Assets::package方法的具体用法?PHP Assets::package怎么用?PHP Assets::package使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assets
的用法示例。
在下文中一共展示了Assets::package方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_index
public function action_index()
{
Assets::package('jquery-ui');
$cur_ds_id = (int) Arr::get($this->request->query(), 'ds_id', Cookie::get('ds_id'));
$tree = Datasource_Data_Manager::get_tree();
$cur_ds_id = Datasource_Data_Manager::exists($cur_ds_id) ? $cur_ds_id : Datasource_Data_Manager::$first_section;
$ds = $this->section($cur_ds_id);
$this->template->content = View::factory('datasource/content', array('content' => View::factory('datasource/data/index'), 'menu' => View::factory('datasource/data/menu', array('tree' => $tree, 'folders' => Datasource_Folder::get_all()))));
$this->template->footer = NULL;
$this->template->breadcrumbs = NULL;
if ($ds instanceof Datasource_Section) {
$this->set_title($ds->name);
$limit = (int) Arr::get($this->request->query(), 'limit', Cookie::get('limit'));
Cookie::set('ds_id', $cur_ds_id);
$keyword = $this->request->query('keyword');
if (!empty($limit)) {
Cookie::set('limit', $limit);
$this->section()->headline()->limit($limit);
}
$this->template->content->content->headline = $this->section()->headline()->render();
$this->template->content->content->toolbar = View::factory('datasource/' . $ds->type() . '/toolbar', array('keyword' => $keyword));
$this->template->set_global(array('datasource' => $ds));
$this->template_js_params['DS_ID'] = $this->_section->id();
$this->template_js_params['DS_TYPE'] = $this->_section->type();
} else {
$this->template->content->content = NULL;
}
}
示例2: before
public function before()
{
parent::before();
if ($this->auto_render === TRUE) {
Assets::js('jquery', ADMIN_RESOURCES . 'libs/jquery.min.js');
Assets::package(array('jquery-ui', 'backbone', 'notify', 'underscore', 'select2', 'core', 'bootstrap'));
}
}
示例3: action_view
public function action_view()
{
Assets::package('ace');
$file = $this->request->param('file');
$backup = Model_Backup::factory(BACKUP_PLUGIN_FOLDER . $file);
$this->template->title = __('Backup view :file', array(':file' => $file));
$this->template->content = View::factory('backup/view', array('model' => $backup, 'filename' => $file));
}
示例4: load_filters
public static function load_filters()
{
foreach (self::$filters as $key => $filter) {
Assets::package($key);
}
foreach (self::$plugins as $plugin) {
Assets::package($plugin);
}
}
示例5: action_index
public function action_index()
{
Assets::package('jquery-ui');
Assets::css('fullcalendar', ADMIN_RESOURCES . 'libs/fullcalendar-2.1.0/fullcalendar.min.css', 'global');
Assets::js('fullcalendar', ADMIN_RESOURCES . 'libs/fullcalendar-2.1.0/fullcalendar.min.js', 'jquery');
Assets::js('fullcalendar.lang', ADMIN_RESOURCES . 'libs/fullcalendar-2.1.0/lang/' . I18n::lang_short() . '.js', 'fullcalendar');
$this->set_title(__('Calendar'), FALSE);
$this->template->content = View::factory('calendar/index', array('colors' => array('default', 'darken', 'danger', 'info', 'primary', 'success', 'warning'), 'icons' => array('info', 'warning', 'check', 'user', 'lock', 'clock-o')));
}
示例6: response
/**
* Get a Response object representing the exception
*
* @uses Kohana_Exception::text
* @param Exception $e
* @return Response
*/
public static function response(Exception $e)
{
if (Config::get('site', 'debug') == Config::YES or Kohana::$environment !== Kohana::PRODUCTION) {
Assets::package(array('jquery', 'core', 'backbone', 'notify', 'underscore'));
// Show the normal Kohana error page.
return parent::response($e);
}
// Show the custom Kodicms error page.
return self::_show_custom_error($e);
}
示例7: action_index
public function action_index()
{
// Подключение media пакета
Assets::package(array('skeleton'));
// Вывод в глобальный шаблон JavaScript параметра
// Все параметры проходят через функцию json_encode
$this->template_js_params['PARAM'] = '...';
$this->set_title(__('Skeleton'));
$this->template->content = View::factory('skeleton/index', array('param' => '....'));
}
示例8: load_all
/**
*
* @param string $type
*/
public static function load_all($type = NULL)
{
foreach (self::$_editors as $editor_id => $data) {
if ($type !== NULL and is_string($type)) {
if ($type != $data['type']) {
continue;
}
}
self::$_loaded[$editor_id] = $data;
Assets::package($data['package']);
}
}
示例9: action_settings
public function action_settings()
{
$this->set_title(__('Settings'));
Assets::package('ace');
$site_pages = array();
foreach (Model_Navigation::get()->sections() as $section) {
foreach ($section->get_pages() as $item) {
$url = trim(str_replace(ADMIN_DIR_NAME, '', $item->url()), '/');
$site_pages[$section->name()][$url] = $item->name();
}
}
$this->template->content = View::factory('system/settings', array('filters' => Arr::merge(array('--none--'), WYSIWYG::findAll()), 'dates' => Date::formats(), 'site_pages' => $site_pages, 'default_status_id' => array(Model_Page::STATUS_DRAFT => __('Draft'), Model_Page::STATUS_PUBLISHED => __('Published'))));
}
示例10: action_view
public function action_view()
{
Assets::package('backbone');
$id = (int) $this->request->query('id');
$doc = $this->_get_document($id);
WYSIWYG::load_filters();
$this->_load_session_data($doc);
$doc->onControllerLoad();
$this->breadcrumbs->add($this->section()->name, Route::get('datasources')->uri(array('directory' => 'datasources', 'controller' => 'data')) . URL::query(array('ds_id' => $this->section()->id()), FALSE));
$this->template_js_params['API_FORM_ACTION'] = '/datasource-document.' . ($doc->loaded() ? 'update' : 'create');
$this->template_js_params['SECTION_ID'] = (int) $this->section()->id();
$this->template_js_params['DOCUMENT_ID'] = $id;
if (!$doc->loaded()) {
$this->set_title(__('New document'));
} else {
$this->set_title($doc->header);
}
$this->_load_template($doc);
}
示例11: action_edit
public function action_edit()
{
$layout_name = $this->request->param('id');
$layout = new Model_File_Layout($layout_name);
if (!$layout->is_exists()) {
if (($found_file = $layout->find_file()) !== FALSE) {
$layout = new Model_File_Layout($found_file);
} else {
Messages::errors(__('Layout not found!'));
$this->go();
}
}
$this->set_title($layout_name);
// check if trying to save
if (Request::current()->method() == Request::POST and ACL::check('layout.edit')) {
return $this->_edit($layout);
}
Assets::package('ace');
$this->template->content = View::factory('layout/edit', array('action' => 'edit', 'layout' => $layout));
}
示例12: action_edit
public function action_edit()
{
$snippet_name = $this->request->param('id');
$snippet = new Model_File_Snippet($snippet_name);
if (!$snippet->is_exists()) {
if (($found_file = $snippet->find_file()) !== FALSE) {
$snippet = new Model_File_Snippet($found_file);
} else {
Messages::errors(__('Snippet not found!'));
$this->go();
}
}
$this->template->title = __('Edit snippet');
$this->breadcrumbs->add($snippet_name);
// check if trying to save
if (Request::current()->method() == Request::POST and ACL::check('snippet.edit')) {
return $this->_edit($snippet_name);
}
Assets::package('ace');
$this->template->content = View::factory('snippet/edit', array('action' => 'edit', 'filters' => WYSIWYG::findAll(), 'snippet' => $snippet));
}
示例13: action_index
public function action_index()
{
Assets::package('gridster');
$widgets_array = Model_User_Meta::get('dashboard', array());
$widget_settings = Model_User_Meta::get('dashboard_widget_settings', array());
foreach ($widgets_array as $i => $data) {
if (!isset($data['widget_id'])) {
unset($widgets_array[$i]);
continue;
}
$widget_object = Arr::get($widget_settings, $data['widget_id']);
if (!$widget_object instanceof Model_Widget_Decorator_Dashboard) {
unset($widgets_array[$i]);
continue;
}
$widget_object->on_page_load();
$widgets_array[$i]['widget'] = $widget_object;
}
$this->set_title(__('Dashboard'), FALSE);
$this->template->content = View::factory('dashboard/index', array('widgets' => $widgets_array, 'columns' => Config::get('dashboard', 'columns', array())));
}
示例14: action_edit
public function action_edit()
{
WYSIWYG::load_filters();
Assets::package('backbone');
$page_id = (int) $this->request->param('id');
$page = ORM::factory('page', $page_id);
if (!$page->loaded()) {
Messages::errors(__('Page not found!'));
$this->go();
}
// Проверка пользователя на доступ к редактированию текущей страницы
if (!Auth::has_permissions($page->get_permissions())) {
Messages::errors(__('You do not have permission to access the requested page!'));
$this->go();
}
// check if trying to save
if ($this->request->method() == Request::POST) {
return $this->_edit($page);
}
$this->set_page_js_params($page);
$this->set_title($page->title);
$this->template->content = View::factory('page/edit', array('action' => 'edit', 'page' => $page, 'permissions' => ORM::factory('role')->find_all()->as_array('id', 'name'), 'page_permissions' => $page->get_permissions()));
}
示例15: init_media
public function init_media()
{
parent::init_media();
$this->template_js_params['ACE_THEME'] = Config::get('ace', 'theme', 'textmate');
$this->template_js_params['DEFAULT_FILTER'] = Config::get('site', 'default_filter_id', '');
Assets::package(array('jquery', 'bootstrap', 'notify', 'select2', 'dropzone', 'fancybox', 'datepicker', 'underscore', 'core'));
foreach (array('.js', '-message.js') as $file_name) {
$filename = Kohana::$cache_dir . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, array('i18n', NULL)) . I18n::lang() . $file_name;
if (file_exists($filename)) {
Assets::js('i18n', BASE_URL . 'cms/cache/i18n/' . I18n::lang() . $file_name, 'global', FALSE, 0);
}
}
$file = $this->request->controller();
$directory = $this->request->directory();
if (!empty($directory)) {
$file = $directory . '/' . $file;
}
$file = strtolower($file);
if (Kohana::find_file('media', FileSystem::normalize_path('js/controller/' . $file), 'js')) {
Assets::js('controller.' . $file, ADMIN_RESOURCES . 'js/controller/' . $file . '.js', 'global', FALSE, 999);
}
Assets::group('global', 'events', '<script type="text/javascript">' . Assets::merge_files('js/events', 'js') . '</script>', 'global');
}