static protected function action_save() {
$request = new \Request();
$selectedProducts = $request->myproducts; // Array of the selected products in the listbox
$selectedCategory = $request->category_id; // Product category selected in the dropdown
$productsDAO = new \app\model\ProductsDao(); // The custom DAO used to store the product data
foreach ($myproducts as $value) {
$productRow = array('product_id' => $value, 'category_id' => $selectedCategory); $productsDAO->store($productRow);
}
....
....
}
static protected function action_RecJugEquipos() {
$request = new \Request();
$selectJugadores = $request->jugadores; // Array of the selected products in the listbox
$selectEquipo = $request->equipo; // Product category selected in the dropdown
$jugadoresDAO = new \app\model\asigjugaDAO(); // The custom DAO used to store the product data
foreach ($myproducts as $value) {
$jugadoRow = array('id_jugador' => $value, 'id_equipo' => $selectEquipo);
$jugadoresDAO->store($jugadoRow);
}
// JSON Response $response = new \Response(); $response->setSuccessMessage("My response", "Action is OK"); return $response;
}
static protected function action_RecJugEquipos() {
$request = new \Request();
$selectJugadores = $request->jugadores; // Array of the selected products in the listbox
$selectEquipo = $request->equipo; // Product category selected in the dropdown
$jugadoresDAO = new \app\model\asigjugaDAO(); // The custom DAO used to store the product data
foreach (
$selectJugadores
as $value) {
$jugadoRow = array('id_jugador' => $value, 'id_equipo' => $selectEquipo);
$jugadoresDAO->store($jugadoRow);
}
// JSON Response
$response = new \Response();
$response->setSuccessMessage("Asingación", "Asignacion correcta");
return $response;
}
<script>
$(document).ready(function () {
/********* When the form is reset **********/
$('#znetdk_user_actions').zdkactionbar({
whenadd: function() {
// Refresh profiles in the listbox
$('#znetdk_user_dialog .zdk-listbox').zdklistbox('refresh');
// ....
},
whenedit: function() {
// Refresh profiles in the listbox keeping current selection
$('#znetdk_user_dialog .zdk-listbox').zdklistbox('refresh',true);
}
});
});
</script>