Esempio n. 1
0
 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');
                 $data['edit_valid'] = (in_array($id, $characters) or $character->crew_type == 'npc') ? true : false;
             } elseif (Auth::get_access_level('characters/bio') == 1) {
                 $characters = $this->char->get_user_characters($this->session->userdata('userid'), '', 'array');
                 $data['edit_valid'] = in_array($id, $characters);
             } else {
                 $data['edit_valid'] = false;
             }
         } else {
             $data['edit_valid'] = false;
         }
     } else {
         $data['edit_valid'] = false;
         $data['edit_valid_form'] = false;
     }
     $data['label'] = array('edit' => ucwords(lang('actions_edit') . ' ' . lang('global_character')), 'view_all_posts' => ucwords(lang('actions_seeall') . ' ' . lang('global_missionposts')), 'view_all_logs' => ucwords(lang('actions_seeall') . ' ' . lang('global_personallogs')), 'view_all_awards' => ucwords(lang('actions_seeall') . ' ' . lang('global_awards')), 'view_all_images' => ucwords(lang('actions_seeall') . ' ' . lang('labels_images')), 'view_user' => ucwords(lang('global_user') . ' ' . lang('labels_info')), 'mission_posts' => ucwords(lang('global_missionposts')), 'personal_logs' => ucwords(lang('global_personallogs')), 'news_items' => ucwords(lang('global_newsitems')), 'comments' => ucwords(lang('labels_comments')), 'last_post' => ucwords(lang('order_last') . ' ' . lang('global_post')), 'stats' => ucfirst(lang('labels_stats')), 'back_manifest' => LARROW . ' ' . ucfirst(lang('actions_back')) . ' ' . lang('labels_to') . ' ' . ucfirst(lang('labels_manifest')));
     $this->_regions['content'] = Location::view('personnel_character', $this->skin, 'main', $data);
     $this->_regions['javascript'] = Location::js('personnel_character_js', $this->skin, 'main');
     Template::assign($this->_regions);
     Template::render();
 }
