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


PHP Articles::deleteArticle方法代码示例

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


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

示例1: Articles

 /**
  * Carries out the specified action
  */
 function _deletePosts()
 {
     // delete the post (it is not physically deleted but rather, we set
     // the status field to 'DELETED'
     $articles = new Articles();
     $errorMessage = "";
     $successMessage = "";
     $totalOk = 0;
     foreach ($this->_postIds as $postId) {
         // get the post
         $post = $articles->getBlogArticle($postId, $this->_blogInfo->getId());
         if ($post) {
             // fire the event
             $this->notifyEvent(EVENT_PRE_POST_DELETE, array("article" => &$post));
             //
             // the next if-else branch allows a site administrator or the blog owner to remove
             // anybody's articles. If not, then users can only remove their own articles
             //
             if ($this->_userInfo->isSiteAdmin() || $this->_blogInfo->getOwner() == $this->_userInfo->getId()) {
                 $result = $articles->deleteArticle($postId, $post->getUser(), $this->_blogInfo->getId(), false);
             } else {
                 $result = $articles->deleteArticle($postId, $this->_userInfo->getId(), $this->_blogInfo->getId(), false);
             }
             if (!$result) {
                 $errorMessage .= $this->_locale->pr("error_deleting_article", $post->getTopic()) . "<br/>";
             } else {
                 $totalOk++;
                 if ($totalOk < 2) {
                     $successMessage .= $this->_locale->pr("article_deleted_ok", $post->getTopic()) . "<br/>";
                 } else {
                     $successMessage = $this->_locale->pr("articles_deleted_ok", $totalOk);
                 }
                 // fire the post event
                 $this->notifyEvent(EVENT_POST_POST_DELETE, array("article" => &$post));
             }
         } else {
             $errorMessage .= $this->_locale->pr("error_deleting_article2", $postId) . "<br/>";
         }
     }
     // clean up the cache
     CacheControl::resetBlogCache($this->_blogInfo->getId());
     $this->_view = new AdminPostsListView($this->_blogInfo);
     if ($errorMessage != "") {
         $this->_view->setErrorMessage($errorMessage);
     }
     if ($successMessage != "") {
         $this->_view->setSuccessMessage($successMessage);
     }
     $this->setCommonData();
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:54,代码来源:admindeletepostaction.class.php

示例2: deleteArticle

 /**
  * funkce smaze clanek
  * @param int $article_id
  * @return bool
  */
 public function deleteArticle($article_id)
 {
     try {
         return Articles::deleteArticle($article_id);
     } catch (Exception $e) {
         throw new RPCFault($e->getMessage(), $e->getCode(), $e->getCode());
     }
 }
开发者ID:kourim,项目名称:limedca,代码行数:13,代码来源:Application.php


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