Ejemplo n.º 1
0
 /**
  * Edits an exclusion
  *
  * @return Redirect
  * @author Dan Cox
  */
 public function editExcludes($id)
 {
     $exclude = DB::find('Exclusion', $id);
     $exclude->setLabel(Input::get('label'))->setDay(Input::get('day'))->setTimes(Input::get('times'));
     $errors = Validator::make($exclude);
     if (count($errors) > 0) {
         return Redirect::route('page.editExcludes', ['id' => $exclude->id])->withInput()->withErrors($errors)->send();
     }
     DB::save($exclude);
     return Redirect::route('page.editExcludes', ['id' => $exclude->id])->with('success', 'Successfully edited exclusion')->send();
 }
Ejemplo n.º 2
0
 /**
  * Edits an activity
  *
  * @return void
  * @author Dan Cox
  */
 public function editActivities($id)
 {
     $activity = DB::find('Activity', $id);
     $activity->setLabel(Input::get('label'))->setHours(Input::has('hours') ? Input::get('hours') : NULL)->setDay(Input::has('day') ? Input::get('day') : NULL)->setTimes(Input::has('times') ? Input::get('times') : NULL);
     $errors = Validator::make($activity);
     if (count($errors) > 0) {
         return Redirect::route('page.editActivities', ['id' => $activity->id])->withInput()->withErrors($errors)->send();
     }
     DB::save($activity);
     return Redirect::route('page.editActivities', ['id' => $activity->id])->with('success', 'Edited activity details')->send();
 }
Ejemplo n.º 3
0
 /**
  * Edits the passed scheduleid
  *
  * @return Redirect
  * @author Dan Cox
  */
 public function editSchedule($id)
 {
     $schedule = DB::find('Schedule', $id);
     $schedule->setName(Input::get('name'))->setDescription(Input::get('description'))->setUpdatedAt(date('Y-m-d H:i:s'));
     $errors = Validator::make($schedule);
     if (count($errors) > 0) {
         return Redirect::route('page.editSchedule', ['id' => $id])->withErrors($errors)->withInput()->send();
     }
     DB::save($schedule);
     return Redirect::route('page.editSchedule', ['id' => $id])->with('success', 'Successfully edited schedule')->send();
 }
Ejemplo n.º 4
0
 public function save($where = array(), $arr = array())
 {
     if (count($where) >= 1) {
         foreach ($where as $k => $v) {
             $str .= $k . '="' . $v . '" and ';
         }
         $str = substr($str, 0, -5);
     } else {
         return 'error';
     }
     return DB::save($this->_table, $arr, $str);
 }
Ejemplo n.º 5
0
 public function save()
 {
     $key = $this->dbPrimaryKey;
     $params = [$key => $this->{$key}];
     $data = [];
     $databaseColumns = DB::getColumns($this->dbTable);
     foreach ($databaseColumns as $column) {
         if (property_exists($this, $column->Field)) {
             $property = $column->Field;
             $data[$property] = $this->{$property};
         }
     }
     return DB::save($this->dbTable, $data, $params);
 }
Ejemplo n.º 6
0
 public function save()
 {
     if ($this->getName() == '') {
         throw new Exception(__('Le nom de la commande ne peut pas être vide :', __FILE__) . print_r($this, true));
     }
     if ($this->getType() == '') {
         throw new Exception($this->getHumanName() . ' ' . __('Le type de la commande ne peut pas être vide :', __FILE__) . print_r($this, true));
     }
     if ($this->getSubType() == '') {
         throw new Exception($this->getHumanName() . ' ' . __('Le sous-type de la commande ne peut pas être vide :', __FILE__) . print_r($this, true));
     }
     if ($this->getEqLogic_id() == '') {
         throw new Exception($this->getHumanName() . ' ' . __('Vous ne pouvez pas créer une commande sans la rattacher à un équipement', __FILE__));
     }
     if ($this->getConfiguration('maxValue') != '' && $this->getConfiguration('minValue') != '' && $this->getConfiguration('minValue') > $this->getConfiguration('maxValue')) {
         throw new Exception($this->getHumanName() . ' ' . __('La valeur minimum de la commande ne peut etre supérieur à la valeur maximum', __FILE__));
     }
     if ($this->getEqType() == '') {
         $this->setEqType($this->getEqLogic()->getEqType_name());
     }
     DB::save($this);
     $mc = cache::byKey('cmd' . $this->getId());
     if ($mc->getLifetime() != $this->getCacheLifetime()) {
         $mc->remove();
     }
     $this->getEqLogic()->emptyCacheWidget();
     return true;
 }
