public function save(WpProQuiz_Model_Quiz $data)
 {
     if ($data->isResultGradeEnabled()) {
         $resultText = serialize($data->getResultText());
     } else {
         $resultText = $data->getResultText();
     }
     $set = array('name' => $data->getName(), 'text' => $data->getText(), 'result_text' => $resultText, 'title_hidden' => (int) $data->isTitleHidden(), 'btn_restart_quiz_hidden' => (int) $data->isBtnRestartQuizHidden(), 'btn_view_question_hidden' => (int) $data->isBtnViewQuestionHidden(), 'question_random' => (int) $data->isQuestionRandom(), 'answer_random' => (int) $data->isAnswerRandom(), 'time_limit' => (int) $data->getTimeLimit(), 'statistics_on' => (int) $data->isStatisticsOn(), 'statistics_ip_lock' => (int) $data->getStatisticsIpLock(), 'result_grade_enabled' => (int) $data->isResultGradeEnabled(), 'show_points' => (int) $data->isShowPoints(), 'quiz_run_once' => (int) $data->isQuizRunOnce(), 'quiz_run_once_type' => $data->getQuizRunOnceType(), 'quiz_run_once_cookie' => (int) $data->isQuizRunOnceCookie(), 'quiz_run_once_time' => (int) $data->getQuizRunOnceTime(), 'numbered_answer' => (int) $data->isNumberedAnswer(), 'hide_answer_message_box' => (int) $data->isHideAnswerMessageBox(), 'disabled_answer_mark' => (int) $data->isDisabledAnswerMark(), 'show_max_question' => (int) $data->isShowMaxQuestion(), 'show_max_question_value' => (int) $data->getShowMaxQuestionValue(), 'show_max_question_percent' => (int) $data->isShowMaxQuestionPercent(), 'toplist_activated' => (int) $data->isToplistActivated(), 'toplist_data' => $data->getToplistData(), 'show_average_result' => (int) $data->isShowAverageResult(), 'prerequisite' => (int) $data->isPrerequisite(), 'quiz_modus' => (int) $data->getQuizModus(), 'show_review_question' => (int) $data->isShowReviewQuestion(), 'quiz_summary_hide' => (int) $data->isQuizSummaryHide(), 'skip_question_disabled' => (int) $data->isSkipQuestionDisabled(), 'email_notification' => $data->getEmailNotification(), 'user_email_notification' => (int) $data->isUserEmailNotification(), 'show_category_score' => (int) $data->isShowCategoryScore(), 'hide_result_correct_question' => (int) $data->isHideResultCorrectQuestion(), 'hide_result_quiz_time' => (int) $data->isHideResultQuizTime(), 'hide_result_points' => (int) $data->isHideResultPoints(), 'autostart' => (int) $data->isAutostart(), 'forcing_question_solve' => (int) $data->isForcingQuestionSolve(), 'hide_question_position_overview' => (int) $data->isHideQuestionPositionOverview(), 'hide_question_numbering' => (int) $data->isHideQuestionNumbering(), 'form_activated' => (int) $data->isFormActivated(), 'form_show_position' => $data->getFormShowPosition(), 'start_only_registered_user' => (int) $data->isStartOnlyRegisteredUser(), 'questions_per_page' => $data->getQuestionsPerPage(), 'sort_categories' => (int) $data->isSortCategories(), 'show_category' => (int) $data->isShowCategory(), 'category_id' => (int) $data->getCategoryId(), 'admin_email' => $data->getAdminEmail(true), 'user_email' => $data->getUserEmail(true), 'plugin_container' => $data->getPluginContainer(true));
     if ($data->getId() != 0) {
         $result = $this->_wpdb->update($this->_table, $set, array('id' => $data->getId()), array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s'), array('%d'));
     } else {
         $result = $this->_wpdb->insert($this->_table, $set, array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s'));
         $data->setId($this->_wpdb->insert_id);
     }
     if ($result === false) {
         return null;
     }
     /**
      * Fired when a new WP Pro Quiz is created.
      *
      * @since 0.38.0
      *
      * @param WpProQuiz_Model_Quiz Object $data The newly created WpProQuiz_Model_Quiz object
      */
     do_action('wp_pro_quiz_save_quiz', $data);
     return $data;
 }
 /**
  * @param DOMDocument $dom
  * @param WpProQuiz_Model_Quiz $quiz
  * @param $forms
  * @return DOMElement
  */
 private function getQuizElement($dom, $quiz, $forms)
 {
     $quizElement = $dom->createElement('quiz');
     $title = $dom->createElement('title');
     $title->appendChild($dom->createCDATASection($quiz->getName()));
     $title->setAttribute('titleHidden', $this->booleanToTrueOrFalse($quiz->isTitleHidden()));
     $quizElement->appendChild($title);
     $quizElement->appendChild($text = $dom->createElement('text'));
     $text->appendChild($dom->createCDATASection($quiz->getText()));
     $quizElement->appendChild($dom->createElement('category', $quiz->getCategoryName()));
     if (is_array($quiz->getResultText())) {
         $resultArray = $quiz->getResultText();
         $result = $dom->createElement('resultText');
         $result->setAttribute('gradeEnabled', $this->booleanToTrueOrFalse($quiz->isResultGradeEnabled()));
         for ($i = 0; $i < count($resultArray); $i++) {
             $r = $dom->createElement('text');
             $r->appendChild($dom->createCDATASection($resultArray['text'][$i]));
             $r->setAttribute('prozent', $resultArray['prozent'][$i]);
             $result->appendChild($r);
         }
         $quizElement->appendChild($result);
     } else {
         $result = $dom->createElement('resultText');
         $result->setAttribute('gradeEnabled', $this->booleanToTrueOrFalse($quiz->isResultGradeEnabled()));
         $result->appendChild($dom->createCDATASection($quiz->getResultText()));
         $quizElement->appendChild($result);
     }
     $quizElement->appendChild($dom->createElement('btnRestartQuizHidden', $this->booleanToTrueOrFalse($quiz->isBtnRestartQuizHidden())));
     $quizElement->appendChild($dom->createElement('btnViewQuestionHidden', $this->booleanToTrueOrFalse($quiz->isBtnViewQuestionHidden())));
     $quizElement->appendChild($dom->createElement('questionRandom', $this->booleanToTrueOrFalse($quiz->isQuestionRandom())));
     $quizElement->appendChild($dom->createElement('answerRandom', $this->booleanToTrueOrFalse($quiz->isAnswerRandom())));
     $quizElement->appendChild($dom->createElement('timeLimit', $quiz->getTimeLimit()));
     $quizElement->appendChild($dom->createElement('showPoints', $this->booleanToTrueOrFalse($quiz->isShowPoints())));
     $statistic = $dom->createElement('statistic');
     $statistic->setAttribute('activated', $this->booleanToTrueOrFalse($quiz->isStatisticsOn()));
     $statistic->setAttribute('ipLock', $quiz->getStatisticsIpLock());
     $quizElement->appendChild($statistic);
     $quizElement->appendChild($quizRunOnce = $dom->createElement('quizRunOnce', $this->booleanToTrueOrFalse($quiz->isQuizRunOnce())));
     $quizRunOnce->setAttribute('type', $quiz->getQuizRunOnceType());
     $quizRunOnce->setAttribute('cookie', $this->booleanToTrueOrFalse($quiz->isQuizRunOnceCookie()));
     $quizRunOnce->setAttribute('time', $quiz->getQuizRunOnceTime());
     $quizElement->appendChild($dom->createElement('numberedAnswer', $this->booleanToTrueOrFalse($quiz->isNumberedAnswer())));
     $quizElement->appendChild($dom->createElement('hideAnswerMessageBox', $this->booleanToTrueOrFalse($quiz->isHideAnswerMessageBox())));
     $quizElement->appendChild($dom->createElement('disabledAnswerMark', $this->booleanToTrueOrFalse($quiz->isDisabledAnswerMark())));
     $quizElement->appendChild($showMaxQuestion = $dom->createElement('showMaxQuestion', $this->booleanToTrueOrFalse($quiz->isShowMaxQuestion())));
     $showMaxQuestion->setAttribute('showMaxQuestionValue', $quiz->getShowMaxQuestionValue());
     $showMaxQuestion->setAttribute('showMaxQuestionPercent', $this->booleanToTrueOrFalse($quiz->isShowMaxQuestionPercent()));
     //Toplist
     $toplist = $dom->createElement('toplist');
     $toplist->setAttribute('activated', $this->booleanToTrueOrFalse($quiz->isToplistActivated()));
     $toplist->appendChild($dom->createElement('toplistDataAddPermissions', $quiz->getToplistDataAddPermissions()));
     $toplist->appendChild($dom->createElement('toplistDataSort', $quiz->getToplistDataSort()));
     $toplist->appendChild($dom->createElement('toplistDataAddMultiple', $this->booleanToTrueOrFalse($quiz->isToplistDataAddMultiple())));
     $toplist->appendChild($dom->createElement('toplistDataAddBlock', $quiz->getToplistDataAddBlock()));
     $toplist->appendChild($dom->createElement('toplistDataShowLimit', $quiz->getToplistDataShowLimit()));
     $toplist->appendChild($dom->createElement('toplistDataShowIn', $quiz->getToplistDataShowIn()));
     $toplist->appendChild($dom->createElement('toplistDataCaptcha', $this->booleanToTrueOrFalse($quiz->isToplistDataCaptcha())));
     $toplist->appendChild($dom->createElement('toplistDataAddAutomatic', $this->booleanToTrueOrFalse($quiz->isToplistDataAddAutomatic())));
     $quizElement->appendChild($toplist);
     $quizElement->appendChild($dom->createElement('showAverageResult', $this->booleanToTrueOrFalse($quiz->isShowAverageResult())));
     $quizElement->appendChild($dom->createElement('prerequisite', $this->booleanToTrueOrFalse($quiz->isPrerequisite())));
     $quizElement->appendChild($dom->createElement('showReviewQuestion', $this->booleanToTrueOrFalse($quiz->isShowReviewQuestion())));
     $quizElement->appendChild($dom->createElement('quizSummaryHide', $this->booleanToTrueOrFalse($quiz->isQuizSummaryHide())));
     $quizElement->appendChild($dom->createElement('skipQuestionDisabled', $this->booleanToTrueOrFalse($quiz->isSkipQuestionDisabled())));
     $quizElement->appendChild($dom->createElement('emailNotification', $quiz->getEmailNotification()));
     $quizElement->appendChild($dom->createElement('userEmailNotification', $this->booleanToTrueOrFalse($quiz->isUserEmailNotification())));
     $quizElement->appendChild($dom->createElement('showCategoryScore', $this->booleanToTrueOrFalse($quiz->isShowCategoryScore())));
     $quizElement->appendChild($dom->createElement('hideResultCorrectQuestion', $this->booleanToTrueOrFalse($quiz->isHideResultCorrectQuestion())));
     $quizElement->appendChild($dom->createElement('hideResultQuizTime', $this->booleanToTrueOrFalse($quiz->isHideResultQuizTime())));
     $quizElement->appendChild($dom->createElement('hideResultPoints', $this->booleanToTrueOrFalse($quiz->isHideResultPoints())));
     $quizElement->appendChild($dom->createElement('autostart', $this->booleanToTrueOrFalse($quiz->isAutostart())));
     $quizElement->appendChild($dom->createElement('forcingQuestionSolve', $this->booleanToTrueOrFalse($quiz->isForcingQuestionSolve())));
     $quizElement->appendChild($dom->createElement('hideQuestionPositionOverview', $this->booleanToTrueOrFalse($quiz->isHideQuestionPositionOverview())));
     $quizElement->appendChild($dom->createElement('hideQuestionNumbering', $this->booleanToTrueOrFalse($quiz->isHideQuestionNumbering())));
     //0.27
     $quizElement->appendChild($dom->createElement('sortCategories', $this->booleanToTrueOrFalse($quiz->isSortCategories())));
     $quizElement->appendChild($dom->createElement('showCategory', $this->booleanToTrueOrFalse($quiz->isShowCategory())));
     $quizModus = $dom->createElement('quizModus', $quiz->getQuizModus());
     $quizModus->setAttribute('questionsPerPage', $quiz->getQuestionsPerPage());
     $quizElement->appendChild($quizModus);
     $quizElement->appendChild($dom->createElement('startOnlyRegisteredUser', $this->booleanToTrueOrFalse($quiz->isStartOnlyRegisteredUser())));
     $formsElement = $dom->createElement('forms');
     $formsElement->setAttribute('activated', $this->booleanToTrueOrFalse($quiz->isFormActivated()));
     $formsElement->setAttribute('position', $quiz->getFormShowPosition());
     //0.29
     if ($quiz->getAdminEmail() !== null) {
         /* @var $adminEmail WpProQuiz_Model_Email */
         $adminEmail = $quiz->getAdminEmail();
         $adminEmailXml = $dom->createElement('adminEmail');
         /*
         * $qElement->appendChild($title = $dom->createElement('title'));
                 $title->appendChild($dom->createCDATASection($question->getTitle()));
         */
         $adminEmailXml->appendChild($dom->createElement('to', $adminEmail->getTo()));
         $adminEmailXml->appendChild($dom->createElement('form', $adminEmail->getFrom()));
         $adminEmailXml->appendChild($dom->createElement('subject', $adminEmail->getSubject()));
         $adminEmailXml->appendChild($dom->createElement('html', $this->booleanToTrueOrFalse($adminEmail->isHtml())));
         $adminEmailXml->appendChild($message = $dom->createElement('message'));
         $message->appendChild($dom->createCDATASection($adminEmail->getMessage()));
         $quizElement->appendChild($adminEmailXml);
     }
     if ($quiz->getUserEmail() !== null) {
         /* @var $adminEmail WpProQuiz_Model_Email */
         $userEmail = $quiz->getUserEmail();
         $userEmaillXml = $dom->createElement('userEmail');
         $userEmaillXml->appendChild($dom->createElement('to', $userEmail->getTo()));
         $userEmaillXml->appendChild($dom->createElement('toUser', $this->booleanToTrueOrFalse($userEmail->isToUser())));
         $userEmaillXml->appendChild($dom->createElement('toForm', $this->booleanToTrueOrFalse($userEmail->isToForm())));
         $userEmaillXml->appendChild($dom->createElement('form', $userEmail->getFrom()));
         $userEmaillXml->appendChild($dom->createElement('subject', $userEmail->getSubject()));
         $userEmaillXml->appendChild($dom->createElement('html', $this->booleanToTrueOrFalse($userEmail->isHtml())));
         $userEmaillXml->appendChild($message = $dom->createElement('message'));
         $message->appendChild($dom->createCDATASection($userEmail->getMessage()));
         $quizElement->appendChild($userEmaillXml);
     }
     foreach ($forms as $form) {
         /** @var WpProQuiz_Model_Form $form * */
         $formElement = $dom->createElement('form');
         $formElement->setAttribute('type', $form->getType());
         $formElement->setAttribute('required', $this->booleanToTrueOrFalse($form->isRequired()));
         $formElement->setAttribute('fieldname', $form->getFieldname());
         if ($form->getData() !== null) {
             $data = $form->getData();
             foreach ($data as $d) {
                 $formDataElement = $dom->createElement('formData', $d);
                 $formElement->appendChild($formDataElement);
             }
         }
         $formsElement->appendChild($formElement);
     }
     $quizElement->appendChild($formsElement);
     return $quizElement;
 }
    public function showMaxQuestion()
    {
        $this->loadButtonNames();
        $question_count = count($this->question);
        $result = $this->quiz->getResultText();
        if (!$this->quiz->isResultGradeEnabled()) {
            $result = array('text' => array($result), 'prozent' => array(0));
        }
        $resultsProzent = json_encode($result['prozent']);
        ?>
		<div class="wpProQuiz_content" id="wpProQuiz_<?php 
        echo $this->quiz->getId();
        ?>
">
		<?php 
        if (!$this->quiz->isTitleHidden()) {
            echo '<h2>', $this->quiz->getName(), '</h2>';
        }
        $this->showTimeLimitBox();
        $this->showCheckPageBox($question_count);
        $this->showInfoPageBox();
        $this->showStartQuizBox();
        $this->showLockBox();
        $this->showLoadQuizBox();
        $this->showStartOnlyRegisteredUserBox();
        $this->showPrerequisiteBox();
        $this->showResultBox($result, $question_count);
        if ($this->quiz->getToplistDataShowIn() == WpProQuiz_Model_Quiz::QUIZ_TOPLIST_SHOW_IN_BUTTON) {
            $this->showToplistInButtonBox();
        }
        $this->showReviewBox($question_count);
        $this->showQuizAnker();
        ?>
		</div>
		<?php 
        $bo = $this->createOption(false);
        ?>
		<script type="text/javascript">
		jQuery(document).ready(function($) {
			$('#wpProQuiz_<?php 
        echo $this->quiz->getId();
        ?>
').wpProQuizFront({
				quizId: <?php 
        echo (int) $this->quiz->getId();
        ?>
,
				mode: <?php 
        echo (int) $this->quiz->getQuizModus();
        ?>
,
				timelimit: <?php 
        echo (int) $this->quiz->getTimeLimit();
        ?>
,
				resultsGrade: <?php 
        echo $resultsProzent;
        ?>
,
				bo: <?php 
        echo $bo;
        ?>
,
				qpp: <?php 
        echo $this->quiz->getQuestionsPerPage();
        ?>
,
				formPos: <?php 
        echo (int) $this->quiz->getFormShowPosition();
        ?>
,
				lbn: <?php 
        echo json_encode($this->quiz->isShowReviewQuestion() && !$this->quiz->isQuizSummaryHide() ? $this->_buttonNames['quiz_summary'] : $this->_buttonNames['finish_quiz']);
        ?>
			});
		});
		</script>	
		<?php 
    }
    public function show()
    {
        ?>
<style>
.wpProQuiz_quizModus th, .wpProQuiz_quizModus td {
	border-right: 1px solid #A0A0A0;
	padding: 5px;
}
.wpProQuiz_demoBox {
	position:  relative;
}
</style>
<div class="wrap wpProQuiz_quizEdit">
	<h2 style="margin-bottom: 10px;"><?php 
        echo $this->header;
        ?>
</h2>
	<form method="post" action="admin.php?page=wpProQuiz&action=addEdit&quizId=<?php 
        echo $this->quiz->getId();
        ?>
">
		<a style="float: left;" class="button-secondary" href="admin.php?page=wpProQuiz"><?php 
        _e('back to overview', 'wp-pro-quiz');
        ?>
</a>
		<div style="float: right;">
			<select name="templateLoadId">
				<?php 
        foreach ($this->templates as $template) {
            echo '<option value="', $template->getTemplateId(), '">', esc_html($template->getName()), '</option>';
        }
        ?>
			</select>
			<input type="submit" name="templateLoad" value="<?php 
        _e('load template', 'wp-pro-quiz');
        ?>
" class="button-primary">
		</div>
		<div style="clear: both;"></div>
		<div id="poststuff">
			<div class="postbox">
				<h3 class="hndle"><?php 
        _e('Quiz title', 'wp-pro-quiz');
        ?>
 <?php 
        _e('(required)', 'wp-pro-quiz');
        ?>
</h3>
				<div class="inside">
					<input name="name" id="wpProQuiz_title" type="text" class="regular-text" value="<?php 
        echo htmlspecialchars($this->quiz->getName(), ENT_QUOTES);
        ?>
">
				</div>
			</div>
			<div class="postbox">
				<h3 class="hndle"><?php 
        _e('Category', 'wp-pro-quiz');
        ?>
 <?php 
        _e('(optional)', 'wp-pro-quiz');
        ?>
</h3>
				<div class="inside">
					<p class="description">
						<?php 
        _e('You can assign classify category for a quiz.', 'wp-pro-quiz');
        ?>
					</p>
					<p class="description">
						<?php 
        _e('You can manage categories in global settings.', 'wp-pro-quiz');
        ?>
					</p>
					<div>
						<select name="category">
							<option value="-1">--- <?php 
        _e('Create new category', 'wp-pro-quiz');
        ?>
 ----</option>
							<option value="0" <?php 
        echo $this->quiz->getCategoryId() == 0 ? 'selected="selected"' : '';
        ?>
>--- <?php 
        _e('No category', 'wp-pro-quiz');
        ?>
 ---</option>
							<?php 
        foreach ($this->categories as $cat) {
            echo '<option ' . ($this->quiz->getCategoryId() == $cat->getCategoryId() ? 'selected="selected"' : '') . ' value="' . $cat->getCategoryId() . '">' . $cat->getCategoryName() . '</option>';
        }
        ?>
						</select>
					</div>
					<div style="display: none;" id="categoryAddBox">
						<h4><?php 
        _e('Create new category', 'wp-pro-quiz');
        ?>
</h4>
						<input type="text" name="categoryAdd" value=""> 
						<input type="button" class="button-secondary" name="" id="categoryAddBtn" value="<?php 
        _e('Create', 'wp-pro-quiz');
        ?>
"> 	
					</div>
					<div id="categoryMsgBox" style="display:none; padding: 5px; border: 1px solid rgb(160, 160, 160); background-color: rgb(255, 255, 168); font-weight: bold; margin: 5px; ">
						Kategorie gespeichert
					</div>
				</div>
			</div>

			<?php 
        do_action('wpProQuiz_action_plugin_quizEdit', $this);
        ?>

			<div class="postbox">
				<h3 class="hndle"><?php 
        _e('Options', 'wp-pro-quiz');
        ?>
</h3>
				<div class="inside">
					<table class="form-table">
						<tbody>
							<tr>
								<th scope="row">
									<?php 
        _e('Hide quiz title', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Hide title', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label for="title_hidden">
											<input type="checkbox" id="title_hidden" value="1" name="titleHidden" <?php 
        echo $this->quiz->isTitleHidden() ? 'checked="checked"' : '';
        ?>
 >
											<?php 
        _e('Activate', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('The title serves as quiz heading.', 'wp-pro-quiz');
        ?>
										</p>
									</fieldset>
								</td>
							</tr>
							<tr>
								<th scope="row">
									<?php 
        _e('Hide "Restart quiz" button', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Hide "Restart quiz" button', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label for="btn_restart_quiz_hidden">
											<input type="checkbox" id="btn_restart_quiz_hidden" value="1" name="btnRestartQuizHidden" <?php 
        echo $this->quiz->isBtnRestartQuizHidden() ? 'checked="checked"' : '';
        ?>
 >
											<?php 
        _e('Activate', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('Hide the "Restart quiz" button in the Frontend.', 'wp-pro-quiz');
        ?>
										</p>
									</fieldset>
								</td>
							</tr>
							<tr>
								<th scope="row">
									<?php 
        _e('Hide "View question" button', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Hide "View question" button', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label for="btn_view_question_hidden">
											<input type="checkbox" id="btn_view_question_hidden" value="1" name="btnViewQuestionHidden" <?php 
        echo $this->quiz->isBtnViewQuestionHidden() ? 'checked="checked"' : '';
        ?>
 >
											<?php 
        _e('Activate', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('Hide the "View question" button in the Frontend.', 'wp-pro-quiz');
        ?>
										</p>
									</fieldset>
								</td>
							</tr>
							<tr>
								<th scope="row">
									<?php 
        _e('Display question randomly', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Display question randomly', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label for="question_random">
											<input type="checkbox" id="question_random" value="1" name="questionRandom" <?php 
        echo $this->quiz->isQuestionRandom() ? 'checked="checked"' : '';
        ?>
 >
											<?php 
        _e('Activate', 'wp-pro-quiz');
        ?>
										</label>
									</fieldset>
								</td>
							</tr>
							<tr>
								<th scope="row">
									<?php 
        _e('Display answers randomly', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Display answers randomly', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label for="answer_random">
											<input type="checkbox" id="answer_random" value="1" name="answerRandom" <?php 
        echo $this->quiz->isAnswerRandom() ? 'checked="checked"' : '';
        ?>
 >
											<?php 
        _e('Activate', 'wp-pro-quiz');
        ?>
										</label>
									</fieldset>
								</td>
							</tr>
							<tr>
								<th scope="row">
									<?php 
        _e('Sort questions by category', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Sort questions by category', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label>
											<input type="checkbox" value="1" name="sortCategories" <?php 
        $this->checked($this->quiz->isSortCategories());
        ?>
 >
											<?php 
        _e('Activate', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('Also works in conjunction with the "display randomly question" option.', 'wp-pro-quiz');
        ?>
										</p>
									</fieldset>
								</td>
							</tr>
							<tr>
								<th scope="row">
									<?php 
        _e('Time limit', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Time limit', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label for="time_limit">
											<input type="number" min="0" class="small-text" id="time_limit" value="<?php 
        echo $this->quiz->getTimeLimit();
        ?>
" name="timeLimit"> <?php 
        _e('Seconds', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('0 = no limit', 'wp-pro-quiz');
        ?>
										</p>
									</fieldset>
								</td>
							</tr>
							<tr>
								<th scope="row">
									<?php 
        _e('Statistics', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Statistics', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label for="statistics_on">
											<input type="checkbox" id="statistics_on" value="1" name="statisticsOn" <?php 
        echo $this->quiz->isStatisticsOn() ? 'checked="checked"' : '';
        ?>
>
											<?php 
        _e('Activate', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('Statistics about right or wrong answers. Statistics will be saved by completed quiz, not after every question. The statistics is only visible over administration menu. (internal statistics)', 'wp-pro-quiz');
        ?>
										</p>
									</fieldset>
								</td>
							</tr>
							<tr id="statistics_ip_lock_tr" style="display: none;">
								<th scope="row">
									<?php 
        _e('Statistics IP-lock', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Statistics IP-lock', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label for="statistics_ip_lock">
											<input type="number" min="0" class="small-text" id="statistics_ip_lock" value="<?php 
        echo $this->quiz->getStatisticsIpLock() === null ? 1440 : $this->quiz->getStatisticsIpLock();
        ?>
" name="statisticsIpLock">
											<?php 
        _e('in minutes (recommended 1440 minutes = 1 day)', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('Protect the statistics from spam. Result will only be saved every X minutes from same IP. (0 = deactivated)', 'wp-pro-quiz');
        ?>
										</p>
									</fieldset>
								</td>
							</tr>
							<tr>
								<th scope="row">
									<?php 
        _e('Execute quiz only once', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
									
										<legend class="screen-reader-text">
											<span><?php 
        _e('Execute quiz only once', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										
										<label>
											<input type="checkbox" value="1" name="quizRunOnce" <?php 
        echo $this->quiz->isQuizRunOnce() ? 'checked="checked"' : '';
        ?>
>
											<?php 
        _e('Activate', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('If you activate this option, the user can complete the quiz only once. Afterwards the quiz is blocked for this user.', 'wp-pro-quiz');
        ?>
										</p>
										
										<div id="wpProQuiz_quiz_run_once_type" style="margin-bottom: 5px; display: none;">
											<?php 
        _e('This option applies to:', 'wp-pro-quiz');
        $quizRunOnceType = $this->quiz->getQuizRunOnceType();
        $quizRunOnceType = $quizRunOnceType == 0 ? 1 : $quizRunOnceType;
        ?>
		
											<label>
												<input name="quizRunOnceType" type="radio" value="1" <?php 
        echo $quizRunOnceType == 1 ? 'checked="checked"' : '';
        ?>
>
												<?php 
        _e('all users', 'wp-pro-quiz');
        ?>
											</label>
											<label>
												<input name="quizRunOnceType" type="radio" value="2" <?php 
        echo $quizRunOnceType == 2 ? 'checked="checked"' : '';
        ?>
>
												<?php 
        _e('registered useres only', 'wp-pro-quiz');
        ?>
											</label>
											<label>
												<input name="quizRunOnceType" type="radio" value="3" <?php 
        echo $quizRunOnceType == 3 ? 'checked="checked"' : '';
        ?>
>
												<?php 
        _e('anonymous users only', 'wp-pro-quiz');
        ?>
											</label>
											
											<div id="wpProQuiz_quiz_run_once_cookie" style="margin-top: 10px;">
												<label>
													<input type="checkbox" value="1" name="quizRunOnceCookie" <?php 
        echo $this->quiz->isQuizRunOnceCookie() ? 'checked="checked"' : '';
        ?>
>
													<?php 
        _e('user identification by cookie', 'wp-pro-quiz');
        ?>
												</label>
												<p class="description">
													<?php 
        _e('If you activate this option, a cookie is set additionally for unregistrated (anonymous) users. This ensures a longer assignment of the user than the simple assignment by the IP address.', 'wp-pro-quiz');
        ?>
												</p>
											</div>
											
											<div style="margin-top: 15px;">
												<input class="button-secondary" type="button" name="resetQuizLock" value="<?php 
        _e('Reset the user identification', 'wp-pro-quiz');
        ?>
">
												<span id="resetLockMsg" style="display:none; background-color: rgb(255, 255, 173); border: 1px solid rgb(143, 143, 143); padding: 4px; margin-left: 5px; "><?php 
        _e('User identification has been reset.');
        ?>
</span>
												<p class="description">
													<?php 
        _e('Resets user identification for all users.', 'wp-pro-quiz');
        ?>
												</p>
											</div>
										</div>
									</fieldset>
								</td>
							</tr>
							<tr>
								<th scope="row">
									<?php 
        _e('Show only specific number of questions', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Show only specific number of questions', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label>
											<input type="checkbox" value="1" name="showMaxQuestion" <?php 
        echo $this->quiz->isShowMaxQuestion() ? 'checked="checked"' : '';
        ?>
>
											<?php 
        _e('Activate', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('If you enable this option, maximum number of displayed questions will be X from X questions. (The output of questions is random)', 'wp-pro-quiz');
        ?>
										</p>
										<div id="wpProQuiz_showMaxBox" style="display: none;">
											<label>
												<?php 
        _e('How many questions should be displayed simultaneously:', 'wp-pro-quiz');
        ?>
 
												<input class="small-text" type="text" name="showMaxQuestionValue" value="<?php 
        echo $this->quiz->getShowMaxQuestionValue();
        ?>
">
											</label>
											<label>
												<input type="checkbox" value="1" name="showMaxQuestionPercent" <?php 
        echo $this->quiz->isShowMaxQuestionPercent() ? 'checked="checked"' : '';
        ?>
>
												<?php 
        _e('in percent', 'wp-pro-quiz');
        ?>
 
											</label>
										</div>
									</fieldset>
								</td>
							</tr>
						<tr>
								<th scope="row">
									<?php 
        _e('End quiz after first incorrect answer', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('End quiz after first incorrect answer', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label>
											<input type="checkbox" value="1" name="endOnFirstIncorrect" <?php 
        echo $this->quiz->isEndOnFirstIncorrect() ? 'checked="checked"' : '';
        ?>
>
											<?php 
        _e('Activate', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('If you enable this option, first incorrect answer will end the test', 'wp-pro-quiz');
        ?>
										</p>
									</fieldset>
								</td>
						</tr>
						<tr>
								<th scope="row">
									<?php 
        _e('Prerequisites', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Prerequisites', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label>
											<input type="checkbox" value="1" name="prerequisite" <?php 
        $this->checked($this->quiz->isPrerequisite());
        ?>
>
											<?php 
        _e('Activate', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('If you enable this option, you can choose quiz, which user have to finish before he can start this quiz.', 'wp-pro-quiz');
        ?>
										</p>
										<p class="description">
											<?php 
        _e('In all selected quizzes statistic function have to be active. If it is not it will be activated automatically.', 'wp-pro-quiz');
        ?>
										</p>
										<div id="prerequisiteBox" style="display: none;">
											<table>
												<tr>
													<th style="width: 120px; padding: 0;"><?php 
        _e('Quiz', 'wp-pro-quiz');
        ?>
</th>
													<th style="padding: 0; width: 50px;"></th>
													<th style="padding: 0; width: 400px;"><?php 
        _e('Prerequisites (This quiz have to be finished)', 'wp-pro-quiz');
        ?>
</th>
												</tr>
												<tr>
													<td style="padding: 0;">
														<select multiple="multiple" size="8" style="width: 200px;" name="quizList">
															<?php 
        foreach ($this->quizList as $list) {
            if (in_array($list['id'], $this->prerequisiteQuizList)) {
                continue;
            }
            echo '<option value="' . $list['id'] . '">' . $list['name'] . '</option>';
        }
        ?>
														</select>
													</td>
													<td style="padding: 0; text-align: center;">
														<div>
															<input type="button" id="btnPrerequisiteAdd" value="&gt;&gt;">
														</div>
														<div>
															<input type="button" id="btnPrerequisiteDelete" value="&lt;&lt;">
														</div>
													</td>
													<td style="padding: 0;">
														<select multiple="multiple" size="8" style="width: 200px" name="prerequisiteList[]">
															<?php 
        foreach ($this->quizList as $list) {
            if (!in_array($list['id'], $this->prerequisiteQuizList)) {
                continue;
            }
            echo '<option value="' . $list['id'] . '">' . $list['name'] . '</option>';
        }
        ?>
														</select>
													</td>
												</tr>
											</table>
										</div>
									</fieldset>
								</td>
							</tr>
							<tr>
								<th scope="row">
									<?php 
        _e('Question overview', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Question overview', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label>
											<input type="checkbox" value="1" name="showReviewQuestion" <?php 
        $this->checked($this->quiz->isShowReviewQuestion());
        ?>
>
											<?php 
        _e('Activate', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('Add at the top of the quiz a question overview, which allows easy navigation. Additional questions can be marked "to review".', 'wp-pro-quiz');
        ?>
										</p>
										<p class="description">
											<?php 
        _e('Additional quiz overview will be displayed, before quiz is finished.', 'wp-pro-quiz');
        ?>
										</p>
										<div class="wpProQuiz_demoBox">
											<?php 
        _e('Question overview', 'wp-pro-quiz');
        ?>
: <a href="#"><?php 
        _e('Demo', 'wp-pro-quiz');
        ?>
</a> 
											<div style="z-index: 9999999; position: absolute; background-color: #E9E9E9; padding: 10px; box-shadow: 0px 0px 10px 4px rgb(44, 44, 44); display: none; ">
												<img alt="" src="<?php 
        echo WPPROQUIZ_URL . '/img/questionOverview.png';
        ?>
 ">
											</div>
										</div>
										<div class="wpProQuiz_demoBox">
											<?php 
        _e('Quiz-summary', 'wp-pro-quiz');
        ?>
: <a href="#"><?php 
        _e('Demo', 'wp-pro-quiz');
        ?>
</a> 
											<div style="z-index: 9999999; position: absolute; background-color: #E9E9E9; padding: 10px; box-shadow: 0px 0px 10px 4px rgb(44, 44, 44); display: none; ">
												<img alt="" src="<?php 
        echo WPPROQUIZ_URL . '/img/quizSummary.png';
        ?>
 ">
											</div>
										</div>
									</fieldset>
								</td>
							</tr>
							<tr class="wpProQuiz_reviewQuestionOptions" style="display: none;">
								<th scope="row">
									<?php 
        _e('Quiz-summary', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Quiz-summary', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label>
											<input type="checkbox" value="1" name="quizSummaryHide" <?php 
        $this->checked($this->quiz->isQuizSummaryHide());
        ?>
>
											<?php 
        _e('Deactivate', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('If you enalbe this option, no quiz overview will be displayed, before finishing quiz.', 'wp-pro-quiz');
        ?>
										</p>
									</fieldset>
								</td>
							</tr>
							<tr class="wpProQuiz_reviewQuestionOptions" style="display: none;">
								<th scope="row">
									<?php 
        _e('Skip question', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Skip question', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label>
											<input type="checkbox" value="1" name="skipQuestionDisabled" <?php 
        $this->checked($this->quiz->isSkipQuestionDisabled());
        ?>
>
											<?php 
        _e('Deactivate', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('If you enable this option, user won\'t be able to skip question. (only in "Overview -> next" mode). User still will be able to navigate over "Question-Overview"', 'wp-pro-quiz');
        ?>
										</p>
									</fieldset>
								</td>
							</tr>
							<!-- 
							<tr>
								<th scope="row">
									<?php 
        _e('Admin e-mail notification', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Admin e-mail notification', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label>
											<input type="radio" name="emailNotification" value="<?php 
        echo WpProQuiz_Model_Quiz::QUIZ_EMAIL_NOTE_NONE;
        ?>
" <?php 
        $this->checked($this->quiz->getEmailNotification(), WpProQuiz_Model_Quiz::QUIZ_EMAIL_NOTE_NONE);
        ?>
>
											<?php 
        _e('Deactivate', 'wp-pro-quiz');
        ?>
										</label>
										<label>
											<input type="radio" name="emailNotification" value="<?php 
        echo WpProQuiz_Model_Quiz::QUIZ_EMAIL_NOTE_REG_USER;
        ?>
" <?php 
        $this->checked($this->quiz->getEmailNotification(), WpProQuiz_Model_Quiz::QUIZ_EMAIL_NOTE_REG_USER);
        ?>
>
											<?php 
        _e('for registered users only', 'wp-pro-quiz');
        ?>
										</label>
										<label>
											<input type="radio" name="emailNotification" value="<?php 
        echo WpProQuiz_Model_Quiz::QUIZ_EMAIL_NOTE_ALL;
        ?>
" <?php 
        $this->checked($this->quiz->getEmailNotification(), WpProQuiz_Model_Quiz::QUIZ_EMAIL_NOTE_ALL);
        ?>
>
											<?php 
        _e('for all users', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('If you enable this option, you will be informed if a user completes this quiz.', 'wp-pro-quiz');
        ?>
										</p>
										<p class="description">
											<?php 
        _e('E-Mail settings can be edited in global settings.', 'wp-pro-quiz');
        ?>
										</p>
									</fieldset>
								</td>
							</tr>
							
							<tr>
								<th scope="row">
									<?php 
        _e('User e-mail notification', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('User e-mail notification', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label>
											<input type="checkbox" name="userEmailNotification" value="1" <?php 
        $this->checked($this->quiz->isUserEmailNotification());
        ?>
>
											<?php 
        _e('Activate', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('If you enable this option, an email is sent with his quiz result to the user. (only registered users)', 'wp-pro-quiz');
        ?>
										</p>
										<p class="description">
											<?php 
        _e('E-Mail settings can be edited in global settings.', 'wp-pro-quiz');
        ?>
										</p>
									</fieldset>
								</td>
							</tr>
							 -->
							<tr>
								<th scope="row">
									<?php 
        _e('Autostart', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Autostart', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label>
											<input type="checkbox" name="autostart" value="1" <?php 
        $this->checked($this->quiz->isAutostart());
        ?>
>
											<?php 
        _e('Activate', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('If you enable this option, the quiz will start automatically after the page is loaded.', 'wp-pro-quiz');
        ?>
										</p>
									</fieldset>
								</td>
							</tr>
							<tr>
								<th scope="row">
									<?php 
        _e('Only registered users are allowed to start the quiz', 'wp-pro-quiz');
        ?>
								</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text">
											<span><?php 
        _e('Only registered users are allowed to start the quiz', 'wp-pro-quiz');
        ?>
</span>
										</legend>
										<label>
											<input type="checkbox" name="startOnlyRegisteredUser" value="1" <?php 
        $this->checked($this->quiz->isStartOnlyRegisteredUser());
        ?>
>
											<?php 
        _e('Activate', 'wp-pro-quiz');
        ?>
										</label>
										<p class="description">
											<?php 
        _e('If you enable this option, only registered users allowed start the quiz.', 'wp-pro-quiz');
        ?>
										</p>
									</fieldset>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div>
			<?php 
        $this->questionOptions();
        ?>
			<?php 
        $this->resultOptions();
        ?>
			<?php 
        $this->quizMode();
        ?>
			<?php 
        $this->leaderboardOptions();
        ?>
			<?php 
        $this->form();
        ?>
			<?php 
        $this->adminEmailOption();
        ?>
			<?php 
        $this->userEmailOption();
        ?>
			<div class="postbox">
				<h3 class="hndle"><?php 
        _e('Quiz description', 'wp-pro-quiz');
        ?>
 <?php 
        _e('(required)', 'wp-pro-quiz');
        ?>
</h3>
				<div class="inside">
					<p class="description">
						<?php 
        _e('This text will be displayed before start of the quiz.', 'wp-pro-quiz');
        ?>
					</p>
					<?php 
        wp_editor($this->quiz->getText(), "text");
        ?>
				</div>
			</div>
			<div class="postbox">
				<h3 class="hndle"><?php 
        _e('Results text', 'wp-pro-quiz');
        ?>
 <?php 
        _e('(optional)', 'wp-pro-quiz');
        ?>
</h3>
				<div class="inside">
					<p class="description">
						<?php 
        _e('This text will be displayed at the end of the quiz (in results). (this text is optional)', 'wp-pro-quiz');
        ?>
					</p>
					<div style="padding-top: 10px; padding-bottom: 10px;">
						<label for="wpProQuiz_resultGradeEnabled">
							<?php 
        _e('Activate graduation', 'wp-pro-quiz');
        ?>
  
							<input type="checkbox" name="resultGradeEnabled" id="wpProQuiz_resultGradeEnabled" value="1" <?php 
        echo $this->quiz->isResultGradeEnabled() ? 'checked="checked"' : '';
        ?>
>
						</label>
					</div>
					<div style="display: none;" id="resultGrade">
						<div>
							<strong><?php 
        _e('Hint:', 'wp-pro-quiz');
        ?>
</strong>
							<ul style="list-style-type: square; padding: 5px; margin-left: 20px; margin-top: 0;">
								<li><?php 
        _e('Maximal 15 levels', 'wp-pro-quiz');
        ?>
</li>
								<li>
									<?php 
        printf(__('Percentages refer to the total score of the quiz. (Current total %d points in %d questions.', 'wp-pro-quiz'), $this->quiz->fetchSumQuestionPoints(), $this->quiz->fetchCountQuestions());
        ?>
									</li>
								<li><?php 
        _e('Values can also be mixed up', 'wp-pro-quiz');
        ?>
</li>
								<li><?php 
        _e('10,15% or 10.15% allowed (max. two digits after the decimal point)', 'wp-pro-quiz');
        ?>
</li>
							</ul>
								
						</div>
						<div>
							<ul id="resultList">
							<?php 
        $resultText = $this->quiz->getResultText();
        for ($i = 0; $i < 15; $i++) {
            if ($this->quiz->isResultGradeEnabled() && isset($resultText['text'][$i])) {
                ?>
								<li style="padding: 5px; border: 1; border: 1px dotted;">
									<div style="margin-bottom: 5px;"><?php 
                wp_editor($resultText['text'][$i], 'resultText_' . $i, array('textarea_rows' => 3, 'textarea_name' => 'resultTextGrade[text][]'));
                ?>
</div>
									<div style="margin-bottom: 5px;background-color: rgb(207, 207, 207);padding: 10px;">
										<?php 
                _e('from:', 'wp-pro-quiz');
                ?>
 <input type="text" name="resultTextGrade[prozent][]" class="small-text" value="<?php 
                echo $resultText['prozent'][$i];
                ?>
"> <?php 
                _e('percent', 'wp-pro-quiz');
                ?>
 <?php 
                printf(__('(Will be displayed, when result-percent is >= <span class="resultProzent">%s</span>%%)', 'wp-pro-quiz'), $resultText['prozent'][$i]);
                ?>
										<input type="button" style="float: right;" class="button-primary deleteResult" value="<?php 
                _e('Delete graduation', 'wp-pro-quiz');
                ?>
">
										<div style="clear: right;"></div>
										<input type="hidden" value="1" name="resultTextGrade[activ][]">
									</div>
								</li>
							
							<?php 
            } else {
                ?>
								<li style="padding: 5px; border: 1; border: 1px dotted; <?php 
                echo $i ? 'display:none;' : '';
                ?>
">
									<div style="margin-bottom: 5px;"><?php 
                wp_editor('', 'resultText_' . $i, array('textarea_rows' => 3, 'textarea_name' => 'resultTextGrade[text][]'));
                ?>
</div>
									<div style="margin-bottom: 5px;background-color: rgb(207, 207, 207);padding: 10px;">
										<?php 
                _e('from:', 'wp-pro-quiz');
                ?>
 <input type="text" name="resultTextGrade[prozent][]" class="small-text" value="0"> <?php 
                _e('percent', 'wp-pro-quiz');
                ?>
 <?php 
                printf(__('(Will be displayed, when result-percent is >= <span class="resultProzent">%s</span>%%)', 'wp-pro-quiz'), '0');
                ?>
										<input type="button" style="float: right;" class="button-primary deleteResult" value="<?php 
                _e('Delete graduation', 'wp-pro-quiz');
                ?>
">
										<div style="clear: right;"></div>
										<input type="hidden" value="<?php 
                echo $i ? '0' : '1';
                ?>
" name="resultTextGrade[activ][]">
									</div>
								</li>
							<?php 
            }
        }
        ?>
							</ul>
							<input type="button" class="button-primary addResult" value="<?php 
        _e('Add graduation', 'wp-pro-quiz');
        ?>
">
						</div>
					</div>
					<div id="resultNormal">
						<?php 
        $resultText = is_array($resultText) ? '' : $resultText;
        wp_editor($resultText, 'resultText', array('textarea_rows' => 10));
        ?>
					</div>
					
					<h4><?php 
        _e('Custom fields - Variables', 'wp-pro-quiz');
        ?>
</h4>
					<ul class="formVariables"></ul>
					
				</div>
			</div>
		<div style="float: left;">
			<input type="submit" name="submit" class="button-primary" id="wpProQuiz_save" value="<?php 
        _e('Save', 'wp-pro-quiz');
        ?>
">
		</div>
		<div style="float: right;">
			<input type="text" placeholder="<?php 
        _e('template name', 'wp-pro-quiz');
        ?>
" class="regular-text" name="templateName" style="border: 1px solid rgb(255, 134, 134);">
			<select name="templateSaveList">
				<option value="0">=== <?php 
        _e('Create new template', 'wp-pro-quiz');
        ?>
 === </option>
				<?php 
        foreach ($this->templates as $template) {
            echo '<option value="', $template->getTemplateId(), '">', esc_html($template->getName()), '</option>';
        }
        ?>
			</select>
			
			<input type="submit" name="template" class="button-primary" id="wpProQuiz_saveTemplate" value="<?php 
        _e('Save as template', 'wp-pro-quiz');
        ?>
">
		</div>
		<div style="clear: both;"></div>
		</div>
	</form>
</div>
<?php 
    }