Skip to content

Commit ead8b71

Browse files
committed
Merge branch 'Build6' Fixed #14, Fixed #4, Fixed #16
2 parents b092aee + 55fd5d4 commit ead8b71

21 files changed

Lines changed: 178 additions & 126 deletions

SQL/responses.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SELECT
22
tCOM.id as completed_id,
3-
tQUIZ.title as algorithm_name,
3+
tQUIZ.title as topic_name,
44
tCOM.datetime as response_date,
55
tUA.answer_text as study_id,
66
tCOM.snapshot as soap_note

UPGRADE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
These are the changes that need to be done when upgrading the plugin from 5.1 to 6.0.
2+
1. Update all [triage-algorithm] shortcodes to [triage-topic].

controllers/completed.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,17 +242,19 @@ static function manage() {
242242
include(CHAINED_PATH."/views/completed.html.php");
243243
} // end manage
244244

245-
// Generate the triage algorithm submitted responses as a dashboard/table.
246-
static function view_submissions($algorithm_ids) {
245+
/**************************************************************************
246+
* FUNCTION: Generate submitted Topics as a dashboard table.
247+
**************************************************************************/
248+
static function view_submissions($topic_ids) {
247249
global $wpdb;
248250

249251
$results = $wpdb->get_results(
250-
"SELECT tCOM.id as completion_id, tCOM.datetime as response_date, tQUIZ.title as algorithm_name, tUA.answer_text as study_id, tCOM.snapshot as soap_note
252+
"SELECT tCOM.id as completion_id, tCOM.datetime as response_date, tQUIZ.title as topic_name, tUA.answer_text as study_id, tCOM.snapshot as soap_note
251253
FROM ".CHAINED_QUIZZES." tQUIZ
252254
JOIN ".CHAINED_COMPLETED." tCOM
253255
JOIN ".CHAINED_QUESTIONS." tQUES
254256
JOIN ".CHAINED_USER_ANSWERS." tUA
255-
WHERE tQUIZ.id IN ($algorithm_ids)
257+
WHERE tQUIZ.id IN ($topic_ids)
256258
AND tQUIZ.id = tCOM.quiz_id
257259
AND tQUIZ.id = tQUES.quiz_id
258260
AND tQUES.id = tUA.question_id
@@ -272,11 +274,11 @@ static function define_dir($col, $ob, $dir) {
272274
else return 'asc';
273275
}
274276

275-
// Captures feedback for a triage algorithm post-submission.
277+
// Captures feedback for a submitted Topic.
276278
static function feedback($comment) {
277279
$admin_email = chained_admin_email();
278280
$sender_email = chained_sender_email();
279-
$subject = 'Triage Algorithm Feedback';
281+
$subject = 'Submitted Topic Feedback';
280282
$message = $comment;
281283
$headers = 'MIME-Version: 1.0' . "\r\n";
282284
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";

controllers/quizzes.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static function add_quiz() {
3030
}
3131
}
3232

33-
$output = __('Success: Algorithm Completed
33+
$output = __('Success: Topic Completed
3434
{{soap-note}}', 'chained');
3535
$is_published = false;
3636
include(CHAINED_PATH.'/views/quiz.html.php');
@@ -55,7 +55,7 @@ static function edit_quiz() {
5555
$output = stripslashes($quiz->output);
5656

5757
// is this quiz currently published?
58-
$is_published = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%[triage-algorithm ".intval($_GET['id'])."]%'
58+
$is_published = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%[triage-topic ".intval($_GET['id'])."]%'
5959
AND post_status='publish' AND post_title!=''");
6060
include(CHAINED_PATH.'/views/quiz.html.php');
6161
} // end edit_quiz
@@ -82,13 +82,13 @@ static function list_quizzes() {
8282

8383
// now select all posts that have watu shortcode in them
8484
$posts=$wpdb->get_results("SELECT * FROM {$wpdb->posts}
85-
WHERE post_content LIKE '%[triage-algorithm %]%' AND post_title!=''
85+
WHERE post_content LIKE '%[triage-topic %]%' AND post_title!=''
8686
AND post_status='publish' ORDER BY post_date DESC");
8787

8888
// match posts to exams
8989
foreach($quizzes as $cnt=>$quiz) {
9090
foreach($posts as $post) {
91-
if(strstr($post->post_content,"[triage-algorithm ".$quiz->id."]")) {
91+
if(strstr($post->post_content,"[triage-topic ".$quiz->id."]")) {
9292
$quizzes[$cnt]->post=$post;
9393
break;
9494
}
@@ -178,11 +178,11 @@ static function answer_question() {
178178
// calculate points
179179
$points = $_question->calculate_points($question, $answer);
180180
echo $points."|CHAINEDQUIZ|";
181-
$total_points = $points + floatval($_POST['points']); // Points for the whole algorithm.
181+
$total_points = $points + floatval($_POST['points']); // Points for the whole Topic.
182182

183183
// figure out next question
184184
if ($question->abort_enabled && $total_points >= $question->points_abort_min && $total_points <= $question->points_abort_max) {
185-
// Abort criteria met. Let's abort the Algorithm and finish it.
185+
// Abort criteria met. Let's abort the Topic and finish it.
186186
$next_question = null;
187187
} else {
188188
$next_question = $_question->next($question, $answer);

controllers/shortcodes.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
<?php
22
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
33
class TriageShortcodes {
4-
// Shortcode handler/receiver for [triage-algorithm].
5-
static function algorithmShortcodeHandler($atts) {
4+
// Shortcode handler/receiver for [triage-topic].
5+
static function topicShortcodeHandler($atts) {
66
global $wpdb;
77
$quiz_id = @$atts[0];
88
if(empty($quiz_id) or !is_numeric($quiz_id)) return __('No quiz to load', 'chained');
99
ob_start();
1010
ChainedQuizQuizzes :: display($quiz_id);
1111
$content = ob_get_clean();
1212
return $content;
13-
} // end algorithm()
13+
} // end topic()
1414

1515
// Shortcode handler/receiver for [triage-submissions].
1616
static function responsesShortcodeHandler($atts) {
1717

1818
$args = shortcode_atts( array(
19-
'algorithm' => '0'
19+
'topic' => '0'
2020
), $atts );
2121

22-
$algorithm_id = @$atts[0];
22+
$topic_id = @$atts[0];
2323
ob_start();
24-
ChainedQuizCompleted :: view_submissions($args['algorithm']);
24+
ChainedQuizCompleted :: view_submissions($args['topic']);
2525
$content = ob_get_clean();
2626
return $content;
2727
} // end dashboard()

models/basic.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ static function install($update = false) {
5858
`quiz_id` INT UNSIGNED NOT NULL DEFAULT 0,
5959
`question_id` INT UNSIGNED NOT NULL DEFAULT 0,
6060
`choice` TEXT,
61+
`patient_note` TEXT,
6162
`provider_note` TEXT,
6263
`assessment` TEXT,
6364
`plan` TEXT,
@@ -151,6 +152,7 @@ static function install($update = false) {
151152
$wpdb->query("ALTER TABLE ".CHAINED_QUESTIONS." ADD COLUMN abort_enabled TINYINT NOT NULL DEFAULT 0 AFTER rank;");
152153
$wpdb->query("ALTER TABLE ".CHAINED_QUESTIONS." ADD COLUMN points_abort_min DECIMAL(8,2) NOT NULL DEFAULT '0.00' AFTER abort_enabled;");
153154
$wpdb->query("ALTER TABLE ".CHAINED_QUESTIONS." ADD COLUMN points_abort_max DECIMAL(8,2) NOT NULL DEFAULT '0.00' AFTER points_abort_min;");
155+
$wpdb->query("ALTER TABLE ".CHAINED_CHOICES." ADD COLUMN patient_note TEXT AFTER choice;");
154156
}
155157

156158
// Set the current plugin version number.
@@ -161,9 +163,9 @@ static function install($update = false) {
161163
static function menu() {
162164
$chained_caps = current_user_can('manage_options') ? 'manage_options' : 'chained_manage';
163165

164-
add_menu_page(__('Triage Algorithm', 'chained'), __('Triage Algorithm', 'chained'), $chained_caps, "chained_quizzes", array('ChainedQuizQuizzes', "manage"));
165-
add_submenu_page('chained_quizzes', __('Algorithms', 'chained'), __('Algorithms', 'chained'), $chained_caps, 'chained_quizzes', array('ChainedQuizQuizzes', "manage"));
166-
add_submenu_page('chained_quizzes', __('Settings', 'chained'), __('Settings', 'chained'), 'manage_options', 'chainedquiz_options', array('ChainedQuiz','options'));
166+
add_menu_page(__('Orchestra', 'chained'), __('Orchestra', 'chained'), $chained_caps, "chained_quizzes", array('ChainedQuizQuizzes', "manage"));
167+
add_submenu_page('chained_quizzes', __('Configure Topics', 'chained'), __('Configure Topics', 'chained'), $chained_caps, 'chained_quizzes', array('ChainedQuizQuizzes', "manage"));
168+
add_submenu_page('chained_quizzes', __('Options', 'chained'), __('Options', 'chained'), 'manage_options', 'chainedquiz_options', array('ChainedQuiz','options'));
167169
add_submenu_page('chained_quizzes', __('Social Sharing', 'chained'), __('Social Sharing', 'chained'), $chained_caps, 'chainedquiz_social_sharing', array('ChainedSharing','options'));
168170
add_submenu_page('chained_quizzes', __('Help', 'chained'), __('Help', 'chained'), $chained_caps, 'chainedquiz_help', array('ChainedQuiz','help'));
169171

@@ -210,7 +212,7 @@ static function init() {
210212
//define( 'CHAINED_VERSION', get_option('chained_version'));
211213

212214
// Register shortcodes offered by this plugin.
213-
add_shortcode('triage-algorithm', array("TriageShortcodes", "algorithmShortcodeHandler"));
215+
add_shortcode('triage-topic', array("TriageShortcodes", "topicShortcodeHandler"));
214216
add_shortcode('triage-submissions', array("TriageShortcodes", "responsesShortcodeHandler"));
215217
add_shortcode('chained-share', array("ChainedSharing", "display"));
216218

models/question.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ function save_choices($vars, $id) {
9898

9999
if(!current_user_can('unfiltered_html')) {
100100
$_POST['answer'.$choice->id] = strip_tags($_POST['answer'.$choice->id]);
101+
$_POST['patient_note'.$choice->id] = strip_tags($_POST['patient_note'.$choice->id]);
101102
$_POST['provider_note'.$choice->id] = strip_tags($_POST['provider_note'.$choice->id]);
102103
$_POST['assessment'.$choice->id] = strip_tags($_POST['assessment'.$choice->id]);
103104
$_POST['plan'.$choice->id] = strip_tags($_POST['plan'.$choice->id]);
@@ -108,9 +109,10 @@ function save_choices($vars, $id) {
108109

109110
// else update
110111
$wpdb->query($wpdb->prepare("UPDATE ".CHAINED_CHOICES." SET
111-
choice=%s, points=%s, provider_note=%s, assessment=%s, plan=%s, is_correct=%d, goto=%s WHERE id=%d",
112-
$_POST['answer'.$choice->id], $_POST['points'.$choice->id], $_POST['provider_note'.$choice->id], $_POST['assessment'.$choice->id], $_POST['plan'.$choice->id],
113-
intval(@$_POST['is_correct'.$choice->id]), $_POST['goto'.$choice->id], $choice->id));
112+
choice=%s, points=%s, patient_note=%s, provider_note=%s,
113+
assessment=%s, plan=%s, is_correct=%d, goto=%s WHERE id=%d",
114+
$_POST['answer'.$choice->id], $_POST['points'.$choice->id], $_POST['patient_note'.$choice->id], $_POST['provider_note'.$choice->id],
115+
$_POST['assessment'.$choice->id], $_POST['plan'.$choice->id], intval(@$_POST['is_correct'.$choice->id]), $_POST['goto'.$choice->id], $choice->id));
114116
}
115117

116118
// add new choices
@@ -254,7 +256,7 @@ function calculate_points($question, $answer) {
254256

255257

256258
/**************************************************************************
257-
* FUNCTION: Get the next configured question in the Algorithm.
259+
* FUNCTION: Get the next configured question in the Topic.
258260
*
259261
* NOTES:
260262
* $question = SELECT * FROM CHAINED_QUESTIONS WHERE id=%d
@@ -324,7 +326,7 @@ function next($question, $answer) {
324326
/**
325327
* THIS IS WHERE WE HANDLE WHAT TO GIVE AS THE NEXT QUESTION.
326328
* */
327-
// #1 - No more questions to ask or current the current answer ends the Algorithm.
329+
// #1 - No more questions to ask or current the current answer ends the Topic.
328330
if(empty($key) || $key == 'finalize') {
329331
return false;
330332
}

0 commit comments

Comments
 (0)