$min_session_time = ortime__sesstime_to_unixtime($line['min_time']);
 $max_session_time = ortime__sesstime_to_unixtime($line['max_time']);
 $total_data = array();
 // pool
 $options = array('upper_experience_limit' => $min_session_time);
 $condition = array('clause' => " status_id > 0 AND creation_time < '" . $max_session_time . "' AND  \n\t\t\t\t  (deletion_time=0 OR deletion_time > '" . $min_session_time . "') ", 'pars' => array());
 $total_data['pool'] = stats__get_data($condition, 'report', array(), $options);
 // experiment eligible
 $options = array('upper_experience_limit' => $min_session_time, 'condition_only_on_pid' => true);
 $condition = array('clause' => "participant_id IN (SELECT participant_id FROM " . table('participate_at') . " \n\t\t\t\t\t\t\t\tWHERE experiment_id= :experiment_id )", 'pars' => array(':experiment_id' => $experiment_id));
 $total_data['exp'] = stats__get_data($condition, 'report', array(), $options);
 // participated
 $options = array('upper_experience_limit' => $min_session_time, 'condition_only_on_pid' => true);
 $participated_clause = expregister__get_pstatus_query_snippet("participated");
 $condition = array('clause' => "participant_id IN (SELECT participant_id FROM " . table('participate_at') . " \n\t\t\t\t\t\t\t\tWHERE experiment_id= :experiment_id AND session_id > 0 AND " . $participated_clause . ")", 'pars' => array(':experiment_id' => $experiment_id));
 $total_data['part'] = stats__get_data($condition, 'report', array(), $options);
 echo '<TABLE class="or_orr_section_content">';
 $i = 0;
 $cols = 2;
 $out = array();
 foreach ($total_data['pool'] as $k => $table1) {
     if (isset($table1['data']) && is_array($table1['data']) && count($table1['data']) > 0) {
         $show = true;
     } else {
         $show = false;
     }
     if ($show) {
         $out[] = stats__report_display_table($table1, lang('stats_report__pool'), $total_data['exp'][$k], lang('stats_report__assigned'), $total_data['part'][$k], lang('stats_report__participated'));
         if (count($out) == $cols) {
             echo '<TR><TD valign="top" align="center">' . implode('</TD><TD valign="top" align="center">', $out) . '</TD></TR>';
             echo '<TR><TD colspan="' . $cols . '">&nbsp;</TD></TR>';
Example #2
0
function stats__get_textstats_for_email()
{
    $condition = array('clause' => participant_status__get_pquery_snippet('eligible_for_experiments'), 'pars' => array());
    $stats_data = stats__get_data($condition, 'stats', array());
    $tout = '';
    foreach ($stats_data as $k => $table) {
        $tout .= stats__stats_display_textstats($table) . "\n\n";
    }
    return $tout;
}
        foreach ($posted as $s => $valarr) {
            if (is_array($valarr)) {
                foreach ($valarr as $k => $v) {
                    if ($v == 'y') {
                        $restrict[$s][$k] = true;
                    }
                }
            }
        }
    }
    if ($all) {
        $condition = array();
    } else {
        $condition = array('clause' => participant_status__get_pquery_snippet('eligible_for_experiments'), 'pars' => array());
    }
    $stats_data = stats__get_data($condition, 'stats', $restrict);
    $_SESSION['stats_data'] = $stats_data;
    echo '<center>';
    if ($browsable) {
        echo '<FORM action="' . thisdoc() . '" METHOD="POST">';
        echo '<INPUT type="hidden" name="all" value="' . urlencode($all) . '">';
    }
    echo '<TABLE border=0 cellspacing="0" width="100%">';
    echo '<TR><TD align="center">';
    echo '<TABLE class="or_page_subtitle" style="background: ' . $color['page_subtitle_background'] . '; color: ' . $color['page_subtitle_textcolor'] . '"><TR><TD>
			' . lang('subject_pool_statistics') . ' ' . $title_add . '
			</TD>';
    echo '<TD>';
    if ($all) {
        echo '<P align="right">' . button_link(thisdoc(), lang('stats_show_for_active'), 'dot-circle-o') . '</p>';
    } else {