Source for file opros.core.php
Documentation is available at opros.core.php
* @author PHPShop Software
global $PHPShopOprosElement;
$this->element= $PHPShopOprosElement;
$this->action= array("post"=> "getopros","nav"=> "index","get"=> "add_forma");
* Экшен по умолчанию, вывод результата опроса
$PHPShopOrm->debug= $this->debug;
$dataArray= $PHPShopOrm->select(array('*'),array('flag'=> "='1'"),array('order'=> 'id DESC'),array('limit'=> 10));
foreach($dataArray as $row) {
$content.= "<h1>". $row['name']. "</h1>";
$content.= $this->element->getOprosValue($row['id'],"RESULT");
$this->title= "Опрос - ". $this->PHPShopSystem->getValue("name");
$this->set('oprosName',false);
$this->set('oprosContent',$content);
* Экшен обновления опроса при наличии переменной $_POST[getopros]
if(!empty($_COOKIE['opros']))
$this->update($_POST['getopros'],false);
setcookie("opros", $_POST['getopros'], time()+ 60* 60* 24* 1, "/opros/", $_SERVER['SERVER_NAME'], 0);
$this->update($_POST['getopros'],true);
* @param int $valueID ИД опроса
* @param Bool $flag проверка на новый голос
function update($valueID,$flag) {
$dataArray= $PHPShopOrm->select(array('total'),array('id'=> "=$valueID"),false,array('limit'=> 1));
$total= $dataArray['total']+ 1;
$PHPShopOrm->update(array('total'=> $total),array('id'=> "=$valueID"),$prefix= '');
$this->set('mesageText','<FONT style="font-size:14px;color:red"><B>'. $this->getValue('lang.good_opros_mesage_1'). '</B></FONT>
<BR>'. $this->getValue('lang.good_opros_mesage_2'));
$this->set('mesageText','<FONT style="font-size:14px;color:red"><B>'. $this->getValue('lang.bad_opros_mesage_1'). '</B></FONT>
<BR>'. $this->getValue('lang.bad_opros_mesage_2'));
|