public function EditBackgroundImage($layoutId, $backgroundImageId) { try { $dbh = PDOConnect::init(); if ($layoutId == 0) { $this->ThrowError(__('Layout not selected')); } // Allow for the 0 media idea (no background image) if ($backgroundImageId == 0) { $bg_image = ''; } else { // Get the file URI $sth = $dbh->prepare('SELECT StoredAs FROM media WHERE MediaID = :mediaid'); $sth->execute(array('mediaid' => $backgroundImageId)); // Look up the bg image from the media id given if (!($row = $sth->fetch())) { $this->ThrowError(__('Cannot find the background image selected')); } $bg_image = Kit::ValidateParam($row['StoredAs'], _STRING); // Tag the background image as a background image $media = new Media(); $media->tag('background', $backgroundImageId); } $region = new region(); if (!$region->EditBackgroundImage($layoutId, $bg_image)) { throw new Exception("Error Processing Request", 1); } // Update the layout record with the new background $sth = $dbh->prepare('UPDATE layout SET backgroundimageid = :backgroundimageid WHERE layoutid = :layoutid'); $sth->execute(array('backgroundimageid' => $backgroundImageId, 'layoutid' => $layoutId)); // Check to see if we already have a LK record for this. $lkSth = $dbh->prepare('SELECT lklayoutmediaid FROM `lklayoutmedia` WHERE layoutid = :layoutid AND regionID = :regionid'); $lkSth->execute(array('layoutid' => $layoutId, 'regionid' => 'background')); if ($lk = $lkSth->fetch()) { // We have one if ($backgroundImageId != 0) { // Update it if (!$region->UpdateDbLink($lk['lklayoutmediaid'], $backgroundImageId)) { $this->ThrowError(__('Unable to update background link')); } } else { // Delete it if (!$region->RemoveDbLink($lk['lklayoutmediaid'])) { $this->ThrowError(__('Unable to remove background link')); } } } else { // None - do we need one? if ($backgroundImageId != 0) { if (!$region->AddDbLink($layoutId, 'background', $backgroundImageId)) { $this->ThrowError(__('Unable to create background link')); } } } // Is this layout valid $this->SetValid($layoutId); return true; } catch (Exception $e) { Debug::LogEntry('error', $e->getMessage()); if (!$this->IsError()) { return $this->SetError(__("Unable to update background information")); } return false; } }
} } if (file_exists('../modules/ptgroup/class.ptgroup.php')) { include '../modules/ptgroup/class.ptgroup.php'; $ptgroup = new ptgroup; if (!$module->activated('ptgroup') && $initmod) { $ptgroup->init_sql(); $ptgroup->init_menu(); $ptgroup->init_deps(); $ptgroup->init_lang(); $ptgroup->init_help(); } } if (file_exists('../modules/region/class.region.php')) { include '../modules/region/class.region.php'; $region = new region; if (!$module->activated('region') && $initmod) { $region->init_sql(); $region->init_menu(); $region->init_deps(); $region->init_lang(); $region->init_help(); } } if (file_exists('../modules/reminder/class.reminder.php')) { include '../modules/reminder/class.reminder.php'; $reminder = new reminder; if (!$module->activated('reminder') && $initmod) { $reminder->init_sql(); $reminder->init_menu(); $reminder->init_deps();
<?php require 'components/get_listview_referrer.php'; require 'subclasses/region.php'; $dbh_region = new region(); $dbh_region->set_where("region_id='" . quote_smart($region_id) . "'"); if ($result = $dbh_region->make_query()->result) { $data = $result->fetch_assoc(); extract($data); }
/** * Gets additional resources for assigned media * @param string $serverKey * @param string $hardwareKey * @param int $layoutId * @param string $regionId * @param string $mediaId * @return mixed * @throws SoapFault */ function GetResource($serverKey, $hardwareKey, $layoutId, $regionId, $mediaId) { // Sanitize $serverKey = Kit::ValidateParam($serverKey, _STRING); $hardwareKey = Kit::ValidateParam($hardwareKey, _STRING); $layoutId = Kit::ValidateParam($layoutId, _INT); $regionId = Kit::ValidateParam($regionId, _STRING); $mediaId = Kit::ValidateParam($mediaId, _STRING); // Check the serverKey matches if ($serverKey != Config::GetSetting('SERVER_KEY')) { throw new SoapFault('Sender', 'The Server key you entered does not match with the server key at this address'); } // Make sure we are sticking to our bandwidth limit if (!$this->CheckBandwidth()) { throw new SoapFault('Receiver', "Bandwidth Limit exceeded"); } // Auth this request... if (!$this->AuthDisplay($hardwareKey)) { throw new SoapFault('Receiver', "This display client is not licensed"); } // Validate the nonce $nonce = new Nonce(); if (!$nonce->AllowedFile('resource', $this->displayId, NULL, $layoutId, $regionId, $mediaId)) { throw new SoapFault('Receiver', 'Requested an invalid file.'); } // What type of module is this? $region = new region(); $type = $region->GetMediaNodeType($layoutId, $regionId, $mediaId); if ($type == '') { throw new SoapFault('Receiver', 'Unable to get the media node type'); } // Dummy User Object $user = new User(); $user->userid = 0; $user->usertypeid = 1; // Initialise the theme (for global styles in GetResource) new Theme($user); Theme::SetPagename('module'); // Get the resource from the module try { $module = ModuleFactory::load($type, $layoutId, $regionId, $mediaId, null, null, $user); } catch (Exception $e) { Debug::Error($e->getMessage(), $this->displayId); throw new SoapFault('Receiver', 'Cannot create module. Check CMS Log'); } $resource = $module->GetResource($this->displayId); if (!$resource || $resource == '') { throw new SoapFault('Receiver', 'Unable to get the media resource'); } // Log Bandwidth $this->LogBandwidth($this->displayId, Bandwidth::$GETRESOURCE, strlen($resource)); return $resource; }
function _region() { // // calls form_region() // display_region() // process_region() // // always check dependencies if ($exitinfo = $this->missing_dependencies('region')) { return print $exitinfo; } if (func_num_args() > 0) { $arg_list = func_get_args(); $menu_id = $arg_list[0]; $post_vars = $arg_list[1]; $get_vars = $arg_list[2]; $validuser = $arg_list[3]; $isadmin = $arg_list[4]; //print_r($arg_list); } $r = new region(); if ($post_vars["submitregion"]) { $r->process_region($menu_id, $post_vars, $get_vars); } $r->display_region($menu_id, $post_vars, $get_vars); $r->form_region($menu_id, $post_vars, $get_vars); }
/** * Re-orders a medias regions * @return */ function TimelineReorder() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); // Vars $layoutId = Kit::GetParam('layoutid', _REQUEST, _INT); $regionId = Kit::GetParam('regionid', _POST, _STRING); $mediaList = Kit::GetParam('medialist', _POST, _STRING); // Check the user has permission Kit::ClassLoader('region'); $region = new region($db); $ownerId = $region->GetOwnerId($layoutId, $regionId); $regionAuth = $this->user->RegionAssignmentAuth($ownerId, $layoutId, $regionId, true); if (!$regionAuth->edit) { trigger_error(__('You do not have permissions to edit this region'), E_USER_ERROR); } // Create a list of media if ($mediaList == '') { trigger_error(__('No media to reorder')); } // Trim the last | if there is one $mediaList = rtrim($mediaList, '|'); // Explode into an array $mediaList = explode('|', $mediaList); // Store in an array $resolvedMedia = array(); foreach ($mediaList as $mediaNode) { // Explode the second part of the array $mediaNode = explode(',', $mediaNode); $resolvedMedia[] = array('mediaid' => $mediaNode[0], 'lkid' => $mediaNode[1]); } // Hand off to the region object to do the actual reorder if (!$region->ReorderTimeline($layoutId, $regionId, $resolvedMedia)) { trigger_error($region->GetErrorMessage(), E_USER_ERROR); } $response->SetFormSubmitResponse(__('Order Changed')); $response->keepOpen = true; $response->Respond(); }
/** * Gets additional resources for assigned media * @param <type> $serverKey * @param <type> $hardwareKey * @param <type> $layoutId * @param <type> $regionId * @param <type> $mediaId * @param <type> $version */ function GetResource($serverKey, $hardwareKey, $layoutId, $regionId, $mediaId, $version) { $db =& $this->db; // Sanitize $serverKey = Kit::ValidateParam($serverKey, _STRING); $hardwareKey = Kit::ValidateParam($hardwareKey, _STRING); $layoutId = Kit::ValidateParam($layoutId, _INT); $regionId = Kit::ValidateParam($regionId, _STRING); $mediaId = Kit::ValidateParam($mediaId, _STRING); $version = Kit::ValidateParam($version, _STRING); // Make sure we are talking the same language if (!$this->CheckVersion($version)) { throw new SoapFault('Receiver', "Your client is not of the correct version for communication with this server."); } // Make sure we are sticking to our bandwidth limit if (!$this->CheckBandwidth()) { throw new SoapFault('Receiver', "Bandwidth Limit exceeded"); } // Auth this request... if (!$this->AuthDisplay($hardwareKey)) { throw new SoapFault('Receiver', "This display client is not licensed"); } // What type of module is this? Kit::ClassLoader('region'); $region = new region($db); $type = $region->GetMediaNodeType($layoutId, $regionId, $mediaId); if ($type == '') { throw new SoapFault('Receiver', 'Unable to get the media node type'); } // Dummy User Object $user = new User($db); $user->userid = 0; $user->usertypeid = 1; // Get the resource from the module require_once 'modules/' . $type . '.module.php'; if (!($module = new $type($db, $user, $mediaId, $layoutId, $regionId))) { throw new SoapFault('Receiver', 'Cannot create module. Check CMS Log'); } $resource = $module->GetResource($this->displayId); if (!$resource || $resource == '') { throw new SoapFault('Receiver', 'Unable to get the media resource'); } // Log Bandwidth $this->LogBandwidth($this->displayId, 5, strlen($resource)); return $resource; }
/** * Replace media in all layouts. * @param <type> $oldMediaId * @param <type> $newMediaId */ private function ReplaceMediaInAllLayouts($replaceInLayouts, $replaceBackgroundImages, $oldMediaId, $newMediaId) { $count = 0; Debug::LogEntry('audit', sprintf('Replacing mediaid %s with mediaid %s in all layouts', $oldMediaId, $newMediaId), 'module', 'ReplaceMediaInAllLayouts'); try { $dbh = PDOConnect::init(); // Some update statements to use $sth = $dbh->prepare('SELECT lklayoutmediaid, regionid FROM lklayoutmedia WHERE mediaid = :media_id AND layoutid = :layout_id'); $sth_update = $dbh->prepare('UPDATE lklayoutmedia SET mediaid = :media_id WHERE lklayoutmediaid = :lklayoutmediaid'); // Loop through a list of layouts this user has access to foreach ($this->user->LayoutList() as $layout) { $layoutId = $layout['layoutid']; // Does this layout use the old media id? $sth->execute(array('media_id' => $oldMediaId, 'layout_id' => $layoutId)); $results = $sth->fetchAll(); if (count($results) <= 0) { continue; } Debug::LogEntry('audit', sprintf('%d linked media items for layoutid %d', count($results), $layoutId), 'module', 'ReplaceMediaInAllLayouts'); // Create a region object for later use (new one each time) $layout = new Layout(); $region = new region($this->db); // Loop through each media link for this layout foreach ($results as $row) { // Get the LKID of the link between this layout and this media.. could be more than one? $lkId = $row['lklayoutmediaid']; $regionId = $row['regionid']; if ($regionId == 'background') { Debug::Audit('Replacing background image'); if (!$replaceBackgroundImages) { continue; } // Straight swap this background image node. if (!$layout->EditBackgroundImage($layoutId, $newMediaId)) { return false; } } else { if (!$replaceInLayouts) { continue; } // Get the Type of this media if (!($type = $region->GetMediaNodeType($layoutId, '', '', $lkId))) { continue; } // Create a new media node use it to swap the nodes over Debug::LogEntry('audit', 'Creating new module with MediaID: ' . $newMediaId . ' LayoutID: ' . $layoutId . ' and RegionID: ' . $regionId, 'region', 'ReplaceMediaInAllLayouts'); try { $module = ModuleFactory::createForMedia($type, $newMediaId, $this->db, $this->user); } catch (Exception $e) { Debug::Error($e->getMessage()); return false; } // Sets the URI field if (!$module->SetRegionInformation($layoutId, $regionId)) { return false; } // Get the media xml string to use in the swap. $mediaXmlString = $module->AsXml(); // Swap the nodes if (!$region->SwapMedia($layoutId, $regionId, $lkId, $oldMediaId, $newMediaId, $mediaXmlString)) { return false; } } // Update the LKID with the new media id $sth_update->execute(array('media_id' => $newMediaId, 'lklayoutmediaid' => $row['lklayoutmediaid'])); $count++; } } } catch (Exception $e) { Debug::LogEntry('error', $e->getMessage()); if (!$this->IsError()) { $this->SetError(1, __('Unknown Error')); } return false; } Debug::LogEntry('audit', sprintf('Replaced media in %d layouts', $count), 'module', 'ReplaceMediaInAllLayouts'); }
function display_ntp_record_details() { if (func_num_args() > 0) { $arg_list = func_get_args(); $menu_id = $arg_list[0]; $post_vars = $arg_list[1]; $get_vars = $arg_list[2]; $validuser = $arg_list[3]; $isadmin = $arg_list[4]; //print_r($arg_list); } // manage Delete here if ($post_vars["submitntp"] && $get_vars["ntp_id"]) { if ($post_vars["submitntp"] == "Delete") { if (module::confirm_delete($menu_id, $post_vars, $get_vars)) { print $sql = "delete from m_patient_ntp where ntp_id = '" . $get_vars["ntp_id"] . "'"; if ($result = mysql_query($sql)) { header("location: " . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&consult_id=" . $get_vars["consult_id"] . "&ptmenu=" . $get_vars["ptmenu"] . "&module=" . $get_vars["module"] . "&ntp=VISIT1"); } } else { if ($post_vars["confirm_delete"] == "No") { header("location: " . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&consult_id=" . $get_vars["consult_id"] . "&ptmenu=" . $get_vars["ptmenu"] . "&module=" . $get_vars["module"] . "&ntp=VISIT1"); } } } } $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]); $consult_date = healthcenter::get_consult_date($get_vars["consult_id"]); $sql = "select patient_id, date_format(ntp_consult_date, '%a %d %b %Y, %h:%i%p') ntp_consult_date, date_format(ntp_timestamp, '%a %d %b %Y, %h:%i%p') ts, ntp_id, user_id, " . "occupation_id, household_contacts, region_id, body_weight, bcg_scar, " . "previous_treatment_flag, previous_treatment_duration, previous_treatment_drugs, " . "patient_type_id, outcome_id, treatment_partner_id, treatment_category_id, contact_person, course_end_flag, " . "intensive_start_date, maintenance_start_date, treatment_end_date, " . "sputum1_date, sputum2_date, sputum3_date, " . "intensive_projected_end_date, maintenance_projected_end_date, " . "to_days('{$consult_date}') days_consult_date, " . "to_days(intensive_projected_end_date) days_proj_int_end, " . "to_days(maintenance_projected_end_date) days_proj_maint_end, " . "to_days(sputum1_date) days_sputum1_date, " . "to_days(sputum2_date) days_sputum2_date, " . "to_days(sputum3_date) days_sputum3_date " . "from m_patient_ntp " . "where ntp_id = '" . $get_vars["ntp_id"] . "'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($ntpdata = mysql_fetch_array($result)) { print "<table width='250' style='border: 1px dotted black'>"; print "<form method='post' action='" . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&consult_id=" . $get_vars["consult_id"] . "&ptmenu=DETAILS&module=ntp&ntp=INTAKE&ntp_id=" . $get_vars["ntp_id"] . "'>"; print "<tr><td>"; print "<span class='tinylight'>"; print "Patient Name: " . strtoupper(patient::get_name($ntpdata["patient_id"])) . "<br/>"; print "Registration Date: " . $ntpdata["ntp_consult_date"] . "<br/>"; print "Last Update: " . $ntpdata["ts"] . "<br/>"; print "Updated By: " . user::get_username($ntpdata["user_id"]) . "<br/>"; print "<hr size='1'/>"; print "IMPORTANT DATES:<br/>"; print "Start Intensive Phase: " . ($ntpdata["intensive_start_date"] != "0000-00-00" ? $ntpdata["intensive_start_date"] : "NA") . "<br/>"; print "Start Maintenance Phase: " . ($ntpdata["maintenance_start_date"] != "0000-00-00" ? $ntpdata["maintenance_start_date"] : "NA") . "<br/>"; print "End of Treatment: " . ($ntpdata["maintenance_start_date"] != "0000-00-00" ? $ntpdata["maintenance_start_date"] : "NA") . "<br/><br/>"; print "PROJECTED DATES:<br/>"; print "Proj End Intensive Phase: " . ($ntpdata["intensive_projected_end_date"] == "0000-00-00" ? "NA" : ($ntpdata["days_proj_int_end"] <= $ntpdata["days_consult_date"] ? "<font color='red'>" . $ntpdata["intensive_projected_end_date"] . "</font>" : $ntpdata["intensive_projected_end_date"])) . "<br/>"; print "Proj End Maint Phase: " . ($ntpdata["maintenance_projected_end_date"] == "0000-00-00" ? "NA" : ($ntpdata["days_proj_maint_end"] <= $ntpdata["days_consult_date"] ? "<font color='red'>" . $ntpdata["maintenance_projected_end_date"] . "</font>" : $ntpdata["maintenance_projected_end_date"])) . "<br/>"; if ($ntpdata["treatment_category"] == 3) { print "Sputum Exam #1 Date: " . ($ntpdate["sputum1_date"] == "0000-00-00" ? "NA" : ($ntpdata["days_sputum1_date"] <= $ntpdata["days_consult_date"] ? "<font color='red'>" . $ntpdata["sputum1_date"] . "</font>" : $ntpdata["sputum1_date"])) . "<br/>"; } else { print "Sputum Exam #1 Date: " . ($ntpdate["sputum1_date"] == "0000-00-00" ? "NA" : ($ntpdata["days_sputum1_date"] <= $ntpdata["days_consult_date"] ? "<font color='red'>" . $ntpdata["sputum1_date"] . "</font>" : $ntpdata["sputum1_date"])) . "<br/>"; print "Sputum Exam #2 Date: " . ($ntpdate["sputum2_date"] == "0000-00-00" ? "NA" : ($ntpdata["days_sputum2_date"] <= $ntpdata["days_consult_date"] ? "<font color='red'>" . $ntpdata["sputum2_date"] . "</font>" : $ntpdata["sputum2_date"])) . "<br/>"; print "Sputum Exam #3 Date: " . ($ntpdate["sputum3_date"] == "0000-00-00" ? "NA" : ($ntpdata["days_sputum3_date"] <= $ntpdata["days_consult_date"] ? "<font color='red'>" . $ntpdata["sputum3_date"] . "</font>" : $ntpdata["sputum3_date"])) . "<br/>"; } print "<hr size='1'/>"; print "Occupation: " . occupation::get_occupation_name($ntpdata["occupation_id"]) . "<br/>"; print "Contact Person: " . $ntpdata["contact_person"] . "<br/>"; print "Region: " . region::get_region_name($ntpdata["region_id"]) . "<br/>"; print "<hr size='1'/>"; print "BCG Scar: " . ($ntpdata["bcg_scar"] == "D" ? "Doubtful" : $ntpdata["bcg_scar"]) . "<br/>"; print "Household Contacts: " . $ntpdata["household_contacts"] . " " . ($ntpdata["household_contacts"] == 1 ? "person" : "persons") . "<br/>"; print "Previous Treatment? " . $ntpdata["previous_treatment_flag"] . "<br/>"; if ($ntpdata["previous_treatment_flag"] == "Y") { print "<span class='tinylight'>"; print " Drugs: " . $ntpdata["previous_treatment_drugs"] . "<br/>"; print " Duration: " . ($ntpdata["previous_treatment_duration"] == "M1" ? ">1 month" : "<1 month") . "<br/>"; print "</span>"; } print "Patient Type: " . ntp::get_patient_type($ntpdata["patient_type_id"]) . "<br/>"; print "Tx Category: " . ntp::get_treatment_cat($ntpdata["treatment_category_id"]) . "<br/>"; print "Tx Outcome: " . ntp::get_treatment_outcome($ntpdata["outcome_id"]) . "<br/>"; print "Tx Partner: " . ntp::get_partner_name($ntpdata["treatment_partner_id"]) . "<br/>"; if ($_SESSION["priv_delete"]) { if ($ntpdata["course_end_flag"] != "Y") { print "<input type='submit' class='tinylight' name='submitntp' value='Delete' style='border: 1px solid black'/>"; } } print "</span>"; print "</td></tr>"; print "</form>"; print "</table>"; } } } }
/** * Set the Background Image * @param int $layoutId [description] * @param int $resolutionId [description] * @param string $color [description] * @param int $backgroundImageId [description] */ public function SetBackground($layoutId, $resolutionId, $color, $backgroundImageId) { Debug::LogEntry('audit', 'IN', 'Layout', 'SetBackground'); try { $dbh = PDOConnect::init(); if ($layoutId == 0) { $this->ThrowError(__('Layout not selected')); } if ($layoutId == 0) { $this->ThrowError(__('Resolution not selected')); } // Allow for the 0 media idea (no background image) if ($backgroundImageId == 0) { $bg_image = ''; } else { // Get the file URI $sth = $dbh->prepare('SELECT StoredAs FROM media WHERE MediaID = :mediaid'); $sth->execute(array('mediaid' => $backgroundImageId)); // Look up the bg image from the media id given if (!($row = $sth->fetch())) { $this->ThrowError(__('Cannot find the background image selected')); } $bg_image = Kit::ValidateParam($row['StoredAs'], _STRING); } // Look up the width and the height $sth = $dbh->prepare('SELECT width, height FROM resolution WHERE resolutionID = :resolutionid'); $sth->execute(array('resolutionid' => $resolutionId)); // Look up the bg image from the media id given if (!($row = $sth->fetch())) { return $this->SetError(__('Unable to get the Resolution information')); } $width = Kit::ValidateParam($row['width'], _INT); $height = Kit::ValidateParam($row['height'], _INT); include_once "lib/data/region.data.class.php"; $region = new region($this->db); if (!$region->EditBackground($layoutId, '#' . $color, $bg_image, $width, $height, $resolutionId)) { throw new Exception("Error Processing Request", 1); } // Update the layout record with the new background $sth = $dbh->prepare('UPDATE layout SET background = :background WHERE layoutid = :layoutid'); $sth->execute(array('background' => $bg_image, 'layoutid' => $layoutId)); // Is this layout valid $this->SetValid($layoutId); return true; } catch (Exception $e) { Debug::LogEntry('error', $e->getMessage()); if (!$this->IsError()) { return $this->SetError(__("Unable to update background information")); } return false; } }
<?php include "../../CLASS/region.class.php"; if ($_POST['ID']) { $id = explode("-", $_POST['ID']); $db = new region(); $data = $db->ambil_data_region_kota($id[0]); $jumlah = sizeof($data); if ($jumlah > 0) { for ($i = 0; $i < $jumlah; $i++) { echo "<option value='" . $data[$i][0] . "-" . $data[$i][1] . "' >" . $data[$i][1] . "</option>"; } } } ?>
require 'path.php'; init_cobalt('Delete region'); if (isset($_GET['region_id'])) { $region_id = urldecode($_GET['region_id']); require_once 'form_data_region.php'; } if (xsrf_guard()) { init_var($_POST['btn_cancel']); init_var($_POST['btn_delete']); require 'components/query_string_standard.php'; if ($_POST['btn_cancel']) { log_action('Pressed cancel button'); redirect("listview_region.php?{$query_string}"); } elseif ($_POST['btn_delete']) { log_action('Pressed delete button'); require_once 'subclasses/region.php'; $dbh_region = new region(); $object_name = 'dbh_region'; require 'components/create_form_data.php'; $dbh_region->delete($arr_form_data); redirect("listview_region.php?{$query_string}"); } } require 'subclasses/region_html.php'; $html = new region_html(); $html->draw_header('Delete Region', $message, $message_type); $html->draw_listview_referrer_info($filter_field_used, $filter_used, $page_from, $filter_sort_asc, $filter_sort_desc); $html->draw_hidden('region_id'); $html->detail_view = TRUE; $html->draw_controls('delete'); $html->draw_footer();
?> " style="width:200px"> <input type="hidden" name="id" value="<?php echo $_GET[id]; ?> "> </div></td> </tr> <tr> <td class="texto_adm"><div align="left">Region</div></td> <td class="texto_adm"><div align="left">:</div></td> <td><div align="left"> <?php //Llamaba a combo de los paises include_once '../controller/class_region.php'; $regiones = new region(); if ($_GET['accion'] == 'modificar') { $regiones->seleccionaRegionesByIdCmb($region); } else { $regiones->seleccionaRegionesCmb(); } ?> </div></td> </tr> </table> <?php if ($_GET['accion'] == 'modificar') { ?> <input name="modificar" value="Modificar" type="submit"> <input name="cancelar" value="Cancelar" type="submit">
/** * Add media to a region from the Library * @return <XiboAPIResponse> */ public function LayoutRegionLibraryAdd() { if (!$this->user->PageAuth('layout')) { return $this->Error(1, 'Access Denied'); } $layoutId = $this->GetParam('layoutId', _INT); $regionId = $this->GetParam('regionId', _STRING); $mediaList = $this->GetParam('mediaList', _ARRAY); // Does the user have permissions to view this region? if (!$this->user->LayoutAuth($layoutId)) { return $this->Error(1, 'Access Denied'); } // Make sure we have permission to edit this region Kit::ClassLoader('region'); $region = new region(); $ownerId = $region->GetOwnerId($layoutId, $regionId); $regionAuth = $this->user->RegionAssignmentAuth($ownerId, $layoutId, $regionId, true); if (!$regionAuth->edit) { return $this->Error(1, 'Access Denied'); } if (!$region->AddFromLibrary($this->user, $layoutId, $regionId, $mediaList)) { return $this->Error($region->GetErrorNumber(), $region->GetErrorMessage()); } return $this->Respond($this->ReturnId('success', true)); }
<?php //**************************************************************************************** //Generated by Cobalt, a rapid application development framework. http://cobalt.jvroig.com //Cobalt developed by JV Roig (jvroig@jvroig.com) //**************************************************************************************** require 'path.php'; init_cobalt('Add region'); require 'components/get_listview_referrer.php'; if (xsrf_guard()) { init_var($_POST['btn_cancel']); init_var($_POST['btn_submit']); require 'components/query_string_standard.php'; require 'subclasses/region.php'; $dbh_region = new region(); $object_name = 'dbh_region'; require 'components/create_form_data.php'; extract($arr_form_data); if ($_POST['btn_cancel']) { log_action('Pressed cancel button'); redirect("listview_region.php?{$query_string}"); } if ($_POST['btn_submit']) { log_action('Pressed submit button'); $message .= $dbh_region->sanitize($arr_form_data)->lst_error; extract($arr_form_data); if ($dbh_region->check_uniqueness($arr_form_data)->is_unique) { //Good, no duplicate in database } else { $message = "Record already exists with the same primary identifiers!"; }
<?php include "../../CLASS/region.class.php"; if ($_POST['ID']) { $id = explode("-", $_POST['ID']); $db = new region(); $data = $db->ambil_data_region_provinsi($id[0]); $jumlah = sizeof($data); if ($jumlah > 0) { if ($id[0] == 107) { //klau negaranya indonesia kode 107 echo '<div class="control-group">'; echo '<label class="control-label" for="cmbProvinsi">Provinsi</label>'; echo '<div class="controls">'; echo '<select class="input-xxlarge" name="cmbProvinsi" id="cmbProvinsi">'; for ($i = 0; $i < $jumlah; $i++) { echo "<option value='" . $data[$i][0] . "-" . $data[$i][1] . "' >" . $data[$i][1] . "</option>"; } echo '</select>'; echo '</div>'; echo '</div>'; echo '<div class="control-group">'; echo '<label class="control-label" for="cmbProvinsi">Kota/Kabupaten</label>'; echo '<div class="controls">'; echo '<select class="input-xxlarge" name="cmbKota" id="cmbKota">'; echo "<option>- Pilih Kota -</option>"; echo '</select>'; echo '</div>'; echo '</div>'; } } else {
<br> <fieldset> <legend class="texto_adm_negrita">Mantención de Regiones </legend> <table width="100%" border="0" cellspacing="2" cellpadding="2"> <tr> <th bgcolor="#CCCCCC" class="texto_adm_negrita" scope="col">ID</th> <th bgcolor="#CCCCCC" class="texto_adm_negrita" scope="col">NOMBRE</th> <th bgcolor="#CCCCCC" class="texto_adm_negrita" scope="col">SIGLA</th> <th bgcolor="#CCCCCC" class="texto_adm_negrita" scope="col">PAIS</th> <th bgcolor="#CCCCCC" class="texto_adm_negrita" scope="col">ELIMINAR</th> <th bgcolor="#CCCCCC" class="texto_adm_negrita" scope="col">MODIFICAR</th> </tr> <?php include_once '../controller/class_region.php'; $empresa = new region(); $r = $empresa->getRegion(); while ($f = mysql_fetch_object($r)) { ?> <tr> <td class="texto_adm"><?php echo $f->id; ?> </td> <td class="texto_adm"><?php echo $f->nombre; ?> </td> <td class="texto_adm"><?php echo $f->sigla; ?>
//**************************************************************************************** //Generated by Cobalt, a rapid application development framework. http://cobalt.jvroig.com //Cobalt developed by JV Roig (jvroig@jvroig.com) //**************************************************************************************** require 'path.php'; init_cobalt('Edit region'); if (isset($_GET['region_id'])) { $region_id = urldecode($_GET['region_id']); require 'form_data_region.php'; } if (xsrf_guard()) { init_var($_POST['btn_cancel']); init_var($_POST['btn_submit']); require 'components/query_string_standard.php'; require 'subclasses/region.php'; $dbh_region = new region(); $object_name = 'dbh_region'; require 'components/create_form_data.php'; extract($arr_form_data); if ($_POST['btn_cancel']) { log_action('Pressed cancel button'); redirect("listview_region.php?{$query_string}"); } if ($_POST['btn_submit']) { log_action('Pressed submit button'); $message .= $dbh_region->sanitize($arr_form_data)->lst_error; extract($arr_form_data); if ($dbh_region->check_uniqueness_for_editing($arr_form_data)->is_unique) { //Good, no duplicate in database } else { $message = "Record already exists with the same primary identifiers!";
//Generated by Cobalt, a rapid application development framework. http://cobalt.jvroig.com //Cobalt developed by JV Roig (jvroig@jvroig.com) //**************************************************************************************** require 'path.php'; init_cobalt('View region'); if (xsrf_guard()) { init_var($_POST['btn_cancel']); init_var($_POST['btn_submit']); if ($_POST['btn_cancel']) { log_action('Pressed cancel button'); redirect("listview_region.php"); } if ($_POST['btn_submit']) { log_action('Pressed submit button'); require 'subclasses/region.php'; $dbh_region = new region(); if ($message == "") { log_action('Exported table data to CSV'); $timestamp = date('Y-m-d'); $token = generate_token(0, 'fs'); $csv_name = $token . $_SESSION['user'] . '_region_' . $timestamp . '.csv'; $filename = TMP_DIRECTORY . '/' . $csv_name; $csv_contents = $dbh_region->export_to_csv(); $csv_file = fopen($filename, "wb"); fwrite($csv_file, $csv_contents); fclose($csv_file); chmod($filename, 0755); $csv_name = urlencode($csv_name); $message = 'CSV file successfully generated: <a href="/' . BASE_DIRECTORY . '/download_generic.php?filename=' . $csv_name . '">Download the CSV file.</a>'; $message_type = 'system'; }