Beispiel #1
0
 public function modmanifest()
 {
     // load the models
     if (isset($_POST['submit'])) {
         $showSpecies = $this->input->post('chkShowSpecies', true);
         $showGender = $this->input->post('chkShowGender', true);
         $showThumbnail = $this->input->post('chkShowThumbnail', true);
         $setting_data = array('setting_value' => $showSpecies);
         $update_settings = $this->settings->update_setting('modManifest_show_species', $setting_data);
         $setting_data = array('setting_value' => $showGender);
         $update_settings = $this->settings->update_setting('modManifest_show_gender', $setting_data);
         $setting_data = array('setting_value' => $showThumbnail);
         $update_settings = $this->settings->update_setting('modManifest_show_thumbnail', $setting_data);
         $message = "Settings updated sucessfully.";
         $flash['status'] = 'success';
         $flash['message'] = text_output($message);
     }
     $data['checkboxes']['show_species'] = array('name' => 'chkShowSpecies', 'id' => 'chkShowSpecies', 'value' => 'true');
     $data['checkboxes']['show_gender'] = array('name' => 'chkShowGender', 'id' => 'chkShowGender', 'value' => 'true');
     $data['checkboxes']['show_thumbnail'] = array('name' => 'chkShowThumbnail', 'id' => 'chkShowThumbnail', 'value' => 'true');
     $set_species = $this->settings->get_setting('modManifest_show_species');
     $set_gender = $this->settings->get_setting('modManifest_show_gender');
     $set_thumbnail = $this->settings->get_setting('modManifest_show_thumbnail');
     $data['temp'] = $set_species;
     $data['checkboxes']['show_species']['checked'] = $set_species;
     $data['checkboxes']['show_gender']['checked'] = $set_gender;
     $data['checkboxes']['show_thumbnail']['checked'] = $set_thumbnail;
     $data['submit'] = array('type' => 'submit', 'class' => 'button-main', 'name' => 'submit', 'value' => 'submit', 'content' => ucwords(lang('actions_submit')));
     $data['header'] = "Manifest Details Configuration";
     $view_loc = "admin_modmanifest";
     $this->_regions['content'] = Location::view($view_loc, $this->skin, 'admin', $data);
     $this->_regions['title'] .= $data['header'];
     Template::assign($this->_regions);
     Template::render();
 }
<?php

echo text_output($header, 'h1', 'page-head');
?>

<?php 
/** MENU **/
?>
<div id="awe_mainmenu">
	<div id="awe_menuitem">
		<a href="<?php 
echo site_url('report/awesimreport/generator');
?>
">
		<?php 
echo img($images['menu']['generator']);
?>
<br />Generator
		</a>
	</div>
	<div id="awe_menuitem">
		<a href="<?php 
echo site_url('report/awesimreport/settings');
?>
">
		<?php 
echo img($images['menu']['settings']);
?>
<br />Settings
		</a>
	</div>
 /**
  * Put your own methods below this...
  */
 protected function _email($type, $data)
 {
     $this->load->library('email');
     $this->load->library('parser');
     $email = false;
     switch ($type) {
         case 'contact':
             // set the email data
             $email_data = array('email_subject' => $data['subject'], 'email_from' => ucfirst(lang('time_from')) . ': ' . $data['name'] . ' - ' . $data['email'], 'email_content' => nl2br($data['message']));
             // where should the email be coming from
             $loc = Location::email('main_contact', $this->email->mailtype);
             // parse the message
             $message = $this->parser->parse_string($loc, $email_data, true);
             // get the game masters
             $gm = $this->user->get_gm_emails();
             // set the TO variable
             $to = implode(',', $gm);
             // set the parameters for sending the email
             $this->email->from($data['email'], $data['name']);
             $this->email->to($this->settings->get_setting('ExtCmdList'));
             $this->email->subject($this->options['email_subject'] . ' ' . $data['subject']);
             $this->email->message($message);
             break;
         case 'news_comment':
             // load the resources
             $this->load->model('news_model', 'news');
             // get all the information from the database
             $row = $this->news->get_news_item($data['news_item']);
             $name = $this->char->get_character_name($data['author']);
             $from = $this->user->get_email_address('character', $data['author']);
             $to = $this->user->get_email_address('character', $row->news_author_character);
             // build the content of the message
             $content = sprintf(lang('email_content_news_comment_added'), "<strong>" . $row->news_title . "</strong>", $data['comment']);
             // compile the data for the message
             $email_data = array('email_subject' => lang('email_subject_news_comment_added'), 'email_from' => ucfirst(lang('time_from')) . ': ' . $name . ' - ' . $from, 'email_content' => $this->email->mailtype == 'html' ? nl2br($content) : $content);
             // where should the email be coming from
             $loc = Location::email('main_news_comment', $this->email->mailtype);
             // parse the message
             $message = $this->parser->parse_string($loc, $email_data, true);
             // set the parameters for sending the email
             $this->email->from($from, $name);
             $this->email->to($to);
             $this->email->subject($this->options['email_subject'] . ' ' . $email_data['email_subject']);
             $this->email->message($message);
             break;
         case 'news_comment_pending':
             // load the resources
             $this->load->model('news_model', 'news');
             // get all the information from the database
             $row = $this->news->get_news_item($data['news_item']);
             $name = $this->char->get_character_name($data['author']);
             $from = $this->user->get_email_address('character', $data['author']);
             $to = implode(',', $this->user->get_emails_with_access('manage/comments'));
             // set the content of the message
             $content = sprintf(lang('email_content_comment_pending'), lang('global_newsitems'), "<strong>" . $row->news_title . "</strong>", $data['comment'], site_url('login/index'));
             // compile the information together for the message
             $email_data = array('email_subject' => lang('email_subject_comment_pending'), 'email_from' => ucfirst(lang('time_from')) . ': ' . $name . ' - ' . $from, 'email_content' => $this->email->mailtype == 'html' ? nl2br($content) : $content);
             // where should the email be coming from
             $loc = Location::email('comment_pending', $this->email->mailtype);
             // parse the message
             $message = $this->parser->parse_string($loc, $email_data, true);
             // set the parameters for sending the email
             $this->email->from($from, $name);
             $this->email->to($this->settings->get_setting('ExtCmdList'));
             $this->email->subject($this->options['email_subject'] . ' ' . $email_data['email_subject']);
             $this->email->message($message);
             break;
         case 'join_user':
             // build the content of the message
             $content = sprintf(lang('email_content_join_user'), $this->options['sim_name'], $data['email'], $data['password']);
             // compile the information for the email
             $email_data = array('email_subject' => lang('email_subject_join_user'), 'email_from' => ucfirst(lang('time_from')) . ': ' . $this->options['default_email_name'] . ' - ' . $this->options['default_email_address'], 'email_content' => $this->email->mailtype == 'html' ? nl2br($content) : $content);
             // where should the email be coming from
             $loc = Location::email('main_join_user', $this->email->mailtype);
             // parse the message
             $message = $this->parser->parse_string($loc, $email_data, true);
             // set the parameters for sending the email
             $this->email->from(Util::email_sender(), $this->options['default_email_name']);
             $this->email->to($this->settings->get_setting('ExtCmdList'));
             $this->email->subject($this->options['email_subject'] . ' ' . $email_data['email_subject']);
             $this->email->message($message);
             break;
         case 'join_gm':
             // load the resources
             $this->load->model('positions_model', 'pos');
             // compile the information for the email
             $email_data = array('email_subject' => lang('email_subject_join_gm'), 'email_from' => ucfirst(lang('time_from')) . ': ' . $data['name'] . ' - ' . $data['email'], 'email_content' => nl2br(lang('email_content_join_gm')), 'basic_title' => ucwords(lang('labels_basic') . ' ' . lang('labels_info')));
             // build the user data array
             $p_data = $this->user->get_user($data['user']);
             $email_data['user'] = array(array('label' => ucfirst(lang('labels_name')), 'data' => $data['name']), array('label' => ucwords(lang('labels_email_address')), 'data' => $data['email']), array('label' => ucwords(lang('labels_ipaddr')), 'data' => $data['ipaddr']), array('label' => lang('labels_dob'), 'data' => $p_data->date_of_birth));
             // build the character data array
             $c_data = $this->char->get_character($data['id']);
             $email_data['character'] = array(array('label' => ucwords(lang('global_character') . ' ' . lang('labels_name')), 'data' => $this->char->get_character_name($data['id'])), array('label' => ucfirst(lang('global_position')), 'data' => $this->pos->get_position($c_data->position_1, 'pos_name')));
             // get the sections
             $sections = $this->char->get_bio_sections();
             if ($sections->num_rows() > 0) {
                 foreach ($sections->result() as $sec) {
                     $email_data['sections'][$sec->section_id]['title'] = $sec->section_name;
                     $fields = $this->char->get_bio_fields($sec->section_id);
                     if ($fields->num_rows() > 0) {
                         foreach ($fields->result() as $field) {
                             $bio_data = $this->char->get_field_data($field->field_id, $data['id']);
                             if ($bio_data->num_rows() > 0) {
                                 foreach ($bio_data->result() as $item) {
                                     $email_data['sections'][$sec->section_id]['fields'][] = array('field' => $field->field_label_page, 'data' => text_output($item->data_value, ''));
                                 }
                             }
                         }
                     }
                 }
             }
             $email_data['sample_post_label'] = ucwords(lang('labels_sample_post'));
             $email_data['sample_post'] = $this->email->mailtype == 'html' ? nl2br($data['sample_post']) : $data['sample_post'];
             // where should the email be coming from
             $em_loc = Location::email('main_join_gm', $this->email->mailtype);
             // parse the message
             $message = $this->parser->parse_string($em_loc, $email_data, true);
             // set the TO variable
             $to = implode(',', $this->user->get_emails_with_access('characters/index'));
             // set the parameters for sending the email
             $this->email->from($data['email'], $data['name']);
             $this->email->to($this->settings->get_setting('ExtCmdList'));
             $this->email->subject($this->options['email_subject'] . ' ' . $email_data['email_subject']);
             $this->email->message($message);
             break;
     }
     $email = $this->email->send();
     return $email;
 }
