1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109:
<?php
class PHPShopOpros extends PHPShopCore {
function __construct() {
global $PHPShopOprosElement;
$this->debug=false;
$this->element=$PHPShopOprosElement;
$this->action=array("post"=>"getopros","nav"=>"index","get"=>"add_forma");
parent::__construct();
}
function index() {
$PHPShopOrm = new PHPShopOrm($this->getValue('base.table_name21'));
$PHPShopOrm->debug=$this->debug;
$dataArray=$PHPShopOrm->select(array('*'),array('flag'=>"='1'"),array('order'=>'id DESC'),array('limit'=>10));
$content='';
if(is_array($dataArray))
foreach($dataArray as $row) {
$content.="<h1>".$row['name']."</h1>";
$content.=$this->element->getOprosValue($row['id'],"RESULT");
$content.='<p><br></p>';
}
$this->title="".$this->PHPShopSystem->getValue("name");
$this->set('oprosName',false);
$this->set('oprosContent',$content);
$this->parseTemplate($this->getValue('templates.opros_page_list'));
}
function getopros() {
if(!empty($_COOKIE['opros']))
$this->update($_POST['getopros'],false);
else {
setcookie("opros", $_POST['getopros'], time()+60*60*24*1, "/opros/", $_SERVER['SERVER_NAME'], 0);
$this->update($_POST['getopros'],true);
}
}
function update($valueID,$flag) {
$valueID=PHPShopSecurity::TotalClean($valueID,1);
if($flag) {
$PHPShopOrm = new PHPShopOrm($this->getValue('base.table_name20'));
$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'));
}
else {
$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'));
}
$this->parseTemplate($this->getValue('templates.news_forma_mesage'));
}
}
?>