本文整理汇总了PHP中School::update方法的典型用法代码示例。如果您正苦于以下问题:PHP School::update方法的具体用法?PHP School::update怎么用?PHP School::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类School
的用法示例。
在下文中一共展示了School::update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _ops_update
function _ops_update()
{
$OID = max(0, intval($_POST['OID']));
$CID = max(0, intval($_POST['CID']));
$msg = "";
loginRequireMgmt();
if (!loginCheckPermission(USER::MGMT_SCHOOL)) {
redirect("errors/401");
}
$itemName = "School";
$urlPrefix = "mgmt_school";
$object = new School();
if ($OID) {
$object->retrieve($OID, $CID);
if (!$object->exists()) {
$msg = "{$itemName} not found!";
} else {
transactionBegin();
$object->merge($_POST);
if ($object->update()) {
transactionCommit();
$msg = "{$itemName} updated!";
} else {
transactionRollback();
$msg = "{$itemName} update failed";
}
}
} else {
$object->merge($_POST);
transactionBegin();
if ($object->create()) {
transactionCommit();
$msg = "{$itemName} created!";
} else {
transactionRollback();
$msg = "{$itemName} Create failed";
}
}
redirect("{$urlPrefix}/manage", $msg);
}
示例2: doEdit
function doEdit()
{
if (isset($_POST['submit'])) {
$SCHOOLID = $_POST['school_id'];
$NAME = $_POST['schoolname'];
$SHORTNAME = $_POST['shortname'];
$ADDRESS = $_POST['address'];
$TELEPHONE = $_POST['telephone'];
$FAX = $_POST['fax'];
$DIRECTLINE = $_POST['directline'];
$EMAIL = $_POST['email'];
$WEBSITE = $_POST['website'];
$FACEBOOK = $_POST['facebook'];
$TWEETER = $_POST['tweeter'];
$GPLUS = $_POST['gplus'];
$YOUTUBE = $_POST['youtube'];
$LINKEDIN = $_POST['linkedin'];
$SKYPE = $_POST['skype'];
$BUREAU = $_POST['bureau'];
$EXTENSION = $_POST['extension'];
$school = new School();
$school->school_id = $SCHOOLID;
$school->extension = $EXTENSION;
$school->name = $NAME;
$school->shortname = $SHORTNAME;
$school->address = $ADDRESS;
$school->telephone = $TELEPHONE;
$school->fax = $FAX;
$school->directline = $DIRECTLINE;
$school->email = $EMAIL;
$school->website = $WEBSITE;
$school->tweeter = $TWEETER;
$school->facebook = $FACEBOOK;
$school->gplus = $GPLUS;
$school->youtube = $YOUTUBE;
$school->linkedin = $LINKEDIN;
$school->skype = $SKYPE;
$school->bureau_id = $BUREAU;
}
if ($SCHOOLID == "") {
message('ID Number is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} elseif ($NAME == "") {
message('School Name is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} elseif ($SHORTNAME == "") {
message('Short Name is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} elseif ($ADDRESS == "") {
message('Address is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} elseif ($EXTENSION == "") {
message('Extension is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} elseif ($TELEPHONE == "") {
message('Telephone is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} elseif ($FAX == "") {
message('Fax is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} elseif ($DIRECTLINE == "") {
message('Directline is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} elseif ($EMAIL == "") {
message('Email is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} elseif ($WEBSITE == "") {
message('Website is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} elseif ($TWEETER == "") {
message('Tweeter is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} elseif ($FACEBOOK == "") {
message('Facebook ID is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} elseif ($GPLUS == "") {
message('Gplus is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} elseif ($YOUTUBE == "") {
message('Youtube is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} elseif ($LINKEDIN == "") {
message('Linkedin is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} elseif ($SKYPE == "") {
message('Skype is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} elseif ($BUREAU == "") {
message('Bureau is required!', "error");
redirect('index.php?view=edit&id=' . $SCHOOLID);
} else {
$school->update($_GET['id']);
message('School information updated successfully!', "info");
redirect('index.php');
}
}