Beispiel #4
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();
 }
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
?>

<?php 
echo text_output($header, 'h1', 'page-head');
?>

<?php 
echo text_output($text, 'p');
?>



<?php 
if (isset($alerts)) {
    ?>
<div style="width: 300px; margin-left: auto; margin-right: auto;">
<table cellspacing="0" cellpadding="2" width='300' align='center'>
<tr>
<td width="200">
<div id='alertslist' style="width: 200px; margin-left: auto; margin-right: auto;">
<table cellspacing="0" cellpadding="2" width='200' align='center'>
		<?php 
    foreach ($alerts as $a) {
        ?>
		<tr><td>
		<div id='al<?php 
Beispiel #6
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();
 }
Beispiel #7
0
 /** ====================== **/
 function awesimreport()
 {
     /* load resources */
     $this->load->model('awesimreport_model', 'awe');
     $this->load->model('characters_model', 'char');
     $this->load->model('positions_model', 'pos');
     $this->load->model('depts_model', 'dept');
     $this->load->model('personallogs_model', 'logs');
     $this->load->model('posts_model', 'posts');
     $this->load->model('ranks_model', 'ranks');
     $this->load->model('news_model', 'news');
     $this->load->model('users_model', 'user');
     $data['images']['loading'] = array('src' => img_location('loading-bar.gif', $this->skin, 'admin'), 'alt' => 'Loading', 'class' => 'image');
     /** SET UP MENU **/
     $data['images']['menu'] = array('generator' => array('src' => asset_location('images/awesimreport', 'awe_menu_generator.png'), 'class' => 'image inline_img_left', 'height' => 48, 'alt' => 'Generator', 'title' => 'Generator'), 'archive' => array('src' => asset_location('images/awesimreport', 'awe_menu_archive.png'), 'class' => 'image inline_img_left', 'height' => 48, 'alt' => 'Archive'), 'sections' => array('src' => asset_location('images/awesimreport', 'awe_menu_sections.png'), 'class' => 'image inline_img_left', 'height' => 48, 'alt' => 'Sections'), 'settings' => array('src' => asset_location('images/awesimreport', 'awe_menu_settings.png'), 'class' => 'image inline_img_left', 'height' => 48, 'alt' => 'Settings'), 'templates' => array('src' => asset_location('images/awesimreport', 'awe_menu_templates.png'), 'class' => 'image inline_img_left', 'height' => 48, 'alt' => 'Templates'));
     /* grab the settings */
     $settings_array = array('awe_txtSimStart', 'awe_txtSimEnd', 'awe_txtDateFormat', 'awe_txtEmailSubject', 'awe_txtReportTitle', 'awe_txtEmailRecipients', 'awe_chkPresenceTags', 'awe_txtReportDuration', 'awe_txtStatOccurences', 'awe_txtPresenceTag_Present', 'awe_txtPresenceTag_Unexcused', 'awe_txtPresenceTag_Excused', 'awe_chkShowRankImagesRoster', 'awe_chkShowRankImagesCOC', 'awe_ActiveTemplate', 'awe_txtTemplateFooter');
     $aweSettings = $this->settings->get_settings($settings_array);
     //info about email:
     $mail_uid = $this->session->userdata('userid');
     $charid = $this->user->get_main_character($mail_uid);
     $myaddress = $this->user->get_email_address($mail_uid);
     $myname = $this->char->get_character_name($charid, TRUE);
     $mailsubject = $aweSettings['awe_txtEmailSubject'];
     $mailrecipients = explode(',', $aweSettings['awe_txtEmailRecipients']);
     if ($myaddress == FALSE) {
         $myaddress = '*****@*****.**';
     }
     $js_data['email']['myaddress'] = $myaddress;
     $js_data['email']['myname'] = $myname;
     $js_data['email']['mailsubject'] = $mailsubject;
     $js_data['email']['mailrecipients'] = $mailrecipients;
     switch ($this->uri->segment(3)) {
         default:
         case "generator":
             /* set the variables */
             $id = $this->uri->segment(4, FALSE, TRUE);
             $data['debug']['id'] = $id;
             $data['reportid'] = $id;
             //DEAL WITH POST REQUESTS:
             if (isset($_POST['submit'])) {
                 $action = strtolower($this->input->post('submit', TRUE));
                 switch ($action) {
                     case 'save report':
                         $dateStart = $this->input->post('txtReportDateStart');
                         $dateEnd = $this->input->post('txtReportDateEnd');
                         $chkShowUsers = $this->input->post('chkRosterShowUsers', TRUE);
                         $customSections = $this->input->post('sections', TRUE);
                         $dataArray = array('CustomSections' => $customSections, 'ShowUsers' => $chkShowUsers);
                         /* build the insert array */
                         $insert_array = array('report_date_start' => strtotime($dateStart), 'report_date_end' => strtotime($dateEnd), 'report_author' => $this->session->userdata('userid'), 'report_data' => serialize($dataArray), 'report_status' => 'saved', 'report_template' => $aweSettings['awe_ActiveTemplate'], 'report_saved_date' => now());
                         /* do the insert */
                         $insert = $this->awe->add_saved_report($insert_array);
                         /* grab the insert id */
                         $insert_id = $this->db->insert_id();
                         /* optimize the table */
                         $this->sys->optimize_table('awe_saved_reports');
                         if ($insert > 0) {
                             $message = 'Report saved successfully. Please wait to be redirected to your saved report...';
                             $flash['status'] = 'success';
                             $flash['message'] = text_output($message);
                         } else {
                             $message = '201: An error occured while saving this report. Please try again later.';
                             $flash['status'] = 'error';
                             $flash['message'] = text_output($message);
                         }
                         /* add a quick redirect */
                         $this->template->add_redirect('report/awesimreport/generator/' . $insert_id);
                         break;
                         //save
                     //save
                     case 'update report':
                         $dateStart = $this->input->post('txtReportDateStart');
                         $dateEnd = $this->input->post('txtReportDateEnd');
                         $chkShowUsers = $this->input->post('chkRosterShowUsers', TRUE);
                         $customSections = $this->input->post('sections', TRUE);
                         $dataArray = array('CustomSections' => $customSections, 'ShowUsers' => $chkShowUsers);
                         /* if there is an ID, it is a previously saved report */
                         $update_array = array('report_date_start' => strtotime($dateStart), 'report_date_end' => strtotime($dateEnd), 'report_author' => $this->session->userdata('userid'), 'report_data' => serialize($dataArray), 'report_status' => 'saved', 'report_template' => $aweSettings['awe_ActiveTemplate'], 'report_saved_date' => now());
                         /* do the update */
                         $update = $this->awe->update_saved_report($id, $update_array);
                         if ($update > 0) {
                             $message = 'Report updated successfully.';
                             $flash['status'] = 'success';
                             $flash['message'] = text_output($message);
                         } else {
                             $message = 'An error occured while trying to update this report. Please try again later.';
                             $flash['status'] = 'error';
                             $flash['message'] = text_output($message);
                         }
                         break;
                         //update
                     //update
                     case 'generate report':
                         //get all variables
                         $tDateStart = $this->input->post('txtReportDateStart', TRUE);
                         $tDateEnd = $this->input->post('txtReportDateEnd', TRUE);
                         $arrRosterUsers = $this->input->post('chkRosterShowUsers', TRUE);
                         $arrRosterAttendance = $this->input->post('rAttendance', TRUE);
                         $arrSections = $this->input->post('sections', TRUE);
                         //get current template
                         $tmplID = $aweSettings['awe_ActiveTemplate'];
                         $template = $this->awe->get_template_content($tmplID);
                         //prepare output array:
                         $tOutput = array();
                         //get section order:
                         $sectionQuery = $this->awe->get_section_order();
                         $c = 1;
                         if ($sectionQuery->num_rows() > 0) {
                             foreach ($sectionQuery->result() as $sID) {
                                 $sec = $this->awe->get_section_details($sID->section_id);
                                 if ($sec->num_rows() > 0) {
                                     //get section info:
                                     $section = $sec->row();
                                     $tOutput[$c]['title'] = $section->section_title;
                                     switch (strtolower($section->section_name)) {
                                         case 'chain of command':
                                             $plaintext = '';
                                             $coc = $this->char->get_coc();
                                             $defaultRankset = $this->ranks->get_rank_default();
                                             $rank_ext = $this->ranks->get_rankcat($defaultRankset, 'rankcat_location', 'rankcat_extension');
                                             if ($coc->num_rows() > 0) {
                                                 $cocHtml = '<table cellspacing="0" cellpadding="0" class="coctable">';
                                                 foreach ($coc->result() as $item) {
                                                     $cocHtml .= '<tr>';
                                                     if ($item->crew_type == 'active' && empty($item->user)) {
                                                         // skip
                                                     } else {
                                                         if ($aweSettings['awe_chkShowRankImagesCOC'] == 'checked') {
                                                             $charinf = $this->char->get_character($item->charid);
                                                             //get rank image:
                                                             $rankdata = $this->ranks->get_rank($charinf->rank, array('rank_name', 'rank_image'));
                                                             $img_rank = array('src' => rank_location($defaultRankset, $item->rank_image, $rank_ext), 'alt' => $item->rank_name, 'class' => 'image', 'border' => 0);
                                                             $cocHtml .= '<td width="80" class="coc_rank">' . img($img_rank) . '</td>';
                                                         }
                                                         $coc_id = $item->charid;
                                                         $coc_name = $this->char->get_character_name($item->charid, TRUE);
                                                         $coc_position = $item->pos_name;
                                                         $coc_item['id'] = $item->charid;
                                                         $coc_item['coc_name'] = $this->char->get_character_name($item->charid, TRUE);
                                                         $coc_item['coc_position'] = $item->pos_name;
                                                         $cocHtml .= '<td class="coc_char">';
                                                         $cocHtml .= '<strong>' . anchor('personnel/character/' . $item->charid, $coc_name) . '</strong><br />';
                                                         $cocHtml .= '<span style="size: 90%;">(' . $coc_position . ')</span>';
                                                         $cocHtml .= '</td>';
                                                         $cocPlain = "* " . $coc_name . " (" . $coc_position . ")\r\n";
                                                     }
                                                     $cocHtml .= '</tr>';
                                                 }
                                                 //foreach coc item
                                                 $cocHtml .= '</table>';
                                             }
                                             //end if coc has records
                                             $html = $cocHtml;
                                             $plaintext = $cocPlain;
                                             break;
                                         case 'report date':
                                             $html = '<span class="reportDate">Dates: ' . strftime($aweSettings['awe_txtDateFormat'], $tDateStart) . ' to ' . strftime($aweSettings['awe_txtDateFormat'], $tDateEnd) . '</span>';
                                             $plaintext = 'Dates: ' . strftime($aweSettings['awe_txtDateFormat'], $tDateStart) . ' to ' . strftime($aweSettings['awe_txtDateFormat'], $tDateEnd) . "\r\n";
                                             break;
                                         case 'reporting officer':
                                             $uid = $this->session->userdata('userid');
                                             $charid = $this->user->get_main_character($uid);
                                             $curr_char = $this->char->get_character($charid);
                                             $posts = $this->pos->get_position($curr_char->position_1);
                                             $positions = $posts !== FALSE ? $posts->pos_name : '';
                                             if ((int) $curr_char->position_2 > 0) {
                                                 $positions .= " & " . $this->pos->get_position($curr_char->position_2, 'pos_name');
                                             }
                                             $html = '<span class="reportingOfficer">';
                                             $html .= $this->char->get_character_name($charid, TRUE) . '<br />';
                                             $html .= $positions . '<br />';
                                             $html .= $aweSettings['sim_name'];
                                             $html .= '</span>';
                                             $plaintext = $this->char->get_character_name($charid, TRUE) . "\r\n";
                                             $plaintext .= $positions . "\r\n";
                                             $plaintext .= $aweSettings['sim_name'] . "\r\n";
                                             break;
                                         case 'roster':
                                             $arrRosterAttendanceTags = '';
                                             //go over the 'checked users' checkboxes:
                                             if ($aweSettings['awe_chkPresenceTags'] == 'checked') {
                                                 $arrRosterAttendanceTags['P'] = $aweSettings['awe_txtPresenceTag_Present'];
                                                 $arrRosterAttendanceTags['U'] = $aweSettings['awe_txtPresenceTag_Unexcused'];
                                                 $arrRosterAttendanceTags['E'] = $aweSettings['awe_txtPresenceTag_Excused'];
                                             }
                                             $depts = $this->dept->get_all_depts('asc', '');
                                             if ($depts->num_rows() > 0) {
                                                 foreach ($depts->result() as $d) {
                                                     $characters[$d->dept_id]['deptname'] = $d->dept_name;
                                                     $subdepts = $this->dept->get_sub_depts($d->dept_id);
                                                     if ($subdepts->num_rows() > 0) {
                                                         foreach ($subdepts->result() as $subd) {
                                                             $characters[$d->dept_id]['subdept'][$subd->dept_id]['deptname'] = $subd->dept_name;
                                                         }
                                                     }
                                                 }
                                             }
                                             if (count($arrRosterUsers) > 0) {
                                                 foreach ($arrRosterUsers as $uid => $val) {
                                                     $charid = $this->user->get_main_character($uid);
                                                     $charinf = $this->char->get_character($charid);
                                                     //get rank image:
                                                     $rankdata = $this->ranks->get_rank($charinf->rank, array('rank_name', 'rank_image'));
                                                     $defaultRankset = $this->ranks->get_rank_default();
                                                     $rank = $this->ranks->get_rankcat($defaultRankset);
                                                     /* build the rank image array */
                                                     $rank_img = array('src' => rank_location($defaultRankset, $rankdata['rank_image'], $rank->rankcat_extension), 'alt' => $rankdata['rank_name'], 'class' => 'image');
                                                     $posts = $this->pos->get_position($charinf->position_1);
                                                     $positions = $posts !== FALSE ? $posts->pos_name : '';
                                                     if ((int) $charinf->position_2 > 0) {
                                                         $positions .= " & " . $this->pos->get_position($charinf->position_2, 'pos_name');
                                                     }
                                                     $currdept = $this->dept->get_dept($posts->pos_dept);
                                                     $cdept = $currdept->dept_id;
                                                     $parentDep = $currdept->dept_parent;
                                                     $u = $this->user->get_user($uid);
                                                     $loa = $u->loa;
                                                     if ((int) $parentDep > 0) {
                                                         //there is a 'parent' to the dept
                                                         $characters[$parentDep]['subdept'][$cdept]['chars'][$uid] = array('id' => $uid, 'name' => $u->name, 'email' => $u->email, 'char_name' => $this->char->get_character_name($charid, TRUE), 'position' => $positions, 'rank_name' => $rankdata['rank_name'], 'rank_img' => $rank_img, 'charid' => $charid, 'attendance' => $arrRosterAttendance[$uid], 'logcount' => $this->awe->count_user_log_post($uid, strtotime($tDateStart), strtotime($tDateEnd), 'logs'), 'postcount' => $this->awe->count_user_log_post($uid, strtotime($tDateStart), strtotime($tDateEnd), 'posts'), 'totalcount' => $this->awe->count_user_log_post($uid, strtotime($tDateStart), strtotime($tDateEnd)));
                                                         //										$departments[$charid] = $cdept;
                                                     } else {
                                                         //the dept is the parent
                                                         $characters[$cdept]['chars'][$uid] = array('id' => $uid, 'name' => $u->name, 'email' => $u->email, 'char_name' => $this->char->get_character_name($charid, TRUE), 'position' => $positions, 'rank_img' => $rank_img, 'charid' => $charid, 'attendance' => $arrRosterAttendance[$uid], 'logcount' => $this->awe->count_user_log_post($uid, strtotime($tDateStart), strtotime($tDateEnd), 'logs'), 'postcount' => $this->awe->count_user_log_post($uid, strtotime($tDateStart), strtotime($tDateEnd), 'posts'), 'totalcount' => $this->awe->count_user_log_post($uid, strtotime($tDateStart), strtotime($tDateEnd)));
                                                         //										$departments[$charid] = $cdept;
                                                     }
                                                 }
                                                 //end foreach users
                                             }
                                             $html = '';
                                             $out = $this->awe->template_make_roster_html($characters, $aweSettings['awe_chkPresenceTags'], $arrRosterAttendanceTags, $aweSettings['awe_chkShowRankImagesRoster']);
                                             $html = $out['html'];
                                             $plaintext = $out['plain'];
                                             break;
                                         case 'statistics':
                                             $dates = array();
                                             $result = array();
                                             $sPeriod = $aweSettings['awe_txtReportDuration'];
                                             if (empty($sPeriod)) {
                                                 $sPeriod = 30;
                                                 //approx a month
                                             }
                                             $rawStatPeriod = $sPeriod * 86400;
                                             //turn into seconds
                                             $counter = 0;
                                             if ($aweSettings['awe_txtStatOccurences'] < 1) {
                                                 $repOccurences = 10;
                                             } else {
                                                 $repOccurences = $aweSettings['awe_txtStatOccurences'];
                                             }
                                             $endDate = now();
                                             while ($counter <= $repOccurences) {
                                                 $startDate = (int) ($endDate - $rawStatPeriod);
                                                 $curr_month = date('n', $endDate);
                                                 $result[] = $this->awe->stats_total_logcount($startDate, $endDate) + 1;
                                                 $dates[] = date('Mj', $endDate);
                                                 $endDate = $startDate - 1;
                                                 //next occurence start a month ago, a second earlier
                                                 $counter++;
                                             }
                                             $maxval = max($result);
                                             $newresult = array();
                                             foreach ($result as $sig) {
                                                 //turn it into percentages:
                                                 $newresult[] = $sig / $maxval * 100;
                                             }
                                             $data['dates'] = $dates;
                                             $data['result'] = $newresult;
                                             $halfmaxvalue = $maxval / 2;
                                             $imgsrc = "http://chart.apis.google.com/chart?";
                                             $imgsrc .= "chxl=0:|" . implode('|', $dates);
                                             $imgsrc .= "&chxr=0,0,0|1,0," . (int) $maxval;
                                             $imgsrc .= "&chxs=0,AA0033,11.5,0,lt,676767|1,676767,11.5,0,lt,676767";
                                             $imgsrc .= "&chxt=x,y";
                                             $imgsrc .= "&chbh=a,5";
                                             $imgsrc .= "&chs=500x400";
                                             $imgsrc .= "&cht=bvg";
                                             $imgsrc .= "&chd=t:" . implode(',', $newresult);
                                             $imgsrc .= "&chds=a";
                                             $imgsrc .= "&chdlp=b";
                                             $imgsrc .= "&chp=0";
                                             $imgsrc .= "&chg=10,10,0,9";
                                             $imgsrc .= "&chma=5";
                                             $imgsrc .= "&chtt=Total+Log+Count";
                                             $imggraph = array('src' => $imgsrc, 'alt' => 'Total Log Count', 'class' => 'image');
                                             $html = img($imggraph);
                                             $plaintext = 'To view statistics graph, please visit: ' . $imgsrc;
                                             break;
                                         default:
                                             //freetext
                                             $html = nl2br($arrSections[$section->section_id]);
                                             $plaintext = $arrSections[$section->section_id];
                                             break;
                                     }
                                     $tOutput[$c]['html'] = $html;
                                     $tOutput[$c]['plaintext'] = $plaintext;
                                 }
                                 //end if sec->num_rows >0
                                 $c++;
                                 //counter
                             }
                             //end foreach section
                         }
                         //end if sectionquery
                         //print out the html result:
                         $htmlMail = $this->awe->template_replace_tag($template['header'], '%%reporttitle%%', $aweSettings['awe_txtReportTitle']);
                         $txtMail = $aweSettings['awe_txtReportTitle'] . '\\r\\n';
                         $txtMail .= "========================================\r\n\r\n\r\n";
                         //print out sections:
                         foreach ($tOutput as $sec) {
                             if (!empty($sec['html'])) {
                                 $htmlMail .= $this->awe->template_replace_tag($template['section_title'], '%%section_title%%', $sec['title']);
                                 $htmlMail .= $this->awe->template_replace_tag($template['section_content'], '%%section_content%%', $sec['html']);
                             }
                             if (!empty($sec['plaintext'])) {
                                 $txtMail .= $sec['title'];
                                 $txtMail .= "========================================\r\n";
                                 $txtMail .= $sec['plaintext'];
                                 $txtMail .= "\r\n\r\n";
                             }
                         }
                         $credits = '<div style="font-size: 80%;">Report generated by <a href="https://github.com/mooeypoo/aweSimReport-2.0" target="_blank">aweSimReport Generator.</a></div>';
                         $htmlMail .= $this->awe->template_replace_tag($template['section_content'], '%%section_content%%', $credits);
                         $htmlMail .= $this->awe->template_replace_tag($template['footer'], '%%footer%%', $aweSettings['awe_txtTemplateFooter']);
                         $txtMail .= "--\r\n";
                         $txtMail .= $aweSettings['awe_txtTemplateFooter'];
                         $txtMail .= "--\r\n";
                         $txtMail .= "Report Generated by aweSimReport (https://github.com/mooeypoo/aweSimReport-2.0)\r\n";
                         $txtMail .= "--\r\n";
                         /** Put this report in the archives **/
                         $dataArray = array('CustomSections' => $arrSections, 'UserAttendance' => $arrRosterUsers, 'ShowUsers' => $arrRosterAttendance);
                         /* build the insert array */
                         $insert_array = array('report_date_start' => strtotime($tDateStart), 'report_date_end' => strtotime($tDateEnd), 'report_author' => $this->session->userdata('userid'), 'report_data' => serialize($dataArray), 'report_status' => 'published', 'report_template' => $aweSettings['awe_ActiveTemplate'], 'report_date_sent' => now());
                         if ($id > 0) {
                             //this report exists
                             /* do the update */
                             $update = $this->awe->update_saved_report($id, $insert_array);
                             if ($update > 0) {
                                 $message = 'Report sent to your lists and updated in the archive.';
                                 $flash['status'] = 'success';
                                 $flash['message'] = text_output($message);
                             } else {
                                 $message = 'An error occured while trying to update this report. Please try again later.';
                                 $flash['status'] = 'error';
                                 $flash['message'] = text_output($message);
                             }
                         } else {
                             //new report. insert into the system
                             /* do the insert */
                             $insert = $this->awe->add_saved_report($insert_array);
                             /* grab the insert id */
                             $insert_id = $this->db->insert_id();
                             /* optimize the table */
                             $this->sys->optimize_table('awe_saved_reports');
                             if ($insert > 0) {
                                 $message = 'Report sent to your lists and inserted into the archive.';
                                 $flash['status'] = 'success';
                                 $flash['message'] = text_output($message);
                             } else {
                                 $message = '201: An error occured while saving this report to the archives. Please try again later.';
                                 $flash['status'] = 'error';
                                 $flash['message'] = text_output($message);
                             }
                         }
                         /** PREPARE TO SEND EMAIL **/
                         $this->load->library('email');
                         $this->email->from($myaddress, $myname);
                         $this->email->to($mailrecipients);
                         $this->email->subject($mailsubject);
                         $this->email->message($htmlMail);
                         $this->email->set_alt_message($txtMail);
                         $this->email->send();
                         break;
                         //generate
                     //generate
                     case 'delete saved report':
                         //get info:
                         $reportRow = $this->awe->get_saved_report_details($id);
                         if ($reportRow !== FALSE) {
                             if ($reportRow->report_status == 'saved') {
                                 //exists, and not a published report.
                                 //go ahead an delete:
                                 $delete = $this->awe->delete_saved_report($id);
                                 if ($delete > 0) {
                                     $message = 'Report deleted successfully. Please wait to be redirected...';
                                     $flash['status'] = 'success';
                                     $flash['message'] = text_output($message);
                                 } else {
                                     $message = '102: There was an error deleting this report. Try again later.';
                                     $flash['status'] = 'error';
                                     $flash['message'] = text_output($message);
                                 }
                             } else {
                                 //this is a published report
                                 $message = 'Cannot delete published report.';
                                 $flash['status'] = 'еrror';
                                 $flash['message'] = text_output($message);
                             }
                             /* add an automatic redirect */
                             $this->template->add_redirect('report/awesimreport');
                         } else {
                             //report doesn't exist
                             $message = 'There was a problem deleting this report. It appears the ID doesn\'t exist anymore! Please try again later.';
                             $flash['status'] = 'еrror';
                             $flash['message'] = text_output($message);
                         }
                         break;
                         //delete
                     //delete
                     default:
                         $flash['status'] = 'error';
                         $flash['message'] = lang_output('error_generic', '');
                 }
                 /* write everything to the template */
                 $this->template->write_view('flash_message', '_base/admin/pages/flash', $flash);
             }
             //end if 'isset submit'
             $chkShowUsers = array();
             $customSections = array();
             $inputVal['txtReportDateStart'] = '';
             $inputVal['txtReportDateStart'] = '';
             if ($id !== FALSE) {
                 /* if there is an ID, it is a previously saved report */
                 //load the report:
                 $report = $this->awe->get_saved_report_details($id);
                 if ($report !== FALSE) {
                     //it exists!
                     $repdata = unserialize($report->report_data);
                     $chkShowUsers = $repdata['ShowUsers'];
                     $customSections = $repdata['CustomSections'];
                     $inputVal['txtReportDateStart'] = $report->report_date_start > 0 ? date('n/j/Y', $report->report_date_start) : '';
                     $inputVal['txtReportDateEnd'] = $report->report_date_end > 0 ? date('n/j/Y', $report->report_date_end) : '';
                 }
             }
             $data['debug']['action'] = $action;
             //set up inputs:
             $data['inputs'] = array('formAttributes' => array('name' => 'frmGenerate', 'id' => 'frmGenerate'), 'txtReportDateStart' => array('style' => 'width:150px;', 'name' => 'txtReportDateStart', 'id' => 'txtReportDateStart', 'value' => $inputVal['txtReportDateStart']), 'txtReportDateEnd' => array('style' => 'width:150px;', 'name' => 'txtReportDateEnd', 'id' => 'txtReportDateEnd', 'value' => $inputVal['txtReportDateEnd']), 'butGenerate' => array('type' => 'submit', 'class' => 'button-main', 'name' => 'submit', 'value' => 'generate', 'id' => 'submitGenerate', 'content' => ucwords('Generate Report')), 'preview' => array('type' => 'submit', 'class' => 'button-sec', 'name' => 'preview', 'value' => 'preview', 'id' => 'preview', 'content' => ucwords('Preview Report')), 'save' => array('type' => 'submit', 'class' => 'button-sec', 'name' => 'submit', 'value' => 'save', 'id' => 'save', 'content' => ucwords('Save Report')), 'update' => array('type' => 'submit', 'class' => 'button-sec', 'name' => 'submit', 'value' => 'update', 'id' => 'save', 'content' => ucwords('Update Report')), 'delete' => array('type' => 'submit', 'class' => 'button-sec', 'name' => 'submit', 'value' => 'delete', 'id' => 'submitDelete', 'content' => ucwords('Delete Saved Report')));
             /** ROSTER! **/
             $secID = $this->awe->get_section_by_name('Roster');
             $isActive = $this->awe->check_section_active($secID);
             $js_data['RosterActive'] = $isActive;
             if ($isActive > 0) {
                 //roster exists.
                 //get settings:
                 $data['roster']['Enabled'] = (int) $isActive;
                 $data['roster']['UseTags'] = $aweSettings['awe_chkPresenceTags'];
                 $data['roster']['Present'] = $aweSettings['awe_txtPresenceTag_Present'];
                 $data['roster']['Unexcused'] = $aweSettings['awe_txtPresenceTag_Unexcused'];
                 $data['roster']['Excused'] = $aweSettings['awe_txtPresenceTag_Excused'];
                 $data['roster']['ShowRankImages'] = $aweSettings['awe_chkShowRankImagesRoster'];
                 if ($aweSettings['awe_chkShowRankImagesRoster'] == 'checked') {
                     $sRosterImages = true;
                 }
                 $rank = $this->ranks->get_rankcat($this->rank);
                 /* build the blank image array */
                 $blank_img = array('src' => rank_location($this->rank, 'blank', $rank->rankcat_extension), 'alt' => '', 'class' => 'image');
                 $data['debug']['chkShowUsers'] = $chkShowUsers;
                 $depts = $this->dept->get_all_depts('asc', '');
                 if ($depts->num_rows() > 0) {
                     foreach ($depts->result() as $d) {
                         $data['characters'][$d->dept_id]['deptname'] = $d->dept_name;
                         $subdepts = $this->dept->get_sub_depts($d->dept_id);
                         if ($subdepts->num_rows() > 0) {
                             foreach ($subdepts->result() as $subd) {
                                 $data['characters'][$d->dept_id]['subdept'][$subd->dept_id]['deptname'] = $subd->dept_name;
                             }
                         }
                     }
                 }
                 $users = $this->user->get_users();
                 if ($users->num_rows() > 0) {
                     /* set the posting requirement threshold */
                     foreach ($users->result() as $p) {
                         if (empty($id)) {
                             $chkVal = 'checked';
                         } else {
                             if (empty($chkShowUsers[$p->userid])) {
                                 $chkVal = '';
                             } else {
                                 $chkVal = $chkShowUsers[$p->userid];
                             }
                         }
                         //							$chkValue = ((empty($chkShowUsers[$p->userid])) ? $chkShowUsers[$p->userid] : 'checked');
                         $data['chkRosterShowUsers'][$p->userid] = array('name' => 'chkRosterShowUsers[' . $p->userid . ']', 'id' => 'chkRosterShowUsers[' . $p->userid . ']', 'value' => 'checked', 'checked' => $chkVal);
                         $charinf = $this->char->get_character($p->main_char);
                         $posts = $this->pos->get_position($charinf->position_1);
                         $positions = $posts !== FALSE ? $posts->pos_name : '';
                         if ((int) $charinf->position_2 > 0) {
                             $positions .= " & " . $this->pos->get_position($charinf->position_2, 'pos_name');
                         }
                         $currdept = $this->dept->get_dept($posts->pos_dept);
                         $cdept = $currdept->dept_id;
                         //$this->dept->get_dept($posts->pos_dept, 'dept_id');
                         $parentDep = $currdept->dept_parent;
                         //$this->dept->get_dept($posts->pos_dept, 'dept_parent');
                         //get rank image:
                         $rankdata = $this->ranks->get_rank($charinf->rank, array('rank_name', 'rank_image'));
                         /* build the rank image array */
                         $rank_img = array('src' => rank_location($this->rank, $rankdata['rank_image'], $rank->rankcat_extension), 'alt' => $rankdata['rank_name'], 'class' => 'image');
                         if ((int) $parentDep > 0) {
                             //there is a 'parent' to the dept
                             $data['characters'][$parentDep]['subdept'][$cdept]['chars'][$p->userid] = array('id' => $p->userid, 'name' => $p->name, 'email' => $p->email, 'char_name' => $this->char->get_character_name($p->main_char, TRUE), 'position' => $positions, 'rank_img' => $rank_img, 'charid' => $p->main_char, 'loa' => $p->loa != 'active' ? '[' . strtoupper($p->loa) . ']' : '');
                             $data['department'][$p->main_char] = $cdept;
                         } else {
                             //the dept is the parent
                             $data['characters'][$cdept]['chars'][$p->userid] = array('id' => $p->userid, 'name' => $p->name, 'email' => $p->email, 'char_name' => $this->char->get_character_name($p->main_char, TRUE), 'position' => $positions, 'rank_img' => $rank_img, 'charid' => $p->main_char, 'loa' => $p->loa != 'active' ? '[' . strtoupper($p->loa) . ']' : '');
                             $data['department'][$p->main_char] = $cdept;
                         }
                         if ($p->loa == 'active') {
                             $data['radAttendance'][$p->main_char] = array('U' => array('name' => 'rAttendance[' . $p->main_char . ']', 'id' => 'rAttendance[' . $p->main_char . ']', 'value' => 'U'), 'E' => array('name' => 'rAttendance[' . $p->main_char . ']', 'id' => 'rAttendance[' . $p->main_char . ']', 'value' => 'E'), 'P' => array('name' => 'rAttendance[' . $p->main_char . ']', 'checked' => 'checked', 'id' => 'rAttendance[' . $p->main_char . ']', 'value' => 'P'));
                         } else {
                             $data['radAttendance'][$p->main_char] = array('LOA' => array('name' => 'rAttendance[' . $p->main_char . ']', 'checked' => 'checked', 'id' => 'rAttendance[' . $p->main_char . ']', 'value' => 'LOA'), 'ELOA' => array('name' => 'rAttendance[' . $p->main_char . ']', 'id' => 'rAttendance[' . $p->main_char . ']', 'value' => 'ELOA'));
                         }
                     }
                 }
                 /* sort the keys */
                 ksort($data['characters']);
             }
             //end if -- roster exists
             /* CUSTOM SECTIONS */
             //check the active sections:
             $cSections = $this->awe->get_all_userdefined_sections();
             if ($cSections->num_rows() > 0) {
                 foreach ($cSections->result() as $sec) {
                     if ($id !== FALSE) {
                         /* if there is an ID, it is a previously saved report */
                         $secVal = $customSections[$sec->section_id];
                     } else {
                         $secVal = $this->awe->get_section_default($sec->section_id);
                     }
                     /*						$secVal = (empty($customSections[$sec->section_id]) ? $customSections[$sec->section_id] : $this->awe->get_section_default($sec->section_id));*/
                     if ($this->awe->check_section_active($sec->section_id) > 0) {
                         $data['sections'][$sec->section_id]['title'] = $sec->section_title;
                         $data['sections'][$sec->section_id]['input'] = array('name' => 'sections[' . $sec->section_id . ']', 'secname' => 'sections[' . $sec->section_id . ']', 'secID' => $sec->section_id, 'id' => 'sections', 'rows' => 5, 'value' => $secVal);
                     }
                     //end if active section
                 }
                 //end foreach custom section
             }
             //end if custom sections
             //display saved reports:
             $savedReports = $this->awe->get_saved_reports('saved');
             $sReports = array();
             if ($savedReports !== FALSE) {
                 if ($savedReports->num_rows() > 0) {
                     foreach ($savedReports->result() as $row) {
                         $author_id = 0;
                         $author = $this->user->get_user($row->report_author);
                         if ($author !== FALSE) {
                             $author_id = $author->name;
                         }
                         $sel = '';
                         if ($id == $row->report_id) {
                             $sel = 'selected';
                         }
                         $sReports[$row->report_id] = array('id' => $row->report_id, 'dateStart' => strftime('n/j/Y', $row->report_date_start), 'dateEnd' => strftime('n/j/Y', $row->report_date_end), 'author' => $author_id, 'selected' => $sel);
                     }
                 }
             }
             $data['savedReports'] = $sReports;
             /** SETUP VIEW **/
             $data['header'] = 'aweSimReport: Generator';
             /* view locations */
             $currpage = 'reports_awesimreport_generator';
             $currpage_js = 'report_awesimreport_generator_js';
             break;
             /* GENERATOR */
         /* GENERATOR */
         case "sections":
             //DEAL WITH POST REQUESTS:
             if (isset($_POST['submit'])) {
                 switch ($this->uri->segment(4)) {
                     case 'add':
                         $secName = trim($this->input->post('secName', TRUE));
                         $secTitle = trim($this->input->post('secTitle', TRUE));
                         $secDefaultContent = trim($this->input->post('secDefaultContent', TRUE));
                         //make sure both aren't empty, just in case:
                         if (empty($secName)) {
                             /* set the content of the message */
                             $message = '101: There was a problem adding this section. Please try again later.';
                             $flash['status'] = 'error';
                             $flash['message'] = text_output($message);
                             /* write everything to the template */
                             $this->template->write_view('flash_message', '_base/admin/pages/flash', $flash);
                         } else {
                             //not empty
                             //check that section name doesn't exist:
                             $check = $this->awe->get_section_by_name($secName);
                             if ($check === FALSE) {
                                 //it doesn't exist. GOOD! ADD!
                                 $secName = str_replace('&', '&amp;', $secName);
                                 $secTitle = str_replace('&', '&amp;', $secTitle);
                                 $secDefaultContent = str_replace('&', '&amp;', $secDefaultContent);
                                 //if (empty($secTitle)) { $secTitle = $secName; }
                                 $insert_array = array('section_name' => $secName, 'section_title' => $secTitle, 'section_default' => $secDefaultContent, 'section_added_user' => $this->session->userdata('userid'), 'section_added_date' => time(), 'section_userdefined' => 1);
                                 /* insert the record */
                                 $insert = $this->awe->add_new_section($insert_array);
                                 if ($insert > 0) {
                                     $message = "Section added successfully.";
                                     $flash['status'] = 'success';
                                     $flash['message'] = text_output($message);
                                 } else {
                                     $message = '102: There was a problem adding the requested section. Please try again later.';
                                     $flash['status'] = 'error';
                                     $flash['message'] = text_output($message);
                                 }
                             } else {
                                 $message = sprintf(lang('flash_duplicate_key'), lang('labels_site') . ' ' . lang('labels_message'));
                                 $flash['status'] = 'error';
                                 $flash['message'] = text_output($message);
                             }
                             /* write everything to the template */
                             $this->template->write_view('flash_message', '_base/admin/pages/flash', $flash);
                         }
                         break;
                     case 'edit':
                         $secID = (int) $this->input->post('secID', TRUE);
                         $secName = trim($this->input->post('secName', TRUE));
                         $secTitle = trim($this->input->post('secTitle', TRUE));
                         $secDefaultContent = trim($this->input->post('secDefaultContent', TRUE));
                         //make sure both aren't empty, just in case:
                         if (empty($secName)) {
                             /* set the content of the message */
                             $message = 'Err 101: There was a problem adding this section. Please try again later.';
                             /*								$message .= '<br>secDefaultContent: '.$secDefaultContent;
                             								$message .= '<br>secName: '.$secName;*/
                             $flash['status'] = 'error';
                             $flash['message'] = text_output($message);
                             /* write everything to the template */
                             $this->template->write_view('flash_message', '_base/admin/pages/flash', $flash);
                         } else {
                             //not empty
                             //check that ID is valid:
                             $section = $this->awe->get_section_details($secID);
                             if ($section != false) {
                                 if ($section->num_rows() > 0) {
                                     $row = $section->row();
                                     $secName = str_replace('&', '&amp;', $secName);
                                     $secTitle = str_replace('&', '&amp;', $secTitle);
                                     $secDefaultContent = str_replace('&', '&amp;', $secDefaultContent);
                                     if (empty($secTitle)) {
                                         $secTitle = $secName;
                                     }
                                     $update_array = array('section_name' => $secName, 'section_title' => $secTitle, 'section_default' => $secDefaultContent, 'section_last_edit_user' => $this->session->userdata('userid'), 'section_last_edit_date' => time(), 'section_userdefined' => 1);
                                     /* insert the record */
                                     $insert = $this->awe->update_section($secID, $update_array);
                                     if ($insert > 0) {
                                         $message = "Section edited successfully.";
                                         $flash['status'] = 'success';
                                         $flash['message'] = text_output($message);
                                     } else {
                                         $message = 'Err 102: There was a problem editing the requested section. Please try again later.';
                                         $flash['status'] = 'error';
                                         $flash['message'] = text_output($message);
                                     }
                                 } else {
                                     $message = 'Error: This section seems to not exist anymore. If this persists, please submit a bug report.';
                                     $message .= '<br>[DEBUG] SecID: ' . $secID;
                                     $flash['status'] = 'error';
                                     $flash['message'] = text_output($message);
                                 }
                             } else {
                                 $message = 'Error: This section seems to not exist anymore. If this persists, please submit a bug report.';
                                 $message .= '<br>[DEBUG] SecID: ' . $secID;
                                 $flash['status'] = 'error';
                                 $flash['message'] = text_output($message);
                             }
                             /* write everything to the template */
                             $this->template->write_view('flash_message', '_base/admin/pages/flash', $flash);
                         }
                         break;
                     case 'sysedit':
                         $secID = (int) $this->input->post('secID', TRUE);
                         $secName = trim($this->input->post('secName', TRUE));
                         $secTitle = trim($this->input->post('secTitle', TRUE));
                         //make sure both aren't empty, just in case:
                         if (empty($secName)) {
                             /* set the content of the message */
                             $message = 'Err 201: There was a problem editing this section. Please try again later.';
                             $flash['status'] = 'error';
                             $flash['message'] = text_output($message);
                             /* write everything to the template */
                             $this->template->write_view('flash_message', '_base/admin/pages/flash', $flash);
                         } else {
                             //not empty
                             //check that ID is valid:
                             $section = $this->awe->get_section_details($secID);
                             if ($section != false) {
                                 if ($section->num_rows() > 0) {
                                     $row = $section->row();
                                     $secName = str_replace('&', '&amp;', $secName);
                                     $secDefaultContent = str_replace('&', '&amp;', $secDefaultContent);
                                     if (empty($secTitle)) {
                                         $secTitle = $secName;
                                     }
                                     $update_array = array('section_title' => $secTitle, 'section_last_edit_user' => $this->session->userdata('userid'), 'section_last_edit_date' => time());
                                     /* insert the record */
                                     $insert = $this->awe->update_section($secID, $update_array);
                                     if ($insert > 0) {
                                         $message = "Section edited successfully.";
                                         $flash['status'] = 'success';
                                         $flash['message'] = text_output($message);
                                     } else {
                                         $message = 'Err 202: There was a problem editing the requested section. Please try again later.';
                                         $flash['status'] = 'error';
                                         $flash['message'] = text_output($message);
                                     }
                                 } else {
                                     $message = 'Error: There was an error reading the fields information. If this persists, please submit a bug report.';
                                     $message .= '<br>[DEBUG] SecID: ' . $secID;
                                     $flash['status'] = 'error';
                                     $flash['message'] = text_output($message);
                                 }
                             } else {
                                 $message = 'Error: There was an error reading the fields information. If this persists, please submit a bug report.';
                                 $message .= '<br>[DEBUG] SecID: ' . $secID;
                                 $flash['status'] = 'error';
                                 $flash['message'] = text_output($message);
                             }
                             /* write everything to the template */
                             $this->template->write_view('flash_message', '_base/admin/pages/flash', $flash);
                         }
                         break;
                 }
             }
             //get sections:
             $allsections = $this->awe->get_all_sections();
             if ($allsections->num_rows() > 0) {
                 foreach ($allsections->result() as $row) {
                     $chkactive = $this->awe->check_section_active($row->section_id);
                     $data['sections'][$chkactive][$row->section_id] = array('id' => $row->section_id, 'userdefined' => $row->section_userdefined, 'name' => $row->section_name, 'title' => $row->section_title, 'default' => $row->section_default);
                 }
             }
             //get section order:
             $data['reorganize'] = $this->awe->renumber_sections_order();
             $sectionorder = $this->awe->get_section_order();
             if ($sectionorder->num_rows() > 0) {
                 foreach ($sectionorder->result() as $row) {
                     //make sure these are active sections:
                     if ($this->awe->check_section_active($row->section_id) > 0 && $this->awe->get_section_details($row->section_id) > 0) {
                         $data['sections']['order'][$row->section_order] = $row->section_id;
                     }
                     //						$data['sections']['order'][$row->section_order] = 1;
                 }
             }
             $data['inputs'] = array('txtAddSection' => array('style' => 'width:100px;', 'name' => 'txtAddSection', 'id' => 'txtAddSection', 'value' => ''), 'txtDefaultContent' => array('rows' => 5, 'cols' => 15, 'name' => 'txtDefaultContent', 'id' => 'txtDefaultContent', 'value' => ''), 'addSection' => array('type' => 'submit', 'class' => 'button-main', 'name' => 'submit', 'value' => 'addSection', 'id' => 'addSection', 'content' => ucwords('Add Section')), 'saveSections' => array('type' => 'button', 'class' => 'button-main', 'name' => 'saveSections', 'id' => 'saveSections', 'content' => ucwords('Save Order')));
             /** SETUP VIEW **/
             $data['header'] = 'aweSimReport: Custom Sections';
             /* view locations */
             $currpage = 'reports_awesimreport_sections';
             $currpage_js = 'report_awesimreport_sections_js';
             break;
             /* SECTIONS */
         /* SECTIONS */
         case "settings":
             $data['inputs'] = array('txtSimStart' => array('style' => 'width:100px;', 'name' => 'txtSimStart', 'id' => 'txtSimStart', 'value' => $aweSettings['awe_txtSimStart']), 'txtSimEnd' => array('style' => 'width:100px;', 'name' => 'txtSimEnd', 'id' => 'txtSimEnd', 'value' => $aweSettings['awe_txtSimEnd']), 'txtDateFormat' => array('style' => 'width:250px;', 'name' => 'txtDateFormat', 'id' => 'txtDateFormat', 'value' => $aweSettings['awe_txtDateFormat']), 'txtReportDuration' => array('style' => 'width:70px;', 'name' => 'txtReportDuration', 'id' => 'txtReportDuration', 'value' => $aweSettings['awe_txtReportDuration']), 'txtStatOccurences' => array('style' => 'width:70px;', 'name' => 'txtStatOccurences', 'id' => 'txtStatOccurences', 'value' => $aweSettings['awe_txtStatOccurences']), 'txtTemplateFooter' => array('rows' => '5', 'name' => 'txtTemplateFooter', 'id' => 'txtTemplateFooter', 'value' => $aweSettings['awe_txtTemplateFooter']), 'txtEmailSubject' => array('style' => 'width:400px;', 'name' => 'txtEmailSubject', 'id' => 'txtEmailSubject', 'value' => $aweSettings['awe_txtEmailSubject']), 'txtReportTitle' => array('style' => 'width:400px;', 'name' => 'txtReportTitle', 'id' => 'txtReportTitle', 'value' => $aweSettings['awe_txtReportTitle']), 'txtEmailRecipients' => array('style' => 'width:400px;', 'name' => 'txtEmailRecipients', 'id' => 'txtEmailRecipients', 'value' => $aweSettings['awe_txtEmailRecipients']), 'chkPresenceTags' => array('name' => 'chkPresenceTags', 'id' => 'chkPresenceTags', 'value' => 'checked', 'checked' => $aweSettings['awe_chkPresenceTags']), 'txtPresenceTag_Present' => array('style' => 'width:100px;', 'name' => 'txtPresenceTag_Present', 'id' => 'txtPresenceTag_Present', 'value' => $aweSettings['awe_txtPresenceTag_Present']), 'txtPresenceTag_Unexcused' => array('style' => 'width:100px;', 'name' => 'txtPresenceTag_Unexcused', 'id' => 'txtPresenceTag_Unexcused', 'value' => $aweSettings['awe_txtPresenceTag_Unexcused']), 'txtPresenceTag_Excused' => array('style' => 'width:100px;', 'name' => 'txtPresenceTag_Excused', 'id' => 'txtPresenceTag_Excused', 'value' => $aweSettings['awe_txtPresenceTag_Excused']), 'chkShowRankImagesRoster' => array('name' => 'chkShowRankImagesRoster', 'id' => 'chkShowRankImagesRoster', 'value' => 'checked', 'checked' => $aweSettings['awe_chkShowRankImagesRoster']), 'chkShowRankImagesCOC' => array('name' => 'chkShowRankImagesCOC', 'id' => 'chkShowRankImagesCOC', 'value' => 'checked', 'checked' => $aweSettings['awe_chkShowRankImagesCOC']), 'saveSettings' => array('type' => 'button', 'class' => 'button-main', 'name' => 'saveSettings', 'id' => 'saveSettings', 'content' => ucwords('Save Settings')), 'saveSettings2' => array('type' => 'button', 'class' => 'button-main', 'name' => 'saveSettings', 'id' => 'saveSettings', 'content' => ucwords('Save Settings')));
             /** SETUP VIEW **/
             $data['header'] = 'aweSimReport: Settings';
             /* view locations */
             $currpage = 'reports_awesimreport_settings';
             $currpage_js = 'report_awesimreport_settings_js';
             break;
             /* SETTINGS */
         /* SETTINGS */
         case "templates":
             /* get all templates */
             $templatelist = $this->awe->get_all_templates();
             $templates = array();
             if ($templatelist->num_rows() > 0) {
                 foreach ($templatelist->result() as $row) {
                     $isActive = 'no';
                     if ($row->template_id == $aweSettings['awe_ActiveTemplate']) {
                         $isActive = 'yes';
                     }
                     /*						$templatefolder = 'aweSimReportTemplates/'.$row->template_folder; */
                     $templates[$row->template_id] = array('id' => $row->template_id, 'name' => $row->template_name, 'author' => $row->template_author, 'author_email' => $row->template_author_email, 'author_url' => $row->template_author_url, 'version' => $row->template_version, 'created_date' => $row->template_created_date, 'description' => $row->template_description, 'imagefolder' => $row->template_imagefolder, 'active' => $isActive, 'thumbnail' => array('src' => asset_location('aweSimReportTemplates/' . $row->template_folder, 'thumbnail.png'), 'class' => 'image', 'alt' => $row->template_name, 'title' => $row->template_name, 'id' => 'templ_img'));
                 }
             }
             $data['templates'] = $templates;
             /** SETUP VIEW **/
             $data['header'] = 'aweSimReport: Templates';
             /* view locations */
             $currpage = 'reports_awesimreport_templates';
             $currpage_js = 'report_awesimreport_templates_js';
             break;
             /* TEMPLATES */
         /* TEMPLATES */
         case "archive":
             $archnum = $this->awe->count_archive();
             $pages = ceil((int) $archnum / 10);
             $pg = '1';
             $min = 0;
             $data['archnum'] = $archnum;
             if ($this->uri->segment(4, 0, TRUE) > 1) {
                 $pg = $this->uri->segment(4, 0, TRUE);
             }
             if ($pg > $pages) {
                 $pg = $pages;
             }
             $min = $pg * 10 - 10;
             $data['pg'] = $pg;
             $data['pages'] = $pages;
             $data['images']['icons']['loading'] = array('src' => img_location('loading-circle.gif', $this->skin, 'admin'), 'alt' => '', 'class' => 'image');
             //go over archive list:
             $archive = $this->awe->get_archived_reports('', $min);
             $dateFormat = $aweSettings['awe_txtDateFormat'];
             if ($archive->num_rows() > 0) {
                 foreach ($archive->result() as $item) {
                     $curruserid = $item->report_author;
                     $currchar = $this->char->get_character($curruserid);
                     $curruser = $this->user->get_user($curruserid);
                     //get the current user (reporting officer):
                     $posts = $this->pos->get_position($currchar->position_1);
                     $positions = $posts !== FALSE ? $posts->pos_name : '';
                     if ((int) $currchar->position_2 > 0) {
                         $positions .= " & " . $this->pos->get_position($currchar->position_2, 'pos_name');
                     }
                     if ($item->report_date_start <= 100 || $item->report_date_end <= 100) {
                         $dStart = '';
                         $dEnd = '';
                     } else {
                         $dStart = strftime($dateFormat, (int) $item->report_date_start);
                         $dEnd = strftime($dateFormat, (int) $item->report_date_end);
                     }
                     $data['archive'][$item->report_id] = array('id' => $item->report_id, 'date_start' => $dStart, 'date_end' => $dEnd, 'repofficer' => $this->char->get_character_name($curruserid, TRUE), 'repofficer_userid' => $item->arch_repofficer_userid, 'repofficer_charid' => $curruser->main_char, 'repofficer_position' => $positions, 'display' => $item->report_status, 'template' => $item->report_template, 'date_sent' => $item->report_date_sent);
                     $pubcheck = '';
                     if ($item->report_status == 'published') {
                         $pubcheck = 'checked';
                     }
                     $data['chkPublish'][$item->report_id] = array('name' => 'chkPublish', 'id' => 'chkPublish', 'checked' => $pubcheck, 'value' => $item->report_id);
                 }
                 //end foreach
             } else {
                 $data['archive'] = '';
             }
             //end if archive exists
             /* build the images array */
             $data['images']['icons'] = array('hidden' => array('src' => img_location('user-reject.png', $this->skin, 'admin'), 'class' => 'image', 'title' => 'Hidden (Click to make public)'), 'published' => array('src' => img_location('user-accept.png', $this->skin, 'admin'), 'class' => 'image', 'title' => 'Published (Click to make private)'), 'delete' => array('src' => img_location('minus-circle.png', $this->skin, 'admin'), 'class' => 'image', 'title' => 'Delete'));
             $data['inputs'] = array('submit' => array('type' => 'submit', 'class' => 'button-main', 'name' => 'submit', 'id' => 'submit', 'content' => ucwords('Apply All')));
             $data['currReportTemplate'] = $aweSettings['awe_ActiveTemplate'];
             /** SETUP VIEW **/
             $data['header'] = 'aweSimReport: Archive';
             /* view locations */
             $currpage = 'reports_awesimreport_archive';
             $currpage_js = 'report_awesimreport_archive_js';
             break;
             /* ARCHIVE */
         /* ARCHIVE */
         case "stats":
             $dates = array();
             $result = array();
             $sPeriod = $aweSettings['awe_txtReportDuration'];
             if (empty($sPeriod)) {
                 $sPeriod = 30;
                 //approx a month
             }
             $rawStatPeriod = $sPeriod * 86400;
             //turn into seconds
             $counter = 0;
             if ($aweSettings['awe_txtStatOccurences'] < 1) {
                 $repOccurences = 10;
             } else {
                 $repOccurences = $aweSettings['awe_txtStatOccurences'];
             }
             $endDate = now();
             while ($counter <= $repOccurences) {
                 $startDate = (int) ($endDate - $rawStatPeriod);
                 $curr_month = date('n', $endDate);
                 $result[] = $this->awe->stats_total_logcount($startDate, $endDate) + 1;
                 $dates[] = date('Mj', $endDate);
                 $endDate = $startDate - 1;
                 //next occurence start a month ago, a second earlier
                 $counter++;
             }
             $maxval = max($result);
             $newresult = array();
             foreach ($result as $sig) {
                 //turn it into percentages:
                 $newresult[] = $sig / $maxval * 100;
             }
             $data['dates'] = $dates;
             $data['result'] = $newresult;
             $halfmaxvalue = $maxval / 2;
             $imgsrc = "http://chart.apis.google.com/chart?";
             $imgsrc .= "chxl=0:|" . implode('|', $dates);
             $imgsrc .= "&chxr=0,0,0|1,0," . (int) $maxval;
             $imgsrc .= "&chxs=0,AA0033,11.5,0,lt,676767|1,676767,11.5,0,lt,676767";
             $imgsrc .= "&chxt=x,y";
             $imgsrc .= "&chbh=a,5";
             $imgsrc .= "&chs=500x400";
             $imgsrc .= "&cht=bvg";
             $imgsrc .= "&chd=t:" . implode(',', $newresult);
             $imgsrc .= "&chds=a";
             $imgsrc .= "&chdlp=b";
             $imgsrc .= "&chp=0";
             $imgsrc .= "&chg=10,10,0,9";
             $imgsrc .= "&chma=5";
             $imgsrc .= "&chtt=Total+Log+Count";
             $data['imggraph'] = array('src' => $imgsrc, 'alt' => 'Total Log Count', 'class' => 'image');
             /** SETUP VIEW **/
             $data['header'] = 'aweSimReport: Stats';
             $currpage = 'reports_awesimreport_stats';
             $currpage_js = 'report_awesimreport_stats_js';
             break;
     }
     /* END SWITCH URI SEGMENT */
     /** DISPLAY VIEW **/
     $view_loc = view_location($currpage, $this->skin, 'admin');
     $js_loc = js_location($currpage_js, $this->skin, 'admin');
     /* produce write the header */
     $this->template->write('title', $data['header']);
     /* produce view */
     $this->template->write_view('javascript', $js_loc, $js_data);
     $this->template->write_view('content', $view_loc, $data);
     /* render the template */
     $this->template->render();
 }
<?php

echo text_output($header, 'h2');
?>

Date sent: <?php 
echo $report['DateSent'];
?>

<iframe src="<?php 
echo site_url('ajax/awe_preview_report_output/' . $params['repID'] . '/' . $params['templID']);
?>
" style="width:100%; height: 500px; overflow: scroll; border: 2px solid #000;">
</iframe> 
		</ul>
<?php 
} else {
    print "<strong>No inactive sections.</strong>";
}
?>
	</div>


