当前位置: 首页>>代码示例>>PHP>>正文


PHP Location::img方法代码示例

本文整理汇总了PHP中Location::img方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::img方法的具体用法?PHP Location::img怎么用?PHP Location::img使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Location的用法示例。


在下文中一共展示了Location::img方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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');
//.........这里部分代码省略.........
开发者ID:rajeltomari,项目名称:Join-Form,代码行数:101,代码来源:personnel.php

示例2: 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();
 }
开发者ID:rajeltomari,项目名称:Join-Form,代码行数:101,代码来源:characters.php

示例3: join


//.........这里部分代码省略.........
                 $user = $check_user === false ? $user_id : $check_user;
                 $character_array = array('user' => $user, 'first_name' => $first_name, 'middle_name' => $middle_name, 'last_name' => $last_name, 'suffix' => $suffix, 'position_1' => $position, 'crew_type' => 'pending', 'new_member' => $new_member);
                 $character = $this->char->create_character($character_array);
                 $character_id = $this->db->insert_id();
                 if ($check_user === false) {
                     $main_char = array('main_char' => $character_id);
                     $update_main = $this->user->update_user($user, $main_char);
                 }
                 $this->sys->optimize_table('characters');
                 $this->sys->optimize_table('users');
                 $name = array($first_name, $middle_name, $last_name, $suffix);
                 $app_array = array('app_email' => $email, 'app_ip' => $this->input->ip_address(), 'app_user' => $user, 'app_user_name' => $real_name, 'app_character' => $character_id, 'app_character_name' => parse_name($name), 'app_position' => $this->pos->get_position($position, 'pos_name'), 'app_date' => now(), 'new_member' => $new_member);
                 $apps = $this->apps->insert_application($app_array);
                 foreach ($_POST as $key => $value) {
                     if (is_numeric($key)) {
                         // build the array
                         $array = array('data_field' => $key, 'data_char' => $character_id, 'data_user' => $user, 'data_value' => $value, 'data_updated' => now());
                         // insert the data
                         $this->char->create_character_data($array);
                     }
                 }
                 if ($character < 1 and $users < 1) {
                     $message = sprintf(lang('flash_failure'), ucfirst(lang('actions_join') . ' ' . lang('actions_request')), lang('actions_submitted'), lang('flash_additional_contact_gm'));
                     $flash['status'] = 'error';
                     $flash['message'] = text_output($message);
                 } else {
                     $user_data = array('email' => $email, 'password' => $password, 'name' => $real_name);
                     $email_user = $this->options['system_email'] == 'on' ? $this->_email('join_user', $user_data) : false;
                     $gm_data = array('email' => $email, 'name' => $real_name, 'id' => $character_id, 'user' => $user, 'sample_post' => $this->input->post('sample_post'), 'ipaddr' => $this->input->ip_address());
                     $email_gm = $this->options['system_email'] == 'on' ? $this->_email('join_gm', $gm_data) : false;
                     $message = sprintf(lang('flash_success'), ucfirst(lang('actions_join') . ' ' . lang('actions_request')), lang('actions_submitted'), '');
                     $flash['status'] = 'success';
                     $flash['message'] = text_output($message);
                 }
             }
         }
         $this->_regions['flash_message'] = Location::view('flash', $this->skin, 'main', $flash);
     } elseif ($this->options['system_email'] == 'off') {
         $flash['status'] = 'info';
         $flash['message'] = lang_output('flash_system_email_off');
         $this->_regions['flash_message'] = Location::view('flash', $this->skin, 'main', $flash);
     }
     if ($agree == false and $submit == false) {
         $data['msg'] = $this->msgs->get_message('join_disclaimer');
         if ($this->uri->segment(3) != false) {
             $data['position'] = $this->uri->segment(3);
         }
         $view_loc = 'main_join_1';
     } else {
         $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;
                         switch ($field->field_type) {
                             case 'text':
                                 $input = array('name' => $field->field_id, 'id' => $field->field_fid, 'class' => $field->field_class, 'value' => $field->field_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' => $field->field_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);
                                 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);
                                 break;
                         }
                     }
                 }
             }
         }
         $data['msg'] = $this->msgs->get_message('join_instructions');
         $view_loc = 'main_join_2';
         $data['inputs'] = array('name' => array('name' => 'name', 'id' => 'name'), 'email' => array('name' => 'email', 'id' => 'email'), 'password' => array('name' => 'password', 'id' => 'password'), 'dob' => array('name' => 'date_of_birth', 'id' => 'date_of_birth'), 'im' => array('name' => 'instant_message', 'id' => 'instant_message', 'rows' => 4), 'first_name' => array('name' => 'first_name', 'id' => 'first_name'), 'middle_name' => array('name' => 'middle_name', 'id' => 'middle_name'), 'last_name' => array('name' => 'last_name', 'id' => 'last_name'), 'suffix' => array('name' => 'suffix', 'id' => 'suffix', 'class' => 'medium'), 'sample_post' => array('name' => 'sample_post', 'id' => 'sample_post', 'rows' => 30), 'new_member_yes' => array('name' => 'new_member', 'id' => 'new_member', 'value' => 'yes', 'checked' => true), 'new_member_no' => array('name' => 'new_member', 'id' => 'new_member', 'value' => 'no', 'checked' => false));
         $data['sample_post_msg'] = $this->msgs->get_message('join_post');
         $data['label'] = array('user_info' => ucwords(lang('global_user') . ' ' . lang('labels_information')), 'name' => ucwords(lang('labels_name')), 'email' => ucwords(lang('labels_email_address')), 'password' => ucwords(lang('labels_password')), 'dob' => lang('labels_dob'), 'im' => ucwords(lang('labels_im')), 'im_inst' => lang('text_im_instructions'), 'fname' => ucwords(lang('order_first') . ' ' . lang('labels_name')), 'mname' => ucwords(lang('order_middle') . ' ' . lang('labels_name')), 'next' => ucwords(lang('actions_next') . ' ' . lang('labels_step')) . ' ' . RARROW, 'lname' => ucwords(lang('order_last') . ' ' . lang('labels_name')), 'suffix' => ucfirst(lang('labels_suffix')), 'position' => ucwords(lang('global_position')), 'other' => ucfirst(lang('labels_other')), 'samplepost' => ucwords(lang('labels_sample_post')), 'character' => ucfirst(lang('global_character')), 'character_info' => ucwords(lang('global_character') . ' ' . lang('labels_info')), 'new_member' => lang('new_member'), 'new_member_yes' => lang('new_member_yes'), 'new_member_no' => lang('new_member_no'));
     }
     $data['button'] = array('submit' => array('type' => 'submit', 'class' => 'button-main', 'name' => 'submit', 'value' => 'submit', 'id' => 'submitJoin', 'content' => ucwords(lang('actions_submit'))), 'next' => array('type' => 'submit', 'class' => 'button-sec', 'name' => 'submit', 'value' => 'submit', 'id' => 'nextTab', 'content' => ucwords(lang('actions_next') . ' ' . lang('labels_step'))), 'agree' => array('type' => 'submit', 'class' => 'button-main', 'name' => 'button_agree', 'value' => 'agree', 'content' => ucwords(lang('actions_agree'))));
     $data['header'] = ucfirst(lang('actions_join'));
     $data['loading'] = array('src' => Location::img('loading-circle.gif', $this->skin, 'main'), 'alt' => lang('actions_loading'), 'class' => 'image');
     $this->_regions['content'] = Location::view($view_loc, $this->skin, 'main', $data);
     $this->_regions['javascript'] = Location::js('main_join_js', $this->skin, 'main');
     $this->_regions['title'] .= $data['header'];
     Template::assign($this->_regions);
     Template::render();
 }
开发者ID:rajeltomari,项目名称:Join-Form,代码行数:101,代码来源:main.php

示例4: 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;
//.........这里部分代码省略.........
开发者ID:rajeltomari,项目名称:Manifest-Details,代码行数:101,代码来源:personnel.php


注:本文中的Location::img方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。