Your IP : 216.73.216.170


Current Path : /var/www/iplanru/data/www/i-plan.ru/components/com_poll/views/poll/tmpl/
Upload File :
Current File : /var/www/iplanru/data/www/i-plan.ru/components/com_poll/views/poll/tmpl/page_nap_sel0.php

<?php
defined( '_JEXEC' ) or die;



$document =& JFactory::getDocument();


$document->addScript('http://code.jquery.com/ui/1.10.3/jquery-ui.js');
$document->addStyleSheet('/components/com_poll/assets/ui/jquery-ui.css');

?>

<div id="system">
	<article class="item">
		<header>
			<h1 class="title">Опрос</h1>
		</header>
		
		<div class="pool">
		

			<div id="pool-top"><?php echo $componentParams->get('top_text', ''); ?></div>
			<div class="content clearfix">
				<form name="poolform" action="<?php echo JRoute::_("index.php?option=com_poll&view=poll"); ?>" method="post">
					<?php
					
					$sql="SELECT * FROM #__pollquestions where state=1 order by ordering";
					
					$count='';
					$db->setQuery($sql, 0, $count);
					$rows = $db->loadAssocList();
					
					
					if (count($rows)<>0)
					{
						
						
						
						foreach ($rows as $row)
						{
							$ans=explode("\r\n",$row['param']);
							foreach($ans as $item)
							{
								$par=explode(":",$item);
								$param[trim($par[0])]=trim($par[1]);
							}
							
							
							if ($row['type']=="text")
							{
								echo "<label id=\"text\">{$row['question']}</label><br><input type=\"text\" name=\"field_{$row['id']}\" value=\"\" /><hr>";
							}
							
							if ($row['type']=="textarea")
							{
								echo "<label id=\"textarea\">{$row['question']}</label><br><textarea rows=\"10\" cols=\"45\" name=\"field_{$row['id']}\" ></textarea><hr>";
							}
							
							if ($row['type']=="list")
							{
								echo "<label id=\"list\">{$row['question']}</label><br>";
								$answ=explode("\r\n",$row['answers']);
								foreach($answ as $item)
								{
									echo "<input type=\"radio\" name=\"field_{$row['id']}\" value=\"{$item}\">{$item}<br>";
								}
								unset($answ);
								echo "<hr>";
							}
							
							if ($row['type']=="slider")
							{
								if ($param['text-before']) echo '<p id="pool-text-before">'.$param['text-before'].'</p>';
								
								$document->addScriptDeclaration('
jQuery(document).ready(function () {
	jQuery("#slider").slider({
		value:'.$param['value'].',
		min: '.$param['min'].',
		max: '.$param['max'].',
		step: '.$param['step'].',
		slide: function( event, ui ) {
			jQuery( "#amount" ).val( ui.value );
		}
	});
jQuery( "#amount" ).val( jQuery( "#slider" ).slider( "value" ) );
});  
								');
								
								echo "<label  for=\"amount\">{$row['question']}</label><br>";								
								echo '<table><tr>';
								if ($param['prefix']) echo '<td style="width: 20%; padding: 10px;"><p id="pool-prefix">'.$param['prefix'].'</p></td>';
										
								echo '<td style="width: 50%; padding: 10px;">';
								
								//zasechki			
								echo '<table width=100%><tr>';
									for ($i = $param['min']; $i <= $param['max']; $i=$i+$param['step']) 
									{
										echo '<td style="text-align: center; width: 10%">'.$i.'</td>';
									}
								echo '</tr></table>';
								
								echo '<div id="slider" style="margin: 10px;"></div>';
								echo '<p style="text-align: center;">время выполнения в неделях</p>';
								echo '<input name="field_'.$row['id'].'" type="hidden" id="amount" style="border:0; color:#f6931f; font-weight:bold; text-align: center;" readonly="readonly" />';		
								echo '</td>';
								
								if ($param['sufix']) echo '<td style="width: 20%; padding: 10px;"><p id="pool-sufix">'.$param['sufix'].'</p></td>';
								echo '</tr></table>';
								
								
								if ($param['text-after']) echo '<p id="pool-text-after">'.$param['text-after'].'</p>';
							}
						}
						echo '<br>';
						echo "<input type=\"hidden\" name=\"selector\" value=\"1\" />";
						echo "<div  onclick=\"document.poolform.submit()\" id=\"submit\" ><span>ОТПРАВИТЬ ОТВЕТЫ</span></div>";
						echo "<img id=\"pool-logo\" src=\"/images/newstyle/opros/logo_intesco.png\"/>";
					}
							
					?>
					<?php echo JHtml::_( 'form.token' ); ?>
				</form>
			</div>
			<div id="pool-btm"><?php echo $componentParams->get('btm_text', ''); ?></div>
		

		
		</div>
		
	</article>
</div>