Esempio n. 2
0
 public function bio($id = false)
 {
     Auth::check_access();
     $id = is_numeric($id) ? $id : false;
     $level = Auth::get_access_level();
     $data['level'] = $level;
     if (!$id and count($this->session->userdata('characters')) > 1) {
         redirect('characters/select');
     } elseif (!$id and count($this->session->userdata('characters')) <= 1) {
         $id = $this->session->userdata('main_char');
     }
     $data['id'] = $id;
     $allowed = false;
     switch ($level) {
         case 1:
             $allowed = in_array($id, $this->session->userdata('characters')) ? true : false;
             break;
         case 2:
             $type = $this->char->get_character($data['id'], 'crew_type');
             if (in_array($id, $this->session->userdata('characters')) or $type == 'npc') {
                 $allowed = true;
             }
             break;
         case 3:
             $allowed = true;
             break;
     }
     if (!$allowed) {
         redirect('admin/error/1');
     }
     $this->load->model('positions_model', 'pos');
     $this->load->model('ranks_model', 'ranks');
     $this->load->model('access_model', 'access');
     $this->load->helper('directory');
     if (isset($_POST['submit'])) {
         switch ($this->uri->segment(4)) {
             default:
                 $user = $this->char->get_character($id, array('user', 'crew_type'));
                 $p = empty($user['user']) ? null : $user['user'];
                 foreach ($_POST as $key => $value) {
                     if (is_numeric($key)) {
                         // build the array
                         $array['fields'][$key] = array('data_field' => $key, 'data_char' => $data['id'], 'data_user' => $p, 'data_value' => $value, 'data_updated' => now());
                     } else {
                         $array['character'][$key] = $value;
                     }
                 }
                 unset($array['character']['submit']);
                 $c = $this->char->get_character($id);
                 if ($level == 2 and $c->crew_type == 'npc' or $level == 3) {
                     $position1_old = $array['character']['position_1_old'];
                     $position2_old = $array['character']['position_2_old'];
                     $rank_old = $array['character']['rank_old'];
                     unset($array['character']['position_1_old']);
                     unset($array['character']['position_2_old']);
                     unset($array['character']['rank_old']);
                     if ($array['character']['rank'] != $rank_old) {
                         $oldR = $this->ranks->get_rank($rank_old, array('rank_order', 'rank_name'));
                         $newR = $this->ranks->get_rank($array['character']['rank'], array('rank_order', 'rank_name'));
                         $promotion = array('prom_char' => $data['id'], 'prom_user' => $this->char->get_character($data['id'], 'user'), 'prom_date' => now(), 'prom_old_order' => $oldR['rank_order'] === null ? 0 : $oldR['rank_order'], 'prom_old_rank' => $oldR['rank_name'] === null ? '' : $oldR['rank_name'], 'prom_new_order' => $newR['rank_order'] === null ? 0 : $newR['rank_order'], 'prom_new_rank' => $newR['rank_name'] === null ? '' : $newR['rank_name']);
                         $prom = $this->char->create_promotion_record($promotion);
                     }
                     if ($level == 3) {
                         if ($c->crew_type == 'active') {
                             // if we've assigned a new position, update the open slots
                             if ($array['character']['position_1'] != $position1_old) {
                                 $this->pos->update_open_slots($array['character']['position_1'], 'add_crew');
                                 $this->pos->update_open_slots($position1_old, 'remove_crew');
                             }
                             // if we've assigned a new position, update the open slots
                             if ($array['character']['position_2'] != $position2_old) {
                                 $this->pos->update_open_slots($array['character']['position_2'], 'add_crew');
                                 $this->pos->update_open_slots($position2_old, 'remove_crew');
                             }
                         }
                     }
                 }
                 $update = $this->char->update_character($data['id'], $array['character']);
                 foreach ($array['fields'] as $k => $v) {
                     $update += $this->char->update_character_data($k, $data['id'], $v);
                 }
                 $message = sprintf($update > 0 ? lang('flash_success') : lang('flash_failure'), ucfirst(lang('global_character')), lang('actions_updated'), '');
                 $flash['status'] = $update > 0 ? 'success' : 'error';
                 $flash['message'] = text_output($message);
                 break;
             case 'activate':
                 if ($level == 3) {
                     $user = isset($_POST['user']) ? $_POST['user'] : false;
                     $activate = isset($_POST['activate_user']) ? (bool) $this->input->post('activate_user') : false;
                     $primary = isset($_POST['primary']) ? (bool) $this->input->post('primary', true) : false;
                     $c = $this->char->get_character($id);
                     if ($activate) {
                         $user_update_data['status'] = 'active';
                         $user_update_data['leave_date'] = null;
                         $user_update_data['access_role'] = Access_Model::STANDARD;
                         $user_update_data['last_update'] = now();
                     }
                     if ($primary) {
                         $user_update_data['main_char'] = $id;
                         $user_update_data['last_update'] = now();
                     }
                     $character_update_data = array('user' => $user, 'crew_type' => 'active', 'date_deactivate' => null);
                     $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_activated'), '');
                     $flash['status'] = $update_char > 0 ? 'success' : 'error';
                     $flash['message'] = text_output($message);
                 }
                 break;
             case 'deactivate':
                 if ($level == 3) {
                     $maincharacter = isset($_POST['main_character']) ? $_POST['main_character'] : false;
                     $deactivate = isset($_POST['deactivate_user']) ? (bool) $this->input->post('deactivate_user') : false;
                     $c = $this->char->get_character($id);
                     if ($deactivate) {
                         $user_update_data['status'] = 'inactive';
                         $user_update_data['leave_date'] = now();
                         $user_update_data['access_role'] = Access_Model::INACTIVE;
                         $user_update_data['last_update'] = now();
                     }
                     if ($maincharacter) {
                         $user_update_data['main_char'] = $maincharacter;
                         $user_update_data['last_update'] = now();
                     }
                     $character_update_data = array('crew_type' => 'inactive', 'date_deactivate' => now());
                     $this->pos->update_open_slots($c->position_1, 'remove_crew');
                     if ($c->position_2 > 0 and $c->position_2 !== null) {
                         $this->pos->update_open_slots($c->position_2, 'remove_crew');
                     }
                     if (isset($user_update_data)) {
                         // update the user
                         $update_user = $this->user->update_user($c->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_deactivated'), '');
                     $flash['status'] = $update_char > 0 ? 'success' : 'error';
                     $flash['message'] = text_output($message);
                 }
                 break;
             case 'makenpc':
                 if ($level == 3) {
                     $maincharacter = isset($_POST['main_character']) ? $_POST['main_character'] : false;
                     $deactivate = isset($_POST['deactivate_user']) ? (bool) $this->input->post('deactivate_user') : false;
                     $assoc = isset($_POST['remove_user']) ? (bool) $this->input->post('remove_user') : false;
                     $c = $this->char->get_character($id);
                     if ($deactivate) {
                         $user_update_data['status'] = 'inactive';
                         $user_update_data['leave_date'] = now();
                         $user_update_data['access_role'] = Access_Model::INACTIVE;
                         $user_update_data['last_update'] = now();
                     }
                     if ($maincharacter) {
                         $user_update_data['main_char'] = $maincharacter;
                         $user_update_data['last_update'] = now();
                     }
                     if ($assoc) {
                         $character_update_data['user'] = null;
                         $user_update_data['main_char'] = null;
                     }
                     $character_update_data['crew_type'] = 'npc';
                     $this->pos->update_open_slots($c->position_1, 'remove_crew');
                     if ($c->position_2 > 0 and $c->position_2 !== null) {
                         $this->pos->update_open_slots($c->position_2, 'remove_crew');
                     }
                     if (isset($user_update_data)) {
                         // update the user
                         $update_user = $this->user->update_user($c->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;
             case 'makeplaying':
                 if ($level == 3) {
                     $maincharacter = isset($_POST['main_character']) ? $_POST['main_character'] : false;
                     $user = isset($_POST['user']) ? $this->input->post('user') : false;
                     $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();
 }
Esempio n. 3
0
 public function join()
 {
     $this->load->model('positions_model', 'pos');
     $this->load->model('depts_model', 'dept');
     $this->load->model('ranks_model', 'ranks');
     $this->load->helper('utility');
     $agree = $this->input->post('agree', true);
     $submit = $this->input->post('submit', true);
     $selected_pos = $this->input->post('position', true);
     $data['selected_position'] = (is_numeric($selected_pos) and $selected_pos > 0) ? $selected_pos : 0;
     $desc = $this->pos->get_position($data['selected_position'], 'pos_desc');
     $data['pos_desc'] = $desc !== false ? $desc : false;
     if ($submit !== false) {
         $email = $this->input->post('email', true);
         $real_name = $this->input->post('name', true);
         $im = $this->input->post('instant_message', true);
         $dob = $this->input->post('date_of_birth', true);
         $password = $this->input->post('password', true);
         $first_name = $this->input->post('first_name', true);
         $middle_name = $this->input->post('middle_name', true);
         $last_name = $this->input->post('last_name', true);
         $suffix = $this->input->post('suffix', true);
         $position = $this->input->post('position_1', true);
         $new_member = $this->input->post('new_member', true);
         if ($position == 0 or $first_name == '' or empty($password) or empty($email)) {
             $message = sprintf(lang('flash_empty_fields'), lang('flash_fields_join'), lang('actions_submit'), lang('actions_join') . ' ' . lang('actions_request'));
             $flash['status'] = 'error';
             $flash['message'] = text_output($message);
         } else {
             $ban['ip'] = $this->sys->get_item('bans', 'ban_ip', $this->input->ip_address());
             $ban['email'] = $this->sys->get_item('bans', 'ban_email', $email);
             if ($ban['ip'] !== false or $ban['email'] !== false) {
                 $message = sprintf(lang('text_ban_join'), lang('global_sim'), lang('global_game_master'));
                 $flash['status'] = 'error';
                 $flash['message'] = text_output($message);
             } else {
                 $this->load->model('applications_model', 'apps');
                 $check_user = $this->user->check_email($email);
                 if ($check_user === false) {
                     // build the users data array
                     $user_array = array('name' => $real_name, 'email' => $email, 'password' => Auth::hash($password), 'instant_message' => $im, 'date_of_birth' => $dob, 'join_date' => now(), 'status' => 'pending', 'skin_main' => $this->sys->get_skinsec_default('main'), 'skin_admin' => $this->sys->get_skinsec_default('admin'), 'skin_wiki' => $this->sys->get_skinsec_default('wiki'), 'display_rank' => $this->ranks->get_rank_default());
                     $users = $this->user->create_user($user_array);
                     $user_id = $this->db->insert_id();
                     $prefs = $this->user->create_user_prefs($user_id);
                     $my_links = $this->sys->update_my_links($user_id);
                 }
                 $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();
 }
Esempio n. 4
0
 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;
                                         }
                                         $color = $char->crew_type == 'npc' ? '_npc' : $color;
                                         // build the combadge image array
                                         $cb_img = array('src' => Location::cb('combadge' . $color . '.png', $this->skin, 'main'), 'alt' => ucwords(lang('actions_view') . ' ' . lang('labels_bio')), 'class' => 'image');
                                         $f_species = $this->char->get_field_data(2, $char->charid);
                                         if ($f_species->num_rows() > 0) {
                                             $fr_species = $f_species->result();
                                             $species = $fr_species[0]->data_value;
                                         }
                                         $f_gender = $this->char->get_field_data(1, $char->charid);
                                         if ($f_gender->num_rows() > 0) {
                                             $fr_gender = $f_gender->result();
                                             $gender = $fr_gender[0]->data_value;
                                         }
                                         if ($char->crew_type == 'active' and empty($char->user)) {
                                             // don't do anything
                                         } else {
                                             // set the data for the characters in a position in a sub dept
                                             $data['depts'][$dept]['sub'][$a]['pos'][$b]['chars'][$c]['char_id'] = $char->charid;
                                             $data['depts'][$dept]['sub'][$a]['pos'][$b]['chars'][$c]['name'] = $name;
                                             $data['depts'][$dept]['sub'][$a]['pos'][$b]['chars'][$c]['rank_img'] = $rank_img;
                                             $data['depts'][$dept]['sub'][$a]['pos'][$b]['chars'][$c]['crew_type'] = $char->crew_type;
                                             $data['depts'][$dept]['sub'][$a]['pos'][$b]['chars'][$c]['combadge'] = $cb_img;
                                             $data['depts'][$dept]['sub'][$a]['pos'][$b]['chars'][$c]['char_gender'] = $gender;
                                             //1=gender
                                             $data['depts'][$dept]['sub'][$a]['pos'][$b]['chars'][$c]['char_species'] = $species;
                                             //2=species
                                             $data['depts'][$dept]['sub'][$a]['pos'][$b]['chars'][$c]['char_image'] = $char_img;
                                             ++$c;
                                         }
                                     }
                                 }
                                 ++$b;
                             }
                         }
                         ++$a;
                     }
                 }
                 // get the positions for the dept
                 $positions = $this->pos->get_dept_positions($dept);
                 if ($positions->num_rows() > 0) {
                     $b = 1;
                     foreach ($positions->result() as $pos) {
                         // set the data for the dept positions
                         $data['depts'][$dept]['pos'][$b]['name'] = $pos->pos_name;
                         $data['depts'][$dept]['pos'][$b]['pos_id'] = $pos->pos_id;
                         $data['depts'][$dept]['pos'][$b]['open'] = $pos->pos_open;
                         $data['depts'][$dept]['pos'][$b]['blank_img'] = $blank_img;
                         // get any characters in a position in the 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) {
                                 // get the character name and rank
                                 $name = $this->char->get_character_name($char->charid, true);
                                 // get the rank data we need
                                 $ranksdata = $this->ranks->get_rank($char->rank, array('rank_name', 'rank_image'));
                                 // build the rank image array
                                 $rank_img = array('src' => Location::rank($this->rank, $ranksdata['rank_image'], $rank->rankcat_extension), 'alt' => $ranksdata['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:
                                     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);
                                     }
                                     // set the image
                                     $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;
                                 }
                                 $color = $char->crew_type == 'inactive' ? '' : $color;
                                 $color = $char->crew_type == 'npc' ? '_npc' : $color;
                                 // build the combadge image array
                                 $cb_img = array('src' => Location::cb('combadge' . $color . '.png', $this->skin, 'main'), 'alt' => ucwords(lang('actions_view') . ' ' . lang('labels_bio')), 'class' => 'image');
                                 $f_species = $this->char->get_field_data(2, $char->charid);
                                 if ($f_species->num_rows() > 0) {
                                     $fr_species = $f_species->result();
                                     $species = $fr_species[0]->data_value;
                                 }
                                 $f_gender = $this->char->get_field_data(1, $char->charid);
                                 if ($f_gender->num_rows() > 0) {
                                     $fr_gender = $f_gender->result();
                                     $gender = $fr_gender[0]->data_value;
                                 }
                                 if ($char->crew_type == 'active' and empty($char->user)) {
                                     // don't do anything
                                 } else {
                                     // set the data for characters in a position in the dept
                                     $data['depts'][$dept]['pos'][$b]['chars'][$c]['char_id'] = $char->charid;
                                     $data['depts'][$dept]['pos'][$b]['chars'][$c]['name'] = $name;
                                     $data['depts'][$dept]['pos'][$b]['chars'][$c]['rank_img'] = $rank_img;
                                     $data['depts'][$dept]['pos'][$b]['chars'][$c]['crew_type'] = $char->crew_type;
                                     $data['depts'][$dept]['pos'][$b]['chars'][$c]['combadge'] = $cb_img;
                                     $data['depts'][$dept]['pos'][$b]['chars'][$c]['char_gender'] = $gender;
                                     //1=gender
                                     $data['depts'][$dept]['pos'][$b]['chars'][$c]['char_species'] = $species;
                                     //2=species
                                     $data['depts'][$dept]['pos'][$b]['chars'][$c]['char_image'] = $char_img;
                                     ++$c;
                                 }
                             }
                         }
                         ++$b;
                     }
                 }
             }
         }
     }
     // pull the top open positions
     $top = $this->pos->get_open_positions('y', true);
     if ($top->num_rows() > 0) {
         foreach ($top->result() as $t) {
             $data['top'][$t->pos_id] = array('name' => $t->pos_name, 'id' => $t->pos_id, 'dept' => $this->dept->get_dept($t->pos_dept, 'dept_name'), 'blank_img' => $blank_img);
         }
     }
     // set the javascript data
     $js_data = array('display' => $this->uri->rsegment(3), 'manifest_defaults' => $MD->manifest_view);
     // set the data being sent to the view
     $data['display'] = $this->uri->rsegment(3, 'crew');
     $data['header'] = ucwords(lang('labels_crew') . ' ' . lang('labels_manifest'));
     $data['loader'] = array('src' => Location::img('loader.gif', $this->skin, 'main'), 'alt' => '', 'class' => 'image');
     $data['label'] = array('playing_chars' => ucwords(lang('status_playing') . ' ' . lang('global_characters')), 'inactive_chars' => ucwords(lang('status_inactive') . ' ' . lang('global_characters')), 'all_chars' => ucwords(lang('labels_all') . ' ' . lang('global_characters')), 'open' => ucwords(lang('status_open') . ' ' . lang('global_positions')), 'show' => ucfirst(lang('actions_show')), 'toggle' => ucfirst(lang('actions_toggle')), 'npcs' => lang('abbr_npcs'), 'loading' => ucfirst(lang('actions_loading')), 'inactive' => ucfirst(lang('status_inactive')), 'apply' => ucwords(lang('global_position') . ' ' . lang('status_open') . ' ' . NDASH . ' ' . lang('actions_apply') . ' ' . lang('time_now')), 'npc' => lang('abbr_npc'), 'manifests' => ucwords(lang('labels_site') . ' ' . lang('labels_manifests')), 'top_positions' => ucwords(lang('labels_top') . ' ' . lang('status_open') . ' ' . lang('global_positions')));
     $this->_regions['content'] = Location::view('personnel_index', $this->skin, 'main', $data);
     $this->_regions['javascript'] = Location::js('personnel_index_js', $this->skin, 'main', $js_data);
     $this->_regions['title'] .= $data['header'];
     Template::assign($this->_regions);
     Template::render();
 }