function optionsVariable($result) { $option_block = ''; foreach ($result as $row) { $typeid = $row["VariableID"]; $typename = translateTerm($row["VariableName"]); $datatype = translateTerm($row["DataType"]); $option_block .= "<option value='{$typeid}'>{$typename} ({$datatype})</option>"; } return $option_block; }
public function change() { if (!isAdmin()) { $this->kickOut(); } if ($_POST) { $this->load->library('form_validation'); $this->form_validation->set_rules('Organization', 'Organization', 'trim|required|xss_clean'); $this->form_validation->set_rules('SourceDescription', 'Source Description', 'trim|required|xss_clean'); $this->form_validation->set_rules('ContactName', 'Contact Name', 'trim|required|xss_clean'); $this->form_validation->set_rules('Phone', 'Phone Number', 'trim|required|xss_clean'); $this->form_validation->set_rules('Email', 'Email Address', 'trim|required|xss_clean'); $this->form_validation->set_rules('Address', 'Address', 'trim|required|xss_clean'); $this->form_validation->set_rules('City', 'City', 'trim|required|xss_clean'); $this->form_validation->set_rules('State', 'State', 'trim|required|xss_clean'); $this->form_validation->set_rules('ZipCode', 'Zip Code', 'trim|required|xss_clean'); $this->form_validation->set_rules('TopicCategory', 'Topic Category', 'trim|required|xss_clean'); $this->form_validation->set_rules('Title', 'Title', 'trim|required|xss_clean'); $this->form_validation->set_rules('Abstract', 'Abstract', 'trim|required|xss_clean'); } if ($this->form_validation->run() == FALSE) { $errors = validation_errors(); if (!empty($errors)) { addError($errors); } } else { //Array for generating MetadatID $dataPoint = array('TopicCategory' => $this->input->post('TopicCategory'), 'Title' => $this->input->post('Title'), 'Abstract' => $this->input->post('Abstract'), 'ProfileVersion' => $this->cNull($this->config->item('ProfileVersion')), 'MetadataLink' => $this->input->post('MetadataLink')); $metaID = $this->sources->updateMD($dataPoint, $this->input->post('MetadataID')); $result = $this->sources->updateSource($this->input->post('Organization'), $this->input->post('SourceDescription'), $this->input->post('SourceLink'), $this->input->post('ContactName'), $this->input->post('Phone'), $this->input->post('Email'), $this->input->post('Address'), $this->input->post('City'), $this->input->post('State'), $this->input->post('ZipCode'), $this->input->post('Citation'), $this->input->post('MetadataID'), $this->input->post('SourceID')); if ($result) { addSuccess(getTxt('SourceEdited')); } else { addError(getTxt('ProcessingError')); } } $sources = $this->sources->getAll(); $sourceOptions = optionsSource($sources); //List of CSS to pass to this view $data = $this->StyleData; $data['sourceOptions'] = $sourceOptions; //Getting the states dropdown $states = getStates(); $states['NULL'] = getTxt('International'); $stateOptions = genOptions($states); $data['stateOptions'] = $stateOptions; //Gets the topicCategory dropdown //getTC was created in the model $topics = $this->sources->getTC(); $topicsArray = array(); foreach ($topics as $topic) { $topicsArray[$topic['Term']] = translateTerm($topic['Term']); } $topicOptions = genOptions($topicsArray); $data['topicOptions'] = $topicOptions; $this->load->view('sources/changesource', $data); }
?> </li> </ul> <div> <?php echo "<b>" . getTxt('Site') . " </b>" . $site['SiteName'] . "<br/>"; if ($site['picname'] == null) { if (isLoggedIn()) { echo "<br><br> " . getTxt('NoImages') . " <a href='" . site_url('sites/edit/' . $SiteID) . "'> " . getTxt('ClickHere') . " </a>"; } else { echo "<br><br> " . getTxt('NoImages'); } } else { echo "<br><br><img src='" . getDetailsImg('' . $site['picname']) . "' width='368' height='250'>"; } echo "<br/><br/><b>" . getTxt('Type') . " </b>" . translateTerm($site['SiteType']) . "<br/><br/><b>" . getTxt('Latitude') . " </b>" . $site['Latitude'] . "<br/><br/><b>" . getTxt('Longitude') . " </b>" . $site['Longitude'] . "<br /><br/><br/><b>" . getTxt('Measurements') . "</b>"; $num_rows = count($Variables); $count = 1; foreach ($Variables as $var) { if ($var['VariableName'] != "") { echo $var['VariableName']; if ($count != $num_rows) { echo "; "; } } $count = $count + 1; } ?> <br/><br/> <?php echo getTxt('WrongSite');
public function getUnitsByType() { $type = $this->input->get('type', TRUE); if ($type !== false) { $result1 = $this->variables->getUnitsByType($type); $result = array(); $result[] = array('unit' => getTxt('SelectEllipsis'), 'unitid' => "-1"); foreach ($result1 as $unit) { $result[] = array('unit' => translateTerm($unit['unitsName']), 'unitid' => $unit['unitsID']); } if (!$this->input->get('noNew', TRUE)) { $result[] = array('unit' => getTxt('OtherSlashNew'), 'unitid' => "-10"); } echo json_encode($result); } else { $data['errorMsg'] = "One of the parameters: unitsType is not defined. An example request would be getUnitTypes?type=Area"; $this->load->view('templates/apierror', $data); } }
public function getJSON() { $result = $this->method->getAll(); foreach ($result as &$var) { $var['MethodDescription'] = translateTerm($var['MethodDescription']); } echo json_encode($result); }
private function genNodes($result) { $dom = new DOMDocument("1.0"); $node = $dom->createElement("markers"); $parnode = $dom->appendChild($node); foreach ($result as $row) { $node = $dom->createElement("marker"); $newnode = $parnode->appendChild($node); $newnode->setAttribute("name", $row['SiteName']); $newnode->setAttribute("siteid", $row['SiteID']); $newnode->setAttribute("sitecode", $row['SiteCode']); $newnode->setAttribute("lat", $row['Latitude']); $newnode->setAttribute("lng", $row['Longitude']); $newnode->setAttribute("sitetype", translateTerm($row['SiteType'])); $newnode->setAttribute("sourcename", $row['Organization']); $newnode->setAttribute("sourcecode", $row['SourceID']); $newnode->setAttribute("sourcelink", $row['SourceLink']); $newnode->setAttribute("sitepic", $row['picname']); } return $dom->saveXML(); }