本文整理汇总了PHP中article::update方法的典型用法代码示例。如果您正苦于以下问题:PHP article::update方法的具体用法?PHP article::update怎么用?PHP article::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类article
的用法示例。
在下文中一共展示了article::update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unserialize
if (isset($_POST['id'])) {
$article = $db->selectObject('article', 'id=' . $_POST['id']);
if ($article != null) {
$loc = unserialize($article->location_data);
}
} else {
$article->rank = $db->max('article', 'rank', 'location_data', "location_data='" . serialize($loc) . "'");
if ($article->rank == null) {
$article->rank = 0;
} else {
$article->rank += 1;
}
}
if (pathos_permissions_check("manage", $loc)) {
$oldcatid = $article->category_id;
$article = article::update($_POST, $article);
$article->location_data = serialize($loc);
if (isset($_POST['categories'])) {
$article->category_id = $_POST['categories'];
}
if (isset($article->id)) {
$article->id = $db->updateObject($article, "article");
} else {
$article->id = $db->insertObject($article, "article");
}
articlemodule::spiderContent($article);
if ($oldcatid != $article->category_id) {
$db->decrement('article', 'rank', 1, "location_data='" . serialize($loc) . "' AND rank > " . $article->rank . " AND category_id=" . $article->category_id);
}
pathos_flow_redirect();
} else {
示例2: IN
if ($tocatid) {
$db->query("UPDATE {$table} SET catid={$tocatid} WHERE `{$fromtype}` IN ({$fromids})");
dmsg('移动成功', $forward);
} else {
msg('请选择目标分类');
}
} else {
$itemid = $itemid ? implode(',', $itemid) : '';
$menuid = 5;
include tpl($action, $module);
}
break;
case 'update':
is_array($itemid) or msg('请选择' . $MOD['name']);
foreach ($itemid as $v) {
$do->update($v);
}
dmsg('更新成功', $forward);
break;
case 'tohtml':
is_array($itemid) or msg('请选择' . $MOD['name']);
$html_itemids = $itemid;
foreach ($html_itemids as $itemid) {
tohtml('show', $module);
}
dmsg('更新成功', $forward);
break;
case 'delete':
$itemid or msg('请选择' . $MOD['name']);
isset($recycle) ? $do->recycle($itemid) : $do->delete($itemid);
dmsg('删除成功', $forward);
示例3: isset
isset($sid) or $sid = $fid;
if (!isset($tid)) {
$r = $db->get_one("SELECT max(itemid) AS tid FROM {$table} WHERE status>2 AND islink=0 {$sql}");
$tid = $r['tid'] ? $r['tid'] : 0;
}
if ($update) {
require MD_ROOT . '/article.class.php';
$do = new article($moduleid);
}
isset($num) or $num = 100;
if ($fid <= $tid) {
$result = $db->query("SELECT itemid FROM {$table} WHERE status>2 AND islink=0 AND itemid>={$fid} {$sql} ORDER BY itemid LIMIT 0,{$num} ");
if ($db->affected_rows($result)) {
while ($r = $db->fetch_array($result)) {
$itemid = $r['itemid'];
$update ? $do->update($itemid) : tohtml('show', $module);
}
$itemid += 1;
} else {
$itemid = $fid + $num;
}
} else {
if ($update) {
$all ? msg('', '?moduleid=' . $moduleid . '&file=' . $file . '&action=index&all=1&one=' . $one) : dmsg('更新成功', $this_forward);
} else {
if ($one) {
dheader('?file=html&action=back&mid=' . $moduleid);
}
$all ? msg($MOD['name'] . '生成成功', $this_forward) : dmsg($MOD['name'] . '生成成功', $this_forward);
}
}
示例4: article
<?php
} else {
$article = new article();
$article->setId(intval($_REQUEST['i']));
if (isset($_REQUEST['published'])) {
$_REQUEST['published'] = true;
} else {
$_REQUEST['published'] = false;
}
if (isset($_REQUEST['onhome'])) {
$_REQUEST['onhome'] = true;
} else {
$_REQUEST['onhome'] = false;
}
$article->setContent($_REQUEST['title_1'], $_REQUEST['content_1'], $_REQUEST['title_2'], $_REQUEST['content_2'], $_REQUEST['title_3'], $_REQUEST['content_3'], $_REQUEST['title_4'], $_REQUEST['content_4'], $_REQUEST['title_5'], $_REQUEST['content_5'], $_REQUEST['title_6'], $_REQUEST['content_6'], $_REQUEST['code']);
$article->setCategory($_REQUEST['category']);
$article->setDateUpdate();
$article->setPublished($_REQUEST['published']);
$article->setonHome($_REQUEST['onhome']);
if ($article->update()) {
print 'sucess';
} else {
print 'failure';
}
}
} else {
print 'error';
}
?>
</div>