break; case 'video': $pageName = "$langAddV"; include 'insert_video.php'; list_videos(); break; case 'ebook': $pageName = "$langAdd $langInsertEBook"; include 'insert_ebook.php'; list_ebooks(); break; case 'forum': $pageName = "$langAdd $langInsertForum"; include 'insert_forum.php'; list_forums(); break; case 'poll': $pageName = "$langAdd $langInsertPoll"; include 'insert_poll.php'; list_polls(); break; case 'wiki': $pageName = "$langAdd $langInsertWiki"; include 'insert_wiki.php'; list_wikis(); break; default: break; } draw($tool_content, 2, null, $head_content); /** * @brief insert docs in database * @global type $webDir * @global type $course_id
$item = new HiddenInput('poll_question_id', $poll_question_id); $votingform->append($item); $item = new HiddenInput('submitted', 1); $votingform->append($item); $item = new SubmitInput('Vote!'); $votingform->append($item); $sql = "select count(*) as voted from poll_votes v join poll_choices c using (poll_choice_id) where userid = {$userid} and poll_question_id = {$poll_question_id}"; $res = mysql_query($sql); $new_row = mysql_fetch_array($res); $voted = $new_row['voted']; if ($voted) { $msg = new InfoText('You have voted in this poll, but you may change your mind.', 'Vote registered'); $thispage->append($msg); } } $thispage->append(list_polls()); $ask = new RequestText('Poll ideas? <a href="mailto:grinnellplans@gmail.com">Email</a>.', 'Feedback?'); $thispage->append($ask); function list_polls() { $list = new WidgetList('polls_list', true, 'All Polls'); $sql = "select html, poll_question_id from poll_questions where poll_question_id not in (16, 17) order by poll_question_id desc"; $res = mysql_query($sql); while ($new_row = mysql_fetch_array($res)) { $link = new Hyperlink('poll_link', false, '?poll_question_id=' . $new_row['poll_question_id'], preg_replace('/<[^>]*>/', '', $new_row['html'])); $list->append($link); } return $list; } interface_disp_page($thispage); db_disconnect($dbh);