$res_tipo = mysql_query($tipo_consulta); $tipo = mysql_fetch_array($res_tipo); //echo $tipo['CONCEPTO_TIPO_ID']; if (!$_GET['cultivo_id']) { $sql_cul = "SELECT CULTIVO_ID FROM `p_analisis_resultados` WHERE `RECEPCION_PARTIDAS_ID` =" . $_GET["recepcion_partidas_id"]; $res_cul = mysql_query($sql_cul); $fetch_cul = mysql_fetch_object($res_cul); $cul_guardado = $fetch_cul->CULTIVO_ID; } else { $cul_guardado = $_GET['cultivo_id']; } //echo $cul_guardado; if ($tipo['CONCEPTO_TIPO_ID'] == 4) { $url = new TableEditor_URL(); $url->removeQueryString('cultivo_id'); $clearURL = $url->getURL(true); $TEMainList .= '<tr><td colspan=2>'; $TEMainList .= combo_universal_var("cultivo_id", "select CULTIVO_ID, NOMBRE from c_cultivos order by NOMBRE", $cul_guardado); $TEMainList .= '<input type=button value="ver" onclick=consulta()>'; $TEMainList .= '</td></tr>'; ?> <script language="javascript"> function consulta() { var searchStr=document.getElementById('cultivo_id').value; location.href = '<?php echo $clearURL; ?> ' + '&'+'cultivo_id=' + searchStr; } </script>
} } // Begin - 18 Nov 2008 - Titles Icons Bg if (!empty($this->icons[$this->table]['icon'])) { foreach ($this->icons[$this->table]['icon'] as $icon => $html_icon) { $TEMainList .= '<th> </th>'; } } // End - 18 Nov 2008 - Titles Icons Bg $TEMainList .= '</tr>'; $url = new TableEditor_URL(); if (!empty($results)) { foreach ($results as $k => $row) { $url->removeQueryString('edit'); $url->addQueryString('edit', $nonFilteredData[$k][$this->pk]); $UrlEdit = $url->getURL(true); $url->removeQueryString('edit'); $url->addQueryString('view', $nonFilteredData[$k][$this->pk]); $UrlView = $url->getURL(true); $url->removeQueryString('view'); $TEMainList .= '<tr onmouseover="this.className=\'TERowOver\';" ' . ($k % 2 == 1 ? 'class="TEaltRow" onmouseout="this.className=\'TEaltRow\';"' : 'class="TERow" onmouseout="this.className=\'TERow\';"') . ' '; if (TERowOnClickEdit == false || !$this->getConfig('allowEdit')) { $TEMainList .= ' onclick="TERowHighlight(this, this.firstChild.firstChild, \'' . ($k % 2 == 1 ? 'TEaltRow' : 'TERow') . '\');"'; } elseif ($this->getConfig('allowEdit')) { $TEMainList .= 'style="cursor:pointer;"'; } $TEMainList .= '>'; if ($this->displayActionButtons()) { $TEMainList .= '<td class="TETdFieldsList">'; $TEMainList .= '<input type="checkbox" name="rowSelector" id="rowSelector" onclick="TERowHighlight(this.parentNode.parentNode, this, \'' . ($k % 2 == 1 ? 'TEaltRow' : 'TERow') . '\');" '; $TEMainList .= 'style="cursor:hand;" value="' . $nonFilteredData[$k][$this->pk] . '" title="' . TECheckboxSelect . '">';
function displayHeader() { $headerfile = $this->getConfig('headerfile'); if ($headerfile) { require $headerfile; return; } $table = $this->table; echo '<div class="TEmainbody" align="center">'; if ($this->errors) { foreach ($this->errors as $e) { $aux_error = split(":", $e); if (strpos($aux_error[1], "Duplicate entry")) { $aux_1 = split(" ", trim($aux_error[1])); $NumberArray = count($aux_1); $aux_2 = $aux_1[5]; $aux = TEgetPrimaryKeyOf($this->table); $valor_duplicado = $aux_1[2]; $ElementDuplicate = (int) $aux_1[$NumberArray - 1]; $campo_duplicado = $aux[$ElementDuplicate]; $ArrayErrorTxt = split("'", trim($aux_error[1])); $valor_duplicado = $ArrayErrorTxt[1]; if ($campo_duplicado != "") { $RecordId = nombre_id($this->table, $campo_duplicado, str_replace("'", "", $valor_duplicado), $aux[1]); } $DuplicateErrorTxt = TEErrorDuplicateEntry . " "; $url = new TableEditor_URL(); $url->removeQueryString('edit'); $url->removeQueryString('add'); $url->addQueryString('view', $RecordId); $PopupUrl = $url->getURL(true); $DuplicateErrorButton .= '<img src="' . TEImagesPath . 'TEActionView.gif" srcover="' . TEImagesPath . 'TEActionViewOver.gif" class="TEInputButton" '; if (file_exists("" . TEditorPath . "TEPopupForm.php")) { $DuplicateErrorButton .= 'onclick="TEWindowOpenPopup(\'' . $TEditorPath . 'TEPopupForm.php?table=' . $this->table . '&view=' . $RecordId . '&TEPopup=1\', \'DuplicateEntry\', \'500\', \'500\', \'0\', \'0\')" '; $DuplicateErrorButton .= 'title="' . TEButtonAdd . '" alt="' . TEButtonAdd . '"> '; } else { $url = new TableEditor_URL(); $url->removeQueryString('edit'); $url->removeQueryString('add'); $url->addQueryString('view', $RecordId); $PopupUrl = $url->getURL(true); $DuplicateErrorButton .= 'onclick="TEWindowOpenPopup(\'' . $PopupUrl . '\', \'DuplicateEntry\', \'769\', \'400\', \'0\', \'1\')" title="' . TEButtonView . '" alt="' . TEButtonView . '"> '; } echo '<script language="javascript"> alert("ERROR: ' . $DuplicateErrorTxt . '\\n");</script><div class="TEditorError">ERROR: ' . $DuplicateErrorTxt . '<br>' . $DuplicateErrorButton . '</div>'; } else { echo '<script language="javascript"> alert("ERROR: ' . htmlspecialchars($e) . '"); </script><div class="TEditorError">ERROR: ' . htmlspecialchars($e) . '</div>'; } } } }
/** * Called when a row is to be edited * * @param mixed $id Optional ID of row to edit */ function displayAddEditCopyPage($id) { foreach (array_keys($this->fields) as $field) { if (empty($this->fields[$field]['noEdit'])) { $fields[] = $field; } } // Edit/copy specific if (isset($_GET['edit']) or isset($_GET['copy'])) { /** * Data filters */ if (!empty($this->dataFilters)) { $filters = implode(' AND ', $this->dataFilters); } else { $filters = 1; } $fields = implode(', ', $fields); list($tables, $joinClause) = $this->getQueryTables(); // Get row data $row = $this->dbGetRow("SELECT {$fields} FROM {$tables} WHERE {$joinClause} AND {$filters} AND {$this->pk} = {$id}"); if ($row === false) { $this->errors[] = 'Failed to find specified row in database'; return; } // If copying, nuke the primary key so we don't get conflicts on insert if (isset($_GET['copy'])) { $row[$this->pk] = '0'; } $title = isset($_GET['edit']) ? 'Edit' : 'Copy'; // Add specific } else { $row = array_flip($fields); foreach ($row as $k => $v) { $row[$k] = isset($this->fields[$k]['default']) ? $this->fields[$k]['default'] : null; } $title = 'Add'; } /** * Use the posted data if we're displaying an error */ if ((!empty($this->errors) or !empty($this->contextErrors)) and !empty($_POST)) { foreach ($row as $k => $v) { if (isset($_POST[$k])) { $row[$k] = $_POST[$k]; } } } $url = new TableEditor_URL(); $actionURL = $url->getURL(true); $this->displayHeader(); ?> <h2><?php echo $title; ?> Row</h2> <form action="<?php echo $actionURL; ?> " method="post"> <table border="0"> <?if($row):?> <?foreach($row as $field => $value):?> <tr> <th><?php echo !empty($this->fields[$field]['required']) ? '<span class="requiredAsterisk">*</span>' : ''; ?> <?php echo $this->fields[$field]['display']; ?> </th> <?if($this->config['useFunctions']):?> <td valign="top"> <select name="function[<?php echo $field; ?> ]" onchange="enableApply()"> <option></option> <?foreach(array_keys($this->config['functions']) as $f):?> <option value="<?php echo $f; ?> "><?php echo $f; ?> </option> <?endforeach?> </select> </td> <?endif?> <td> <?php switch ($this->fields[$field]['input']) { case 'textarea': printf('<textarea name="%s" cols="50" rows="12" onkeyup="enableApply()" %s>%s</textarea>', htmlspecialchars($field), $field == $this->pk && !$this->getConfig('allowPKEditing') ? 'disabled' : '', $value); break; case 'select': printf('<select name="%s" %s onchange="enableApply()"><option value="">Select...</option>', htmlspecialchars($field), $field == $this->pk && !$this->getConfig('allowPKEditing') ? 'disabled' : ''); // Print option tags foreach ($this->fields[$field]['values'] as $k => $v) { printf('<option value="%s" %s>%s</option>', htmlspecialchars($k), (string) $k === $value ? 'selected' : '', $v); } echo '</select>'; break; case 'bitmask': printf('<select name="%s[]" %s onchange="enableApply()" size="7" multiple>', htmlspecialchars($field), $field == $this->pk && !$this->getConfig('allowPKEditing') ? 'disabled' : ''); // Print option tags foreach ($this->fields[$field]['values'] as $k => $v) { printf("<option value=\"%s\" %s>%s</option>\n", htmlspecialchars($k), $k & $value ? 'selected' : '', htmlspecialchars($v)); } echo '</select>'; break; case 'date': printf('<input type="text" name="%s" value="%s" onkeyup="enableApply()" %s> <a href="javascript: void(document.forms[0].elements[\'%s\'].value = currentDate())" onclick="enableApply()" title="Click to set current date">Now</a>', htmlspecialchars($field), htmlspecialchars($value), $field == $this->pk && !$this->getConfig('allowPKEditing') ? 'disabled' : '', htmlspecialchars($field)); break; case 'time': printf('<input type="text" name="%s" value="%s" onkeyup="enableApply()" %s> <a href="javascript: void(document.forms[0].elements[\'%s\'].value = currentTime())" onclick="enableApply()" title="Click to set current time">Now</a>', htmlspecialchars($field), htmlspecialchars($value), $field == $this->pk && !$this->getConfig('allowPKEditing') ? 'disabled' : '', htmlspecialchars($field)); break; case 'datetime': printf('<input type="text" name="%s" value="%s" onkeyup="enableApply()" %s> <a href="javascript: void(document.forms[0].elements[\'%s\'].value = currentDateTime())" onclick="enableApply()" title="Click to set current date and time">Now</a>', htmlspecialchars($field), htmlspecialchars($value), $field == $this->pk && !$this->getConfig('allowPKEditing') ? 'disabled' : '', htmlspecialchars($field)); break; case 'password': printf('<input type="password" name="%s" onkeyup="enableApply()"><br><input type="password" name="%s_confirm" onkeyup="enableApply()"> <i>(confirm)</i><br><input type="checkbox" value="1" name="%s_blank" id="%s_blank"> <label for="%s_blank">Set blank password?</label>', htmlspecialchars($field), htmlspecialchars($field), htmlspecialchars($field), htmlspecialchars($field), htmlspecialchars($field)); break; case 'text': // Technically not need, but here for clarity // Technically not need, but here for clarity default: printf('<input type="text" name="%s" value="%s" onkeyup="enableApply()" %s>', htmlspecialchars($field), $value, $field == $this->pk && !$this->getConfig('allowPKEditing') ? 'disabled' : ''); break; } if (!empty($this->contextErrors[$field])) { printf('<br><span class="contextError">%s</span>', $this->contextErrors[$field]); } ?> </td> </tr> <?endforeach?> <?endif?> <tr> <td colspan="3"> <span class="requiredAsterisk">*</span> Required fields </td> </tr> <tr> <td colspan="3" align="right"> <input type="submit" name="action" style="width: 65px" value="OK"> <input type="submit" name="action" style="width: 65px" value="Cancel"> <input type="submit" name="action" style="width: 65px" value="Apply" disabled> </td> </tr> </table> </form> <?php $this->displayFooter(); exit; }
<?php $url = new TableEditor_URL(); $url->removeQueryString('edit'); $url->removeQueryString('add'); $url->removeQueryString('idcopy'); //if(isset($_POST["ActionRedirection"]) && (TEChangeRedirection==1)) if (isset($_POST["ActionRedirection"]) && TEChangeRedirection == 1) { $RecordId = str_replace("'", "", $id); $RedirectionUrl = $url->getURL(true); $url->addQueryString('edit', $RecordId); $RedirectionEditUrl = $url->getURL(true); $url->removeQueryString('edit'); $url->removeQueryString('idcopy'); $url->addQueryString('add', '1'); $RedirectionAddURL = $url->getURL(true); if (defined("ADD_REDIRECCION") and $add > 0) { $LocationUrl = "" . TEditorPath . "?table=" . ADD_REDIRECCION . "&" . strtolower(TEFieldKey($table)) . "=" . $RecordId; } else { if ($_POST["ActionRedirection"] == 1) { TERedirection($RedirectionUrl); exit; } if ($_POST["ActionRedirection"] == 2) { TERedirection($RedirectionEditUrl); exit; } if ($_POST["ActionRedirection"] == 3) { TERedirection($RedirectionAddURL); exit; }
function TEButtonsPreviousNext($Id, $Action) { $url = new TableEditor_URL(); $Buttons = ''; $Buttons .= '<table cellpadding="0" cellspacing="0" align="center" width="100%">'; $Buttons .= '<tr>'; $Buttons .= '<td width="50%" style="text-align:left;">'; if (TEPreviousRecord($Id)) { $url->removeQueryString($Action); $url->addQueryString($Action, TEPreviousRecord($Id)); $UrlPrevious = $url->getURL(true); $Buttons .= '<img src="' . TEImagesPath . 'TEActionPrevius.png" srcover="' . TEImagesPath . 'TEActionPreviusOver.png" class="TEInputButton" '; $Buttons .= 'onclick="document.location=\'' . $UrlPrevious . '\';" title="' . TEButtonPrevious . '" alt="' . TEButtonPrevious . '"> '; } $Buttons .= '</td>'; $Buttons .= '<td width="50%" style="text-align:right;">'; if (TENextRecord($Id)) { $url->removeQueryString($Action); $url->addQueryString($Action, TENextRecord($Id)); $UrlNext = $url->getURL(true); $Buttons .= '<img src="' . TEImagesPath . 'TEActionNext.png" srcover="' . TEImagesPath . 'TEActionNextOver.png" class="TEInputButton" '; $Buttons .= 'onclick="document.location=\'' . $UrlNext . '\';" title="' . TEButtonNext . '" alt="' . TEButtonNext . '"> '; } $Buttons .= '</td>'; $Buttons .= '</tr>'; $Buttons .= '</table>'; return $Buttons; }
echo ' <input type="radio" name="ActionRedirection" id="ActionRedirection" value="3" ' . $aux_3 . '>Agregar otro registro'; echo '</td>'; echo '</tr>'; } echo '<tr>'; echo '<td colspan="3" align="center">'; $url = new TableEditor_URL(); if ($edit) { $TxtRemove = 'edit'; } elseif ($add == 1) { $TxtRemove = 'add'; } $url->removeQueryString($TxtRemove); $url->removeQueryString("importa_tabla"); $url->removeQueryString("importa_id"); $okURL = $url->getURL(false); if ($edit) { $url->addQueryString('view', $edit); $ViewURL = $url->getURL(true); $url->removeQueryString('view'); } $url->addQueryString('add', '1'); $AddURL = $url->getURL(false); $url->removeQueryString('add'); if ($edit) { $Copy = "idcopy"; $url->addQueryString($Copy, $edit); $CopyURL = $url->getURL(false); $url->removeQueryString($Copy); } if ($edit) {
var searchStr=document.getElementById('cuenta_id').value; location.href = '<?php echo $clearURL; ?> ' + '&'+'cuenta_id=' + searchStr; } </script> <?php break; case "_sample_vta_p_facturas": $url = new TableEditor_URL(); $url->removeQueryString('folio_fiscal'); $nuevoURL = $url->getURL(true); $url_detalle = new TableEditor_URL(); $url_detalle->removeQueryString('table'); $url_detalle->addQueryString('table', "_sample_vta_p_facturas_detalle"); $nuevoURL_detalle = $url_detalle->getURL(true); $TEMainList .= '<tr><td colspan=2>'; $TEMainList .= '<input name="folio_fiscal" type text>'; $TEMainList .= '<input type=button value="Buscar factura" onclick=consulta()>'; $TEMainList .= '</td><td colspan=2>'; $TEMainList .= '<input name="buscar_en_partidas" type text>'; $TEMainList .= '<input type=button value="Buscar en partidas" onclick=consulta_partidas()>'; $TEMainList .= '</td></tr>'; ?> <script language="javascript"> function consulta() { var searchStr=document.getElementById('folio_fiscal').value; location.href = '<?php echo $nuevoURL; ?>