Skip to content

Commit 6eda58a

Browse files
committed
Fixed #14
1 parent b092aee commit 6eda58a

20 files changed

Lines changed: 93 additions & 90 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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ static function install($update = false) {
161161
static function menu() {
162162
$chained_caps = current_user_can('manage_options') ? 'manage_options' : 'chained_manage';
163163

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'));
164+
add_menu_page(__('Orchestra', 'chained'), __('Orchestra', 'chained'), $chained_caps, "chained_quizzes", array('ChainedQuizQuizzes', "manage"));
165+
add_submenu_page('chained_quizzes', __('Configure Topics', 'chained'), __('Configure Topics', 'chained'), $chained_caps, 'chained_quizzes', array('ChainedQuizQuizzes', "manage"));
166+
add_submenu_page('chained_quizzes', __('Options', 'chained'), __('Options', 'chained'), 'manage_options', 'chainedquiz_options', array('ChainedQuiz','options'));
167167
add_submenu_page('chained_quizzes', __('Social Sharing', 'chained'), __('Social Sharing', 'chained'), $chained_caps, 'chainedquiz_social_sharing', array('ChainedSharing','options'));
168168
add_submenu_page('chained_quizzes', __('Help', 'chained'), __('Help', 'chained'), $chained_caps, 'chainedquiz_help', array('ChainedQuiz','help'));
169169

@@ -210,7 +210,7 @@ static function init() {
210210
//define( 'CHAINED_VERSION', get_option('chained_version'));
211211

212212
// Register shortcodes offered by this plugin.
213-
add_shortcode('triage-algorithm', array("TriageShortcodes", "algorithmShortcodeHandler"));
213+
add_shortcode('triage-topic', array("TriageShortcodes", "topicShortcodeHandler"));
214214
add_shortcode('triage-submissions', array("TriageShortcodes", "responsesShortcodeHandler"));
215215
add_shortcode('chained-share', array("ChainedSharing", "display"));
216216

models/question.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ function calculate_points($question, $answer) {
254254

255255

256256
/**************************************************************************
257-
* FUNCTION: Get the next configured question in the Algorithm.
257+
* FUNCTION: Get the next configured question in the Topic.
258258
*
259259
* NOTES:
260260
* $question = SELECT * FROM CHAINED_QUESTIONS WHERE id=%d
@@ -324,7 +324,7 @@ function next($question, $answer) {
324324
/**
325325
* THIS IS WHERE WE HANDLE WHAT TO GIVE AS THE NEXT QUESTION.
326326
* */
327-
// #1 - No more questions to ask or current the current answer ends the Algorithm.
327+
// #1 - No more questions to ask or current the current answer ends the Topic.
328328
if(empty($key) || $key == 'finalize') {
329329
return false;
330330
}

models/quiz.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,14 @@ function send_emails($quiz, $output, $attach_path) {
292292
function auto_publish($quiz_id, $vars) {
293293
global $wpdb;
294294

295-
$post = array('post_content' => '[triage-algorithm '.$quiz_id.']', 'post_name'=> sanitize_text_field($vars['title']),
295+
$post = array('post_content' => '[triage-topic '.$quiz_id.']', 'post_name'=> sanitize_text_field($vars['title']),
296296
'post_title'=>sanitize_text_field($vars['title']), 'post_status'=>'publish');
297297
wp_insert_post($post);
298298
}
299299

300300

301301
/**************************************************************************
302-
* FUNCTION: Create a table of questions and answers along with correct/wrong answer and points.
302+
* FUNCTION: Create a table of Questions and Answers along with correct/wrong Answer and Points.
303303
**************************************************************************/
304304
function answers_table($completion_id) {
305305
global $wpdb;
@@ -453,7 +453,7 @@ function soap_note($completion_id, $result) {
453453
$output .= $user_answer;
454454
}
455455

456-
// Add the description for the Algorithm Result.
456+
// Add the description for the Topic Result.
457457
if (isset($result) && $result->description) {
458458
$output .= '<li>' . $result->description . '</li>';
459459
$count++;
@@ -501,7 +501,7 @@ function soap_note($completion_id, $result) {
501501
$output .= $user_answer;
502502
}
503503

504-
// Add the subjective note for the Algorithm Result.
504+
// Add the subjective note for the Topic Result.
505505
if (isset($result) && $result->subjective) {
506506
$output .= '<li>' . $result->subjective . '</li>';
507507
$count++;
@@ -550,7 +550,7 @@ function soap_note($completion_id, $result) {
550550
$output .= $user_answer;
551551
}
552552

553-
// Add the objective note for the Algorithm Result.
553+
// Add the objective note for the Topic Result.
554554
if (isset($result) && $result->objective) {
555555
$output .= '<li>' . $result->objective . '</li>';
556556
$count++;
@@ -570,7 +570,7 @@ function soap_note($completion_id, $result) {
570570
}
571571
}
572572

573-
// Add the assessment and plan for the Algorithm Result.
573+
// Add the assessment and plan for the Topic Result.
574574
if (isset($result)) {
575575
if ($result->assessment || $result->plan) {
576576
$user_answer .= '<tr><td width="50%">'.$result->assessment.'</td><td width="50%">'.$result->plan.'</td></tr>';

readme upgrade to 6.0.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

triage-algorithm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
Plugin Name: Triage Algorithm
44
Plugin URI: http://windwake.io
5-
Description: Create a triage algorithm where questions are asked and answers translated into clinical decision support information.
5+
Description: Create a Triage Algorithm where Questions are asked for specific Topic and Answers translated into clinical decision support information.
66
Author: WindWake Healthcare Technologies LLC
77
Version: 5.1
88
Author URI: http://windwake.io

0 commit comments

Comments
 (0)