function al_Main($atts) { global $wpdb, $current_user, $al_lang, $post; $a = shortcode_atts(array('al_id' => $post->ID), $atts); $return = '<div id="al_table_cont_' . $a['al_id'] . '" class="al_table_cont">'; if ($current_user->ID > 0) { $return .= '<table id="al_head_' . $a['al_id'] . '"><tr><td class="al_head"><strong>' . $al_lang['question'] . '</strong> </td><td class="al_head">' . '<a href="#" id="al_vote1_' . $a['al_id'] . '" title="1" class="al_btn al_btn_' . $a['al_id'] . '">' . $al_lang['vote1'] . '</a> ' . '<a href="#" id="al_vote2_' . $a['al_id'] . '" title="2" class="al_btn al_btn_' . $a['al_id'] . '">' . $al_lang['vote2'] . '</a> ' . '<a href="#" id="al_vote3_' . $a['al_id'] . '" title="3" class="al_btn al_btn_' . $a['al_id'] . '">' . $al_lang['vote3'] . '</a> ' . '<span id="al_state_' . $a['al_id'] . '" class="al_state"></span></td></tr></table>'; $wp_user_search = $wpdb->get_results("SELECT ID, display_name FROM {$wpdb->users} ORDER BY user_nicename"); $return .= '<table id="al_head_' . $a['al_id'] . '"><tr><td class="al_head">'; /*$return.= '<form name="formulaire">';*/ $return .= '<select id="boite1" name="boite1" onChange=""> '; $return .= '<option selected value="-1">Choisissez un nom</option> '; foreach ($wp_user_search as $userid) { $user_id = (int) $userid->ID; $user_info = get_userdata($user_id); if ($user_info->user_login != 'arruanais' && $user_info->user_login != 'admin') { $return .= '<option value="' . $user_id . '">' . $user_info->display_name . '</option> '; } } $return .= '</select>'; $return .= '</td>'; //$return .= '<td class="al_head"><strong>'.$al_lang['question2'].'</strong> </td>'; $return .= '<td class="al_head">' . '<a href="#" id="al_vote1_' . $a['al_id'] . '" title="1" class="al_btn al_btn2_' . $a['al_id'] . '">' . $al_lang['vote1'] . '</a> ' . '<a href="#" id="al_vote2_' . $a['al_id'] . '" title="2" class="al_btn al_btn2_' . $a['al_id'] . '">' . $al_lang['vote2'] . '</a> ' . '<a href="#" id="al_vote3_' . $a['al_id'] . '" title="3" class="al_btn al_btn2_' . $a['al_id'] . '">' . $al_lang['vote3'] . '</a> ' . '<span id="al_state2_' . $a['al_id'] . '" class="al_state"></span></td></tr></table>'; } else { $return .= '<table><tr><td>' . $al_lang['login'] . '</td></tr></table>'; } $return .= '<div id="al_cont_' . $a['al_id'] . '">' . al_DrawList($a['al_id']) . '</div></div>'; $return .= "<script language='javascript'>\n\tjQuery(document).ready(function(){\n\t jQuery('.al_btn_" . $a['al_id'] . "').click(function() {\n\t \tjQuery('#al_state_" . $a['al_id'] . "').html('<img src=\"" . get_bloginfo('wpurl') . "/wp-content/plugins/attendance-list/img/ajax-loader.gif\" />');\n\t param=jQuery(this).attr('title');\n\t jQuery.post('" . get_bloginfo('wpurl') . "/wp-content/plugins/attendance-list/response.php', { al_vote: param, al_postid:" . $a['al_id'] . ", al_user_ID:" . $current_user->ID . " }, \n\t function(data){ \n\t if(data) {\n\t\t\tjQuery('#al_cont_" . $a['al_id'] . "').html(data);\n\t\t\tjQuery('#al_state_" . $a['al_id'] . "').html('');\n\t }\n\t }, \n\t 'html');\n\t return false;\n\t });\n\t\n\t jQuery('.al_btn2_" . $a['al_id'] . "').click(function() {\n\t\tvar e = document.getElementById('boite1');\n\t\tvar strUser = e.options[e.selectedIndex].value;\n\t \tjQuery('#al_state2_" . $a['al_id'] . "').html('<img src=\"" . get_bloginfo('wpurl') . "/wp-content/plugins/attendance-list/img/ajax-loader.gif\" />');\n\t \tparam=jQuery(this).attr('title');\n\t \tjQuery.post('" . get_bloginfo('wpurl') . "/wp-content/plugins/attendance-list/response.php', { al_vote: param, al_postid:" . $a['al_id'] . ", al_user_ID: strUser }, \n\t \tfunction(data){ \n\t \t\tif(data) {\n\t\t\t\tjQuery('#al_cont_" . $a['al_id'] . "').html(data);\n\t\t\t\tjQuery('#al_state2_" . $a['al_id'] . "').html('');\n\t \t\t}\n\t \t}, \n\t \t'html');\n\t return false;\n\t });\n\t});\n\t</script>"; return $return; }
function al_Main() { global $wpdb, $current_user, $al_lang, $post; $return = '<div id="al_table_cont_' . $post->ID . '" class="al_table_cont">'; if ($current_user->ID > 0) { $return .= '<table id="al_head_' . $post->ID . '"><tr><td class="al_head"><strong>' . $al_lang['question'] . '</strong> </td><td class="al_head">' . '<a href="#" id="al_vote1_' . $post->ID . '" title="1" class="al_btn al_btn_' . $post->ID . '">' . $al_lang['vote1'] . '</a> ' . '<a href="#" id="al_vote2_' . $post->ID . '" title="2" class="al_btn al_btn_' . $post->ID . '">' . $al_lang['vote2'] . '</a> ' . '<a href="#" id="al_vote3_' . $post->ID . '" title="3" class="al_btn al_btn_' . $post->ID . '">' . $al_lang['vote3'] . '</a> ' . '<span id="al_state_' . $post->ID . '" class="al_state"></span></td></tr></table>'; } else { $return .= '<table><tr><td>' . $al_lang['login'] . '</td></tr></table>'; } $return .= '<div id="al_cont_' . $post->ID . '">' . al_DrawList() . '</div></div>'; $return .= "<script language='javascript'>\n\tjQuery(document).ready(function(){\n\t jQuery('.al_btn_" . $post->ID . "').click(function() {\n\t \tjQuery('#al_state_" . $post->ID . "').html('<img src=\"" . get_bloginfo('wpurl') . "/wp-content/plugins/attendance-list/img/ajax-loader.gif\" />');\n\t param=jQuery(this).attr('title');\n\t jQuery.post('" . get_bloginfo('wpurl') . "/wp-content/plugins/attendance-list/response.php', { al_vote: param, al_postid:" . $post->ID . " }, \n\t function(data){ \n\t if(data) {\n\t\t\tjQuery('#al_cont_" . $post->ID . "').html(data);\n\t\t\tjQuery('#al_state_" . $post->ID . "').html('');\n\t }\n\t }, \n\t 'html');\n\t return false;\n\t });\n\t});\n\t</script>"; return $return; }
function al_AjaxVote($vars) { global $wpdb, $current_user, $al_lang; $res = al_AddVote(intval($vars["al_postid"]), intval($vars["al_vote"]), intval($vars["al_user_ID"])); //return al_DrawList(intval($vars["al_postid"]), intval($current_user->ID)); return al_DrawList(intval($vars["al_postid"]), intval($vars["al_user_ID"])); }