PHP Classes

File: DOC.en.txt

Recommend this page to a friend!
  Classes of Pierre FAUQUE   Tobacco Class   DOC.en.txt   Download  
File: DOC.en.txt
Role: Documentation
Content type: text/plain
Description: Documentation (English)
Class: Tobacco Class
Display and evaluate tobacco tests
Author: By
Last change: Convertion into utf-8 encoded file
Date: 7 years ago
Size: 2,501 bytes


Class file image Download
MINI-DOCUMENTATION This class displays and evaluates three different tests about tobacco : - The Fagerström test to evaluate the dependency to nicotine, - The Demaria, Grimaldi and Lagrue test, used to determinate the motivation for smoking cessation, - The Horn test used to determinate the smoker profile. - Maybe other tests in a future version... You have to intanciate the class using the initials of de desired tests : - D for Demaria, Grimaldi and Lagrue test, - F for Fagerström test and - H for Horn test Uppercase and lowercase for these initials are accepted. You might display one, two or three tests. The order of initals determines the displayed order. examples: $test = new tobacco('F'); // Only Fagerström test. $test = new tobacco('DFH'); // Test in order Demaria, Fagerström, Horn. $test = new tobacco('FDH'); // Test in order Fagerström, Demaria, Horn. $test = new tobacco('DH'); // Only two tests : Demaria first, Horn after. The results of each test are always stored in arrays : $test->tabd for Demaria test $test->tabf for Fagerström test $test->tabh for Horn test The attribute $test->showtest can be set to 0 or 1. 1 : the results of tests are shown. It is the default value. 0 : the results are not shown. You can set the value of this attribute at the instanciation : $test = new tobacco('DFH'); or $test = new tobacco('DFH',1); // to display results $test = new tobacco('DFH',0); // to not display If $test->showtest is set to 0, the results are not displayed and you can use the results array ($test->tabd, $test->tabf, $test->tabh) to write your own texts with the styles you want. The answers made, whether the results are displayed or not, are always stored in these arrays. To display the test(s), use the method $test->display(); To evaluate the test(s), use the method $test->evaluate(); To write the corresponding javascript, use the method $test->write_js(); To see the answers array or the results array, use the method $test->showresults(); after the method $test->evaluate(); whether the $test->showtest attribute is set to 0 or 1. Javascript: - In the Fagerström test, all questions must be answered. - In the Demaria test, the first question (radio: 3 choices) must be ansewered. All other propositions can be checked if they are true. - In the Horn test, all questions must be answered. Take a look at the demo.en.php file History: 16/01/2017 : v0.1 Initial version.