<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class Poll_View_Helper_VoteHash extends Zend_View_Helper_Abstract
{
    private $element = array();

    public function voteHash(Poll_Model_Poll $poll = null)
    {
        $this->element = new Engine_Form_Element_Hash('token_poll_' . $poll->getIdentity(), array(
          'timeout' => 3600
        ));
        return $this;
    }

    public function getElement()
    {
        return $this->element;
    }

    public function generateHash()
    {
        $this->element->initCsrfToken();
        return $this->element->getHash();
    }

}