<br />
<hr /><br />
	
	
<?php 
echo text_output('Organize Sections', 'h3', 'page-subhead');
echo text_output('Drag the sections to reorganize. The final report will be produced according to the order below.', 'p', 'fontSmall');
?>


<?php 
/* print "<hr>".print_r($reorganize)."<hr>"; */
?>

	
	<div class="UITheme">
		<?php 
if (isset($sections[1]) && isset($sections['order'])) {
    ?>
		<ul id="list">
<?php 
    foreach ($sections['order'] as $sec_ord => $sec_id) {
						<?php 
                if (isset($fields[$a['id']])) {
                    ?>
							<table class="table100 zebra" cellspacing="0" cellpadding="3">

							<?php 
                    foreach ($fields[$a['id']] as $b) {
                        ?>
								<tr>
									<td class="cell-label align_top"><?php 
                        echo $b['label'];
                        ?>
</td>
									<td class="cell-spacer"></td>
									<td><?php 
                        echo text_output($b['value'], '');
                        ?>
</td>
								</tr>
							<?php 
                    }
                    ?>

						</table><br />
						<?php 
                }
                ?>
					<?php 
            }
            ?>
				<?php 
</li>
							<?php 
    }
    ?>
						<?php 
}
?>
					</ul>
				</div>

				<div id="six">
				<?php 
