本文整理汇总了PHP中ArticleModel::save方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleModel::save方法的具体用法?PHP ArticleModel::save怎么用?PHP ArticleModel::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleModel
的用法示例。
在下文中一共展示了ArticleModel::save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AddAction
protected function AddAction()
{
$article = new ArticleModel();
$article->title = $_POST['title'];
$article->content = $_POST['content'];
$article->save();
$view = new View();
$view->display('add.php');
}
示例2: invoke
function invoke($request)
{
//save
global $_SESSION, $config;
session_start();
if(isset($request["password"]) and $request["password"]===$config["password"] )
{
$_SESSION["password"] = $request["password"];
}
if(isset($request["save"]) and $_SESSION["password"]===$config["password"])
{
ArticleModel::save($request);
}
$view = new HtmlView($request);
$view->put();
}
示例3: update
public function update()
{
if (!IS_POST) {
$this->message2('非法操作!', __APP__ . '/Admin');
}
$id = I('id', NULL);
if (!empty($id)) {
$article = new ArticleModel();
if ($data = $article->create()) {
if (false !== $article->save()) {
$this->message('编辑成功', __URL__ . '/index');
} else {
$this->message('编辑失败:' . $article->getError(), __URL__ . '/index');
}
} else {
$this->message('编辑失败:' . $article->getError(), __URL__ . '/index');
}
} else {
$this->message('请选择编辑对象', __URL__ . '/index');
}
}
示例4: SaveSubjectAction
public function SaveSubjectAction()
{
$request = Project::getRequest();
$article_model = new ArticleModel();
if (count($article_model->loadByParentId(0, array(ARTICLE_COMPETITION_STATUS::NEW_ARTICLE), Project::getUser()->getDbUser()->id)) < 5) {
$article_model->title = $request->title;
$article_model->articles_tree_id = $request->parent_id;
$article_model->user_id = Project::getUser()->getDbUser()->id;
$article_model->rate_status = ARTICLE_COMPETITION_STATUS::NEW_ARTICLE;
$article_model->creation_date = date("Y-m-d H:i:s");
$article_model->save();
}
Project::getResponse()->redirect($request->createUrl('Article', 'CompetitionCatalog'));
}
示例5: update
/**
* 文章编辑更新页面
*/
function update()
{
$article = new ArticleModel();
if (!!($data = $article->create())) {
if (!empty($data['id'])) {
if (false !== $article->save()) {
$this->assign('jumpUrl', __URL__ . '/index');
$this->success('更新成功');
} else {
$this->error('更新失败:' . $article->getDbError());
}
} else {
$this->error('请选择编辑用户');
}
} else {
$this->error('更新失败:( ' . $article->getError() . ' )');
}
}
示例6: SaveArticleAction
public function SaveArticleAction()
{
$request = Project::getRequest();
$id = (int) $request->id;
$article_model = new ArticleModel();
$article_page_model = new ArticlePageModel();
$article_model->load($id);
$article_model->user_id = Project::getUser()->getDbUser()->id;
$article_model->articles_tree_id = $request->article_cat;
$article_model->title = $request->article_title;
$article_model->allowcomments = (bool) $request->allow_comment;
$article_model->rate_status = (bool) $request->allow_rate;
$article_model->creation_date = date("Y-m-d H:i:s");
$id = $article_model->save();
for ($i = 0; $i < count($request->title_page); $i++) {
$article_page_model = new ArticlePageModel();
$article_page_model->load($request->id_page[$i]);
$article_page_model->article_id = $id;
$article_page_model->title = $request->title_page[$i];
$article_page_model->p_text = $request->content_page[$i];
$article_page_model->save();
}
$data = array();
$this->_makeArticleList($data);
$this->_view->AjaxArticleList($data);
$this->_view->ajax();
}