Ejemplo n.º 1
0
protect_page();
$user_id = $_SESSION['user_id'];
$alpha = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l');
$project_id = $activeProject['project_id'];
if (empty($activeProject)) {
    //redirects if there's no active project for the user (if they've not created one)
    header("Location: new_project.php");
    exit;
}
if ($project_id == 0) {
    //redirects if there's no active project for the user (if they've not created one)
    echo "<script>parent.jQuery.colorbox.close(); parent.location.reload();</script>";
    exit;
}
$character_id = @$_GET['character'];
$character_data = get_character_data($project_id, $character_id);
$characters = get_project_characters($project_id);
$factions = get_project_factions($project_id);
$projects = get_project_list();
if (empty($character_data)) {
    if (empty($factions)) {
        echo "Invalid character id!<script>parent.jQuery.colorbox.close(); parent.location.reload();</script>";
        exit;
    }
    unset($character_id);
    foreach ($factions as $faction) {
        if (!$faction['deleted']) {
            foreach ($characters[$faction['faction_num']] as $character) {
                if (!$character['deleted']) {
                    $character_id = $character['character_id'];
                    header("Location: character_card.php?character=" . $character_id);
Ejemplo n.º 2
0
/**
 * Returns the opinion of the receiver held by the bearer. If no direct opinion exists,
 * the opinion of the receivers faction held by the bearer is returned. If no direct opinion
 * exists, the opinion of the receivers faction held by the bearer's faction is returned.
 */
function get_character_opinions($type, $project_id, $bearer_id, $receiver_id)
{
    if (empty($type) || empty($project_id) || empty($bearer_id) || empty($receiver_id)) {
        return false;
    }
    $return = array('bearer' => array(), 'receiver' => array(), 'opinion_word' => 'Neutral', 'opinion_text' => 'Neutral', 'from' => '', 'f2f' => array());
    switch ($type) {
        case 'c2c':
            $return['c2f'] = array();
            $return['c2c'] = array();
            $bearer = get_character_data($project_id, $bearer_id);
            $bearer_faction_id = $bearer['faction']['faction_id'];
            $return['bearer'] = $bearer;
            $receiver = get_character_data($project_id, $receiver_id);
            $receiver_faction_id = $receiver['faction']['faction_id'];
            $return['receiver'] = $receiver;
            break;
        case 'c2f':
            $return['c2f'] = array();
            $bearer = get_character_data($project_id, $bearer_id);
            $receiver = get_faction($receiver_id);
            $bearer_faction_id = $bearer['faction']['faction_id'];
            $receiver_faction_id = $receiver_id;
            $return['bearer'] = $bearer;
            $return['receiver'] = $receiver;
            $bearer_id = $bearer['faction']['faction_id'];
            break;
        case 'f2f':
            $bearer = get_faction($bearer_id);
            $receiver = get_faction($receiver_id);
            $bearer_faction_id = $bearer_id;
            $receiver_faction_id = $receiver_id;
            $return['bearer'] = $bearer;
            $return['receiver'] = $receiver;
            break;
    }
    $result = get_f2f_opinions($project_id, $bearer_faction_id, $receiver_faction_id);
    if (!empty($result)) {
        $return['opinion_word'] = empty($result['opinion_word']) ? 'Neutral' : $result['opinion_word'];
        $return['opinion_text'] = empty($result['opinion_text']) ? 'Neutral' : $result['opinion_text'];
        $return['f2f'] = array('opinion_id' => $result['opinion_id'], 'opinion_word' => empty($result['opinion_word']) ? 'Neutral' : $result['opinion_word'], 'opinion_text' => empty($result['opinion_text']) ? 'Neutral' : $result['opinion_text']);
        $return['from'] = 'f2f';
    }
    if ($type != 'f2f') {
        $result = get_c2f_opinions($project_id, $bearer_id, $receiver_faction_id);
        if (!empty($result)) {
            $return['opinion_word'] = empty($result['opinion_word']) ? 'Neutral' : $result['opinion_word'];
            $return['opinion_text'] = empty($result['opinion_text']) ? 'Neutral' : $result['opinion_text'];
            $return['c2f'] = array('opinion_id' => $result['opinion_id'], 'opinion_word' => empty($result['opinion_word']) ? 'Neutral' : $result['opinion_word'], 'opinion_text' => empty($result['opinion_text']) ? 'Neutral' : $result['opinion_text']);
            $return['from'] = 'c2f';
        }
        if ($type == 'c2c') {
            $result = get_c2c_opinions($project_id, $bearer_id, $receiver_id);
            if (!empty($result)) {
                $return['opinion_word'] = empty($result['opinion_word']) ? 'Neutral' : $result['opinion_word'];
                $return['opinion_text'] = empty($result['opinion_text']) ? 'Neutral' : $result['opinion_text'];
                $return['c2c'] = array('opinion_id' => $result['opinion_id'], 'opinion_word' => empty($result['opinion_word']) ? 'Neutral' : $result['opinion_word'], 'opinion_text' => empty($result['opinion_text']) ? 'Neutral' : $result['opinion_text']);
                $return['from'] = 'c2c';
            }
        }
    }
    return $return;
}
Ejemplo n.º 3
0
$characters = get_project_characters($project_id);
$factions = get_project_factions($project_id);
$firstPage = true;
foreach ($characters as $faction_num => $faction_characters) {
    if ($factions[$faction_num]['deleted']) {
        continue;
    }
    foreach ($faction_characters as $character_num => $faction_character) {
        if ($faction_character['deleted']) {
            continue;
        }
        if (!$firstPage) {
            $pdf->AddPage();
        }
        $firstPage = false;
        $character_data = get_character_data($project_id, $faction_character['character_id']);
        $pdf->cell(45, 10, 'Character: ' . $faction_character['character_name'], 0, 0, 'L');
        $pdf->cell(45, 10, 'Player: ' . $faction_character['player_name'], 0, 0, 'L');
        $pdf->cell(45, 10, 'Faction: ' . $factions[$faction_num]['faction_name'], 0, 0, 'L');
        $pdf->cell(45, 10, 'Priority: ' . $faction_character['priority_label'], 0, 1, 'L');
        $pdf->multicell(90, 4, 'Bio: ' . $faction_character['character_bio'], 0, 2);
        $pdf->Ln();
        $inner_characters = $characters;
        foreach ($inner_characters as $inner_faction_num => $inner_faction_characters) {
            if ($factions[$inner_faction_num]['deleted']) {
                continue;
            }
            $pdf->cell(45, 4, $factions[$inner_faction_num]['faction_name'], 0, 1);
            foreach ($inner_faction_characters as $inner_character_num => $inner_faction_character) {
                if ($inner_faction_character['deleted']) {
                    continue;