Ejemplo n.º 7
0
<?php

include "DB.php";
$tarea = $_POST['task'];
$id = isset($_POST['id']) ? $_POST['id'] : 0;
if ($tarea != "") {
    $db = new DB("root", "110992", "localhost", "todo");
    $data = [];
    if ($id == 0) {
        $data = ['task' => $tarea];
    } else {
        $data = ['task' => $tarea, 'id' => $id];
    }
    $db->save("tasks", $data);
}
header("Location:index.php");
Ejemplo n.º 8
0
<?php

include "DB.php";
$en_uso = $_POST['en_uso'];
$id_habitacion = $_POST['id_habitacion'];
$id_entrenador = $_POST['id_entrenador'];
$id = isset($_POST['id']) ? $_POST['id'] : 0;
if ($en_uso != 0) {
    $db = new DB("root", "110992", "localhost", "centrospokemon");
    $data = array();
    if ($id == 0) {
        $data = array('en_uso' => $nombre, 'id_habitacion' => $id_habitacion, 'id_entrenador' => $id_entrenador);
        $db->save("camas", $data);
        header("Location:camas.php");
    } else {
        $data = array('en_uso' => $en_uso, 'id_habitacion' => $id_habitacion, 'id_entrenador' => $id_entrenador, 'id' => $id);
        $db->save("camas", $data);
        header("Location:updatecamas.php");
    }
}
Ejemplo n.º 9
0
<?php

include "DB.php";
$id = isset($_POST['id']) ? $_POST['id'] : 0;
$especie = $_POST['especie'];
$alias = $_POST['alias'];
$sexo = $_POST['sexo'];
$nivel = $_POST['nivel'];
$es_intercambiable = $_POST['es_intercambiable'];
$hit_points = $_POST['hit_points'];
$ataque = $_POST['ataque'];
$defensa = $_POST['defensa'];
$velocidad = $_POST['velocidad'];
$evasion = $_POST['evasion'];
$prezision = $_POST['prezision'];
$estatus = $_POST['estatus'];
if ($especie != 0) {
    $db = new DB("root", "110992", "localhost", "centrospokemon");
    $data = array();
    if ($id == 0) {
        $data = array('especie' => $especie, 'alias' => $alias, 'sexo' => $sexo, 'nivel' => $nivel, 'es_intercambiable' => $es_intercambiable, 'hit_points' => $hit_points, 'ataque' => $ataque, 'defensa' => $defensa, 'velocidad' => $velocidad, 'evasion' => $evasion, 'prezision' => $prezision, 'estatus' => $estatus);
        $db->save("pokemon", $data);
        header("Location:pokemon.php");
    } else {
        $data = array('especie' => $especie, 'alias' => $alias, 'sexo' => $sexo, 'nivel' => $nivel, 'es_intercambiable' => $es_intercambiable, 'hit_points' => $hit_points, 'ataque' => $ataque, 'defensa' => $defensa, 'velocidad' => $velocidad, 'evasion' => $evasion, 'prezision' => $prezision, 'estatus' => $estatus, 'id' => $id);
        $db->save("pokemon", $data);
        header("Location:updatepokemon.php");
    }
}
Ejemplo n.º 10
0
 public function getFriend($id)
 {
     $db = new DB();
     $db->table("user")->pk("id");
     $rs = $db->find($id);
     var_dump($rs);
     parent::setData($rs);
     // $this->username = '******';
     $this->age = 20;
     var_dump($this->getData());
     $db->save($this->getData());
     // $db->save();
 }
