$view = new GrlxView($args); $form = new GrlxForm(); $button = new GrlxLinkStyle(); $sl = new GrlxSelectList(); /* ! Actions * * * * * * * */ // Change one or more tone_id records if (is_numeric($_POST['new_tone_id']) && $_POST['sel'] && $_POST['submit']) { unset($_GET); $new_id = $_POST['new_tone_id']; if (is_array($_POST['sel'])) { $sel = array_keys($_POST['sel']); foreach ($sel as $item) { $db_vars[] = strfunc_split_tablerow($item); } } else { $db_vars[] = strfunc_split_tablerow($_POST['sel']); } if ($db_vars) { foreach ($db_vars as $i => $row) { $row['table'] == 'milieu' ? $col = 'value' : ($col = 'tone_id'); $data = array($col => $new_id); if ($row['table'] == 'book_page') { $marker = new GrlxMarker($row['id']); $page_ids = array_keys($marker->pageList); $db->where('id', $page_ids, 'IN'); unset($marker); } else { $db->where('id', $row['id']); } $db->update($row['table'], $data); }
<?php /** * Update an existing tone record. * * @param string $_GET['item'] = db table name w/out prefix.'-'.value of the record’s id field * @param int $_GET['tone_id'] = the tone id for the record */ require_once 'panl.init.php'; $db_vars = strfunc_split_tablerow($_GET['item']); $tone_id = $_GET['tone_id']; if (is_numeric($tone_id) && is_numeric($db_vars['id']) && $db_vars['table']) { $db_vars['table'] == 'milieu' ? $col = 'value' : ($col = 'tone_id'); $data = array($col => $tone_id); $db->where('id', $db_vars['id']); $db->update($db_vars['table'], $data); }
$timezone_master_list['Pacific/Noumea'] = array('id' => 'Pacific/Noumea', 'title' => 'UTC+11:00: Honiara, Noumea'); $timezone_master_list['Pacific/Auckland'] = array('id' => 'Pacific/Auckland', 'title' => 'UTC+12:00: Auckland, Suva'); $timezone_master_list['Pacific/Honolulu'] = array('id' => 'Pacific/Honolulu', 'title' => 'UTC−10:00: Papeete, Honolulu'); $timezone_master_list['Pacific/Samoa'] = array('id' => 'Pacific/Samoa', 'title' => 'UTC−11:00: American Samoa'); $timezone_master_list['America/Anchorage'] = array('id' => 'America/Anchorage', 'title' => 'UTC−09:00: Anchorage'); /***** * Updates */ // Save changes to milieu items if ($_POST['submit']) { $input = $_POST['input']; $ga_input = $_POST['googleanalytics']; // $milieu_group = explode('-', $_POST['submit']); // $milieu_group = $milieu_group[1]; $count = 0; $homepage = strfunc_split_tablerow($_POST['homepage']); // Safety checks for site root if (!trim($input['directory'])) { unset($input['directory']); } else { $string = trim($input['directory']); $string = trim($string, '/'); $input['directory'] = '/' . $string; } foreach ($input as $key => $val) { $val = trim($val); $val = htmLawed($val); $data = array('value' => $val); $db->where('label', $key); // $db -> where('milieu_type_id', $milieu_group); $db->update('milieu', $data);