本文整理汇总了PHP中School::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP School::exists方法的具体用法?PHP School::exists怎么用?PHP School::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类School
的用法示例。
在下文中一共展示了School::exists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _ops_delete
function _ops_delete($OID = 0, $CID = 0)
{
$OID = max(0, intval($OID));
$CID = max(0, intval($CID));
$msg = '';
loginRequireMgmt();
if (!loginCheckPermission(USER::MGMT_SCHOOL)) {
redirect("errors/401");
}
$itemName = "School";
$urlPrefix = "mgmt_school";
$object = new School($OID, $CID);
if (!$object->exists()) {
$msg = "{$itemName} not found!";
} else {
transactionBegin();
if ($object->delete()) {
transactionCommit();
$msg = "{$itemName} deleted!";
} else {
TransactionRollback();
$msg = "{$itemName} delete failed!";
}
}
redirect("{$urlPrefix}/manage", $msg);
}
示例2: _edit
function _edit($OID = 0, $CID = 0)
{
loginRequireMgmt();
if (!loginCheckPermission(USER::MGMT_SCHOOL)) {
redirect("errors/401");
}
$item = "School";
$urlPrefix = "mgmt_school";
$object = new School();
$object->retrieve($OID, $CID);
if (!$object->exists()) {
$data['body'][] = "<p>{$item} Not Found!</p>";
} else {
$fdata['form_heading'] = "Edit {$item}";
$fdata['object'] = $object;
$fdata['actionUrl'] = myUrl("{$urlPrefix}/ops_update");
$fdata['actionLabel'] = "Submit";
$fdata['cancelUrl'] = myUrl("{$urlPrefix}/manage");
$fdata['cancelLabel'] = "Cancel";
$form = View::do_fetch(VIEW_PATH . "{$urlPrefix}/form.php", $fdata);
$data['head'][] = View::do_fetch(VIEW_PATH . "{$urlPrefix}/form_js.php");
$data['body'][] = "<h2>Edit {$item}</h2>";
$data['body'][] = $form;
}
View::do_dump(VIEW_PATH . 'layouts/mgmtlayout.php', $data);
}
示例3: _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);
}