| version 1.10, 2005/11/28 15:14:10 |
version 1.11, 2005/11/28 23:04:47 |
| Line 1109 function ezin_get_poll($section_id, $lan |
|
| Line 1109 function ezin_get_poll($section_id, $lan |
|
| if ($section_id > 0) { |
if ($section_id > 0) { |
| $query = 'SELECT' |
$query = 'SELECT' |
| .' polls.id poll_id,' |
.' polls.id poll_id,' |
| .' polls.question poll_question' |
.' polls.votes poll_votes,' |
| |
.' polls.answers poll_answers,' |
| |
.' polls.question poll_question,' |
| |
.' polls.description poll_description' |
| .' FROM '.$ezin_sys['db']['tables']['polls'].' AS polls' |
.' FROM '.$ezin_sys['db']['tables']['polls'].' AS polls' |
| .' WHERE polls.section_id = '.$section_id |
.' WHERE polls.section_id = '.$section_id |
| .' AND polls.dt_valid_from <= SYSDATE()' |
.' AND polls.dt_valid_from <= SYSDATE()' |
| Line 1140 function ezin_get_poll($section_id, $lan |
|
| Line 1143 function ezin_get_poll($section_id, $lan |
|
| if (strlen($ids_str)) { |
if (strlen($ids_str)) { |
| $query = 'SELECT' |
$query = 'SELECT' |
| .' polls.id poll_id,' |
.' polls.id poll_id,' |
| .' polls.question poll_question' |
.' polls.votes poll_votes,' |
| |
.' polls.answers poll_answers,' |
| |
.' polls.question poll_question,' |
| |
.' polls.description poll_description' |
| .' FROM '.$ezin_sys['db']['tables']['polls'].' AS polls' |
.' FROM '.$ezin_sys['db']['tables']['polls'].' AS polls' |
| .' WHERE polls.section_id IN ('.$ids_str.')' |
.' WHERE polls.section_id IN ('.$ids_str.')' |
| .' AND polls.dt_valid_from <= SYSDATE()' |
.' AND polls.dt_valid_from <= SYSDATE()' |
| Line 1154 function ezin_get_poll($section_id, $lan |
|
| Line 1160 function ezin_get_poll($section_id, $lan |
|
| return $row; |
return $row; |
| } |
} |
| } |
} |
| |
return array( |
| return array('id' => 0, 'question' => ''); |
'poll_id' => 0, |
| |
'poll_votes' => 0, |
| |
'poll_answers' => 0, |
| |
'poll_question' => '' |
| |
); |
| } /* }}} */ |
} /* }}} */ |
| |
|
| function ezin_get_poll_answer_list($poll_id) /* {{{ */ |
function ezin_get_poll_answer_list($poll_id) /* {{{ */ |
| Line 1214 function ezin_is_valid_poll($poll_answer |
|
| Line 1224 function ezin_is_valid_poll($poll_answer |
|
| return is_array($row) ? $row[0] : 0; |
return is_array($row) ? $row[0] : 0; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| function ezin_poll_answer_vote($poll_answer_id) /* {{{ */ |
function ezin_poll_answer_vote($poll_answer_id, $poll_id = 0) /* {{{ */ |
| { |
{ |
| global $ezin_sys; |
global $ezin_sys; |
| global $ezin_db_handle; |
global $ezin_db_handle; |
| $poll_answer_id = intval($poll_answer_id); |
$poll_answer_id = intval($poll_answer_id); |
| |
$poll_id = intval($poll_id); |
| $query = sprintf('UPDATE %s SET votes = votes + 1 WHERE id = %d', |
$query = sprintf('UPDATE %s SET votes = votes + 1 WHERE id = %d', |
| $ezin_sys['db']['tables']['poll_answers'], $poll_answer_id); |
$ezin_sys['db']['tables']['poll_answers'], $poll_answer_id); |
| $result = @mysql_query($query, $ezin_db_handle) |
$result = @mysql_query($query, $ezin_db_handle) |
| or ezin_db_error('ezin_poll_answer_vote()'); |
or ezin_db_error('ezin_poll_answer_vote() [1]'); |
| |
if ($poll_id > 0) { |
| |
$query = sprintf('UPDATE %s SET votes = votes + 1 WHERE id = %d', |
| |
$ezin_sys['db']['tables']['polls'], $poll_id); |
| |
$result = @mysql_query($query, $ezin_db_handle) |
| |
or ezin_db_error('ezin_poll_answer_vote() [2]'); |
| |
} |
| return true; |
return true; |
| } /* }}} */ |
} /* }}} */ |
| |
|