Example #1
0
/**
 *  Generate formatted data for highcharts
 *
 */
function graph_results($results)
{
    $string = '';
    $tmp_objective = '';
    foreach ($results as $row) {
        if ($tmp_objective !== js_special_chars($row->skills_group)) {
            if (!empty($tmp_objective)) {
                $string = substr("{$string}", 0, -2);
                $string .= "]}, {";
            }
            $tmp_objective = js_special_chars($row->skills_group);
            $string .= "name:'{$tmp_objective}',\ndata:[";
        }
        $string .= $row->user_percentage;
        $string .= ', ';
    }
    $string = substr("{$string}", 0, -2);
    $string .= "]";
    return $string;
}
    }
    ?>
');
  while ($('#opt_login_table tbody>tr').size() < <?php 
    echo count($options['users']);
    ?>
) { $("#opt_login_add").click(); }
  while ($('#opt_login_table tbody>tr').size() > <?php 
    echo max(1, count($options['users']));
    ?>
) { $('#opt_login_table tbody>tr:last').remove(); }
<?php 
    $i = 0;
    foreach ($options['users'] as $k => $v) {
        $k = js_special_chars($k);
        $v = js_special_chars($v);
        echo "  \$('#opt_login_table [name=users[]]').eq({$i}).val('{$k}');\n";
        echo "  \$('#opt_login_table [name=passwords[]]').eq({$i}).val('{$v}');\n";
        $i++;
    }
    ?>
  if ($('#opt_forbidden_filetypes_block').attr('checked')) { $('#opt_rename_these_filetypes_to_0').hide(); }
  else { $('#opt_rename_these_filetypes_to_0').show(); }
  if ($('#opt_login').attr('checked')) { $('#opt_login_0').show(); }
  else { $('#opt_login_0').hide(); }
  if ($('#opt_new_window').attr('checked')) { $('#opt_new_window_0').show(); }
  else { $('#opt_new_window_0').hide(); }
}

function set_element_val(id, value, display) {
  display = (typeof display == 'undefined') ? value : display;