Ejemplo n.º 11
0
<?php

include "DB.php";
$nombre = $_POST['nombre'];
$id = isset($_POST['id']) ? $_POST['id'] : 0;
if ($nombre != "") {
    $db = new DB("root", "110992", "localhost", "centrospokemon");
    $data = array();
    if ($id == 0) {
        $data = array('nombre' => $nombre);
    } else {
        $data = array('nombre' => $nombre, 'id' => $id);
    }
}
$db->save("catalogo_habilidades", $data);
header("Location:catalogo_habilidades.php");
Ejemplo n.º 12
0
 public function save()
 {
     if ($this->getLastLaunch() == '' && ($this->getMode() == 'schedule' || $this->getMode() == 'all')) {
         $calculateScheduleDate = $this->calculateScheduleDate();
         $this->setLastLaunch($calculateScheduleDate['prevDate']);
     }
     if ($this->getId() != '') {
         $this->emptyCacheWidget();
     }
     DB::save($this);
     if ($this->_changeState) {
         @nodejs::pushUpdate('eventScenario', $this->getId());
     }
 }
Ejemplo n.º 13
0
<?php

include "DB.php";
$id = isset($_POST['id']) ? $_POST['id'] : 0;
$tipo = $_POST['tipo'];
$fecha_nacimiento = $_POST['fecha_nacimiento'];
$fecha_graduacion = $_POST['fecha_graduacion'];
$id_enfermera = $_POST['id_enfermera'];
$id_centro_pokemon = $_POST['id_centro_pokemon'];
if ($fecha_nacimiento != "") {
    $db = new DB("root", "110992", "localhost", "centrospokemon");
    $data = array();
    if ($id == 0) {
        $data = array('tipo' => $tipo, 'fecha_nacimiento' => $fecha_nacimiento, 'fecha_graduacion' => $fecha_graduacion, 'id_enfermera' => $id_enfermera, 'id_centro_pokemon' => $id_centro_pokemon);
        $db->save("ayudantes", $data);
        header("Location:ayudantes.php");
    } else {
        $data = array('tipo' => $tipo, 'fecha_nacimiento' => $fecha_nacimiento, 'fecha_graduacion' => $fecha_graduacion, 'id_enfermera' => $id_enfermera, 'id_centro_pokemon' => $id_centro_pokemon, 'id' => $id);
        $db->save("ayudantes", $data);
        header("Location:updateayudantes.php");
    }
}
Ejemplo n.º 14
0
<?php

include "DB.php";
$suspendido = $_GET['suspendido'];
$id = isset($_GET['id']) ? $_GET['id'] : 0;
if ($suspendido != "") {
    $db = new DB("root", "110992", "localhost", "centrospokemon");
    $data = array();
    if ($id != 0) {
        $data = array('suspendido' => $suspendido, 'id' => $id);
    }
}
$db->save("pokebolas", $data);
header("Location:consultapokebola.php");
Ejemplo n.º 15
0
<?php

include "DB.php";
$enfermera_entrada = $_POST['enfermera_entrada'];
$fecha_entrada = $_POST['fecha_entrada'];
$id_regenerador = $_POST['id_regenerador'];
$hit_points = $_POST['hit_points'];
$estatus = $_POST['estatus'];
$id_pokebola = $_POST['id_pokebola'];
$suspendido = $_POST['suspendido'];
$id = isset($_POST['id']) ? $_POST['id'] : 0;
if ($enfermera_entrada != 0) {
    $db = new DB("root", "110992", "localhost", "centrospokemon");
    $data = array();
    if ($id == 0) {
        $data = array('enfermera_entrada' => $enfermera_entrada, 'fecha_entrada' => $fecha_entrada, 'id_regenerador' => $id_regenerador, 'hit_points' => $hit_points, 'estatus' => $estatus, 'id_pokebola' => $id_pokebola, 'suspendido' => $suspendido);
        $db->save("registros", $data);
        header("Location:registros.php");
    } else {
        $data = array('enfermera_entrada' => $enfermera_entrada, 'fecha_entrada' => $fecha_entrada, 'id_regenerador' => $id_regenerador, 'hit_points' => $hit_points, 'estatus' => $estatus, 'id_pokebola' => $id_pokebola, 'enfermera_salida' => $enfermera_salida, 'fecha_estimada' => $fecha_estimada, 'fecha_salida' => $fecha_salida, 'suspendido' => $suspendido, 'id' => $id);
        $db->save("registros", $data);
        header("Location:registrosfinal.php");
    }
}
Ejemplo n.º 16
0
<?php

