本文整理汇总了PHP中Location::asset方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::asset方法的具体用法?PHP Location::asset怎么用?PHP Location::asset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Location
的用法示例。
在下文中一共展示了Location::asset方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: alertstatus
/**
* Put your own methods below this...
*/
function alertstatus()
{
$this->auth->check_access('site/settings', TRUE);
/* load models */
$this->load->model('alertstatus_model', 'alert');
$alerts = $this->alert->get_alerts();
if ($alerts->num_rows() > 0) {
foreach ($alerts->result() as $alert) {
$imgstat = 'off';
if ($alert->alert_active == 'y') {
$imgstat = 'on';
}
$data['alerts'][$alert->alert_id] = array('img' => array('src' => Location::asset('images/alerts', $alert->alert_image . '-' . $imgstat . '.png'), 'alt' => $alert->alert_name, 'class' => $imgstat, 'currStat' => $alert->alert_image, 'id' => 'al' . $alert->alert_id), 'name' => $alert->alert_name, 'desc' => $alert->alert_description, 'active' => $alert->alert_active, 'id' => $alert->alert_id, 'imgbase' => $alert->alert_image);
$data_js['img'][$alert->alert_id] = array('src' => $alert->alert_image . '-hover.png', 'id' => $alert->alert_id);
}
}
$data['loading'] = array('src' => Location::asset('images/alerts', 'black-bg-loading.gif'), 'alt' => '', 'class' => 'image');
$data['imglocation'] = base_url() . Location::asset('images/alerts', '');
$data['activealert'] = $this->alert->get_current_alert();
$data['header'] = 'Alert Status';
$data['text'] = 'Set the current alert status of your ship by clicking on the proper alert claxon.';
$this->_regions['content'] = Location::view('admin_alertstatus', $this->skin, 'admin', $data);
$this->_regions['javascript'] = Location::js('admin_alertstatus_js', $this->skin, 'admin');
$this->_regions['title'] .= $data['header'];
Template::assign($this->_regions);
Template::render();
}
示例2: index
/**
* Put your own methods below this...
*/
function index()
{
/* other data used by the view */
$data['header'] = ucwords(lang('labels_the') . ' ' . lang('global_sim'));
$data['msg_sim'] = $this->msgs->get_message('sim');
/* load models */
$this->load->model('alertstatus_model', 'alert');
$currAlert = $this->alert->get_current_alert();
$data['alertimg'] = array('src' => Location::asset('images/alerts', $currAlert->alert_image . '-on.png'), 'alt' => $currAlert->alert_name, 'id' => 'al' . $currAlert->alert_id);
$this->_regions['content'] = Location::view('sim_index', $this->skin, 'main', $data);
$this->_regions['title'] .= $data['header'];
Template::assign($this->_regions);
Template::render();
}
示例3: character
public function character($id = false)
{
// load the models
$this->load->model('ranks_model', 'ranks');
$this->load->model('positions_model', 'pos');
$this->load->model('posts_model', 'posts');
$this->load->model('personallogs_model', 'logs');
$this->load->model('news_model', 'news');
$this->load->model('awards_model', 'awards');
$this->load->helper('utility');
$id = is_numeric($id) ? $id : false;
$character = $this->char->get_character($id);
$data['postcount'] = 0;
$data['logcount'] = 0;
$data['newscount'] = 0;
$data['awardcount'] = 0;
if ($character !== false) {
$data['postcount'] = $this->posts->count_character_posts($id);
$data['logcount'] = $this->logs->count_character_logs($id);
$data['newscount'] = $this->news->count_character_news($id);
$data['awardcount'] = $this->awards->count_character_awards($id);
$data['last_post'] = mdate($this->options['date_format'], gmt_to_local($character->last_post, $this->timezone, $this->dst));
$name_array = array('first_name' => $character->first_name, 'middle_name' => $character->middle_name, 'last_name' => $character->last_name, 'suffix' => $character->suffix);
$name = parse_name($name_array);
$abbr_name = parse_name(array('first_name' => $character->first_name, 'last_name' => $character->last_name));
$rank = $this->ranks->get_rank($character->rank, 'rank_name');
$data['character_info'] = array(array('label' => ucfirst(lang('labels_name')), 'value' => $name), array('label' => ucfirst(lang('global_position')), 'value' => $this->pos->get_position($character->position_1, 'pos_name')), array('label' => ucwords(lang('order_second') . ' ' . lang('global_position')), 'value' => $this->pos->get_position($character->position_2, 'pos_name')), array('label' => ucfirst(lang('global_rank')), 'value' => $rank));
$data['character']['id'] = $id;
$data['character']['name'] = $name;
$data['character']['rank'] = $character->rank;
$data['character']['position_1'] = $character->position_1;
$data['character']['position_2'] = $character->position_2;
$data['character']['user'] = $character->user;
if ($character->images > '') {
$images = explode(',', $character->images);
$images_count = count($images);
$src = strstr($images[0], 'http://') !== false ? $images[0] : base_url() . Location::asset('images/characters', trim($images[0]));
$data['character']['image'] = array('src' => $src, 'alt' => $name, 'class' => 'image', 'width' => 200);
$data['character']['image_array'] = array();
for ($i = 1; $i < $images_count; $i++) {
$src = strstr($images[$i], 'http://') !== false ? trim($images[$i]) : base_url() . Location::asset('images/characters', trim($images[$i]));
$data['character']['image_array'][] = array('src' => $src, 'alt' => $name, 'class' => 'image');
}
} else {
$data['character']['noavatar'] = array('src' => Location::img('no-avatar.png', $this->skin, 'main'), 'alt' => '', 'class' => 'image', 'width' => 200);
}
$tabs = $this->char->get_bio_tabs();
$sections = $this->char->get_bio_sections();
if ($tabs->num_rows() > 0) {
$i = 1;
foreach ($tabs->result() as $tab) {
$data['tabs'][$i]['id'] = $tab->tab_id;
$data['tabs'][$i]['name'] = $tab->tab_name;
$data['tabs'][$i]['link'] = $tab->tab_link_id;
++$i;
}
}
if ($sections->num_rows() > 0) {
$i = 1;
foreach ($sections->result() as $sec) {
$fields = $this->char->get_bio_fields($sec->section_id);
if ($fields->num_rows() > 0) {
$j = 1;
foreach ($fields->result() as $field) {
$data['fields'][$sec->section_id][$j]['label'] = $field->field_label_page;
$data['fields'][$sec->section_id][$j]['value'] = false;
$info = $this->char->get_field_data($field->field_id, $id);
if ($info->num_rows() > 0) {
foreach ($info->result() as $item) {
$data['fields'][$sec->section_id][$j]['value'] = $item->data_value;
}
}
++$j;
}
}
if ($tabs->num_rows() > 0) {
$data['sections'][$sec->section_tab][$i]['id'] = $sec->section_id;
$data['sections'][$sec->section_tab][$i]['name'] = $sec->section_name;
} else {
$data['sections'][$i]['id'] = $sec->section_id;
$data['sections'][$i]['name'] = $sec->section_name;
}
++$i;
}
}
// set the header
$data['header'] = $rank . ' ' . $abbr_name;
$this->_regions['title'] .= ucfirst(lang('labels_biography')) . ' - ' . $abbr_name;
} else {
$data['header'] = sprintf(lang('error_title_invalid_char'), ucfirst(lang('global_character')));
$data['msg_error'] = sprintf(lang_output('error_msg_invalid_char'), lang('global_character'));
$this->_regions['title'] .= lang('error_pagetitle');
}
if (Auth::is_logged_in()) {
$data['edit_valid_form'] = Auth::check_access('site/bioform', false) ? true : false;
if (Auth::check_access('characters/bio', false) === true) {
if (Auth::get_access_level('characters/bio') == 3) {
$data['edit_valid'] = true;
} elseif (Auth::get_access_level('characters/bio') == 2) {
$characters = $this->char->get_user_characters($this->session->userdata('userid'), '', 'array');
//.........这里部分代码省略.........
示例4: bio
//.........这里部分代码省略.........
$c = $this->char->get_character($id);
$u = $this->user->get_user($user);
if ($u->status == 'inactive') {
$user_update_data['status'] = 'active';
$user_update_data['leave_date'] = null;
$user_update_data['last_update'] = now();
$user_update_data['access_role'] = Access_Model::STANDARD;
}
if ($maincharacter) {
$user_update_data['main_char'] = $id;
$user_update_data['last_update'] = now();
}
$character_update_data['crew_type'] = 'active';
$character_update_data['user'] = $user;
$this->pos->update_open_slots($c->position_1, 'add_crew');
if ($c->position_2 > 0 and $c->position_2 !== null) {
$this->pos->update_open_slots($c->position_2, 'add_crew');
}
if (isset($user_update_data)) {
$update_user = $this->user->update_user($user, $user_update_data);
}
$update_char = $this->char->update_character($id, $character_update_data);
$message = sprintf($update_char > 0 ? lang('flash_success') : lang('flash_failure'), ucfirst(lang('global_character')), lang('actions_updated'), '');
$flash['status'] = $update_char > 0 ? 'success' : 'error';
$flash['message'] = text_output($message);
}
break;
}
$this->_regions['flash_message'] = Location::view('flash', $this->skin, 'admin', $flash);
}
$char = $this->char->get_character($id);
$sections = $this->char->get_bio_sections();
if ($sections->num_rows() > 0) {
foreach ($sections->result() as $sec) {
$sid = $sec->section_id;
$data['join'][$sid]['name'] = $sec->section_name;
$fields = $this->char->get_bio_fields($sec->section_id);
if ($fields->num_rows() > 0) {
foreach ($fields->result() as $field) {
$f_id = $field->field_id;
$data['join'][$sid]['fields'][$f_id]['field_label'] = $field->field_label_page;
$info = $this->char->get_field_data($field->field_id, $data['id']);
$row = $info->num_rows() > 0 ? $info->row() : false;
switch ($field->field_type) {
case 'text':
$input = array('name' => $field->field_id, 'id' => $field->field_fid, 'class' => $field->field_class, 'value' => $row !== false ? $row->data_value : '');
$data['join'][$sid]['fields'][$f_id]['input'] = form_input($input);
break;
case 'textarea':
$input = array('name' => $field->field_id, 'id' => $field->field_fid, 'class' => $field->field_class, 'value' => $row !== false ? $row->data_value : '', 'rows' => $field->field_rows);
$data['join'][$sid]['fields'][$f_id]['input'] = form_textarea($input);
break;
case 'select':
$value = false;
$values = false;
$input = false;
$values = $this->char->get_bio_values($field->field_id);
$data_val = $row !== false ? $row->data_value : '';
if ($values->num_rows() > 0) {
foreach ($values->result() as $value) {
$input[$value->value_field_value] = $value->value_content;
}
}
$data['join'][$sid]['fields'][$f_id]['input'] = form_dropdown($field->field_id, $input, $data_val);
break;
}
}
}
}
}
$pos1 = $this->pos->get_position($char->position_1);
$pos2 = $this->pos->get_position($char->position_2);
$rank = $this->ranks->get_rank($char->rank);
$rankcat = $this->ranks->get_rankcat($this->rank);
$data['inputs'] = array('first_name' => array('name' => 'first_name', 'id' => 'first_name', 'value' => $char->first_name), 'middle_name' => array('name' => 'middle_name', 'id' => 'middle_name', 'value' => $char->middle_name), 'last_name' => array('name' => 'last_name', 'id' => 'last_name', 'value' => $char->last_name), 'suffix' => array('name' => 'suffix', 'id' => 'suffix', 'class' => 'medium', 'value' => $char->suffix), 'position1_id' => $char->position_1, 'position2_id' => $char->position_2, 'position1_name' => $pos1 !== false ? $pos1->pos_name : '', 'position2_name' => $pos2 !== false ? $pos2->pos_name : '', 'position1_desc' => $pos1 !== false ? $pos1->pos_desc : '', 'position2_desc' => $pos2 !== false ? $pos2->pos_desc : '', 'rank_id' => $char->rank, 'rank_name' => $rank !== false ? $rank->rank_name : '', 'rank' => array('src' => $rank !== false ? Location::rank($this->rank, $rank->rank_image, $rankcat->rankcat_extension) : '', 'alt' => $rank !== false ? $rank->rank_name : '', 'class' => 'image'), 'crew_type' => $char->crew_type, 'images' => !empty($char->images) ? explode(',', $char->images) : '');
$data['values']['crew_type'] = array('active' => ucwords(lang('status_playing') . ' ' . lang('global_character')), 'npc' => ucwords(lang('status_nonplaying') . ' ' . lang('global_character')), 'inactive' => ucwords(lang('status_inactive') . ' ' . lang('global_character')), 'pending' => ucwords(lang('status_pending') . ' ' . lang('global_character')));
$data['directory'] = array();
$dir = $this->sys->get_uploaded_images('bio');
if ($dir->num_rows() > 0) {
foreach ($dir->result() as $d) {
if ($d->upload_user == $this->session->userdata('userid')) {
$data['myuploads'][$d->upload_id] = array('image' => array('src' => Location::asset('images/characters', $d->upload_filename), 'alt' => $d->upload_filename, 'class' => 'image image-height-100'), 'file' => $d->upload_filename, 'id' => $d->upload_id);
} else {
$data['directory'][$d->upload_id] = array('image' => array('src' => Location::asset('images/characters', $d->upload_filename), 'alt' => $d->upload_filename, 'class' => 'image image-height-100'), 'file' => $d->upload_filename, 'id' => $d->upload_id);
}
}
}
$data['header'] = ucwords(lang('actions_edit') . ' ' . lang('labels_bio')) . ' - ' . $this->char->get_character_name($data['id']);
$data['image_instructions'] = sprintf(lang('text_image_select'), lang('labels_bio'));
$data['button'] = array('submit' => array('type' => 'submit', 'class' => 'button-main', 'name' => 'submit', 'value' => 'submit', 'content' => ucwords(lang('actions_submit'))), 'use' => array('type' => 'submit', 'class' => 'button-sec add', 'name' => 'use', 'value' => 'use', 'content' => ucwords(lang('actions_use') . ' ' . lang('labels_image'))), 'update' => array('type' => 'submit', 'class' => 'button-main', 'name' => 'submit', 'value' => 'submit', 'id' => 'update', 'rel' => $data['id'], 'content' => ucwords(lang('actions_update'))), 'activate' => array('type' => 'submit', 'class' => 'button-main', 'name' => 'submit', 'value' => 'submit', 'id' => 'char-activate', 'myid' => $id, 'content' => ucwords(lang('actions_activate') . ' ' . lang('global_character'))), 'deactivate' => array('type' => 'submit', 'class' => 'button-main', 'name' => 'submit', 'value' => 'submit', 'id' => 'char-deactivate', 'myid' => $id, 'content' => ucwords(lang('actions_deactivate') . ' ' . lang('global_character'))), 'npc' => array('type' => 'submit', 'class' => 'button-main', 'name' => 'submit', 'value' => 'submit', 'id' => 'char-npc', 'myid' => $id, 'content' => ucwords(lang('actions_make') . ' ' . strtoupper(lang('abbr_npc')))), 'playing' => array('type' => 'submit', 'class' => 'button-main', 'name' => 'submit', 'value' => 'submit', 'id' => 'char-playingchar', 'myid' => $id, 'content' => ucwords(lang('actions_make') . ' ' . lang('status_playing') . ' ' . lang('global_character'))));
$data['images'] = array('loading' => array('src' => Location::img('loading-circle.gif', $this->skin, 'admin'), 'alt' => lang('actions_loading'), 'class' => 'image'), 'upload' => array('src' => Location::img('image-upload.png', $this->skin, 'admin'), 'alt' => lang('actions_upload'), 'class' => 'image'), 'loader' => array('src' => Location::img('loading-bar.gif', $this->skin, 'admin'), 'alt' => lang('actions_loading'), 'class' => 'image'));
$data['label'] = array('character' => ucfirst(lang('global_character')), 'fname' => ucwords(lang('order_first') . ' ' . lang('labels_name')), 'images' => ucfirst(lang('labels_images')), 'info' => ucfirst(lang('labels_info')), 'loading' => ucfirst(lang('actions_loading')) . '...', 'lname' => ucwords(lang('order_last') . ' ' . lang('labels_name')), 'mname' => ucwords(lang('order_middle') . ' ' . lang('labels_name')), 'myuploads' => ucwords(lang('labels_my') . ' ' . lang('labels_uploads')), 'other' => ucfirst(lang('labels_other')), 'position1' => ucwords(lang('order_first') . ' ' . lang('global_position')), 'position2' => ucwords(lang('order_second') . ' ' . lang('global_position')), 'rank' => ucfirst(lang('global_rank')), 'suffix' => ucfirst(lang('labels_suffix')), 'type' => ucwords(lang('global_character') . ' ' . lang('labels_type')), 'type_active' => ucwords(lang('status_active') . ' ' . lang('global_characters')), 'type_inactive' => ucwords(lang('status_inactive') . ' ' . lang('global_characters')), 'type_npc' => ucwords(lang('status_nonplaying') . ' ' . lang('global_characters')), 'upload' => ucwords(lang('actions_upload') . ' ' . lang('labels_images') . ' ' . RARROW), 'change' => ucwords(lang('actions_change') . ' ' . lang('global_character') . ' ' . lang('labels_status')), 'available_images' => ucwords(lang('labels_available') . ' ' . lang('labels_images')), 'character_images' => ucwords(lang('global_character') . ' ' . lang('labels_images')));
$js_data['rankloc'] = $this->rank;
$js_data['id'] = $data['id'];
$this->_regions['content'] = Location::view('characters_bio', $this->skin, 'admin', $data);
$this->_regions['javascript'] = Location::js('characters_bio_js', $this->skin, 'admin', $js_data);
$this->_regions['title'] .= $data['header'];
Template::assign($this->_regions);
Template::render();
}
示例5: foreach
?>
</span>
</p><br />
<ul id="list-grid">
<?php
if (is_array($inputs['images']) && count($inputs['images']) > 0) {
?>
<?php
foreach ($inputs['images'] as $i) {
?>
<?php
if (strpos($i, '://') === FALSE) {
?>
<?php
$image = array('src' => base_url() . Location::asset('images/characters', $i), 'height' => 140);
?>
<?php
} else {
?>
<?php
$image = array('src' => $i, 'height' => 140);
?>
<?php
}
?>
<li id="img_<?php
echo str_replace('.', '\\.', $i);
?>
"><a href="#" class="image upload-close" remove="<?php
echo str_replace('.', '\\.', $i);
示例6: index
public function index()
{
// load the models
$this->load->model('depts_model', 'dept');
$this->load->model('ranks_model', 'ranks');
$this->load->model('positions_model', 'pos');
$this->load->model('settings_model', 'settings');
// get the variables
$manifest = $this->uri->segment(3, $this->dept->get_default_manifest());
// grab all settings
$data['settings']['show']['species'] = $this->settings->get_setting('modManifest_show_species');
$data['settings']['show']['gender'] = $this->settings->get_setting('modManifest_show_gender');
$data['settings']['show']['thumbnail'] = $this->settings->get_setting('modManifest_show_thumbnail');
// pull all the manifests
$manifests = $this->dept->get_all_manifests();
if ($manifests->num_rows() > 0) {
if ($manifests->num_rows() > 1) {
foreach ($manifests->result() as $m) {
$data['manifests'][$m->manifest_id] = array('id' => $m->manifest_id, 'name' => $m->manifest_name, 'desc' => $m->manifest_desc);
}
}
// get the manifest details (MD)
$MD = $this->dept->get_manifest($manifest);
// pull the content for the header
$data['manifest_header'] = $MD->manifest_header_content;
// run the methods
$this->db->where('dept_manifest', $manifest);
$depts = $this->dept->get_all_depts();
$rank = $this->ranks->get_rankcat($this->rank);
// build the blank image array
$blank_img = array('src' => Location::rank($this->rank, 'blank', $rank->rankcat_extension), 'alt' => '', 'class' => 'image');
if ($depts->num_rows() > 0) {
$a = 1;
foreach ($depts->result() as $depts) {
$name = '';
// set the dept id as a variable
$dept = $depts->dept_id;
// set the dept name
$data['depts'][$dept]['name'] = $depts->dept_name;
$data['depts'][$dept]['type'] = $depts->dept_type;
// get the sub depts
$subdepts = $this->dept->get_sub_depts($dept);
if ($subdepts->num_rows() > 0) {
$a = 1;
foreach ($subdepts->result() as $sub) {
// set the name of the sub dept
$data['depts'][$dept]['sub'][$a]['name'] = $sub->dept_name;
$data['depts'][$dept]['sub'][$a]['type'] = $sub->dept_type;
// grab the positions for the sub dept
$positions = $this->pos->get_dept_positions($sub->dept_id);
if ($positions->num_rows() > 0) {
$b = 1;
foreach ($positions->result() as $pos) {
// set the sub dept position data
$data['depts'][$dept]['sub'][$a]['pos'][$b]['name'] = $pos->pos_name;
$data['depts'][$dept]['sub'][$a]['pos'][$b]['pos_id'] = $pos->pos_id;
$data['depts'][$dept]['sub'][$a]['pos'][$b]['open'] = $pos->pos_open;
$data['depts'][$dept]['sub'][$a]['pos'][$b]['blank_img'] = $blank_img;
// get any characters in a position in a sub dept
$characters = $this->char->get_characters_for_position($pos->pos_id, array('rank' => 'asc'));
if ($characters->num_rows() > 0) {
$c = 1;
foreach ($characters->result() as $char) {
// grab the rank data we need
$rankdata = $this->ranks->get_rank($char->rank, array('rank_name', 'rank_image'));
// get the character name and rank
$name = $this->char->get_character_name($char->charid, true);
// build the rank image array
$rank_img = array('src' => Location::rank($this->rank, $rankdata['rank_image'], $rank->rankcat_extension), 'alt' => $rankdata['rank_name'], 'class' => 'image');
// get char image
$char_img = '';
if ($char->images > '') {
// get the images
$images = explode(',', $char->images);
$images_count = count($images);
$src = strstr($images[0], 'http://') !== false ? $images[0] : base_url() . Location::asset('images/characters', trim($images[0]));
list($imgwidth, $imgheight, $imgtype, $imgattr) = getimagesize($src);
if ($imgwidth < $imgheight) {
$factor = round($imgwidth / 80, 2);
} else {
$factor = round($imgheight / 80, 2);
}
// set the image
$char_img = array('src' => $src, 'alt' => $name, 'class' => 'charimg', 'height' => $imgheight / $factor, 'width' => $imgwidth / $factor);
} else {
//no image:
// set the image
list($imgwidth, $imgheight, $imgtype, $imgattr) = getimagesize(base_url() . Location::img('no-avatar.png', $this->skin, 'main'));
if ($imgwidth < $imgheight) {
$factor = round($imgwidth / 80, 2);
} else {
$factor = round($imgheight / 80, 2);
}
$char_img = array('src' => Location::img('no-avatar.png', $this->skin, 'main'), 'alt' => '', 'class' => 'charimg', 'height' => $imgheight / $factor, 'width' => $imgwidth / $factor);
}
// set the color
$color = '';
if ($char->user > 0) {
$color = $this->user->get_loa($char->user) == 'loa' ? '_loa' : $color;
$color = $this->user->get_loa($char->user) == 'eloa' ? '_eloa' : $color;
//.........这里部分代码省略.........