本文整理汇总了PHP中edit函数的典型用法代码示例。如果您正苦于以下问题:PHP edit函数的具体用法?PHP edit怎么用?PHP edit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateIcon
function updateIcon()
{
$request = Slim::getInstance()->request();
$body = $request->getBody();
$body = json_decode($body);
unset($body->created_date);
if (!empty($body->image)) {
file_put_contents('./icon_images/' . $body->image->filename, base64_decode($body->image->base64));
$body->image = $body->image->filename;
} else {
unset($body->image);
}
$id = $body->id;
unset($body->image_url);
if (isset($body->imagee)) {
unset($body->imagee);
}
if (isset($body->id)) {
unset($body->id);
}
$allinfo['save_data'] = $body;
$coupon_details = edit(json_encode($allinfo), 'icon', $id);
if (!empty($coupon_details)) {
$result = '{"type":"success","message":"Changed Succesfully"}';
} else {
$result = '{"type":"error","message":"Not Changed"}';
}
echo $result;
}
示例2: write
function write(&$frm)
{
if ($frm->validate("write")) {
return edit($frm);
}
$cols = grp(m("value", $_POST["print_dialog"]));
$qry = new dbUpdate("settings", "cubit", $cols, "constant='PRINT_DIALOG'");
$qry->run(DB_UPDATE);
$OUT = "\n\t<h3>Printing Options</h3>\n\tSuccessfully saved printing options.";
return $OUT;
}
示例3: updateSiteSettings
function updateSiteSettings()
{
$request = Slim::getInstance()->request();
$body = $request->getBody();
$user = json_decode($body);
$user->id = 1;
unset($user->id);
$allinfo['save_data'] = $user;
$result = edit(json_encode($allinfo), 'site_settings', 1);
$result = '{"type":"success","message":"Updated Succesfully"}';
echo $result;
}
示例4: write
function write($frm)
{
/* @var $frm cForm */
if ($frm->validate("confirm")) {
return edit($frm);
}
/* point of sale message at the bottom of the slip */
$cols = grp(m("value", $_POST["posmsg"]));
$upd = new dbUpdate("settings", "cubit", $cols, "constant='POSMSG'");
$upd->run(DB_UPDATE);
$OUT = "\n\t<h3>Point of Sale Settings</h3>\n\t\n\tSuccessfully updated.<br />";
return $OUT;
}
示例5: edit
/**
* Author : Jan Germann
* Datum : 26.04.2010
* Modul : files
* Beschreibung : Dateiendaten Editieren
* in 3 Schritten: Datei auswählen, Dateidaten anzeigen und ändern
* und am ende die Dateidaten Updaten
*/
function edit()
{
global $msg, $log, $mysql;
if (!isset($_POST['id'])) {
//Prüfen ob Dateien zum Editieren in der Datenbank vorhanden sind
if (1 > mysql_result(mysql_query("SELECT count(*) FROM " . _PREFIX_ . "files"), 0)) {
$msg->error("Es gibt noch keine Dateien die editiert werden können.");
return;
}
//Selectfeld mit Dateien vorbereiten
$q = mysql_query("SELECT * FROM " . _PREFIX_ . "files ORDER BY name");
while ($r = mysql_fetch_object($q)) {
$data .= "<option value=" . $r->id . ">" . $r->name . "</option>";
}
// Template ausfüllen -->
$tpl = dirname(__FILE__) . "/template/form.edit.choose.tpl";
$tpl = file_get_contents($tpl);
return str_replace("%files%", $data, $tpl);
// <-- Template ausfüllen
} elseif (isset($_POST['id']) && !isset($_POST['name'])) {
$q = mysql_query("SELECT * FROM " . _PREFIX_ . "files WHERE id='" . intval($_POST['id']) . "'");
$o = mysql_fetch_object($q);
// Template ausfüllen -->
$tpl = dirname(__FILE__) . "/template/form.edit.tpl";
if (is_file($tpl)) {
$template = file_get_contents($tpl);
}
$template = str_replace(array("%id%", "%name%", "%description%", "%file%"), array($o->id, $o->name, $o->description, $o->file), $template);
// <-- Template ausfüllen
return $template;
} elseif (isset($_POST['id']) && isset($_POST['name'])) {
if (empty($_POST['name'])) {
$msg->error("Sie haben keinen Namen angegeben.");
unset($_POST['name']);
return edit();
}
//Wenn kein Fehler beim Dateiupload bekannt ist soll die Datei ersetzt werden.
if (!$_FILES['file']['error']) {
update_file($_POST['id'], $_FILES['file']);
}
$name = mysql_real_escape_string($_POST['name']);
$description = mysql_real_escape_string($_POST['description']);
$id = intval($_POST['id']);
$mysql->query("UPDATE " . _PREFIX_ . "files\r\n\t\t\t\t\t SET name = '" . $name . "',\r\n\t\t\t\t\t\t description = '" . $description . "'\r\n\t\t\t\t\t WHERE id = '" . $id . "'\r\n\t\t\t\t\t LIMIT 1");
$msg->success("Datei editiert.");
$log->add("Dateiupdate", "<id>" . $id . "</id><name>" . $name . "</name><description>" . $description . "</description>");
}
}
示例6: updateCoupon
function updateCoupon($id)
{
$request = Slim::getInstance()->request();
$body = $request->getBody();
$coupon = json_decode($body);
if (isset($coupon->id)) {
unset($coupon->id);
}
$allinfo['save_data'] = $coupon;
$coupon_details = edit(json_encode($allinfo), 'coupons', $id);
if (!empty($coupon_details)) {
$result = '{"type":"success","message":"Changed Succesfully"}';
} else {
$result = '{"type":"error","message":"Not Changed"}';
}
echo $result;
}
示例7: jump
function jump($action)
{
switch ($action) {
case 'add':
add();
break;
case 'edit_del':
if (array_key_exists('edit', $_REQUEST)) {
edit();
} elseif (array_key_exists('delete', $_REQUEST)) {
delete_confirm();
} else {
error('invalid edit_del');
}
break;
case 'update':
if (array_key_exists('cancel', $_REQUEST)) {
message('Edit canceled');
main_page();
} else {
update();
}
break;
case 'delete_do':
if (array_key_exists('cancel', $_REQUEST)) {
message('Delete canceled');
main_page();
} else {
delete_do();
}
break;
default:
error_message('unhandled jump: ' . $action);
main_page();
}
// fall-through
message('jump > fall-through (%s)', $action);
main_page();
}
示例8: write
function write($_POST)
{
# get vars
foreach ($_POST as $key => $value) {
${$key} = $value;
}
if (isset($back)) {
return edit($div);
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($div, "num", 1, 50, "Invalid branch id.");
$v->isOk($brancod, "string", 0, 50, "Invalid branch code.");
$v->isOk($branname, "string", 1, 255, "Invalid branch name.");
$v->isOk($brandet, "string", 0, 255, "Invalid details.");
# Display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class=err>{$e['msg']}</li>";
}
$confirm .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
// Update branch
db_connect();
$sql = "UPDATE branches SET brancod = '{$brancod}', branname = '{$branname}', brandet = '{$brandet}' WHERE div = '{$div}'";
$rslt = db_exec($sql) or errDie("Unable to update branch in Cubit.", SELF);
$write = "\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\r\n\t<tr><th>Branch edited</th></tr>\r\n\t<tr class=datacell><td>Branch, {$branname} ({$brancod}) has been successfully edited.</td></tr>\r\n\t</table>\r\n\t<p>\r\n\t<table border=0 cellpadding='2' cellspacing='1'>\r\n\t<tr><th>Quick Links</th></tr>\r\n\t<tr class='bg-odd'><td><a href='admin-branview.php'>View Branches</a></td></tr>\r\n\t<tr class='bg-odd'><td><a href='main.php'>Main Menu</a></td></tr>\r\n\t</table>";
return $write;
}
示例9: cfieldCfgInit
$gui->linked_tprojects = null;
$gui->cfield_types = $cfield_mgr->get_available_types();
$result_msg = null;
$do_control_combo_display = 1;
$cfieldCfg = cfieldCfgInit($cfield_mgr);
// Changed default values
$emptyCF = array('id' => $args->cfield_id, 'name' => '', 'label' => '', 'type' => 0, 'possible_values' => '', 'show_on_design' => 1, 'enable_on_design' => 1, 'show_on_execution' => 0, 'enable_on_execution' => 0, 'show_on_testplan_design' => 0, 'enable_on_testplan_design' => 0, 'node_type_id' => $cfieldCfg->allowed_nodes['testcase']);
$gui->cfield = $emptyCF;
switch ($args->do_action) {
case 'create':
$templateCfg->template = $templateCfg->default_template;
$user_feedback = '';
$operation_descr = '';
break;
case 'edit':
$op = edit($args, $cfield_mgr);
$gui->cfield = $op->cf;
$gui->cfield_is_used = $op->cf_is_used;
$gui->cfield_is_linked = $op->cf_is_linked;
$gui->linked_tprojects = $op->linked_tprojects;
$user_feedback = $op->user_feedback;
$operation_descr = $op->operation_descr;
break;
case 'do_add':
case 'do_add_and_assign':
$op = doCreate($_REQUEST, $cfield_mgr, $args);
$gui->cfield = $op->cf;
$user_feedback = $op->user_feedback;
$templateCfg->template = $op->template;
$operation_descr = '';
break;
示例10: edit
#
#
#
#
#
#
#
#
#
#
# get settings
require "../settings.php";
require "../core-settings.php";
require "../libs/ext.lib.php";
if (isset($_GET['listid'])) {
$OUTPUT = edit($_GET['listid']);
} else {
$OUTPUT = "<li> - Invalid use of module.</li>";
}
# display output
require "../template.php";
function edit($listid)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($listid, "num", 1, 50, "Invalid Price List id.");
# display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
示例11: switch
# decide what to do
if (isset($_POST["key"])) {
switch ($_POST["key"]) {
case "write":
$OUTPUT = write($_POST);
break;
default:
if (isset($_GET['fcid'])) {
$OUTPUT = edit($_GET['fcid']);
} else {
$OUTPUT = "<li> - Invalid use of module";
}
}
} else {
if (isset($_GET['fcid'])) {
$OUTPUT = edit($_GET['fcid']);
} else {
$OUTPUT = "<li> - Invalid use of module";
}
}
require "template.php";
##
# functions
##
# Enter settings
function edit($fcid)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($fcid, "num", 1, 20, "Invalid Currency.");
示例12: confirm
function confirm($_POST)
{
# Get vars
global $_FILES, $DOCLIB_DOCTYPES;
foreach ($_POST as $key => $value) {
${$key} = $value;
}
# Validate input
require_lib("validate");
$v = new validate();
$v->isOk($docid, "string", 1, 20, "Invalid document number.");
$v->isOk($typeid, "string", 1, 20, "Invalid type code.");
if (isset($xin)) {
$v->isOk($xin, "num", 1, 20, "Invalid {$DOCLIB_DOCTYPES[$typeid]} number.");
}
$v->isOk($docname, "string", 1, 255, "Invalid Document name.");
$v->isOk($docref, "string", 0, 255, "Invalid Document reference.");
$date = $day . "-" . $mon . "-" . $year;
if (!checkdate($mon, $day, $year)) {
$v->isOk($date, "num", 1, 1, "Invalid date.");
}
// $v->isOk ($docname, "string", 1, 255, "Invalid Document name.");
$v->isOk($descrip, "string", 0, 255, "Invalid Document Description.");
# Display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class=err>" . $e["msg"];
}
// $confirm .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return edit($_POST, $confirm);
}
if (!isset($xin)) {
$typRs = get("yr2", "*", "doctypes", "typeid", $typeid);
$typ = pg_fetch_array($typRs);
$typename = "({$typ['typeref']}) {$typ['typename']}";
$xinc = "";
} else {
$typename = $DOCLIB_DOCTYPES[$typeid];
$xinc = xinc_gw($typeid, $xin);
}
$confirm = "<h3>Confirm Document</h3>\r\n\t<form action='" . SELF . "' method=post>\r\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<input type=hidden name=key value=write>\r\n\t<input type=hidden name=docid value='{$docid}'>\r\n\t<input type=hidden name=typeid value='{$typeid}'>\r\n\t<input type=hidden name=docname value='{$docname}'>\r\n\t<input type=hidden name=docref value='{$docref}'>\r\n\t<input type=hidden name=day value='{$day}'>\r\n\t<input type=hidden name=mon value='{$mon}'>\r\n\t<input type=hidden name=year value='{$year}'>\r\n\t<input type=hidden name=descrip value='{$descrip}'>\r\n\t<tr><th>Field</th><th>Value</th></tr>\r\n\t<tr class='even'><td>Type</td><td>{$typename}</td></tr>\r\n\t{$xinc}\r\n\t<tr class='odd'><td>Document Name</td><td>{$docname}</td></tr>\r\n\t<tr class='even'><td>Ref</td><td>{$docref}</td></tr>\r\n\t<tr class='odd'><td>Date</td><td align=center>{$date}</td></tr>\r\n\t<tr class='even'><td>Description</td><td>{$descrip}</td></tr>\r\n\t<tr><td><br></td></tr>\r\n\t<tr><td align=right></td><td valign=left><input type=submit value='Write »'></td></tr>\r\n\t</table></form>";
return $confirm;
}
示例13: switch
<?php
require_once '../init.php';
switch ($_POST['type']) {
case 'add':
if (add($_POST['contact_name'], $_POST['contact_lastname'], $_POST['companyname'], $_POST['first_adress'], $_POST['first_zipcode'], $_POST['first_city'], $_POST['first_housenumber'], $_POST['second_adress'], $_POST['second_zipcode'], $_POST['second_city'], $_POST['second_housenumber'], $_POST['initials'], $_POST['first_telephonenumber'], $_POST['second_telephonenumber'], $_POST['fax'], $_POST['email'], $db)) {
header('location: ../../public/views/dashboard/dashboard.php');
} else {
echo "<script> history.go(-1); </script>";
}
break;
case 'edit':
if (edit($_POST['id'], $_POST['contact_name'], $_POST['contact_lastname'], $_POST['companyname'], $_POST['first_adress'], $_POST['first_zipcode'], $_POST['first_city'], $_POST['first_housenumber'], $_POST['second_adress'], $_POST['second_zipcode'], $_POST['second_city'], $_POST['second_housenumber'], $_POST['initials'], $_POST['first_telephonenumber'], $_POST['second_telephonenumber'], $_POST['fax'], $_POST['email'], $_POST['ledgeraccountnumber'], $_POST['taxcode'], $_POST['creditworthy'], $_POST['bkrcheck'], $_POST['open_project'], $db)) {
header('location: ../../public/views/dashboard/dashboard.php');
} else {
echo "<script> history.go(-1); </script>";
}
break;
case 'archive':
$id = filter_var($_POST['id'], FILTER_SANITIZE_NUMBER_INT);
if (archive($db, $_POST['id'])) {
header('location: ../../public/views/dashboard/dashboard.php');
} else {
header('location: ../../public/views/dashboard/dashboard.php');
}
break;
case 'dearchive':
$id = filter_var($_POST['id'], FILTER_SANITIZE_NUMBER_INT);
if (dearchive($db, $_POST['id'])) {
header('location: ../../public/views/dashboard/dashboard.php');
}
示例14: switch
/*
* Autor : Jan Germann
* Datum : 24.04.2010
* Modul : user
* Beschreibung : Die Nutzerverwaltung
*/
$_SESSION['content'] = '
<div id=modulemenu><a href="' . $_SERVER['PHP_SELF'] . '?a=' . $_GET['a'] . '&exec=create">Erstellen</a>
<a href="' . $_SERVER['PHP_SELF'] . '?a=' . $_GET['a'] . '&exec=edit">Editieren</a>
<a href="' . $_SERVER['PHP_SELF'] . '?a=' . $_GET['a'] . '&exec=delete">Löschen</a></div>';
switch ($_GET['exec']) {
case "create":
$_SESSION['content'] .= insert();
break;
case "edit":
$_SESSION['content'] .= edit();
break;
case "delete":
$_SESSION['content'] .= delete();
break;
}
function get_rightlevels($select = 0)
{
$select = intval($select);
$query = mysql_query("SELECT * FROM " . _PREFIX_ . "rightlevel ORDER BY id");
while ($o = mysql_fetch_object($query)) {
if ($o->id == $select) {
$data .= '<option selected value=' . $o->id . '>' . $o->title . '</option>';
} else {
$data .= '<option value=' . $o->id . '>' . $o->title . '</option>';
}
示例15: updatePointMaster
function updatePointMaster()
{
$rarray = array();
$request = Slim::getInstance()->request();
$body = json_decode($request->getBody());
$id = $body->id;
unset($body->id);
if (isset($body->merchant_name)) {
unset($body->merchant_name);
}
$allinfo['save_data'] = $body;
//$allinfo['save_data']['offer_to_date'] = $body->offer_to_date.' 23:59:59';
$save = edit(json_encode($allinfo), 'point_master', $id);
if (!empty($save)) {
$rarray = array('type' => 'success', 'offers' => $save);
} else {
$rarray = array('type' => 'error', 'message' => 'Internal error please try again later.');
}
echo json_encode($rarray);
}