include "DB.php";
$id = isset($_POST['id']) ? $_POST['id'] : 0;
$id_pokemon = $_POST['id_pokemon'];
$id_tipo = $_POST['id_tipo'];
if ($id_pokemon != 0) {
    $db = new DB("root", "110992", "localhost", "centrospokemon");
    $data = array();
    if ($id == 0) {
        $data = array('id_pokemon' => $id_pokemon, 'id_tipo' => $id_tipo);
    } else {
        $data = array('id_pokemon' => $id_pokemon, 'id_tipo' => $id_tipo, 'id' => $id);
    }
    $db->save("tipos", $data);
}
header("Location:catalogo_pokemon.php");
Ejemplo n.º 17
0
 public function save($_direct = false)
 {
     if ($this->getName() == '') {
         throw new Exception(__('Le nom de l\'équipement ne peut pas être vide : ', __FILE__) . print_r($this, true));
     }
     if ($this->getId() != '') {
         $this->emptyCacheWidget();
         $this->setConfiguration('updatetime', date('Y-m-d H:i:s'));
     } else {
         $this->setConfiguration('createtime', date('Y-m-d H:i:s'));
     }
     return DB::save($this, $_direct);
 }
<?php

include "DB.php";
$id = isset($_POST['id']) ? $_POST['id'] : 0;
$slots = $_POST['slots'];
$slots_funcionales = $_POST['slots_funcionales'];
$esta_mantenimiento = $_POST['esta_mantenimiento'];
$id_centro_pokemon = $_POST['id_centro_pokemon'];
if ($slots_funcionales != "") {
    $db = new DB("root", "110992", "localhost", "centrospokemon");
    $data = array();
    if ($id == 0) {
        $data = array('slots' => $slots, 'slots_funcionales' => $slots_funcionales, 'esta_mantenimiento' => $esta_mantenimiento, 'id_centro_pokemon' => $id_centro_pokemon);
        $db->save("regeneradores", $data);
        header("Location:regeneradores.php");
    } else {
        $data = array('slots' => $slots, 'slots_funcionales' => $slots_funcionales, 'esta_mantenimiento' => $esta_mantenimiento, 'id_centro_pokemon' => $id_centro_pokemon, 'id' => $id);
    }
    $db->save("regeneradores", $data);
    header("Location:updateregeneradores.php");
}
Ejemplo n.º 19
0
 /**
  * Update IconMap.
  * @param array $iconMaps
  * @return array
  */
 public function update(array $iconMaps)
 {
     if (USER_TYPE_SUPER_ADMIN != self::$userData['type']) {
         self::exception(ZBX_API_ERROR_PERMISSIONS, _('Only Super Admins can update icon maps.'));
     }
     $iconMaps = zbx_toArray($iconMaps);
     $iconMapids = zbx_objectValues($iconMaps, 'iconmapid');
     $updates = [];
     $duplicates = [];
     foreach ($iconMaps as $iconMap) {
         if (!check_db_fields(['iconmapid' => null], $iconMap)) {
             self::exception(ZBX_API_ERROR_PARAMETERS, _s('Incorrect parameters for icon map update method "%s".', $iconMap['name']));
         }
         if (isset($iconMap['name'])) {
             if (zbx_empty($iconMap['name'])) {
                 self::exception(ZBX_API_ERROR_PARAMETERS, _s('Icon map name cannot be empty.'));
             } elseif (isset($duplicates[$iconMap['name']])) {
                 self::exception(ZBX_API_ERROR_PARAMETERS, _s('Cannot create icon maps with identical name "%s".', $iconMap['name']));
             } else {
                 $duplicates[$iconMap['name']] = $iconMap['name'];
             }
         }
     }
     $this->validateMappings($iconMaps, false);
     $iconMapsUpd = API::IconMap()->get(['iconmapids' => $iconMapids, 'output' => API_OUTPUT_EXTEND, 'preservekeys' => true, 'selectMappings' => API_OUTPUT_EXTEND]);
     $oldIconMappings = [];
     $newIconMappings = [];
     foreach ($iconMaps as $iconMap) {
         if (!isset($iconMapsUpd[$iconMap['iconmapid']])) {
             self::exception(ZBX_API_ERROR_PARAMETERS, _s('Icon map with iconmapid "%s" does not exist.', $iconMap['iconmapid']));
         }
         // Existence
         if (isset($iconMap['name'])) {
             $iconMapExists = $this->get(['filter' => ['name' => $iconMap['name']], 'output' => ['iconmapid'], 'editable' => true, 'nopermissions' => true, 'preservekeys' => true]);
             if (($iconMapExists = reset($iconMapExists)) && bccomp($iconMapExists['iconmapid'], $iconMap['iconmapid']) != 0) {
                 self::exception(ZBX_API_ERROR_PARAMETERS, _s('Icon map "%s" already exists.', $iconMap['name']));
             }
         }
         if (isset($iconMap['mappings'])) {
             $mappingsDb = $iconMapsUpd[$iconMap['iconmapid']]['mappings'];
             foreach ($mappingsDb as $mapping) {
                 $oldIconMappings[] = $mapping;
             }
             foreach ($iconMap['mappings'] as $mapping) {
                 $mapping['iconmapid'] = $iconMap['iconmapid'];
                 $newIconMappings[] = $mapping;
             }
         }
         $iconMapid = $iconMap['iconmapid'];
         unset($iconMap['iconmapid']);
         if (!empty($iconMap)) {
             $updates[] = ['values' => $iconMap, 'where' => ['iconmapid' => $iconMapid]];
         }
     }
     DB::save('icon_map', $iconMaps);
     DB::replace('icon_mapping', $oldIconMappings, $newIconMappings);
     return ['iconmapids' => $iconMapids];
 }
