public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/classes/quizcustomfeedback.php
/**
		 * Generates the form where the trainer can edit the details of the custom message.
		 */
Generates the form where the trainer can edit the details of the custom message.
Generates the form where the trainer can edit the details of the custom message .
public function generate_editForm() {
			$html = false;
			$fieldSuffix = '_' . $this->feedbackMsgDetails->qfeedback_id;
			$fieldPrefix = 'wpcw_qcfm_sgl_';
			$html .= sprintf( '<div id="%swrapper%s"><table class="wpcw_quiz_custom_feedback_wrap_single" cellspacing="0"><tbody>', $fieldPrefix, $fieldSuffix );
			$html .= sprintf( '<tr class="wpcw_quiz_custom_feedback_hdr">' );
			$html .= sprintf( '<th>%s:<span class="wpcw_inner_hint">%s</span></th>',
				__( 'Message Description', 'wp-courseware' ),
				__( '(Required) A quick summary for this message. This will not be displayed to students.' )
			);
			$html .= '<td>';
			$html .= sprintf( '<input name="%s" type="text" value="%s" class="wpcw_qcfm_sgl_summary" placeholder="%s">',
				$fieldPrefix . 'summary' . $fieldSuffix,
				$this->feedbackMsgDetails->qfeedback_summary,
				__( 'e.g. Low score on MyTag section', 'wp-courseware' )
			);
			$html .= sprintf( '<span class="wpcw_quiz_custom_feedback_error">%s</span>', __( 'Please specify a quick summary for this message.', 'wp-courseware' ) );
			$html .= '</td>';
			$html .= '</tr>';
			$html .= sprintf( '<tr>' );
			$html .= sprintf( '<th>%s:<span class="wpcw_inner_hint">%s</span></th>',
				__( 'Select Question Tag', 'wp-courseware' ),
				__( '(Required) Select the tag for which you want to provide feedback.' )
			);
			$html .= '<td>';
			$html .= WPCW_questions_tags_getTagDropdown( __( '-- Please choose a tag ---', 'wp-courseware' ), $fieldPrefix . 'tag' . $fieldSuffix, $this->feedbackMsgDetails->qfeedback_tag_id, 'wpcw_qcfm_sgl_tag', false, false );
			$html .= sprintf( '<span class="wpcw_quiz_custom_feedback_error">%s</span>', __( 'Please select a tag for this message.', 'wp-courseware' ) );
			$html .= '</td>';
			$html .= '</tr>';
			$html .= sprintf( '<tr class="alternate">' );
			$html .= sprintf( '<th>%s:<span class="wpcw_inner_hint">%s</span></th>',
				__( 'Select Question Tag', 'wp-courseware' ),
				__( '(Required) Select the tag for which you want to provide feedback.' )
			);
			$html .= '<td class="wpcw_quiz_custom_feedback_score">';
			$html .= sprintf( '<span class="wpcw_quiz_custom_feedback_score_label_first">%s</span>', __( 'Display this message to students who score:', 'wp-courseware' ) );
			$html .= '<span class="wpcw_quiz_custom_feedback_score_radio_wrap">';
			$html .= sprintf( '<label><input type="radio" name="%s" value="above" %s /> %s</label>',
				$fieldPrefix . 'score_type' . $fieldSuffix,
				( $this->feedbackMsgDetails->qfeedback_score_type == 'above' ? 'checked="checked"' : false ),
				__( 'above', 'wp-courseware' )
			);
			$html .= sprintf( '<label><input type="radio" name="%s" value="below" %s /> %s</label>',
				$fieldPrefix . 'score_type' . $fieldSuffix,
				( $this->feedbackMsgDetails->qfeedback_score_type == 'below' ? 'checked="checked"' : false ),
				__( 'at or below', 'wp-courseware' )
			);
			$html .= '</span>';
			$html .= WPCW_forms_createDropdown( $fieldPrefix . 'score_grade' . $fieldSuffix, WPCW_quizzes_getPercentageList( false ), $this->feedbackMsgDetails->qfeedback_score_grade );
			$html .= sprintf( '<span class="wpcw_quiz_custom_feedback_score_label_second">%s</span>', __( 'across all questions for the tag selected above', 'wp-courseware' ) );
			$html .= sprintf( '<span class="wpcw_quiz_custom_feedback_error">%s</span>', __( 'Please select a trigger score for this message.', 'wp-courseware' ) );
			$html .= '</td>';
			$html .= '</tr>';
			$html .= sprintf( '<tr>' );
			$html .= sprintf( '<th>%s:<span class="wpcw_inner_hint">%s</span></th>',
				__( 'Custom Feedback Message', 'wp-courseware' ),
				__( '(Required) Enter the message to display to students when conditions above are met.' ),
				'test'
			);
			$html .= '<td>';
			$html .= sprintf( '<textarea name="%s" rows="7" class="wpcw_qcfm_sgl_message">%s</textarea>',
				$fieldPrefix . 'message' . $fieldSuffix,
				$this->feedbackMsgDetails->qfeedback_message
			);
			$html .= sprintf( '<span class="wpcw_quiz_custom_feedback_error">%s</span>', __( 'Please enter a helpful feedback message for the trainee.', 'wp-courseware' ) );
			$html .= '</td>';
			$html .= '</tr>';
			$html .= sprintf( '<tr class="wpcw_quiz_row_footer">
				<td colspan="3" class="wpcw_question_actions">
					<a href="#" class="wpcw_delete_icon" rel="%s">Delete</a>
				</td>
			</tr>', __( 'Are you sure you wish to delete this custom feedback message?', 'wp-courseware' ) );
			$html .= '</tbody></table></div>';
			return $html;
		}
public function generate_editForm ( ) { $ html = false ; $ fieldSuffix = '_' . $ this -> feedbackMsgDetails -> qfeedback_id ; $ fieldPrefix = 'wpcw_qcfm_sgl_' ; $ html .= sprintf ( '<div id="%swrapper%s"><table class="wpcw_quiz_custom_feedback_wrap_single" cellspacing="0"><tbody>' , $ fieldPrefix , $ fieldSuffix ) ; $ html .= sprintf ( '<tr class="wpcw_quiz_custom_feedback_hdr">' ) ; $ html .= sprintf ( '<th>%s:<span class="wpcw_inner_hint">%s</span></th>' , __ ( 'Message Description' , 'wp-courseware' ) , __ ( '(Required) A quick summary for this message. This will not be displayed to students.' ) ) ; $ html .= '<td>' ; $ html .= sprintf ( '<input name="%s" type="text" value="%s" class="wpcw_qcfm_sgl_summary" placeholder="%s">' , $ fieldPrefix . 'summary' . $ fieldSuffix , $ this -> feedbackMsgDetails -> qfeedback_summary , __ ( 'e.g. Low score on MyTag section' , 'wp-courseware' ) ) ; $ html .= sprintf ( '<span class="wpcw_quiz_custom_feedback_error">%s</span>' , __ ( 'Please specify a quick summary for this message.' , 'wp-courseware' ) ) ; $ html .= '</td>' ; $ html .= '</tr>' ; $ html .= sprintf ( '<tr>' ) ; $ html .= sprintf ( '<th>%s:<span class="wpcw_inner_hint">%s</span></th>' , __ ( 'Select Question Tag' , 'wp-courseware' ) , __ ( '(Required) Select the tag for which you want to provide feedback.' ) ) ; $ html .= '<td>' ; $ html .= WPCW_questions_tags_getTagDropdown ( __ ( '-- Please choose a tag ---' , 'wp-courseware' ) , $ fieldPrefix . 'tag' . $ fieldSuffix , $ this -> feedbackMsgDetails -> qfeedback_tag_id , 'wpcw_qcfm_sgl_tag' , false , false ) ; $ html .= sprintf ( '<span class="wpcw_quiz_custom_feedback_error">%s</span>' , __ ( 'Please select a tag for this message.' , 'wp-courseware' ) ) ; $ html .= '</td>' ; $ html .= '</tr>' ; $ html .= sprintf ( '<tr class="alternate">' ) ; $ html .= sprintf ( '<th>%s:<span class="wpcw_inner_hint">%s</span></th>' , __ ( 'Select Question Tag' , 'wp-courseware' ) , __ ( '(Required) Select the tag for which you want to provide feedback.' ) ) ; $ html .= '<td class="wpcw_quiz_custom_feedback_score">' ; $ html .= sprintf ( '<span class="wpcw_quiz_custom_feedback_score_label_first">%s</span>' , __ ( 'Display this message to students who score:' , 'wp-courseware' ) ) ; $ html .= '<span class="wpcw_quiz_custom_feedback_score_radio_wrap">' ; $ html .= sprintf ( '<label><input type="radio" name="%s" value="above" %s /> %s</label>' , $ fieldPrefix . 'score_type' . $ fieldSuffix , ( $ this -> feedbackMsgDetails -> qfeedback_score_type == 'above' ? 'checked="checked"' : false ) , __ ( 'above' , 'wp-courseware' ) ) ; $ html .= sprintf ( '<label><input type="radio" name="%s" value="below" %s /> %s</label>' , $ fieldPrefix . 'score_type' . $ fieldSuffix , ( $ this -> feedbackMsgDetails -> qfeedback_score_type == 'below' ? 'checked="checked"' : false ) , __ ( 'at or below' , 'wp-courseware' ) ) ; $ html .= '</span>' ; $ html .= WPCW_forms_createDropdown ( $ fieldPrefix . 'score_grade' . $ fieldSuffix , WPCW_quizzes_getPercentageList ( false ) , $ this -> feedbackMsgDetails -> qfeedback_score_grade ) ; $ html .= sprintf ( '<span class="wpcw_quiz_custom_feedback_score_label_second">%s</span>' , __ ( 'across all questions for the tag selected above' , 'wp-courseware' ) ) ; $ html .= sprintf ( '<span class="wpcw_quiz_custom_feedback_error">%s</span>' , __ ( 'Please select a trigger score for this message.' , 'wp-courseware' ) ) ; $ html .= '</td>' ; $ html .= '</tr>' ; $ html .= sprintf ( '<tr>' ) ; $ html .= sprintf ( '<th>%s:<span class="wpcw_inner_hint">%s</span></th>' , __ ( 'Custom Feedback Message' , 'wp-courseware' ) , __ ( '(Required) Enter the message to display to students when conditions above are met.' ) , 'test' ) ; $ html .= '<td>' ; $ html .= sprintf ( '<textarea name="%s" rows="7" class="wpcw_qcfm_sgl_message">%s</textarea>' , $ fieldPrefix . 'message' . $ fieldSuffix , $ this -> feedbackMsgDetails -> qfeedback_message ) ; $ html .= sprintf ( '<span class="wpcw_quiz_custom_feedback_error">%s</span>' , __ ( 'Please enter a helpful feedback message for the trainee.' , 'wp-courseware' ) ) ; $ html .= '</td>' ; $ html .= '</tr>' ; $ html .= sprintf ( '<tr class="wpcw_quiz_row_footer">
				<td colspan="3" class="wpcw_question_actions">
					<a href="#" class="wpcw_delete_icon" rel="%s">Delete</a>
				</td>
			</tr>' , __ ( 'Are you sure you wish to delete this custom feedback message?' , 'wp-courseware' ) ) ; $ html .= '</tbody></table></div>' ; return $ html ; }
Generates the form where the trainer can edit the details of the custom message.
Generates the form where the trainer can edit the details of the custom message .
// Build the root of each field name, then append a suffix for each field. // ### 1) - Show the feedback message - summary field. // Label // Entry field for message summary name // Error message if incomplete // Toggle field //$html .= sprintf('<td class="wpcw_quiz_custom_feedback_toggle">[+]</td>'); // ### 2) - Show tag selection field // Label // Tag selection // Dropdown for the tags // Error message if incomplete // Shows the count of how many tags are available for this tag // This has not been continued for now, as it's an extremely expensive operation due to the random questions. /*
			if ($this->feedbackMsgDetails->qfeedback_tag_id > 0)
			{
				$questionCount = 3;//WPCW_quizzes_getQuestionCountForTag($this->quizID, $this->feedbackMsgDetails->qfeedback_tag_id);

				// Show count based on how many questions found for this tag.
				$html .= sprintf('<span class="wpcw_quiz_custom_feedback_question_count"><b>%d %s</b> %s</span>',
					$questionCount,
					_n('question', 'questions', $questionCount, 'wp-courseware'),
					__('found for this tag in this quiz.', 'wp-courseware')
				);
			}

			// No selected tag, so just hide this.
			else {
				$html .= '<span class="wpcw_quiz_custom_feedback_question_count" style="display: none;"></span>';
			}*/ // Empty toggle field. //$html .= sprintf('<td></td>'); // ### 3) - Show the score level selection // Label // Score condition check // Score selection // Error message if incomplete // ### 4) - Show the message form // Label // Text area for message // Error message if incomplete // ### 5) Show the footer with the delete icon