本文整理汇总了PHP中Poll::triggerStatistics方法的典型用法代码示例。如果您正苦于以下问题:PHP Poll::triggerStatistics方法的具体用法?PHP Poll::triggerStatistics怎么用?PHP Poll::triggerStatistics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Poll
的用法示例。
在下文中一共展示了Poll::triggerStatistics方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createCopy
/**
* Create a copy of an poll.
*
* @param string $p_title
* @param string $p_question
* @param array $p_answers
* @return Poll
*/
public function createCopy($p_data, $p_answers)
{
// Construct the duplicate poll object.
$poll_copy = new Poll();
$poll_copy->m_data['poll_nr'] = Poll::generatePollNumber();
$poll_copy->m_data['parent_poll_nr'] = $this->m_data['poll_nr'];
$poll_copy->m_data['fk_language_id'] = $this->m_data['fk_language_id'];
// Create the record
$values = array('title' => $p_data['title'], 'question' => $p_data['question'], 'date_begin' => $p_data['date_begin'], 'date_end' => $p_data['date_end'], 'nr_of_answers' => count($p_answers), 'votes_per_user' => $p_data['votes_per_user']);
$success = $poll_copy->__create($values);
if (!$success) {
return false;
}
// create an set of answers
PollAnswer::CreateCopySet($poll_copy->getNumber(), $this->m_data['fk_language_id'], $this->m_data['poll_nr'], $p_answers);
$poll_copy->triggerStatistics();
/*
if (function_exists("camp_load_translation_strings")) {
camp_load_translation_strings("api");
}
$logtext = getGS('Article #$1 "$2" ($3) translated to "$5" ($4)',
$this->getArticleNumber(), $this->getTitle(), $this->getLanguageName(),
$articleCopy->getTitle(), $articleCopy->getLanguageName());
Log::Message($logtext, null, 31);
*/
return $poll_copy;
}
示例2: vote
public function vote($p_value = 1)
{
if (!settype($p_value, 'float')) {
return false;
}
$this->setProperty('nr_of_votes', $this->getProperty('nr_of_votes') + 1);
$this->setProperty('value', $this->getProperty('value') + $p_value);
$this->setProperty('average_value', $this->getProperty('value') / $this->getProperty('nr_of_votes'));
$this->getPoll()->increaseUserVoteCount();
Poll::triggerStatistics($this->m_data['fk_poll_nr']);
}