'; $poll_results .= '0;'; } } if ( $poll_answers ) { $query = "SELECT COUNT(*) FROM ProfilesPolls WHERE id_profile = '" . $member['ID'] . "'"; $polls_num = db_arr( $query ); $profile_poll_num = getParam("profile_poll_num"); if ( $profile_poll_num && $polls_num[0] < $profile_poll_num ) { // limit number of polls $iAct = getParam("profile_poll_act") == 'on' ? 1 : 0; $query = "INSERT INTO ProfilesPolls ( id_profile, poll_question, poll_answers, poll_results, poll_status, poll_approval ) VALUES ( '{$member['ID']}', '" . process_db_input($_POST['question'], 1) . "', '{$poll_answers}', '{$poll_results}', 'active', '{$iAct}')"; db_res( $query ); $message = _t("_poll created"); } } } // --------------- page components $_ni = $_page['name_index']; $_page_cont[$_ni]['page_main_code'] = ThisPageMainCode(); // --------------- [END] page components PageCode(); // --------------- page components functions /** * page code function */ function ThisPageMainCode() { global $logged; global $member; // create poll section ------------------------------------------------------------------- $ret .= '
'; $query = "SELECT COUNT(`id_poll`) FROM `ProfilesPolls` WHERE `id_profile` = '{$member['ID']}'"; $ras_arr = db_arr( $query ); $polls_num = db_arr( $query ); $profile_poll_num = getParam("profile_poll_num"); if ( $profile_poll_num && $polls_num[0] < $profile_poll_num ) // limit number of polls $ret .= ShowPollCreationForm(); else $ret .= _t('_max_poll_reached'); $ret .= '
'; // show polls section -------------------------------------------------------------------- $ret .= '
'; $ret .= '
'; $query = "SELECT `id_poll`, `poll_status` FROM `ProfilesPolls` WHERE `id_profile` = '{$member['ID']}'"; $polls_num = db_res( $query ); while( $poll_arr = mysql_fetch_array ( $polls_num ) ) { $uID = $poll_arr['id_poll']; $ret .= '
'; $ret .= ShowPoll( $uID ); $ret .= '
'; //$ret .= '
' . _t('_controls') . ':
'; $sCurStatus = ''; $sCTStatus = ''; $status_change_to = ''; if ( 'active' == $poll_arr['poll_status'] ) { $sCurStatus = _t('_Active'); $sCTStatus = _t('_Disabled'); $status_change_to = 'disabled'; } else { $sCurStatus = _t('_Disabled'); $sCTStatus = _t('_Active'); $status_change_to = 'active'; } $ret .= ""; $ret .= ''. _t('_delete') .''; $ret .= ''; $ret .= '
'; $ret .= '
'; } // if no polls if ( !$uID ) $ret .= _t_err('_no poll'); $ret .= '
'; $ret .= '
'; return $ret; } function ShowPollCreationForm() { ob_start(); ?>
:
:
|