本文整理汇总了PHP中Rank::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Rank::update方法的具体用法?PHP Rank::update怎么用?PHP Rank::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rank
的用法示例。
在下文中一共展示了Rank::update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: procede
public function procede()
{
try {
if ($this->oRequest->existParam('name')) {
if ($this->oRequest->existParam('edit')) {
$oRank = new Rank($this->oRequest->getParam('name', 'string'), $this->oRequest->getParam('default', 'boolean'), $this->oRequest->getParam('edit', 'int'));
//Delete
if ($this->oRequest->existParam('delete') && $this->oRequest->getParam('delete', 'boolean')) {
$oRank->delete();
Logger::log('admin', Language::translate('RANKS_ADMIN_RANK_DELLOG') . $this->oRequest->getParam('name', 'string') . ' [' . $this->oCurrentUser->getLogin() . ']');
$this->oView->addAlert(Language::translate('RANKS_ADMIN_RANK_DEL'), 'success');
} else {
//Edit
$oRank->update();
Logger::log('admin', Language::translate('RANKS_ADMIN_RANK_UPDATELOG') . $this->oRequest->getParam('name', 'string') . ' [' . $this->oCurrentUser->getLogin() . ']');
$this->oView->addAlert(Language::translate('RANKS_ADMIN_RANK_UPDATE'), 'success');
}
} else {
$oRank = new Rank($this->oRequest->getParam('name', 'string'), $this->oRequest->getParam('default', 'boolean'));
$oRank->store();
Logger::log('admin', Language::translate('RANKS_ADMIN_RANK_ADDLOG') . $this->oRequest->getParam('name', 'string') . ' [' . $this->oCurrentUser->getLogin() . ']');
$this->oView->addAlert(Language::translate('RANKS_ADMIN_RANK_ADD'), 'success');
}
}
} catch (Exception $ex) {
$this->oView->addAlert($ex, 'danger');
} finally {
$this->createView();
}
}
示例2: filterArray
}
}
if ($countErrors > 0) {
$_POST = filterArray($_POST);
$_POST['submit'] = false;
} else {
// EVERYTHING IS OK
$newRank = new Rank($mysqli);
$arrColumns = array("rankcategory_id", "name", "description", "imageurl", "ordernum", "autodays", "hiderank", "promotepower", "autodisable", "color", "imagewidth", "imageheight");
$arrValues = array($_POST['rankcat'], $_POST['rankname'], $_POST['rankdesc'], $rankImgURL, $intNewRankOrderNum, isset($_POST['autodays']) ? $_POST['autodays'] : 0, isset($_POST['hiderank']) ? $_POST['hiderank'] : 0, isset($_POST['promoterank']) ? $_POST['promoterank'] : 0, isset($_POST['autodisable']) ? $_POST['autodisable'] : 0, $_POST['rankcolor'], $_POST['rankimagewidth'], $_POST['rankimageheight']);
if ($newRank->addNew($arrColumns, $arrValues)) {
// Added Rank! Now give the rank its privileges
$newRankInfo = $newRank->get_info_filtered();
// If maximum rank is set to "(this rank)", set the promotepower to the new rank's rank_id
if ($_POST['promoterank'] == -1) {
$newRank->update(array("promotepower"), array($newRankInfo['rank_id']));
}
$arrColumns = array("rank_id", "console_id");
$privObj = new Basic($mysqli, "rank_privileges", "privilege_id");
$result = $mysqli->query("SELECT * FROM " . $dbprefix . "console ORDER BY sortnum");
$rankOptions = "";
while ($row = $result->fetch_assoc()) {
$strPostVarName = "consoleid_" . $row['console_id'];
if (isset($_POST[$strPostVarName]) && $_POST[$strPostVarName] == 1) {
$arrValues = array($newRankInfo['rank_id'], $row['console_id']);
$privObj->addNew($arrColumns, $arrValues);
}
}
$manageRanksCID = $consoleObj->findConsoleIDByName("Manage Ranks");
echo "\n\t\t\t<div style='display: none' id='successBox'>\n\t\t\t\t<p align='center'>\n\t\t\t\t\tSuccessfully Added New Rank: <b>" . $newRankInfo['name'] . "</b>!\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t\t\n\t\t\t<script type='text/javascript'>\n\t\t\t\tpopupDialog('Add New Rank', '" . $MAIN_ROOT . "members/console.php?cID=" . $manageRanksCID . "', 'successBox');\n\t\t\t</script>\n\t\t";
} else {
示例3: elseif
if (!$uploadFile->uploadFile()) {
$countErrors++;
$dispError .= "<b>·</b> Unable to upload rank image file. Please make sure the file extension is either .jpg, .png, .gif or .bmp<br>";
} else {
$rankImgURL = "images/ranks/" . $uploadFile->getUploadedFileName();
$arrUpdateValues[] = $rankImgURL;
$arrUpdateColumns[] = "imageurl";
}
} elseif ($_POST['rankimageurl'] != "") {
$arrUpdateValues[] = $_POST['rankimageurl'];
$arrUpdateColumns[] = "imageurl";
}
if ($countErrors == 0) {
// No errors after checking/uploading new rank image
$rank->select($_GET['rID']);
$rank->update($arrUpdateColumns, $arrUpdateValues);
if ($resortRanks) {
$rank->resortOrder();
}
$rankInfo = $rank->get_info_filtered();
// Update privileges
$result = $mysqli->query("DELETE FROM " . $dbprefix . "rank_privileges WHERE rank_id = '" . $rankInfo['rank_id'] . "'");
if ($result) {
$arrColumns = array("rank_id", "console_id");
$privObj = new Basic($mysqli, "rank_privileges", "privilege_id");
$result = $mysqli->query("SELECT * FROM " . $dbprefix . "console ORDER BY sortnum");
$rankOptions = "";
while ($row = $result->fetch_assoc()) {
$strPostVarName = "consoleid_" . $row['console_id'];
if (isset($_POST[$strPostVarName]) && $_POST[$strPostVarName] == 1) {
$arrValues = array($rankInfo['rank_id'], $row['console_id']);
示例4: extract
</select>
</td>
</tr>
<tr>
<td colspan="2"><button id="edit" name="edit" class="btn btn-primary" type="button" onclick="editRank()">Edit</button></td>
</tr>
</table>
</form>
<div id="loading" class="alert alert-info" role="alert" style="display: none">
</div>
<?php
} else {
if ($do == 'edit') {
extract($_POST);
$rank->update($name, $division, $abbrev, $paygrade);
Event::addEvent('Rank ' . $ranks->getName() . ' has been modified.', $_SESSION['user'], 2);
}
}
} else {
if ($action == 'create') {
if ($do == 'none') {
?>
<form action="#" method="post">
<table>
<tr>
<th><label for="name">Rank Name:</label></th>
<td><input type="text" id="name" name="name" required/></td>
</tr>
<tr>
<th><label for="abbrev">Rank Abbreviation:</label> </th>
示例5: array
// No errors... Add to DB
$arrColumns = array("name", "imageurl", "ordernum", "hidecat", "useimage", "description", "imagewidth", "imageheight", "color");
$arrValues = array($_POST['catname'], $strCatImageURL, $intNewCatOrderNum, $_POST['hidecat'], $_POST['useimage'], $_POST['catdesc'], $_POST['catimagewidth'], $_POST['catimageheight'], $_POST['rankcolor']);
$newCat = new RankCategory($mysqli);
if ($newCat->addNew($arrColumns, $arrValues)) {
// Added New Category... Now set the ranks in this category
$newCatInfo = $newCat->get_info();
$rankObj = new Rank($mysqli);
$result = $mysqli->query("SELECT * FROM " . $dbprefix . "ranks WHERE rank_id != '1'");
while ($row = $result->fetch_assoc()) {
$postVar = "rankid_" . $row['rank_id'];
if (isset($_POST[$postVar]) && $_POST[$postVar] == 1) {
if ($rankObj->select($row['rank_id'])) {
$arrColumn = array("rankcategory_id");
$arrValue = array($newCatInfo['rankcategory_id']);
$rankObj->update($arrColumn, $arrValue);
}
}
}
echo "\n\t\t\t<div style='display: none' id='successBox'>\n\t\t\t\t<p align='center'>\n\t\t\t\t\tSuccessfully Added New Rank Category!\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t\t\n\t\t\t<script type='text/javascript'>\n\t\t\t\tpopupDialog('Add New Rank Category', '" . $MAIN_ROOT . "members', 'successBox');\n\t\t\t</script>\n\t\t\t";
} else {
$_POST['submit'] = false;
$dispError .= " <b>·</b> Unable to add category. Please try again.<br>";
}
} else {
$_POST['submit'] = false;
}
}
if (!isset($_POST['submit']) || !$_POST['submit']) {
$result = $mysqli->query("SELECT * FROM " . $dbprefix . "rankcategory ORDER BY ordernum DESC");
$orderoptions = "";