Ejemplo n.º 1
0
    }
}
if ($origin == 'learnpath') {
    echo '<div style="height:15px">&nbsp;</div>';
}
/* Display the action messages */
if (!empty($message)) {
    Display::display_confirmation_message($message);
}
/* Action links */
echo '<div class="actions">';
if ($origin != 'learnpath') {
    if ($origin == 'group') {
        echo '<a href=' . api_get_path(WEB_CODE_PATH) . '"group/group_space.php?' . api_get_cidreq() . '&amp;gradebook=' . $gradebook . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('Groups'), '', ICON_SIZE_MEDIUM) . '</a>';
    } else {
        echo '<span style="float:right;">' . search_link() . '</span>';
        echo '<a href="' . $forumUrl . 'index.php">' . Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM) . '</a>';
    }
}
// The link should appear when
// 1. the course admin is here
// 2. the course member is here and new threads are allowed
// 3. a visitor is here and new threads AND allowed AND  anonymous posts are allowed
if (api_is_allowed_to_edit(false, true) or $current_forum['allow_new_threads'] == 1 and isset($_user['user_id']) or $current_forum['allow_new_threads'] == 1 and !isset($_user['user_id']) and $current_forum['allow_anonymous'] == 1) {
    if ($current_forum['locked'] != 1 and $current_forum['locked'] != 1) {
        if (!api_is_anonymous()) {
            if ($my_forum == strval(intval($my_forum))) {
                echo '<a href="' . $forumUrl . 'newthread.php?' . api_get_cidreq() . '&amp;forum=' . Security::remove_XSS($my_forum) . $origin_string . '">' . Display::return_icon('new_thread.png', get_lang('NewTopic'), '', ICON_SIZE_MEDIUM) . '</a>';
            } else {
                $my_forum = strval(intval($my_forum));
                echo '<a href="' . $forumUrl . 'newthread.php?' . api_get_cidreq() . '&amp;forum=' . $my_forum . $origin_string . '">' . Display::return_icon('new_thread.png', get_lang('NewTopic'), '', ICON_SIZE_MEDIUM) . '</a>';
Ejemplo n.º 2
0
/* ACTIONS */
$whatsnew_post_info = isset($_SESSION['whatsnew_post_info']) ? $_SESSION['whatsnew_post_info'] : null;
/* Is the user allowed here? */
// if the user is not a course administrator and the forum is hidden
// then the user is not allowed here.
if (!api_is_allowed_to_edit(false, true) and $current_forum_category && $current_forum_category['visibility'] == 0) {
    api_not_allowed();
}
/* Action Links */
$html = '';
$html .= '<div class="actions">';
$html .= '<a href="index.php?' . api_get_cidreq() . '">' . Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM) . '</a>';
if (api_is_allowed_to_edit(false, true)) {
    $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory=' . $current_forum_category['cat_id'] . '&action=add&content=forum"> ' . Display::return_icon('new_forum.png', get_lang('AddForum'), '', ICON_SIZE_MEDIUM) . '</a>';
}
$html .= search_link();
$html .= '</div>';
/* ACTIONS */
echo $html;
$action_forums = isset($_GET['action']) ? $_GET['action'] : '';
if (api_is_allowed_to_edit(false, true)) {
    handle_forum_and_forumcategories();
}
// Notification
if ($action_forums == 'notify' && isset($_GET['content']) && isset($_GET['id'])) {
    $return_message = set_notification($_GET['content'], $_GET['id']);
    Display::display_confirmation_message($return_message, false);
}
if ($action_forums != 'add') {
    /*
    RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS
Ejemplo n.º 3
0
            $all_groups[$group['id']] = $group;
        }
    }
}
/* CLEAN GROUP ID FOR AJAXFILEMANAGER */
if (isset($_SESSION['_gid'])) {
    unset($_SESSION['_gid']);
}
/* ACTION LINKS */
echo '<div class="actions">';
//if is called from learning path
if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) {
    echo "<a href=\"../newscorm/lp_controller.php?" . api_get_cidreq() . "&gradebook=&action=add_item&type=step&lp_id={$lp_id}#resource_tab-5\">" . Display::return_icon('back.png', get_lang("BackTo") . ' ' . get_lang("LearningPaths"), '', ICON_SIZE_MEDIUM) . "</a>";
}
if (!empty($forum_list)) {
    echo search_link();
}
if (api_is_allowed_to_edit(false, true)) {
    echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add&content=forumcategory&lp_id=' . $lp_id . '"> ' . Display::return_icon('new_folder.png', get_lang('AddForumCategory'), '', ICON_SIZE_MEDIUM) . '</a>';
    if (is_array($forumCategories) and !empty($forumCategories)) {
        echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add&content=forum&lp_id=' . $lp_id . '"> ' . Display::return_icon('new_forum.png', get_lang('AddForum'), '', ICON_SIZE_MEDIUM) . '</a>';
    }
}
echo '</div>';
// Fixes error if there forums with no category.
$forumsInNoCategory = get_forums_in_category(0);
if (!empty($forumsInNoCategory)) {
    $forumCategories = array_merge($forumCategories, array(array('cat_id' => 0, 'session_id' => 0, 'visibility' => 1, 'cat_comment' => null)));
}
/* Display Forum Categories and the Forums in it */
// Step 3: We display the forum_categories first.
Ejemplo n.º 4
0
} catch (Exception $e) {
    var_dump($e->getMessage());
    exit;
}
$current = FALSE;
while ($current = $story->getCurrentPassage()) {
    echo $current->text . PHP_EOL;
    if (!empty($current->links) && is_array($current->links)) {
        echo 'You can do:' . PHP_EOL;
        foreach ($current->links as $link) {
            echo $link['text'] . PHP_EOL;
        }
        echo PHP_EOL . PHP_EOL;
        $text_next = prompt_answer();
        echo $log;
        $next = search_link($text_next);
        if (!empty($next)) {
            $story->followLink($next);
        }
    } else {
        break;
    }
    echo PHP_EOL . PHP_EOL;
}
function prompt_answer()
{
    global $current, $story, $log;
    $handle = fopen("php://stdin", "r");
    $answer = trim(fgets($handle));
    if ($answer === 'undo') {
        $story->undo();