本文整理汇总了PHP中Assets类的典型用法代码示例。如果您正苦于以下问题:PHP Assets类的具体用法?PHP Assets怎么用?PHP Assets使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Assets类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseAssets
public function parseAssets($rowset, $characterID, $containerID)
{
//echo "Working on container: $containerID <br>";
foreach ($rowset as $item) {
if ($item->count() > 0) {
//echo "Triggered next nest. Count = {$rowset->count()} <br>";
$this->parseAssets($item->rowset->row, $characterID, $item->attributes()->itemID);
}
if (isset($item->attributes()->locationID)) {
$locationName = $this->getLocationName($item->attributes()->locationID);
}
$invType = Invtypes::Model()->findByPk($item->attributes()->typeID);
$asset = new Assets();
$asset->characterID = $characterID;
$asset->itemID = $item->attributes()->itemID;
$asset->locationID = $item->attributes()->locationID;
$asset->typeID = $item->attributes()->typeID;
$asset->quantity = $item->attributes()->quantity;
$asset->flag = $item->attributes()->flag;
$asset->singleton = $item->attributes()->singleton;
$asset->containerID = $containerID;
$asset->locationName = $locationName;
$asset->typeName = $invType->typeName;
$asset->groupID = $invType->groupID;
try {
$asset->save();
//echo "Item: {$asset->itemID} {$asset->typeName} Character: {$asset->characterID} Container: {$asset->containerID} <br>";
} catch (Exception $e) {
//echo "ERROR: Item {$asset->itemID} <br>";
//echo "Item: {$asset->itemID} {$asset->typeName} Character: {$asset->characterID} Container: {$asset->containerID} <br>";
//$message = $e->getMessage();
//echo "Exception: $message <br>";
}
}
}
示例2: resource
function resource($file, $level = '', $display = 'url', $params = '')
{
include_once APPPATH . 'libraries/Assets.php';
$assets = new Assets();
if ($display === 'url') {
return $assets->url($file, $level);
} elseif ($display === 'file') {
return $assets->load($file, $level, $params);
} else {
return $assets->url($file, $level);
}
}
示例3: show
public function show($options = array(), $data)
{
// dump($data);die;
$name = $data['field_name'];
$path = site_url("admin/" . $data['options']->path . "/ajax_execute/order_box");
$js = <<<EOT
\t\t\t\$(".order_box").change(function(){
\t\t\t\tdata_send = {
\t\t\t\t\t"field_name" : \$(this).attr("order_box_field"),
\t\t\t\t\t"pk"\t\t: \$(this).attr("order_box_pk"),
\t\t\t\t\t"pk_val"\t : \$(this).attr("order_box_id"),
\t\t\t\t\t"value"\t : \$(this).val()
\t\t\t\t};
\t\t\t\t\$.getJSON('{$path}', data_send, function(data) {
\t\t\t\t\t // alert(JSON.stringify(data));
\t\t\t\t});
\t\t\t});
\t\t\t\t\t
EOT;
Assets::add_js($js, "inline", true);
// dump($data);die;
return "<input class='order_box' name='' value='{$data['value']}' order_box_id='{$data['pk']}' min='0' max='99' order_box_pk='{$data['pk_name']}' order_box_field='{$data['field_name']}' type='number' style='max-width: 30px;' />";
}
示例4: test_inline
public function test_inline()
{
$assets = Assets::factory('test_name')->process(FALSE)->css('test.css')->js('test.js');
$inline = $assets->inline();
$this->assertContains('.test { display: block; }', $inline);
$this->assertContains('var test;', $inline);
}
示例5: enqueue_manage_post_assets
function enqueue_manage_post_assets()
{
$WP = \EzFilter\getWpObject();
$post_types = $WP->getSettings('post_types');
if (!in_array($WP->typenow, $post_types)) {
return false;
}
$assetsToEnqueue = array();
$remove_default = $WP->removeDefaultFilter();
$post_type_settings = $WP->getSettings($WP->typenow);
$post_type_settings = isset($post_type_settings['config']) ? $post_type_settings['config'] : array();
if (in_array('date_range', $post_type_settings)) {
$assetsToEnqueue['css'][$WP->plugin_domain . "-post-css"] = $WP->plugin_domain . "-post-css";
$assetsToEnqueue['css']['jquery-style'] = 'jquery-style';
$assetsToEnqueue['js']['jquery'] = 'jquery';
$assetsToEnqueue['js']['jquery-ui-core'] = 'jquery-ui-core';
$assetsToEnqueue['js']['jquery-ui-datepicker'] = 'jquery-ui-datepicker';
$assetsToEnqueue['js'][$WP->plugin_domain . "-post-js"] = $WP->plugin_domain . "-post-js";
}
if ($remove_default) {
$assetsToEnqueue['css'][$WP->plugin_domain . "-post-css"] = $WP->plugin_domain . "-post-css";
$assetsToEnqueue['js']['jquery'] = 'jquery';
$assetsToEnqueue['js'][$WP->plugin_domain . "-post-js"] = $WP->plugin_domain . "-post-js";
}
Assets::enqueue_assets($assetsToEnqueue);
return true;
}
示例6: index
public function index(array $params = [])
{
Assets::addCSS('svgtree-0.3.0.min.css');
Assets::addCSS('main.css');
Assets::addJS('jsrender.min.js');
Assets::addJS('db.js');
Assets::addJS('main.js');
Assets::addJS('search.js');
Assets::addJS('svgtree-0.3.0.min.js');
Assets::addJS('trees.js');
$this->SearchModel = $this->loader->loadModel('Search');
if (isset($_POST['words'])) {
$words = json_decode($_POST['words']);
$results = $this->SearchModel->searchFromKeywords($words);
$response = [];
// if we have some results to handle
if ($results) {
// count values
$results = array_count_values($results);
// sort by count
arsort($results);
// keep only sorted links id
$results = array_keys($results);
foreach ($results as $linkId) {
$link = $this->SearchModel->getLink($linkId);
if ($link) {
$response[] = $link;
}
}
}
echo json_encode($response);
exit;
}
$this->loader->loadView('index', $this->data, true);
}
示例7: create_form
public function create_form($fields_data = false)
{
$this->table_structure = $this->get_table_structure();
Assets::add_js("jasny-bootstrap.min.js");
Assets::add_js("modernizr-2.5.3.js");
Assets::add_css("jasny-bootstrap.min.css");
$hiddens = array();
//hiddens only on update
if ($fields_data !== FALSE) {
$primary_key = $this->get_primary_key();
$hiddens = array($primary_key => $fields_data->{$primary_key});
}
$form = "";
$form .= form_open_multipart($this->ci->uri->uri_string(), 'class="form-horizontal" name="form_upload"', $hiddens);
foreach ($this->table_structure as $field_info) {
if ($this->can_show_input($field_info)) {
$form .= $this->generate_input($field_info, $fields_data);
}
}
// AFTER CREATE THE FORM, WE WILL INSERT HERE THE COMPONENTS
if (isset($this->config->components)) {
foreach ($this->config->components as $component_name => $component_configurations) {
$component_configurations = $this->get_default_config($component_configurations);
$component_lib = $this->ci->load->library("components/{$component_name}", $component_configurations);
$form .= $component_lib->generate();
}
}
$cancel_link = anchor(SITE_AREA . $this->get_path(), "Cancelar", "class='btn btn-warning'");
$form .= "\n\t\t <fieldset>\n\t\t <div class='form-actions'>\n\t\t <br/>\n\t\t <input type='submit' name='save' class='btn btn-success' value='Salvar' />\n\t\t <input type='submit' name='save' class='btn btn-success' value='Salvar e continuar' />\n\t\t <!--<input type='submit' name='draft' class='btn btn-primary' value='Rascunho' />-->\n\t\t {$cancel_link}\n\t\t </div>\n\t\t </fieldset>\n\t\t";
$form .= form_close();
return $form;
}
示例8: __construct
/**
* Create an instance of this class by using a plain PHP array.
*
* @param array $conf an array containing the configuration
* settings
* @param string $path the path to the config file that was used
* (NULL if instantiated via constructor)
*/
function __construct($conf = array(), $path = NULL)
{
global $ABSOLUTE_PATH_STUDIP;
$defaults = array('assets_root' => "{$ABSOLUTE_PATH_STUDIP}assets", 'package_path' => "{$ABSOLUTE_PATH_STUDIP}assets/squeezed", 'package_url' => \Assets::url('squeezed'), 'javascripts' => array(), 'compress' => true, 'compressor_options' => array());
$this->settings = array_merge($defaults, $conf);
$this->settings['config_path'] = $path ?: __FILE__;
}
示例9: actionStoreValue
public function actionStoreValue()
{
$id = $_GET['id'];
$asset = Assets::Model()->findByPk($id);
$this->storeSingleAssetValue($asset->typeID);
$this->renderPartial('storeValue');
}
示例10: __construct
public function __construct()
{
parent::__construct();
// Set default javascript
$this->template->append_metadata(Assets::adminJs('main', 'js'));
// Show login page
$current_page = $this->uri->segment(1, '') . '/' . $this->uri->segment(2, 'index');
if (!$this->ion_auth->logged_in()) {
if ($current_page != 'admin/login') {
redirect('admin/login');
}
}
//Set theme for backend
$this->template->set_partial('sidebar', 'admin/sidebar')->set_partial('head', 'admin/head')->enable_parser(FALSE)->set_layout('main', 'admin');
// Check access
$currentModule = $this->router->fetch_module();
$accessGranted = $this->ion_auth->check_access(get_module_id($currentModule), 'admin');
if ($this->ion_auth->logged_in() && !$accessGranted) {
// Allow access to dashboard
$this->session->set_flashdata('access_error', 'You don\'t have access to this module!');
if ($current_page != 'admin/index') {
redirect('admin');
}
}
}
示例11: st_vc_about_icon
function st_vc_about_icon($attr, $content = false)
{
$data = shortcode_atts(array('st_icon' => '', 'st_name' => '', 'st_description' => '', 'st_link' => '', 'st_pos_icon' => 'top', 'st_color_icon' => '', 'st_size_icon' => 'box-icon-sm', 'st_text_align' => 'text-center', 'st_border' => '', 'st_to_color' => 'black'), $attr, 'st_about_icon');
extract($data);
$icons_center = '';
if ($st_text_align == 'text-center') {
$icons_center = 'box-icon-center';
}
$class_bg_color = Assets::build_css("background: " . $st_color_icon . "");
if (!empty($st_border)) {
$class_bg_color = Assets::build_css("border-color: " . $st_color_icon . "!important;\r\n color: " . $st_color_icon . "!important;");
}
if (empty($st_link)) {
$title = '<h4 class="thumb-title">' . $st_name . '</h4>';
} else {
$title = ' <h5 class="thumb-title">
<a href="' . $st_link . '" class="text-darken">' . $st_name . '</a>
</h5>';
}
$txt = '
<div class="thumb ' . $st_text_align . '">
<header class="thumb-header pull-' . $st_pos_icon . ' st-thumb-header">
<i class="fa ' . $st_icon . ' ' . $st_size_icon . ' box-icon-' . $st_pos_icon . ' ' . $icons_center . ' round ' . $class_bg_color . ' animate-icon-top-to-bottom ' . $st_border . ' box-icon-to-' . $st_to_color . ' "></i>
</header>
<div class="thumb-caption pull-' . $st_pos_icon . ' st-thumb-caption">
' . $title . '
<p class="thumb-desc">' . $st_description . '</p>
</div>
</div>
';
return $txt;
}
示例12: index
public function index()
{
$offset = $this->uri->segment(4);
Assets::add_js($this->load->view('settings/users_js', null, true), 'inline');
$total_users = $this->user_model->count_all();
$this->pager['base_url'] = site_url(SITE_AREA . '/settings/users/index');
$this->pager['total_rows'] = $total_users;
$this->pager['per_page'] = $this->limit;
$this->pager['uri_segment'] = 4;
$this->pagination->initialize($this->pager);
// Was a filter set?
if ($this->input->post('filter_submit') && $this->input->post('filter_by_role_id')) {
$role_id = $this->input->post('filter_by_role_id');
$this->db->where('role_id', $role_id);
Template::set('filter', $role_id);
}
if (config_item('auth.use_usernames')) {
$this->db->order_by('username', 'asc');
} else {
$this->db->order_by('email', 'asc');
}
Template::set('users', $this->user_model->limit($this->limit, $offset)->find_all());
Template::set('total_users', $total_users);
Template::set('deleted_users', $this->user_model->count_all(true));
Template::set('roles', $this->role_model->select('role_id, role_name, default')->find_all());
Template::set('user_count', $this->user_model->count_all());
Template::set('login_attempts', $this->user_model->get_login_attempts($this->limit));
$this->load->helper('ui/ui');
Template::set('toolbar_title', lang('us_user_management'));
Template::render();
}
示例13: render
public function render()
{
$asset = Assets::get();
$this->addData(['css' => $asset->Css(), 'js' => $asset->Js(), 'internalCss' => $asset->InternalCss(), 'jsReady' => $asset->OnLoadJs()]);
$tpl = Template::get()->loadTemplate($this->template);
return $tpl->render($this->data);
}
示例14: create
/**
* Create a Groups object.
*
* @return void
*/
public function create()
{
$this->load->config('address');
$this->load->helper('address');
if (isset($_POST['save'])) {
if ($insert_id = $this->save_groups()) {
log_activity($this->auth->user_id(), lang('groups_act_create_record') . ': ' . $insert_id . ' : ' . $this->input->ip_address(), 'groups');
Template::set_message(lang('groups_create_success'), 'success');
redirect('/');
}
// Not validation error
if (!empty($this->groups_model->error)) {
Template::set_message(lang('groups_create_failure') . $this->groups_model->error, 'error');
}
}
if ($this->siteSettings['auth.password_show_labels'] == 1) {
Assets::add_js($this->load->view('users_js', array('settings' => $this->siteSettings), true), 'inline');
}
// Generate password hint messages.
$this->user_model->password_hints();
$result = array();
$group_type_options = $this->group_types_model->get_group_types_list();
array_unshift($group_type_options, "Select");
Template::set('group_type_options', $group_type_options);
Template::set('toolbar_title', lang('groups_action_create'));
Template::set_view('content/create', $result);
Template::render();
}
示例15: __construct
/**
* Constructor
*
* @return void
*/
public function __construct()
{
parent::__construct();
$this->load->model('botan_structure/botan_structure_model');
$this->lang->load('botan_structure');
Assets::add_module_js('botan_structure', 'botan_structure.js');
}