$value) { if (property_exists(get_called_class(), $field)) { if (substr($field, 0, 5) == "vlan_" && !$value) { $model->$field = null; continue; } $model->$field = $value; } } $me = mfValuecache::singleton()->get("me"); if (!$me) { $me = new User(); $me->loadMe(); mfValuecache::singleton()->set("me", $me); } if ($model->create_by === null) { $model->create_by = $me->id; } if ($model->edit_by === null) { $model->edit_by = $me->id; } return $model; } public static function getpoprackmodule($poprack_id) { $items = []; $db = FronkDB::singleton(); $sql = "SELECT `id`, `name`, `start_he`,`end_he`,`plug`,`ports` FROM `Poprackmodule` WHERE `poprack_id`='" . $poprack_id . "' AND type ='0' ORDER by start_he"; $res = $db->query($sql); if ($db->num_rows($res)) { while ($data = $db->fetch_array($res)) { $items[] = $data; } $response['data'] = $items; $response['success'] = true; } else { $response['success'] = false; } echo json_encode($response); exit; } public static function getpoprackmoduleall($pop_id) { $items = []; $db = FronkDB::singleton(); $sql = "SELECT `Poprackmodule`.`id`, `Poprackmodule`.`name`, `Poprackmodule`.`start_he`,`Poprackmodule`.`end_he`,`Poprackmodule`.`plug`,`Poprackmodule`.`ports`,`Poprack`.id poprackid ,`Poprack`.name poprackname FROM `Poprackmodule` INNER JOIN `Poprack` ON (`Poprack`.`id` = `Poprackmodule`.`poprack_id`) WHERE `Poprack`.`pop_id`='" . $pop_id . "' AND `Poprackmodule`.`type` ='0' ORDER by `Poprack`.`sort`,`Poprackmodule`.`start_he`,`Poprackmodule`.`position`"; $res = $db->query($sql); if ($db->num_rows($res)) { while ($data = $db->fetch_array($res)) { $items[$data['poprackname']][] = $data; } $response['data'] = $items; $response['success'] = true; } else { $response['success'] = false; } echo json_encode($response); exit; } }