~l3on/ubuntu/precise/rkward/rebuild1

« back to all changes in this revision

Viewing changes to rkward/plugins/plots/irt/polytomous/plot_pcm.php

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-05-11 21:58:23 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20090511215823-m2f3gehcvapwrzgp
Tags: 0.5.0d-0ubuntu1
* New upstream release (LP: #375213)
* Bump Standards-Version to 3.8.1
* Drop cmake, libphon-dev from build-deps
* Update maintainer field

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?
 
2
function preprocess () {
 
3
  // we'll need the eRm package, so in case it's not loaded...
 
4
?>
 
5
  require(eRm)
 
6
<?}
 
7
 
 
8
function calculate () {
 
9
}
 
10
 
 
11
function printout () {
 
12
        doPrintout (true);
 
13
}
 
14
 
 
15
function preview () {
 
16
        preprocess ();
 
17
        calculate ();
 
18
        doPrintout (false);
 
19
}
 
20
 
 
21
function doPrintout ($final) {
 
22
        // this function takes care of generating the code for the printout() section. If $final is set to true,
 
23
        // it generates the full code, including headers. If $final is set to false, only the essentials will
 
24
        // be generated.
 
25
 
 
26
  // let's read all values into php variables for the sake of readable code
 
27
  $inp_items        = getRK_val("inp_items");
 
28
  $spin_abilfrom    = getRK_val("spin_abilfrom");
 
29
  $spin_abilto      = getRK_val("spin_abilto");
 
30
  $spin_probfrom    = getRK_val("spin_probfrom");
 
31
  $spin_probto      = getRK_val("spin_probto");
 
32
  $annotation       = getRK_val("annotation");
 
33
  $chk_ask          = getRK_val("chk_ask");
 
34
  $chk_mplot        = getRK_val("chk_mplot");
 
35
 
 
36
  // in case there are generic plot options defined:
 
37
  $plot_options     = getRK_val("plotoptions.code.printout");
 
38
  $plot_ops_main    = getRK_val("plotoptions.main");
 
39
  $plot_ops_type    = getRK_val("plotoptions.pointtype");
 
40
  $plot_ops_xlab    = getRK_val("plotoptions.xlab");
 
41
  $plot_ops_ylab    = getRK_val("plotoptions.ylab");
 
42
 
 
43
  ///////////////////////////////////
 
44
  // check for selected options
 
45
  $options = array() ;
 
46
  // plot all items?
 
47
  if($inp_items) {
 
48
    // for user convenience, we replace "-", ";" and space, split all input into an array
 
49
    // and join it again, separated by commas:
 
50
    $inp_items = str_replace("-",":",$inp_items);
 
51
    $arr_items = split('[ ;]', $inp_items);
 
52
    $options[] = "item.subset=c(".join(",", $arr_items).")"; }
 
53
  if($chk_mplot == "mplot")
 
54
    $options[] = "mplot=TRUE" ;
 
55
  if($chk_ask != "ask")
 
56
    $options[] = "ask=FALSE" ;
 
57
 
 
58
  // more advanced options
 
59
  // user defined ranges? we'll round it to two digits
 
60
  if(($spin_abilfrom != "-4" || $spin_abilto != "4") && $spin_abilfrom < $spin_abilto)
 
61
    $options[] = "xlim=c(".round($spin_abilfrom,2).",".round($spin_abilto,2).")" ;
 
62
  if(($spin_probfrom != "0" || $spin_probto != "1") && $spin_probfrom < $spin_probto)
 
63
    $options[] = "ylim=c(".round($spin_probfrom,2).",".round($spin_probto,2).")" ;
 
64
  // annotate lines and show legend?
 
65
  if($annotation == "plain")
 
66
    $options[] = "legpos=FALSE" ;
 
67
 
 
68
        if ($final) { ?>
 
69
rk.header("Partial credit model plot")
 
70
 
 
71
rk.graph.on()
 
72
<?       }
 
73
        // only the following section will be generated for $final==false
 
74
 
 
75
        ?>
 
76
try(plotICC(<? getRK("x");
 
77
              if($options) echo(", ".join(", ", $options));
 
78
              if($plot_options) echo($plot_options);
 
79
          ?>))
 
80
<?
 
81
        if ($final) { ?>
 
82
rk.graph.off()
 
83
<? }
 
84
}
 
85
?>
 
 
b'\\ No newline at end of file'