This topic is locked

Option Grid for Notification Subscription

3/15/2024 1:32:45 PM
PHPRunner General questions
D
druck281 author

I am looking to expand my notifications to make them user-confirgurable. I am basically looking to do something similar to the way the Admin Area is set up. I want a list of events down the side of the page with columns at the top for 'On Screen', 'SMS' and 'Email'. From the user profile page, users would select the checkbox for the notification events that they want and how they want to receive them. I can design the DB very similar to the user groups that are built into PHPRunner but I have no idea how to design the Edit page for the grid. Has anyone done anything like this that is dynamic (so I don't have to manually redsign the page whenever a new notification event is added)?

Thanks,
-Jason

fhumanes 3/15/2024

Hello,

I would work with this model:

img alt

-- -----------------------------------------------------
-- Table `mydb`.`user`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`user` (
`id_user` INT NOT NULL AUTO_INCREMENT,
`login` VARCHAR(16) NOT NULL,
`password` VARCHAR(200) NOT NULL,
`name` VARCHAR(100) NOT NULL,
`email` VARCHAR(100) NOT NULL,
`telephone` VARCHAR(20) NOT NULL,
PRIMARY KEY (`id_user`),
UNIQUE INDEX `login_UNIQUE` (`login` ASC))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`config_event`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`config_event` (
`id_config_event` INT NOT NULL AUTO_INCREMENT,
`event_code` VARCHAR(15) NOT NULL,
`event_name` VARCHAR(100) NULL,
PRIMARY KEY (`id_config_event`),
UNIQUE INDEX `event_code_UNIQUE` (`event_code` ASC),
UNIQUE INDEX `event_name_UNIQUE` (`event_name` ASC))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`config_notification`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`config_notification` (
`id_config_notification` INT NOT NULL AUTO_INCREMENT,
`user_id` INT NOT NULL,
`config_event_id` INT NOT NULL,
`on_screen` VARCHAR(1) NULL DEFAULT '0',
`sms` VARCHAR(1) NULL DEFAULT '0',
`email` VARCHAR(1) NULL DEFAULT '0',
PRIMARY KEY (`id_config_notification`),
INDEX `fk_config_notification_user_idx` (`user_id` ASC),
INDEX `fk_config_notification_config_event1_idx` (`config_event_id` ASC),
CONSTRAINT `fk_config_notification_user`
FOREIGN KEY (`user_id`)
REFERENCES `mydb`.`user` (`id_user`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_config_notification_config_event1`
FOREIGN KEY (`config_event_id`)
REFERENCES `mydb`.`config_event` (`id_config_event`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;

Greetings,
fernando

D
druck281 author 3/16/2024

I am trying to figure out how to build something like this in PHPRunner. This would be an edit page specific to the logged in user allowing them to check off which notifications they want and how they want them delivered.
img alt