$region_type = REGION_CITY; $sponsor_ids = Sponsor::get_ids_by_region($region_id, $region_type); $html = new HTML('admin'); $html->set_title('Edit personnel directory listings'); $html->generate_header(); ?> <div class='row_clickable' onclick="document.location.href='sponsor_edit'"> <h3>Add a new sponsor to the directory</h3> </div> <?php if (!empty($sponsor_ids)) { foreach ($sponsor_ids as $id) { $sponsor = new Sponsor($id); $sponsor_type = $sponsor->sponsor_type(); if ($sponsor_type == 'I') { $name_last = $sponsor->name_last(); $name_first = $sponsor->name_first(); $name_middle = $sponsor->name_middle(); $title = $sponsor->title(); $sponsor_name = $name_first . ' ' . $name_last . ', ' . $title; } elseif ($sponsor_type == 'O') { $office = $sponsor->office(); $sponsor_name = $office; } $src = '/images/photos/personnel/' . $sponsor->image(); $region_name = $sponsor->region; ?> <div class='row_clickable row_thumb' onclick="document.location.href='sponsor_edit?id=<?php echo $id; ?> '">
require_once DOC_ROOT . '/includes/classes/class.html.php'; require_once DOC_ROOT . '/includes/classes/class.sponsor.php'; require_once DOC_ROOT . '/includes/classes/class.office.php'; $region_id = 65517; $region_type = REGION_CITY; $office_ids = Office::get_ids_by_region($region_id, $region_type); $id = get_param('id'); $sponsor = new Sponsor($id); if (!empty($_POST)) { $sponsor->region_id($region_id); $sponsor->region_type($region_type); $sponsor->department_id(get_param('department_id')); $sponsor->sponsor_type(get_param('sponsor_type')); $sponsor->title(get_param('title')); $sponsor->name_first(get_param('name_first')); $sponsor->name_last(get_param('name_last')); $sponsor->name_middle(get_param('name_middle')); $sponsor->office(get_param('office')); $sponsor->phone(get_param('phone')); $sponsor->email(get_param('email')); $sponsor->bio(get_param('bio')); $sponsor->image(get_param('image')); if ($id) { $sponsor->update(); } else { $id = $sponsor->insert(); } redirect('sponsor'); } $html = new HTML('admin'); $html->set_title("Edit this person's directory information");