Ejemplo n.º 20
0
 public function save()
 {
     if ($this->getQuery() == '') {
         throw new Exception(__('La commande (demande) ne peut pas être vide', __FILE__));
     }
     $this->setLink_id(str_replace('#', '', jeedom::fromHumanReadable($this->getLink_id())));
     return DB::save($this);
 }
Ejemplo n.º 21
0
 public function save()
 {
     if ($this->getQuery() == '') {
         throw new Exception(__('La commande vocale ne peut pas être vide', __FILE__));
     }
     if ($this->getInteractDef_id() == '') {
         throw new Exception(__('SarahDef_id ne peut pas être vide', __FILE__));
     }
     return DB::save($this);
 }
Ejemplo n.º 22
0
 public function save()
 {
     DB::save($this);
 }
Ejemplo n.º 23
0
<?php

include "DB.php";
$id = isset($_POST['id']) ? $_POST['id'] : 0;
$nombre = $_POST['nombre'];
$apellidos = $_POST['apellidos'];
$fecha_nacimiento = $_POST['fecha_nacimiento'];
$fecha_graduacion = $_POST['fecha_graduacion'];
$cedula = $_POST['cedula'];
$id_centro_pokemon = $_POST['id_centro_pokemon'];
if ($nombre != "") {
    $db = new DB("root", "110992", "localhost", "centrospokemon");
    $data = array();
    if ($id == 0) {
        $data = array('nombre' => $nombre, 'apellidos' => $apellidos, 'fecha_nacimiento' => $fecha_nacimiento, 'fecha_graduacion' => $fecha_graduacion, 'cedula' => $cedula, 'id_centro_pokemon' => $id_centro_pokemon);
        $db->save("enfermeras", $data);
        header("Location:enfermeras.php");
    } else {
        $data = array('nombre' => $nombre, 'apellidos' => $apellidos, 'fecha_nacimiento' => $fecha_nacimiento, 'fecha_graduacion' => $fecha_graduacion, 'cedula' => $cedula, 'id_centro_pokemon' => $id_centro_pokemon, 'id' => $id);
        $db->save("enfermeras", $data);
        header("Location:updateenfermeras.php");
    }
}
Ejemplo n.º 24
0
<?php