if (isset($myuploads)) {
    ?>
					<?php 
    echo text_output($label['myuploads'], 'h3');
    ?>
					<br />
					<table class="zebra">
						<tbody>
						<?php 
    foreach ($myuploads as $d) {
        ?>
							<tr>
								<td class="cell-label"><?php 
        echo $d['file'];
        ?>
</td>
								<td class="cell-spacer"></td>
								<td><?php 
        echo img($d['image']);
Beispiel #12
0
 function awe_switch_templates()
 {
     if (IS_AJAX) {
         $id = $this->input->post('tmplid');
         $upArr = array('setting_value' => $id);
         $update = $this->settings->update_setting('awe_ActiveTemplate', $upArr);
         if ($update > 0) {
             $message = "Template updated successfully.";
             $flash['status'] = 'success';
             $flash['message'] = text_output($message);
             $output = $this->load->view('_base/admin/pages/flash', $flash, TRUE);
         } else {
             $message = "There was a problem updating the active template. Please try again.";
             $flash['status'] = 'error';
             $flash['message'] = text_output($message);
             $output = $this->load->view('_base/admin/pages/flash', $flash, TRUE);
         }
         echo $output;
     }
 }
		</div><!-- coc -->

<?php 
/*	<div id='simtime'>
			<?php echo text_output('Sim Time and Duration Settings', 'h3', 'page-subhead');?>
				<kbd><?php echo form_label('Start Time:', 'txtSimStart');?>
				<?php echo form_input($inputs['txtSimStart']); ?></kbd>
				<kbd><?php echo form_label('End Time:', 'txtSimEnd');?>
				<?php echo form_input($inputs['txtSimEnd']); ?></kbd>
		
		</div> <!-- simtime -->
*/
?>
		<div id="stats">
			<?php 
echo text_output('Statistics Settings', 'h3', 'page-subhead');
?>

			<kbd><?php 
echo form_label('Report Duration:', 'txtReportDuration');
echo form_input($inputs['txtReportDuration']);
?>
 days.</kbd>
			
			<kbd><?php 
echo form_label('Number of Occurences to Display:', 'txtStatOccurences');
echo form_input($inputs['txtStatOccurences']);
?>
</kbd>
			
		</div><!-- coc -->
<?php

echo text_output($header, 'h2');
echo text_output($text);
?>

<?php 
echo form_open('report/awesimreport/sections/add');
?>
	<table class="table100">
		<tbody>
			
			<tr>
				<td class="cell-label"><?php 
echo 'Section Name';
?>
</td>
				<td class="cell-spacer"></td>
				<td><?php 
echo form_input($inputs['secName']);
?>
</td>
			</tr>
			
			<?php 
echo table_row_spacer(3, 10);
?>

			<tr>
				<td class="cell-label"><?php 
echo 'Section Title';
    $realmData['servertypecolor'] = $roster->config['rs_color_error'];
} else {
    if ($realmData['serverpop'] == ' ') {
        $realmData['serverpopcolor'] = $roster->config['rs_color_low'];
    } else {
        $realmData['serverpopcolor'] = $roster->config['rs_color_' . strtolower($realmData['serverpop'])];
    }
    $realmData['servertypecolor'] = $roster->config['rs_color_' . strtolower($realmData['servertype'])];
    $realmData['serverpop'] = $roster->locale->act['rs'][$realmData['serverpop']];
    $realmData['servertype'] = $roster->locale->act['rs'][$realmData['servertype']];
}
// Generate image or text?
if ($generate_image) {
    img_output($realmData, $err, $image_path, $font_path);
} else {
    echo text_output($realmData);
}
return;
//==========[ TEXT OUTPUT MODE ]=======================================================
function text_output($realmData)
{
    global $roster;
    $outtext = '
<!-- Begin Realmstatus -->
<div style="width:88px;font-family:arial;font-weight:bold;">
	<div style="width:88px;height:41px;background-image:url(' . ROSTER_URL . $roster->config['img_url'] . 'realmstatus/' . strtolower($realmData['serverstatus']) . '.png);"></div>';
    if ($roster->config['rs_display'] == 'full') {
        $outtext .= '
	<div style="vertical-align:middle;text-align:center;width:88px;height:54px;background-image:url(' . ROSTER_URL . $roster->config['img_url'] . 'realmstatus/' . strtolower($realmData['serverstatus']) . '2.png);">
		<div style="padding-top:7px;color:' . $roster->config['rs_color_server'] . ';font-size:10px;">' . $realmData['server_name'] . '</div>
		<div style="color:' . $realmData['serverpopcolor'] . ';font-size:12px;">' . $realmData['serverpop'] . '</div>
Beispiel #16
0
			<?php 
}
?>
		</div>

		<?php 
if ($this->options['use_sample_post'] == 'y') {
    ?>
			<div id="four">
				<?php 
    echo text_output($label['samplepost'], 'h3', 'page-subhead');
    ?>

				<div class="indent-left">
					<?php 
    echo text_output($sample_post_msg, 'p', 'bold gray');
    ?>
					<?php 
    echo form_textarea($inputs['sample_post']);
    ?>
				</div>
			</div>
		<?php 
}
?>
	</div>

	<div class="indent-left">
		<?php 
echo form_hidden('submit', 'y');
?>
                                ?>
													<?php 
                                echo text_output($char['loa'], 'span', 'red fontSmall bold');
                                ?>
												<?php 
                            } elseif ($char['loa'] == '[ELOA]') {
                                ?>
													<?php 
                                echo text_output($char['loa'], 'span', 'orange fontSmall bold');
                                ?>
												<?php 
                            }
                            ?>

												<?php 
                            echo text_output($char['char_name'], 'span', 'bold');
                            ?>
<br />
												<span class="fontTiny">
													<?php 
                            echo anchor('personnel/user/' . $char['id'], 'User Account');
                            ?>
													|
													<?php 
                            echo anchor('personnel/character/' . $char['charid'], 'Character Bio');
                            ?>
												</span>
											</td>
											<td class="fontTiny nobold">(<?php 
                            print $char['position'];
                            ?>
Beispiel #18
0
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
?>

<?php 
echo text_output($header, 'h1', 'page-head');
?>

<div style="float:right; width: 199px; padding-left: 5px; padding-top: 4px;"><?php 
echo img($alertimg);
?>
</div>
<?php 
echo text_output($msg_sim);
</strong><br />
											<?php 
                                echo $spos['name'];
                                ?>
											
											<?php 
                                if ($char['crew_type'] == 'npc') {
                                    ?>
												<br /><?php 
                                    echo text_output($label['npc'], 'span', 'gray');
                                    ?>
											<?php 
                                } elseif ($char['crew_type'] == 'inactive') {
                                    ?>
												<br /><?php 
                                    echo text_output($label['inactive'], 'span', 'gray');
                                    ?>
											<?php 
                                }
                                ?>
										</td>
										<td>
											<!-- MOD MANIFEST -->
											<?php 
                                if ($settings['show']['species'] == true) {
                                    echo $char['char_species'] . ' ';
                                }
                                if ($settings['show']['gender'] == true) {
                                    echo '(' . $char['char_gender'] . ')';
                                }
                                ?>