Exemple #1
0
function draw_statistics_page()
{
    ?>
	<div class="ono_wrap">
		<div id="wrap">
			<h2 class="heading"><?php 
    echo __("SSQuiz Statistics", 'ssquiz');
    ?>
</h2>
			
			<?php 
    if (function_exists('ssquiz_print_aux_stats')) {
        ssquiz_print_aux_stats();
    }
    ?>
			
			<legend style="margin-top: 20px;"><i class="icon-group"></i> Quiz users</legend>
			
			<div class="cf" style="margin: 30px 0 0 10px; position: relative;">
				<div id="display_questions" style="float:left;">
					<label style="display:inline-block;left: -10px; position: relative;"><?php 
    echo __("Find: ", 'ssquiz');
    ?>
</label>
					<input type="text" id="find_name" placeholder="User/Quiz name" />
					<input type="checkbox" id="find_completed" style="position: relative;top: -6px;margin-left: 20px;" />
					<label style="display:inline-block;left: 15px; position: relative;"><?php 
    echo __("only passed", 'ssquiz');
    ?>
</label>
				</div>

				<div style="float:right;">
					<a class="btn ssquiz_ask_delete_history" href="#">
						<i class="icon-trash"></i> <?php 
    echo __("Delete All Entries", 'ssquiz');
    ?>
					</a>
					<div class="confirm_delete_history" style="right: 0px;top: -5px; display:none;">
						<a href="#" class="btn btn-danger ssquiz_delete_history" onclick="jQuery.fn.crud_history( -1 ); return false;">Confirm</a>
						<a href="#" class="btn btn-success ssquiz_cancel_history">Cancel</a>
						<span style="margin: 15px;">Are you sure you want to clear history of using SSQuiz?</span>
					</div>
				</div>
			</div>
			
			<div id="ssquiz_history_container">
				<?php 
    ssquiz_print_history(-1, 'clear');
    ?>
			</div>
		</div> <!-- #wrap -->
	</div>
	
	<?php 
    if (function_exists('print_user_info')) {
        print_user_info();
    }
    ssquiz_print_footer();
}
Exemple #2
0
function draw_settings_page()
{
    $settings = get_option('ssquiz_settings');
    ?>
	<div class="ono_wrap">
		<div id="wrap" class="ssquiz_settings">

			<h2 class="heading"><?php 
    echo __("SSQuiz Settings", 'ssquiz');
    ?>
</h2>
	
			<div class="bs-docs-sidebar">
				<ul class="nav nav-list bs-docs-sidenav affix">
					<!--<li><a href="#general_settings">General Settings</a></li>-->
					<li><a href="#start_screen"><?php 
    echo __("Start Screen", 'ssquiz');
    ?>
</a></li>
					<li><a href="#finish_screen"><?php 
    echo __("Finish Screen", 'ssquiz');
    ?>
</a></li>
					<li><a href="#email_template"><?php 
    echo __("Email Template", 'ssquiz');
    ?>
</a></li>
					<li><a href="#teachers_template"><?php 
    echo __("Teacher's Template", 'ssquiz');
    ?>
</a></li>
				</ul>
			</div>
			
			<!--
			<section>
			<span id="general_settings"></span>
			<form>
				<fieldset>
					<legend><i class="icon-align-justify"></i> <?php 
    //echo __("General Settings", 'ssquiz');
    ?>
</legend>
				</fieldset>
			</form>
			</section>
			-->
			
			<section>
			<span id="start_screen"></span>
			<form>
				<fieldset>
				<legend><i class="icon-align-justify"></i> <?php 
    echo __("Start Screen", 'ssquiz');
    ?>
					<small><?php 
    echo __("Folowing content will appear when quiz is loaded on page", 'ssquiz');
    ?>
</small>
				</legend>
				<?php 
    wp_editor($settings->start_template, "start_template");
    ?>
				<dl class="dl-horizontal">
					<dt>%%TITLE%%</dt><dd><?php 
    echo __("Title of the quiz", 'ssquiz');
    ?>
</dd>
					<dt>%%DESCRIPTION%%</dt><dd><?php 
    echo __("Description of the quiz", 'ssquiz');
    ?>
</dd>
					<dt>%%QUESTIONS%%</dt><dd><?php 
    echo __("Total number of questions", 'ssquiz');
    ?>
</dd>
				</dl>
				<button type="submit" class="btn btn-primary" id="btn_start" onclick="jQuery.fn.crud_template('btn_start'); return false;">Save</button>
				</fieldset>
			</form>
			</section>
			
			<section>
			<span id="finish_screen"></span>
			<form>
				<fieldset>
				<legend><i class="icon-align-justify"></i> <?php 
    echo __("Finish Screen", 'ssquiz');
    ?>
					<small><?php 
    echo __("Folowing content will appear when quiz is competed or exited", 'ssquiz');
    ?>
</small>
				</legend>
				<?php 
    wp_editor($settings->finish_template, "finish_template");
    ?>
				<dl class="dl-horizontal">
					<dt>%%NAME%%</dt><dd><?php 
    echo __("User's name", 'ssquiz');
    ?>
</dd>
					<dt>%%NUMBER%%</dt><dd><?php 
    echo __("Quiz's ID", 'ssquiz');
    ?>
</dd>
					<dt>%%TITLE%%</dt><dd><?php 
    echo __("Title of the quiz", 'ssquiz');
    ?>
</dd>
					<dt>%%DESCRIPTION%%</dt><dd><?php 
    echo __("Description of the quiz", 'ssquiz');
    ?>
</dd>
					<dt>%%TOTAL%%</dt><dd><?php 
    echo __("Number of answered questions", 'ssquiz');
    ?>
</dd>
					<dt>%%CORRECT%%</dt><dd><?php 
    echo __("Number of correct answers", 'ssquiz');
    ?>
</dd>
					<dt>%%PERCENT%%</dt><dd><?php 
    echo __("Percent of correct answered over total questions", 'ssquiz');
    ?>
</dd>
				</dl>
				<button type="submit" class="btn btn-primary" id="btn_finish" onclick="jQuery.fn.crud_template('btn_finish'); return false;">Save</button>
				</fieldset>
			</form>
			</section>
			
			<section>
			<span id="email_template"></span>
			<form>
				<fieldset>
				<legend><i class="icon-align-justify"></i> <?php 
    echo __("Email Template to user", 'ssquiz');
    ?>
					<small><?php 
    echo __("Folowing content can be sent as a message to user", 'ssquiz');
    ?>
</small>
				</legend>
				<label><?php 
    echo __("Subject", 'ssquiz');
    ?>
</label>
				<input type="text" style="width:500px;" id="user_email_subject" value="<?php 
    echo esc_attr($settings->user_email_subject);
    ?>
">
				<dl class="dl-horizontal">
					<dt>%%NAME%%</dt><dd><?php 
    echo __("User's name", 'ssquiz');
    ?>
</dd>
					<dt>%%TITLE%%</dt><dd><?php 
    echo __("Title of the quiz", 'ssquiz');
    ?>
</dd>
				</dl>
				<?php 
    wp_editor($settings->user_email_template, "user_email_template");
    ?>
				<dl class="dl-horizontal">
					<dt>%%NAME%%</dt><dd><?php 
    echo __("User's name", 'ssquiz');
    ?>
</dd>
					<dt>%%NUMBER%%</dt><dd><?php 
    echo __("Quiz's ID", 'ssquiz');
    ?>
</dd>
					<dt>%%TITLE%%</dt><dd><?php 
    echo __("Title of the quiz", 'ssquiz');
    ?>
</dd>
					<dt>%%DESCRIPTION%%</dt><dd><?php 
    echo __("Description of the quiz", 'ssquiz');
    ?>
</dd>
					<dt>%%TOTAL%%</dt><dd><?php 
    echo __("Number of answered questions", 'ssquiz');
    ?>
</dd>
					<dt>%%CORRECT%%</dt><dd><?php 
    echo __("Number of correct answers", 'ssquiz');
    ?>
</dd>
					<dt>%%PERCENT%%</dt><dd><?php 
    echo __("Percent of correct answered over total questions", 'ssquiz');
    ?>
</dd>
					<!--<dt>%%FILE%%</dt><dd><?php 
    //echo __("Url to the report file", 'ssquiz')
    ?>
</dd>-->
				</dl>
				<label class="checkbox">
					<input type="checkbox" id="user_will_receive" <?php 
    if (true == $settings->user_will_receive) {
        echo 'checked="checked"';
    }
    ?>
 > User will receive email
				</label>
				<button type="submit" class="btn btn-primary" id="btn_user_email" onclick="jQuery.fn.crud_template('btn_user_email'); return false;">Save</button>
				</fieldset>
			</form>
			</section>
			
			<section>
			<span id="teachers_template"></span>
			<form>
				<fieldset>
				<legend><i class="icon-align-justify"></i> <?php 
    echo __("Teacher's Template", 'ssquiz');
    ?>
					<small><?php 
    echo __("Folowing content can be sent as a message to third person (teacher)", 'ssquiz');
    ?>
</small>
				</legend>
				<label><?php 
    echo __("Email address", 'ssquiz');
    ?>
</label>
				<input type="text" id="teacher_email_address" value="<?php 
    echo esc_attr($settings->teacher_email_address);
    ?>
">
				<label><?php 
    echo __("Subject", 'ssquiz');
    ?>
</label>
				<input type="text" style="width:500px;" id="teacher_email_subject" value="<?php 
    echo esc_attr($settings->teacher_email_subject);
    ?>
">
				<dl class="dl-horizontal">
					<dt>%%NAME%%</dt><dd><?php 
    echo __("User's name", 'ssquiz');
    ?>
</dd>
					<dt>%%TITLE%%</dt><dd><?php 
    echo __("Title of the quiz", 'ssquiz');
    ?>
</dd>
				</dl>
				<?php 
    wp_editor($settings->teacher_email_template, "teacher_email_template");
    ?>
				<dl class="dl-horizontal">
					<dt>%%NAME%%</dt><dd><?php 
    echo __("User's name", 'ssquiz');
    ?>
</dd>
					<dt>%%EMAIL%%</dt><dd><?php 
    echo __("User's email", 'ssquiz');
    ?>
</dd>
					<dt>%%NUMBER%%</dt><dd><?php 
    echo __("Quiz's ID", 'ssquiz');
    ?>
</dd>
					<dt>%%TITLE%%</dt><dd><?php 
    echo __("Title of the quiz", 'ssquiz');
    ?>
</dd>
					<dt>%%DESCRIPTION%%</dt><dd><?php 
    echo __("Description of the quiz", 'ssquiz');
    ?>
</dd>
					<dt>%%TOTAL%%</dt><dd><?php 
    echo __("Number of answered questions", 'ssquiz');
    ?>
</dd>
					<dt>%%CORRECT%%</dt><dd><?php 
    echo __("Number of correct answers", 'ssquiz');
    ?>
</dd>
					<dt>%%PERCENT%%</dt><dd><?php 
    echo __("Percent of correct answered over total questions", 'ssquiz');
    ?>
</dd>
					<!--<dt>%%FILE%%</dt><dd><?php 
    //echo __("Url to the report file", 'ssquiz')
    ?>
</dd>-->
				</dl>
				<label class="checkbox">
					<input type="checkbox" id="teacher_will_receive" <?php 
    if (true == $settings->teacher_will_receive) {
        echo 'checked="checked"';
    }
    ?>
 > Teacher will receive email
				</label>
				<button type="submit" class="btn btn-primary" id="btn_teacher_email" onclick="jQuery.fn.crud_template('btn_teacher_email'); return false;">Save</button>
				</fieldset>
			</form>
			</section>
			
			<?php 
    /*
    <form>
    	<fieldset>
    	<legend><i class="icon-align-justify"></i> <?php echo __("Report's Template", 'ssquiz')?></legend>
    	<?php wp_editor($settings->pdf_template, "pdf_template", array('textarea_rows' => '10')); ?>
    	<dl class="dl-horizontal" id="pdf_template">
    		<dt>%%NAME%%</dt><dd><?php echo __("User's name", 'ssquiz')?></dd>
    		<dt>%%TITLE%%</dt><dd><?php echo __("Title of the quiz", 'ssquiz')?></dd>
    		<dt>%%DESCRIPTION%%</dt><dd><?php echo __("Description of the quiz", 'ssquiz')?></dd>
    		<dt>%%TOTAL%%</dt><dd><?php echo __("Number of answered questions", 'ssquiz')?></dd>
    		<dt>%%CORRECT%%</dt><dd><?php echo __("Number of correct answers", 'ssquiz')?></dd>
    		<dt>%%PERCENT%%</dt><dd><?php echo __("Percent of correct answered over total questions", 'ssquiz')?></dd>
    		<dt>%%DATE%%</dt><dd><?php echo __("Percent of correct answered over total questions", 'ssquiz')?></dd>
    	</dl>
    	<button type="submit" class="btn btn-primary" onclick="jQuery.fn.crud_template('btn_report'); return false;">Save</button>
    	</fieldset>
    </form>
    */
    ?>
		</div>
	</div>
	
	<?php 
    ssquiz_print_footer();
}
Exemple #3
0
function draw_docs_page()
{
    ?>
	<div class="ono_wrap">
		<div id="wrap" class="ssquiz_settings">

			<h2 class="heading"><?php 
    echo __("SSQuiz Documentation", 'ssquiz');
    ?>
</h2>
	
			<div class="bs-docs-sidebar">
				<ul class="nav nav-list bs-docs-sidenav affix">
					<li><a href="#general_usage">General Usage</a></li>
					<li><a href="#for_developers">For Developers</a></li>
				</ul>
			</div>

			<section>
			<span id="general_usage"></span>
			<form>
				<fieldset>
					<legend><i class="icon-align-justify"></i> <?php 
    echo __("General Usage", 'ssquiz');
    ?>
</legend>
					<p style="text-indent:40px;">SSQuiz 2.0 is rethought and rewritten compared to previous versions. 
						If you were using previous version, then your SSQuiz data will be converted to a new format on activation. If you're uninstalling plugin, quizzes will stay on database. To delete them, Delete tables with names like <em>'ssquiz'</em> in Wordpress database.</p>
					<p>When answering to questions, user must be connected to internet, as every answer is sent to server and checked there, making cheating harder.</p>
					<p>Quiz accepts empty answers from users.</p>
					<p>API and email sending trigger only if user went through all questions, however quiz saves every attempt to the statistics page.</p>
					<h4>Shortcodes</h4>
					<div>
						<p>You can use following arguments:</p>
						<dl class="dl-horizontal">
							<dt>all</dt><dd>to show all questions on once</dd>
							<dt>not_correct</dt><dd>not showing correct answers after quiz is finished</dd>
							<dt>show_correct</dt><dd>to show weather user ansered correctly after each answer</dd>
							<dt>qrandom</dt><dd>to randomize order of questions</dd>
							<dt>arandom</dt><dd>to randomize order of  answers</dd>
							<dt>name</dt><dd>to request user name at quiz start. For logged in users this field will be pre-filled.</dd>
							<dt>email</dt><dd>to request user email at quiz start and to send him email when quiz is done. For logged in users this field will be pre-filled.</dd>
							<dt>timer</dt><dd>set timer in seconds. For example: timer=12</dd>
							<dt>one_chance</dt><dd>for registered users sets only one attempt to pass test
								To start again you should delete their attempt from quiz's history</dd>
							<dt>total</dt><dd>number of questions to display. It is useful with <em>'qrandom'</em> to change questions each time.</dd>
						</dl>
						<p>For example: <em>[ssquiz id=1 qrandom timer=20]</em> means insert on page quiz with id = 1, with shuffled questions. In 20 seconds after user clicks 'Start' exit will be triggered.</p>
					</div>
					<h4>Admin Interface</h4>
					<div>
						<p>Quiz uses ajax requests for all operations on admin side. So the pages will not reload on each update, making working with quiz more convenient. Max number of questions on page is <em>20</em>.</p>
						<p>On 'Manage quizzes' page selected quiz and page is saved, so when you leaved and then went back it would show the questions you recently had been working with.
						<p><strong>For questions type 'choise': </strong>if you write many answers, but only one of those is correct, then 
							it will be "multiple choice" test, and user will be able to choose only one answer.</p>
						<p>If you checks more than one correct answer to question, then it would be possible, to choose several answers at once.</p>
						<p>While working with quizzes you can:</p>
						<ul style="list-style:square;">
							<li>Leave answers blank to delete them</li>
							<li>Drag question within quiz to change order of questions</li>
							<li>Delete quizzes or questions while <em>editing</em> them. There will be button 'delete' on the buttom.</li>
						</ul>
					</div>
				</fieldset>
			</form>
			</section>
			
			<section>
			<span id="for_developers"></span>
			<form>
				<fieldset>
					<legend><i class="icon-align-justify"></i> <?php 
    echo __("For Developers", 'ssquiz');
    ?>
</legend>
					<h4>API</h4>
					<div>
						<p>You can add following piece of code into your plugin:</p>
						<p style="text-indent:40px;">hook is triggered when SSQuiz is finished by the user</p>
						<pre>
add_action('ssquiz_finished', 'after_quiz_done', 10, 4);

function after_quiz_done( $quiz_id, $user_id, $questions_right, $total_questions )
{
	// do stuff here
}
						</pre>
					</div>
					<h4>Enhancements</h4>
					<div>
						<p>CSS styles that are applied to client side of quiz are written in <em>ssquiz-style.css</em>. 
							You can make some changes to.</p>
					</div>
				</fieldset>
			</form>
			</section>
		</div> <!-- #wrap -->
	</div>
	
	<?php 
    ssquiz_print_footer();
}
Exemple #4
0
function draw_main_page()
{
    ?>
	<div class="ono_wrap ssquiz_manager">
		<div id="wrap">
			<h2 class="heading"><?php 
    echo __("Manage Quizzes", 'ssquiz');
    ?>
</h2>

			<div class="cf" style="margin: 30px 0 0 10px">
				<div id="display_questions" style="float:left; width:30%;">
					<label style="display:inline-block;left: -10px; position: relative;"><?php 
    echo __("Filter quizzes: ", 'ssquiz');
    ?>
</label>
					<select style="display:inline-block" id="select_quiz">
						<?php 
    ssquiz_list_quizzes(true);
    ?>
					</select>
				</div>

				<div style="float:right; margin-right: 30px;">
					<a class="btn btn-primary" href="#" onclick="jQuery.fn.crud_quiz( 'quiz', 'add', 0 );return false;"
						data-toggle="modal" data-target="#ssquiz_quiz_modal">
						<i class="icon-plus-sign"></i> <?php 
    echo __("Add Quiz", 'ssquiz');
    ?>
					</a>
				</div>
			</div>
			

			<div id="ssquiz_questions_container">
				<?php 
    ssquiz_print_questions(-1, -1);
    ?>
			</div>
			
		</div>
	</div>
	<?php 
    ssquiz_print_footer();
    ?>
	
	<div class="ono_wrap">
		<div id="ssquiz_quiz_modal" class="modal hide fade">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				<h3 class="modal_title">Edit Quiz</h3>
			</div>
			<div class="modal-body">
			<?php 
    ssquiz_quiz_template();
    ?>
			</div>
			<div class="modal-footer">
				<div class="confirm_delete">
					<span>It will delete all questions belonging to this quiz. Continue?</span>
					<a href="#" class="btn btn-danger ssquiz_delete" data-dismiss="modal" aria-hidden="true">Confirm</a>
					<a href="#" class="btn btn-success ssquiz_cancel">Cancel</a>
				</div>
				<a href="#" class="btn btn-danger ssquiz_ask_delete">Delete</a>
				<span style="width: 80%;display: inline-block;">&nbsp;</span>
				<a href="#" class="btn btn-primary ssquiz_save" data-dismiss="modal" aria-hidden="true">Save</a>
			</div>
		</div>
		
		<div id="ssquiz_question_modal" class="modal hide fade">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				<h3 class="modal_title">Edit Question</h3>
			</div>
			<div class="modal-body">
			<?php 
    ssquiz_question_template();
    ?>
			</div>
			<div class="modal-footer">
				<a href="#" class="btn btn-danger ssquiz_delete" data-dismiss="modal" aria-hidden="true">Delete</a>
				<span style="width: 80%;display: inline-block;">&nbsp;</span>
				<a href="#" class="btn btn-primary ssquiz_save" data-dismiss="modal" aria-hidden="true">Save</a>
			</div>
		</div>
	</div>
<?php 
}