include "DB.php";
$nombre = $_POST['nombre'];
$tiempo = $_POST['tiempo'];
$desaparece_a = $_POST['desaparece_a'];
$id = isset($_POST['id']) ? $_POST['id'] : 0;
if ($nombre != "") {
    $db = new DB("root", "110992", "localhost", "centrospokemon");
    $data = array();
    if ($id == 0) {
        $data = array('nombre' => $nombre, 'tiempo' => $tiempo, 'desaparece_a' => $desaparece_a);
    } else {
        $data = array('nombre' => $nombre, 'tiempo' => $tiempo, 'desaparece_a' => $desaparece_a, 'id' => $id);
    }
}
$db->save("catalogo_estatus", $data);
header("Location:catalogo_estatus.php");
Ejemplo n.º 25
0
<?php

include "DB.php";
$suspendido = $_GET['suspendido'];
$id = isset($_GET['id']) ? $_GET['id'] : 0;
if ($suspendido != "") {
    $db = new DB("root", "110992", "localhost", "centrospokemon");
    $data = array();
    if ($id != 0) {
        $data = array('suspendido' => $suspendido, 'id' => $id);
    }
}
$db->save("habitaciones", $data);
header("Location:consultahabitaciones.php");
<?php

include "DB.php";
$id = isset($_POST['id']) ? $_POST['id'] : 0;
$id_prevolucion = $_POST['id_prevolucion'];
$id_evolucion = $_POST['id_evolucion'];
if ($id_prevolucion != 0) {
    $db = new DB("root", "110992", "localhost", "centrospokemon");
    $data = array();
    if ($id == 0) {
        $data = array('id_prevolucion' => $id_prevolucion, 'id_evolucion' => $id_evolucion);
    } else {
        $data = array('id_prevolucion' => $id_prevolucion, 'id_evolucion' => $id_evolucion, 'id' => $id);
    }
    $db->save("evoluciones", $data);
}
header("Location:catalogo_pokemon.php");
Ejemplo n.º 27
0
<?php

include "DB.php";
$suspendido = $_POST['suspendido'];
$id = isset($_POST['id']) ? $_POST['id'] : 0;
if ($suspendido != "") {
    $db = new DB("root", "110992", "localhost", "centrospokemon");
    $data = array();
    if ($id != 0) {
        $data = array('suspendido' => $suspendido, 'id' => $id);
    }
}
$db->save("entrenadores", $data);
header("Location:updateentrenadores.php");
<?php

include "DB.php";
$id = isset($_POST['id']) ? $_POST['id'] : 0;
$id_pokemon = $_POST['id_pokemon'];
$id_habilidad = $_POST['id_habilidad'];
if ($id_pokemon != 0) {
    $db = new DB("root", "110992", "localhost", "centrospokemon");
    $data = array();
    if ($id == 0) {
        $data = array('id_pokemon' => $id_pokemon, 'id_habilidad' => $id_habilidad);
    } else {
        $data = array('id_pokemon' => $id_pokemon, 'id_habilidad' => $id_habilidad, 'id' => $id);
    }
    $db->save("habilidades", $data);
}
header("Location:catalogo_pokemon.php");
Ejemplo n.º 29
0
 public function save()
 {
     return DB::save($this);
 }
