public function getAction($champion_name) { // Get the user chosen options from POST data $item_set = $this->request->getPost("item_set"); /** $skill_set = $this->request->getPost("skill_set"); **/ $combined_set = $this->request->getPost("combined_set"); if ($combined_set !== '') { $item_set = $combined_set; /** $skill_set = $combined_set; **/ } // Get the kind of set type to find $item_type = $item_set == "Overall" ? "overall" : "vs"; /** $skill_type = ($skill_set == "Overall") ? "overall" : "vs"; **/ // Convert champion names into IDs, to be used for CachedData conditionals $champion_result = Champion::findFirst("champion_name = '" . $champion_name . "'"); $champion_id = $champion_result->champion_id; $item_set_result = Champion::findFirst("champion_name = '" . $item_set . "'"); $vs_item_id = $item_set == "Overall" ? "overall" : $item_set_result->champion_id; /** $vs_skill_id = ($skill_set == "Overall") ? "overall" : Champion::find(array("champion_name" => $skill_set))->champion_id; **/ $find_item_set = CachedData::findFirst(array("conditionals = '" . json_encode(array("champion_id" => $champion_id, "vs_id" => $vs_item_id)) . "'")); $item_set_array = explode(' ', $find_item_set->value); /** $find_skill_set = CachedData::find( array( "type" => $skill_type . "_skill_set", "conditionals" => json_encode(array("champion_id" => $champion_id, "vs_id" => $vs_skill_id)) ) ); // Insert skill set into item set $json = json_decode($find_item_set->value, true); $json[blocks][0][type] = $find_skill_set->value; $json_data = json_encode($json); **/ $compiled_item_set = array("title" => $champion_name . " vs " . $item_set, "type" => "custom", "map" => "any", "mode" => "any", "priority" => false, "sortrank" => 1, "blocks" => array(array("type" => "Basic Items", "recMath" => false, "minSummonerLevel" => -1, "maxSummonerLevel" => -1, "showIfSummonerSpell" => "", "hideIfSummonerSpell" => "", "items" => array(array("id" => "2003", "count" => 1), array("id" => "3340", "count" => 1), array("id" => "3341", "count" => 1), array("id" => "3342", "count" => 1), array("id" => "2044", "count" => 1), array("id" => "2043", "count" => 1))), array("type" => "Item Set", "recMath" => false, "minSummonerLevel" => -1, "maxSummonerLevel" => -1, "showIfSummonerSpell" => "", "hideIfSummonerSpell" => "", "items" => array(array("id" => $item_set_array[0], "count" => 1), array("id" => $item_set_array[1], "count" => 1), array("id" => $item_set_array[2], "count" => 1), array("id" => $item_set_array[3], "count" => 1), array("id" => $item_set_array[4], "count" => 1), array("id" => $item_set_array[5], "count" => 1))))); // Get JSON data and location to be sent to user $filename = $champion_name . "VS" . $item_set . ".json"; $json_string = json_encode($compiled_item_set); // Send data back to user forwarding through setAction $this->dispatcher->forward(array("action" => "set", "params" => array($champion_name, $filename, $json_string))); }