Exemplo n.º 1
0
function sex_sense_render_posts($posts, $options = array())
{
    foreach ($posts as $post) {
        $out .= sex_sense_bright_container_top();
        $out .= sex_sense_dark_container_top();
        $out .= '<h3 class="sex_sense_post_header" id="header_' . $post['id'] . '">' . $post['title'] . '</h3>' . "\n";
        $out .= sex_sense_dark_container_bottom();
        $out .= '<div class="' . (isset($options['unhide_content']) && $options['unhide_content'] == true ? 'content' : 'hidden_content') . '" id="content_' . $post['id'] . '">';
        $out .= '<p>' . nl2br($post['question']) . '</p>' . "\n";
        foreach ($post['answers'] as $answer) {
            $out .= ui_avatar($answer['user_id']);
            $out .= sex_sense_bubble_top();
            $out .= '<h4>' . $answer['username'] . ' svarar:</h4>' . "\n";
            $out .= '<p>' . nl2br($answer['answer']);
            $out .= is_privilegied('sex_sense_admin') ? '<br /><a href="/sex_och_sinne/aendra_svar.php?id=' . $answer['id'] . '">Ändra svar.</a>' : '';
            $out .= '</p>' . "\n";
            $out .= sex_sense_bubble_bottom();
        }
        $direct_link = '/sex_och_sinne/';
        $categories = sex_sense_fetch_categories(array('category_id' => $post['category_id']));
        foreach ($categories as $category_tree) {
            $category = array_pop($category_tree);
            $direct_link .= $category['category_handle'] . '/';
        }
        $direct_link .= $post['handle'] . '.html';
        $out .= '<button class="button_80" onclick="window.location=\'' . $direct_link . '\';">Direktlänk</button>' . "\n";
        if ($post['forum_post_id'] != 0) {
            $thread_url = forum_get_url_by_post($post['forum_post_id']);
            $out .= '<button class="button_140" onclick="window.location=\'' . $thread_url . '\';">Diskutera i forumet</button>' . "\n";
        }
        $out .= is_privilegied('sex_sense_admin') ? '<br /><a href="/sex_och_sinne/admin.php?id=' . $post['id'] . '">Ändra fråga/lägg till svar &raquo;</a>' : '';
        $out .= '<div style="clear: both; height: 5px;"></div>' . "\n";
        $out .= '</div>';
        $out .= sex_sense_bright_container_bottom();
        $closed_content++;
    }
    return $out;
}
Exemplo n.º 2
0
        foreach ($categories as $category) {
            $out .= '<optgroup label="' . $category['category_title'] . '">' . "\n";
            $child_categories = array_pop(sex_sense_fetch_categories(array('parent_category' => $category['category_id'])));
            foreach ($child_categories as $child_category) {
                $selected = $question['category'] == $child_category['category_id'] ? ' selected="selected"' : '';
                $out .= "\t" . '<option value="' . $child_category['category_id'] . '"' . $selected . '>' . $child_category['category_title'] . '</option>' . "\n";
            }
            $out .= '</optgroup>' . "\n";
        }
        $out .= '</select>';
        $out .= '</h3>' . "\n";
        $out .= sex_sense_dark_container_bottom();
        $out .= '<textarea name="question" style="width: 550px; height: 200px;">' . $question['question'] . '</textarea><br style="clear: both;" />' . "\n";
        foreach ($question['answers'] as $answer) {
            $out .= ui_avatar($answer['user_id']);
            $out .= sex_sense_bubble_top();
            $out .= '<h4>' . $answer['username'] . ' svarar:</h4>' . "\n";
            $out .= '<p>' . nl2br($answer['answer']) . '</p>' . "\n";
            $out .= sex_sense_bubble_bottom();
        }
        $out .= '<input type="hidden" name="answer_to" value="' . $question['id'] . '" />' . "\n";
        $out .= '<label for="answer">Svara på frågan: <strong>Detta fält måste fyllas i, annars går saker sönder.</strong></label>' . "\n";
        $out .= '<textarea name="answer" style="width: 550px; height: 200px;">' . "\n";
        $out .= '</textarea>' . "\n";
        $out .= '<br /><input type="submit" value="Skicka" onclick="return checkChosenCategory()" class="button_60" />' . "\n";
        $out .= '<a onclick="checkChosenCategory()">LOOOL</a>' . "\n";
        $out .= '</form>' . "\n";
        $out .= '<div style="clear: both; height: 5px;"></div>' . "\n";
        $out .= sex_sense_bright_container_bottom();
    }
} else {