Ejemplo n.º 30
0
 /**
  * Updates the host prototypes and propagates the changes to linked hosts and templates.
  *
  * @param array $hostPrototypes
  *
  * @return array
  */
 protected function updateReal(array $hostPrototypes)
 {
     // save the host prototypes
     foreach ($hostPrototypes as $hostPrototype) {
         DB::updateByPk($this->tableName(), $hostPrototype['hostid'], $hostPrototype);
     }
     $exHostPrototypes = $this->get(['output' => ['hostid'], 'selectGroupLinks' => API_OUTPUT_EXTEND, 'selectGroupPrototypes' => API_OUTPUT_EXTEND, 'selectTemplates' => ['templateid'], 'selectInventory' => API_OUTPUT_EXTEND, 'hostids' => zbx_objectValues($hostPrototypes, 'hostid'), 'preservekeys' => true]);
     // update related objects
     $inventoryCreate = [];
     $inventoryDeleteIds = [];
     foreach ($hostPrototypes as $key => $hostPrototype) {
         $exHostPrototype = $exHostPrototypes[$hostPrototype['hostid']];
         // group prototypes
         if (isset($hostPrototype['groupPrototypes'])) {
             foreach ($hostPrototype['groupPrototypes'] as &$groupPrototype) {
                 $groupPrototype['hostid'] = $hostPrototype['hostid'];
             }
             unset($groupPrototype);
             // save group prototypes
             $exGroupPrototypes = zbx_toHash(array_merge($exHostPrototype['groupLinks'], $exHostPrototype['groupPrototypes']), 'group_prototypeid');
             $modifiedGroupPrototypes = [];
             foreach ($hostPrototype['groupPrototypes'] as $groupPrototype) {
                 if (isset($groupPrototype['group_prototypeid'])) {
                     unset($exGroupPrototypes[$groupPrototype['group_prototypeid']]);
                 }
                 $modifiedGroupPrototypes[] = $groupPrototype;
             }
             if ($exGroupPrototypes) {
                 $this->deleteGroupPrototypes(array_keys($exGroupPrototypes));
             }
             $hostPrototypes[$key]['groupPrototypes'] = DB::save('group_prototype', $modifiedGroupPrototypes);
         }
         // templates
         if (isset($hostPrototype['templates'])) {
             $existingTemplateIds = zbx_objectValues($exHostPrototype['templates'], 'templateid');
             $newTemplateIds = zbx_objectValues($hostPrototype['templates'], 'templateid');
             $this->unlink(array_diff($existingTemplateIds, $newTemplateIds), [$hostPrototype['hostid']]);
             $this->link(array_diff($newTemplateIds, $existingTemplateIds), [$hostPrototype['hostid']]);
         }
         // inventory
         if (isset($hostPrototype['inventory'])) {
             $inventory = zbx_array_mintersect(['inventory_mode'], $hostPrototype['inventory']);
             $inventory['hostid'] = $hostPrototype['hostid'];
             if ($hostPrototype['inventory'] && (!isset($hostPrototype['inventory']['inventory_mode']) || $hostPrototype['inventory']['inventory_mode'] != HOST_INVENTORY_DISABLED)) {
                 if ($exHostPrototype['inventory']) {
                     DB::update('host_inventory', ['values' => $inventory, 'where' => ['hostid' => $inventory['hostid']]]);
                 } else {
                     $inventoryCreate[] = $inventory;
                 }
             } else {
                 $inventoryDeleteIds[] = $hostPrototype['hostid'];
             }
         }
     }
     // save inventory
     DB::insert('host_inventory', $inventoryCreate, false);
     DB::delete('host_inventory', ['hostid' => $inventoryDeleteIds]);
     // TODO: REMOVE info
     $updatedHostPrototypes = $this->get(['hostids' => zbx_objectValues($hostPrototypes, 'hostid'), 'output' => ['host'], 'selectParentHost' => ['host'], 'nopermissions' => true]);
     foreach ($updatedHostPrototypes as $hostProtototype) {
         info(_s('Updated: Host prototype "%1$s" on "%2$s".', $hostProtototype['host'], $hostProtototype['parentHost']['host']));
     }
     return $hostPrototypes;
 }