本文整理汇总了PHP中Groups::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Groups::update方法的具体用法?PHP Groups::update怎么用?PHP Groups::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Groups
的用法示例。
在下文中一共展示了Groups::update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeOrderRecalc
public function makeOrderRecalc()
{
$obj = new Groups();
$obj->isRecalc = false;
$groups = $obj->get();
$orderArr = $atLast = [];
foreach ($groups as $gr) {
if ($gr->order_id == null) {
$atLast[] = $gr->id;
} else {
$orderArr[$gr->order_id] = $gr->id;
}
}
ksort($orderArr);
$newOrderArr = array_values($orderArr);
$finalOrderArr = array_merge($newOrderArr, $atLast);
foreach ($finalOrderArr as $orderId => $id) {
$obj->update(['id' => $id], ['order_id' => $orderId]);
}
}
示例2: AdminPage
require_once "config.php";
require_once WWW_DIR . "/lib/adminpage.php";
require_once WWW_DIR . "/lib/groups.php";
require_once WWW_DIR . "/lib/category.php";
$page = new AdminPage();
$groups = new Groups();
$category = new Category();
$id = 0;
// set the current action
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
switch ($action) {
case 'submit':
if ($_POST["id"] == "") {
$groups->add($_POST);
} else {
$groups->update($_POST);
}
header("Location:" . WWW_TOP . "/group-list.php");
break;
case 'view':
default:
if (isset($_GET["id"])) {
$page->title = "Newsgroup Edit";
$id = $_GET["id"];
$group = $groups->getByID($id);
} else {
$page->title = "Newsgroup Add";
$group = array();
$group["active"] = "1";
$group["first_record"] = "0";
$group["last_record"] = "0";
示例3: sgToggleDefaultGroup
public function sgToggleDefaultGroup()
{
global $wpdb;
$this->checkPermissions($_POST['_wpnonce'], 'sg-toggle-default-group');
$groupsObj = new Groups();
$groupsObj->returnMessages = true;
$wpdb->query('UPDATE ' . $groupsObj->table . ' SET `default` = 0');
if ($_POST['id']) {
$result = $groupsObj->update(['id' => $_POST['id']], ['default' => 1]);
$output['result'] = $result['result'];
$output['messages'] = $result['messages']['error'];
} else {
$output['result'] = 1;
$output['messages'] = [];
}
echo json_encode($output, JSON_UNESCAPED_UNICODE);
die;
}