load->helper('url'); $this->load->helper('form'); $link_back = 'admin/spell_tool'; $name_effect = 'effect'; $attr_effect = 'class="drop"'; $attr_drop = 'class="drop"'; $attr_duration = array( 'name' => 'duration', 'class' => 'input'); $attr_cooldown = array( 'name' => 'cooldown', 'class' => 'input'); $attr_description = array( 'name' => 'description', 'rows' => '5', 'cols' => '50', 'class' => 'textarea'); $attr_description_admin = array( 'name' => 'description_admin', 'rows' => '5', 'cols' => '50', 'class' => 'textarea'); $attr_cost_food = array( 'name' => 'cost_food', 'class' => 'input'); $attr_cost_wood = array( 'name' => 'cost_wood', 'class' => 'input'); $attr_cost_stone = array( 'name' => 'cost_stone', 'class' => 'input'); $attr_cost_iron = array( 'name' => 'cost_iron', 'class' => 'input'); $attr_cost_mana = array( 'name' => 'cost_mana', 'class' => 'input'); $attr_mod_max_food = array( 'name' => 'mod_max_food', 'class' => 'input'); $attr_mod_max_wood = array( 'name' => 'mod_max_wood', 'class' => 'input'); $attr_mod_max_stone = array( 'name' => 'mod_max_stone', 'class' => 'input'); $attr_mod_max_iron = array( 'name' => 'mod_max_iron', 'class' => 'input'); $attr_mod_max_mana = array( 'name' => 'mod_max_mana', 'class' => 'input'); $attr_mod_rate_food = array( 'name' => 'mod_rate_food', 'class' => 'input'); $attr_mod_rate_wood = array( 'name' => 'mod_rate_wood', 'class' => 'input'); $attr_mod_rate_stone = array( 'name' => 'mod_rate_stone', 'class' => 'input'); $attr_mod_rate_iron = array( 'name' => 'mod_rate_iron', 'class' => 'input'); $attr_mod_rate_mana = array( 'name' => 'mod_rate_mana', 'class' => 'input'); $attr_mod_percent_food = array( 'name' => 'mod_percent_food', 'class' => 'input'); $attr_mod_percent_wood = array( 'name' => 'mod_percent_wood', 'class' => 'input'); $attr_mod_percent_stone = array( 'name' => 'mod_percent_stone', 'class' => 'input'); $attr_mod_percent_iron = array( 'name' => 'mod_percent_iron', 'class' => 'input'); $attr_mod_percent_mana = array( 'name' => 'mod_percent_mana', 'class' => 'input'); $attr_submit = array( 'name' => 'submit', 'value' => 'Submit', 'class' => 'submit'); if ($new) { //set every value with set_value() $link_form = 'admin/spell'; //spell effect goes from controller $attr_duration['value'] = set_value('duration'); $attr_cooldown['value'] = set_value('cooldown'); $attr_description['value'] = set_value('description'); $attr_description_admin['value'] = set_value('description_admin'); $attr_cost_food['value'] = set_value('cost_food'); $attr_cost_wood['value'] = set_value('cost_wood'); $attr_cost_stone['value'] = set_value('cost_stone'); $attr_cost_iron['value'] = set_value('cost_iron'); $attr_cost_mana['value'] = set_value('cost_mana'); $attr_mod_max_food['value'] = set_value('mod_max_food'); $attr_mod_max_wood['value'] = set_value('mod_max_wood'); $attr_mod_max_stone['value'] = set_value('mod_max_stone'); $attr_mod_max_iron['value'] = set_value('mod_max_iron'); $attr_mod_max_mana['value'] = set_value('mod_max_mana'); $attr_mod_rate_food['value'] = set_value('mod_rate_food'); $attr_mod_rate_wood['value'] = set_value('mod_rate_wood'); $attr_mod_rate_stone['value'] = set_value('mod_rate_stone'); $attr_mod_rate_iron['value'] = set_value('mod_rate_iron'); $attr_mod_rate_mana['value'] = set_value('mod_rate_mana'); $attr_mod_percent_food['value'] = set_value('mod_percent_food'); $attr_mod_percent_wood['value'] = set_value('mod_percent_wood'); $attr_mod_percent_stone['value'] = set_value('mod_percent_stone'); $attr_mod_percent_iron['value'] = set_value('mod_percent_iron'); $attr_mod_percent_mana['value'] = set_value('mod_percent_mana'); } else { //set every value from data sent $link_form = 'admin/spell/' . $spell['id']; $seff = $spell['effect']; $attr_duration['value'] = $spell['duration']; $attr_cooldown['value'] = $spell['cooldown']; $attr_description['value'] = $spell['description']; $attr_description_admin['value'] = $spell['description_admin']; $sweather = $spell['weather_change_to']; $attr_cost_food['value'] = $spell['cost_food']; $attr_cost_wood['value'] = $spell['cost_wood']; $attr_cost_stone['value'] = $spell['cost_stone']; $attr_cost_iron['value'] = $spell['cost_iron']; $attr_cost_mana['value'] = $spell['cost_mana']; $attr_mod_max_food['value'] = $spell['mod_max_food']; $attr_mod_max_wood['value'] = $spell['mod_max_wood']; $attr_mod_max_stone['value'] = $spell['mod_max_stone']; $attr_mod_max_iron['value'] = $spell['mod_max_iron']; $attr_mod_max_mana['value'] = $spell['mod_max_mana']; $attr_mod_rate_food['value'] = $spell['mod_rate_food']; $attr_mod_rate_wood['value'] = $spell['mod_rate_wood']; $attr_mod_rate_stone['value'] = $spell['mod_rate_stone']; $attr_mod_rate_iron['value'] = $spell['mod_rate_iron']; $attr_mod_rate_mana['value'] = $spell['mod_rate_mana']; $attr_mod_percent_food['value'] = $spell['mod_percent_food']; $attr_mod_percent_wood['value'] = $spell['mod_percent_wood']; $attr_mod_percent_stone['value'] = $spell['mod_percent_stone']; $attr_mod_percent_iron['value'] = $spell['mod_percent_iron']; $attr_mod_percent_mana['value'] = $spell['mod_percent_mana']; } ?>