<?php
/**
 * ThunderSnarf
 *
 * @author Ricardo H.F. Sette P. <ricardohfsp@gmail.com>
 * @link http://www.freebsdbrasil.com.br/
 * @copyright Copyright &copy; 2010 - FreeBSD Brasil LTDA
 * @license licença GNU/GPL v2.0 http://www.gnu.org/licenses/gpl-2.0.html
 */
?>
<div class="wide form">

<p>
Você pode, opcionalmente, digitar um operador de comparação (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) no início de cada valor para especificar como a comparação deve ser feita.
</p>
<?php $form=$this->beginWidget('CActiveForm', array(
	'action'=>Yii::app()->createUrl($this->route),
	'method'=>'get',
)); ?>
	<div class="row">
		<?php echo $form->label($model,'id'); ?>
		<?php echo $form->textField($model,'id'); ?>
	</div>

	<div class="row">
		<?php echo $form->label($model,'domain_id'); ?>
		<?php
		$array_plugins = array();
		foreach(Yii::app()->user->getState('thunderplugin',array("vazio")) as $key=>$value){
			$id_domain = Domain::model()->find("t.domain='$value'");
			if(isset($id_domain->id)){
				$array_plugins[$id_domain->id] = $value;
			}
		}
		echo CHtml::activeDropDownList(
						$model,
						'domain_id',		
						$array_plugins,
						array('empty'=>'Todos')
					); 
		?>
	</div>

	<div class="row">
		<?php echo $form->label($model,'file'); ?>
		<?php echo $form->textField($model,'file',array('size'=>60,'maxlength'=>300)); ?>
	</div>

	<div class="row">
		<?php echo $form->label($model,'size'); ?>
		<?php echo $form->textField($model,'size',array('value'=>isset($_GET["File"]["size"])?$_GET["File"]["size"]:'')); ?> em bytes
	</div>

	<div class="row">
		<?php echo $form->label($model,'requested'); ?>
		<?php echo $form->textField($model,'requested',array('value'=>isset($_GET["File"]["requested"])?$_GET["File"]["requested"]:'')); ?>
	</div>
	
	<div class="row">
        <?php 
        echo $form->label($model,'ultimaSolicitacaoA');
        echo $form->textField($model,'ultimaSolicitacaoA',array('value'=>isset($_GET["File"]["ultimaSolicitacaoA"])?$_GET["File"]["ultimaSolicitacaoA"]:''));
		echo " até ";
        echo $form->textField($model,'ultimaSolicitacaoB',array('value'=>isset($_GET["File"]["ultimaSolicitacaoB"])?$_GET["File"]["ultimaSolicitacaoB"]:''));
		$basePath=Yii::getPathOfAlias('zii.vendors.jui');
		$baseUrl=Yii::app()->getAssetManager()->publish($basePath);
		$scriptUrl=$baseUrl.'/js';
		$themeUrl=$baseUrl.'/css';
		$cs=Yii::app()->getClientScript();
		$cs->registerCssFile($themeUrl.'/base/jquery-ui.css');
		$cs->registerCoreScript('jquery');
		Yii::app()->getClientScript()->registerScriptFile($scriptUrl.'/'.'jquery-ui.min.js',CClientScript::POS_END);
		Yii::app()->clientScript->registerScript('datas','
		    $(function() {
				var dates = $(\'#File_ultimaSolicitacaoA, #File_ultimaSolicitacaoB\').datepicker(jQuery.extend(jQuery.datepicker.regional[\'pt-BR\'],{
					defaultDate: "+1w",
					dateFormat: "dd-mm-yy",
					changeMonth: true,
					changeYear: true,
					numberOfMonths: 3,
					maxDate: "+0D",
					showAnim: "",
					showOn: "both",
					buttonImage: "'.Yii::app()->request->baseUrl.'/images/calendar.gif",
					buttonImageOnly: "true",
					onSelect: function(selectedDate) {
						var option = this.id == "File_ultimaSolicitacaoA" ? "minDate" : "maxDate";
						var instance = $(this).data("datepicker");
						var date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
						dates.not(this).datepicker("option", option, date);
					}
				}));
			});
		'
		,CClientScript::POS_READY);
		?>
    </div>

	<div class="row">
		<?php echo $form->label($model,'cache_static'); ?>
		<?php echo $form->textField($model,'cache_static',array('value'=>isset($_GET["File"]["cache_static"])?$_GET["File"]["cache_static"]:'')); ?> em bytes
	</div>

	<div class="row">
		<?php echo $form->label($model,'cache_dynamic'); ?>
		<?php echo $form->textField($model,'cache_dynamic',array('value'=>isset($_GET["File"]["cache_dynamic"])?$_GET["File"]["cache_dynamic"]:'')); ?> em bytes
	</div>

	<div class="row">
		<?php echo $form->label($model,'traffic_static'); ?>
		<?php echo $form->textField($model,'traffic_static',array('value'=>isset($_GET["File"]["traffic_static"])?$_GET["File"]["traffic_static"]:'')); ?> em bytes
	</div>

	<div class="row">
		<?php echo $form->label($model,'traffic_dynamic'); ?>
		<?php echo $form->textField($model,'traffic_dynamic',array('value'=>isset($_GET["File"]["traffic_dynamic"])?$_GET["File"]["traffic_dynamic"]:'')); ?> em bytes
	</div>

	<div class="row">
		<?php echo $form->label($model,'hit_static'); ?>
		<?php echo $form->textField($model,'hit_static',array('value'=>isset($_GET["File"]["hit_static"])?$_GET["File"]["hit_static"]:'')); ?>
	</div>

	<div class="row">
		<?php echo $form->label($model,'hit_dynamic'); ?>
		<?php echo $form->textField($model,'hit_dynamic',array('value'=>isset($_GET["File"]["hit_dynamic"])?$_GET["File"]["hit_dynamic"]:'')); ?>
	</div>

	<div class="row">
		<?php echo $form->label($model,'miss_static'); ?>
		<?php echo $form->textField($model,'miss_static',array('value'=>isset($_GET["File"]["miss_static"])?$_GET["File"]["miss_static"]:'')); ?>
	</div>

	<div class="row">
		<?php echo $form->label($model,'miss_dynamic'); ?>
		<?php echo $form->textField($model,'miss_dynamic',array('value'=>isset($_GET["File"]["miss_dynamic"])?$_GET["File"]["miss_dynamic"]:'')); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton('Filtrar'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- search-form -->