Every time I select the parameters in the Select2 boxes and hit submit the page shows me an HTTP ERROR 500.
This is what I have in my Report.php setup function:
$query_params = array();
if($this->params["bot_type"]!=array())
{
$query_params[":bot_type"] = $this->params["bot_type"];
}
if($this->params["bot_name"]!=array())
{
$query_params[":bot_name"] = $this->params["bot_name"];
}
if($this->params["event"]!=array())
{
$query_params[":event"] = $this->params["event"];
}
$this->src("bots")->query("select
bot_type,
bot_name,
event
from botfacts;
".(($this->params["bot_type"]!=array())?"and bot_type in (:bot_type)":"")."
".(($this->params["bot_name"]!=array())?"and bot_name in (:bot_name)":"")."
".(($this->params["event"]!=array())?"and event in (:event)":"")."
")->params($query_params)
->pipe($this->dataStore("botfacts"));
This is what I have in my Report.view.php:
<form method="post">
<div class="row">
<div class="col-md-6">
<div class="form-group" style="width:30%;">
<b>Select BotType</b>
<?php
Select2::create(array(
"multiple"=>true,
"name"=>"bot_type",
"dataSource"=>$this->src("bots")->query("
select bot_type
from botfacts
group by bot_type
"),
"attributes"=>array(
"class"=>"form-control"
)
));
?>
</div>
<div class="form-group" style="width:30%;">
<b>Select BotName</b>
<?php
Select2::create(array(
"multiple"=>true,
"name"=>"bot_name",
"dataSource"=>$this->src("bots")->query("
select bot_name
from botfacts
group by bot_name
"),
"attributes"=>array(
"class"=>"form-control"
)
));
?>
</div>
<div class="form-group" style="width:30%;">
<b>Select Event</b>
<?php
Select2::create(array(
"multiple"=>true,
"name"=>"event",
"dataSource"=>$this->src("bots")->query("
select event
from botfacts
group by event
"),
"attributes"=>array(
"class"=>"form-control"
)
));
?>
</div>
<div class="form-group">
<button class="btn btn-primary">Submit</button>
</div>
</div>
</div>
</form>
<div style="width:25%;">
<?php
Table::create(array(
"dataSource"=>$this->dataStore("botfacts"),
"columns"=>array(
"bot_type",
"bot_name",
"event"
),
"paging"=>array(
"pageSize"=>9
),
"cssClass"=>array(
"table"=>"table-bordered"
)
));
?>
</div>
</div>