当前位置: 首页>>代码示例>>PHP>>正文


PHP blogPostModel::updateById方法代码示例

本文整理汇总了PHP中blogPostModel::updateById方法的典型用法代码示例。如果您正苦于以下问题:PHP blogPostModel::updateById方法的具体用法?PHP blogPostModel::updateById怎么用?PHP blogPostModel::updateById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在blogPostModel的用法示例。


在下文中一共展示了blogPostModel::updateById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateMarkdownText

 public function updateMarkdownText($post)
 {
     $post_id = $post['id'];
     $text = null;
     if (isset($post['plugin']) && isset($post['plugin'][$this->id]) && $post['plugin'][$this->id]) {
         $text = trim($post['plugin'][$this->id]);
     }
     $post_model = new blogPostModel();
     $post_model->updateById($post_id, array('text_markdown' => $text));
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:10,代码来源:blogMarkdown.plugin.php

示例2: execute

 public function execute()
 {
     $data = waRequest::post('data', null);
     if (!$data) {
         return;
     }
     foreach ($data as $name => $value) {
         if (in_array($name, $this->allowed_fields) === false) {
             throw new waException("Can't update post: editing of this field is denied");
         }
         if ($name == 'status') {
             if (in_array($value, array(blogPostModel::STATUS_DRAFT, blogPostModel::STATUS_DEADLINE, blogPostModel::STATUS_SCHEDULED, blogPostModel::STATUS_PUBLISHED)) === false) {
                 throw new waException("Can't change status: unknown value");
             }
         }
     }
     $post_id = waRequest::post('post_id', null, waRequest::TYPE_INT);
     $post_model = new blogPostModel();
     $post = null;
     if ($post_id) {
         $post = $post_model->getFieldsById($post_id, array('id', 'blog_id', 'contact_id', 'datetime'));
     }
     if (!$post) {
         throw new waException("Unknown post");
     }
     $contact = wa()->getUser();
     $contact_id = $contact->getId();
     $allow = blogHelper::checkRights($post['blog_id'], $contact_id, $contact_id != $post['contact_id'] ? blogRightConfig::RIGHT_FULL : blogRightConfig::RIGHT_READ_WRITE);
     if (!$allow) {
         throw new waException("Access denied");
     }
     if (!$post_model->updateById($post_id, $data)) {
         throw new waException("Error when updating data");
     }
     $post = array_merge($post, $data);
     if ($post['status'] == blogPostModel::STATUS_DEADLINE) {
         $user = wa()->getUser();
         $timezone = $user->getTimezone();
         $current_datetime = waDateTime::date("Y-m-d", null, $timezone);
         $datetime = waDateTime::date("Y-m-d", $post['datetime'], $timezone);
         if ($datetime <= $current_datetime) {
             $post['overdue'] = true;
         }
     }
     $this->response['post'] = $post;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:46,代码来源:blogPostSaveField.controller.php

示例3: cancelSchedule

 private function cancelSchedule($post)
 {
     $this->post_model->updateById($post['id'], array("schedule_datetime" => null));
     $this->response['redirect'] = $this->getRedirectUrl(array('module' => 'post', 'action' => 'edit', 'id' => $post['id']));
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:5,代码来源:blogPostSave.controller.php


注:本文中的blogPostModel::updateById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。