$columns[] = $k;
         }
     }
 }
 if (count($columns) == 0) {
     message(lang('no_data_columns_selected'));
     redirect('admin/' . thisdoc());
 } else {
     $query = "SELECT count(*) as num_matches, " . implode(', ', $columns) . "\n                    FROM " . table('participants') . "\n                    GROUP BY " . implode(', ', $columns) . "\n                    HAVING num_matches>1\n                    ORDER BY num_matches DESC";
     $result = or_query($query);
     $dupvals = array();
     while ($line = pdo_fetch_assoc($result)) {
         $dupvals[] = $line;
     }
     if (check_allow('participants_edit')) {
         echo javascript__edit_popup();
     }
     $part_statuses = participant_status__get_statuses();
     $cols = participant__get_result_table_columns('result_table_search_duplicates');
     echo '<TABLE class="or_listtable"><thead>';
     echo '<TR style="background: ' . $color['list_header_background'] . '; color: ' . $color['list_header_textcolor'] . ';">';
     echo '<TD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>';
     echo participant__get_result_table_headcells($cols, false);
     echo '</TR></thead>
             <tbody>';
     $num_cols = count($cols) + 1;
     foreach ($dupvals as $dv) {
         $mvals = array();
         $pars = array();
         $qclause = array();
         foreach ($columns as $c) {
Example #2
0
function query_show_query_result($query_arr, $type = "participants_search_active", $allow_sort = true)
{
    global $lang, $color, $settings;
    $allow_edit = check_allow('participants_edit');
    // prepare edit popup
    if (($type == 'participants_search_active' || $type == 'participants_search_all' || $type == 'participants_unconfirmed') && $allow_edit) {
        echo javascript__edit_popup();
    }
    $result = or_query($query_arr['query'], $query_arr['pars']);
    $count_results = pdo_num_rows($result);
    echo '<B>' . $count_results . ' ' . lang('xxx_participants_in_result_set') . '</B>';
    if ($type == 'assign') {
        echo '<BR>' . lang('only_ny_assigned_part_showed');
    } elseif ($type == 'deassign') {
        echo '<BR>' . lang('only_assigned_part_ny_reg_shownup_part_showed');
    }
    echo '<BR><BR>';
    if ($type == 'participants_search_active' || $type == 'participants_search_all') {
        query__resulthead_participantsearch();
    } elseif ($type == 'assign' || $type == 'deassign') {
        query__resulthead_assign($type);
    }
    if ($type == 'participants_search_active') {
        $cols = participant__get_result_table_columns('result_table_search_active');
    } elseif ($type == 'participants_search_all') {
        $cols = participant__get_result_table_columns('result_table_search_all');
    } elseif ($type == 'participants_unconfirmed') {
        $cols = participant__get_result_table_columns('result_table_search_unconfirmed');
    } else {
        $cols = participant__get_result_table_columns('result_table_assign');
    }
    echo '<table class="or_listtable" style="width: 95%;">';
    echo '<thead>';
    echo '<TR style="background: ' . $color['list_header_background'] . '; color: ' . $color['list_header_textcolor'] . ';">';
    echo participant__get_result_table_headcells($cols, $allow_sort);
    echo '</TR>';
    echo '</thead><tbody>';
    $shade = false;
    $assign_ids = array();
    while ($p = pdo_fetch_assoc($result)) {
        if ($type == 'participants_unconfirmed') {
            $assign_ids[] = $p['email'];
        } else {
            $assign_ids[] = $p['participant_id'];
        }
        echo '<tr class="small"';
        if ($shade) {
            echo ' bgcolor="' . $color['list_shade1'] . '"';
        } else {
            echo 'bgcolor="' . $color['list_shade2'] . '"';
        }
        echo '>';
        echo participant__get_result_table_row($cols, $p);
        echo '</tr>';
        if ($shade) {
            $shade = false;
        } else {
            $shade = true;
        }
    }
    echo '</tbody></table>';
    return $assign_ids;
}