本文整理汇总了PHP中News::updateNews方法的典型用法代码示例。如果您正苦于以下问题:PHP News::updateNews方法的具体用法?PHP News::updateNews怎么用?PHP News::updateNews使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类News
的用法示例。
在下文中一共展示了News::updateNews方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateNews
function updateNews()
{
$news = new News();
$news->id($_REQUEST['id']);
$get_edited = array();
foreach ($_REQUEST as $k => $v) {
$get_edited[str_replace("edit_", "", $k)] = $v;
}
$news->setValues($get_edited);
if ($news->updateNews()) {
Common::jsonSuccess("News Update Successfully!");
} else {
Common::jsonError("Error");
}
}
示例2: editAction
/** Edit a news story
* @access public
* @return void
*/
public function editAction()
{
$form = new NewsStoryForm();
$form->submit->setLabel('Update story');
$this->view->form = $form;
if ($this->getRequest()->isPost()) {
if ($form->isValid($this->_request->getPost())) {
$this->_news->updateNews($form->getValues(), $this->getParam('id'));
$this->_helper->solrUpdater->update('content', $this->getParam('id'), 'news');
$this->getFlash()->addMessage('News story information updated!');
$this->redirect(self::REDIRECT);
} else {
$form->populate($this->_request->getPost());
}
} else {
// find id is expected in $params['id']
$id = (int) $this->_request->getParam('id', 0);
if ($id > 0) {
$form->populate($this->_news->fetchRow('id=' . $id)->toArray());
}
}
}
示例3: News
<?php
require __DIR__ . "/model/Database.php";
require __DIR__ . "/model/Article.php";
if (!empty($_POST)) {
$news = new News();
$news->title = $_POST['title'];
$news->content = $_POST['content'];
$news->author = $_POST['author'];
$news->updateNews($_GET['id']);
header("Location:/");
exit;
}
include __DIR__ . "/view/update.php";
示例4: News
$news_obj = new News();
$id = (int) $_POST['id'];
switch ($_POST['act']) {
case "update":
if (isset($_POST['title']) && isset($_POST['tomtat']) && isset($_POST['content']) && isset($_POST['cat_id']) && isset($_POST['hotnews']) && isset($_POST['featured'])) {
$title = $_POST['title'];
$tomtat = $_POST['tomtat'];
$content = $_POST['content'];
$cat_id = $_POST['cat_id'];
$hotnews = $_POST['hotnews'];
$featured = $_POST['featured'];
if (!empty($_FILES['file']['name'])) {
$temp_name = explode(".", $_FILES["file"]["name"]);
$newfilename = microtime() . "." . end($temp_name);
if (upload_image($_FILES['file'], $newfilename)) {
if ($news_obj->updateNews($title, $newfilename, $tomtat, $content, $cat_id, $hotnews, $featured, $id)) {
header("Location: ../index.php?view=list-news&stt=success");
} else {
header("Location: ../index.php?view=list-news&stt=fail");
}
}
} else {
if ($news_obj->updateNews($title, "", $tomtat, $content, $cat_id, $hotnews, $featured, $id)) {
header("Location: ../index.php?view=list-news&stt=success");
} else {
header("Location: ../index.php?view=list-news&stt=fail");
}
}
}
break;
case "xoa":
示例5: Header
} else {
$baseDir = $bvsSiteIni['ENVIRONMENT']['DATABASE_PATH'];
}
if ($_COOKIE['userID'] == "") {
Header("Location: /");
}
$DirNameLocal = dirname(__FILE__) . '/';
/*
adicionando a noticia pelo postBack
*/
if (isset($_GET['remove_home_page'])) {
$news = new News();
$news->setUserID($_COOKIE['userID']);
$news->setID($_GET['remove_home_page']);
$news->setInHome('0');
$news->updateNews();
header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/myNews.php");
exit;
}
if (isset($_POST['rss_url'])) {
$news = new News();
$news->setUserID($_COOKIE['userID']);
$news->setRSSURL($_POST['rss_url']);
$news->setInHome(false);
$news->addNews();
header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/myNews.php");
exit;
}
if (isset($_POST['remove_news_id'])) {
$news = new News();
$news->setUserID($_COOKIE['userID']);
示例6: sanitize
<?php
include "../../../classes/Database.php";
include "../../../classes/Connection.php";
include_once "../../../includes/bootstrap.php";
include "../../../classes/News.php";
include "../../../classes/AdminAction.php";
include "../../../includes/security.funcs.inc";
include_once "../../../includes/Pagination.php";
if (isset($_POST['submit'])) {
$_POST = sanitize($_POST);
$news = $_POST;
settype($news, 'object');
News::updateNews($news);
$success = "News Successfully Changed!";
$updates = 'Update news and events content';
AdminAction::addAdminAction($_SESSION['admin_name'], $updates);
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link rel="stylesheet" type="text/css" media="screen" href="<?php
echo $ROOT_URL;
?>
_admin/_assets/css/core3.css" />
<link rel="stylesheet" type="text/css" media="screen" href="<?php
echo $ROOT_URL;
?>