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


PHP blogPostModel::countByField方法代码示例

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


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

示例1: execute

 /**
  * @param array $params deleted contact_id
  * @return array|void
  */
 public function execute(&$params)
 {
     waLocale::loadByDomain('blog');
     $post_model = new blogPostModel();
     $comment_model = new blogCommentModel();
     $links = array();
     foreach ($params as $contact_id) {
         $links[$contact_id] = array();
         if ($count = $post_model->countByField('contact_id', $contact_id)) {
             $links[$contact_id][] = array('role' => _wd('blog', 'Posts author'), 'links_number' => $count);
         }
         if ($count = $comment_model->countByField('contact_id', $contact_id)) {
             $links[$contact_id][] = array('role' => _wd('blog', 'Comments author'), 'links_number' => $count);
         }
     }
     return $links;
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:21,代码来源:contacts.links.handler.php

示例2: backendSidebar

    public function backendSidebar($params)
    {
        $output = array();
        $post_model = new blogPostModel();
        $blogs = blogHelper::getAvailable(false);
        $search_options = array('contact_id' => wa()->getUser()->getId(), 'status' => blogPostModel::STATUS_PUBLISHED, 'blog_id' => array_keys($blogs));
        $count = $post_model->countByField($search_options);
        $selected = '';
        if (waRequest::get('search') == $this->id) {
            $selected = ' class="selected"';
        }
        $img_url = wa()->getUser()->getPhoto(20);
        $title = _wp('Posts by me');
        $output['menu'] = <<<HTML
<li{$selected}>
\t<span class="count my_count">{$count}</span>
\t<a href="?search={$this->id}">
\t\t<i class="icon16 userpic20" style="background-image: url('{$img_url}');"></i>{$title}
\t</a>
</li>
HTML;
        return $output;
    }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:23,代码来源:blogMyposts.plugin.php

示例3: execute

 public function execute()
 {
     $this->setLayout(new blogDefaultLayout());
     $blog_id = (int) waRequest::get('blog');
     $blog_model = new blogBlogModel();
     if ($blog_id && $this->getRights("blog.{$blog_id}") < blogRightConfig::RIGHT_FULL || !$blog_id && !$this->getRights(blogRightConfig::RIGHT_ADD_BLOG)) {
         throw new waRightsException(_w('Access denied'));
     }
     // save settings (POST)
     $settings = waRequest::post('settings');
     $draft_data = array();
     if ($settings) {
         $settings['status'] = isset($settings['status']) ? blogBlogModel::STATUS_PUBLIC : blogBlogModel::STATUS_PRIVATE;
         $settings['name'] = trim($settings['name']);
         $settings['icon'] = !empty($settings['icon_url']) ? $settings['icon_url'] : $settings['icon'];
         if (isset($settings['qty'])) {
             unset($settings['qty']);
         }
         if (isset($settings['sort'])) {
             unset($settings['sort']);
         }
         $settings['id'] = $blog_id;
         $validate_massages = $this->validate($settings);
         if (!$validate_massages) {
             //TODO handle settings
             if ($blog_id) {
                 $blog_model->updateById($blog_id, $settings);
                 $this->log('blog_modify');
             } else {
                 $settings['sort'] = (int) $blog_model->select('MAX(`sort`)')->fetchField() + 1;
                 $blog_id = $blog_model->insert($settings);
                 $this->getUser()->setRight($this->getApp(), "blog.{$blog_id}", blogRightConfig::RIGHT_FULL);
                 $this->log('blog_add');
             }
             // refresh qty post in blogs
             $blog_model->recalculate($blog_id);
             $this->redirect(array('blog' => $blog_id));
         } else {
             $this->view->assign('messages', $validate_massages);
             $draft_data = $settings;
         }
     }
     $colors = $this->getConfig()->getColors();
     $icons = $this->getConfig()->getIcons();
     if ($blog_id) {
         if (!($blog = $blog_model->search(array('blog' => $blog_id), array('link' => false))->fetchSearchItem())) {
             throw new waException(_w('Blog not found'), 404);
         }
         $blog['other_settlements'] = blogBlogModel::getPureSettlements($blog);
         $blog['settlement'] = array_shift($blog['other_settlements']);
     } else {
         $blog = array('id' => false, 'name' => '', 'status' => blogBlogModel::STATUS_PUBLIC, 'icon' => current($icons), 'color' => current($colors), 'url' => false);
         $blogs = array($blog);
         $blogs = $blog_model->prepareView($blogs, array('link' => false));
         $blog = array_shift($blogs);
         $blog['other_settlements'] = blogBlogModel::getPureSettlements($blog);
         $blog['settlement'] = array_shift($blog['other_settlements']);
     }
     $this->getResponse()->setTitle($blog_id ? trim(sprintf(_w('%s settings'), $blog['name'])) : _w('New blog'));
     $blog = !$draft_data ? $blog : array_merge($blog, $draft_data);
     $posts_total_count = 0;
     if ($blog_id) {
         $post_model = new blogPostModel();
         $posts_total_count = $post_model->countByField('blog_id', $blog_id);
         if ($posts_total_count) {
             $blog_model = new blogBlogModel();
             $blogs = $blog_model->getAvailable($this->getUser());
             $this->view->assign('blogs', $blogs);
         }
     }
     /**
      * Backend blog settings
      * UI hook allow extends backend blog settings page
      * @event backend_blog_edit
      * @param array[string]mixed $blog Blog data
      * @param array['id']int $blog['id'] Blog ID
      * @return array[string][string]string $return['%plugin_id%']['settings'] Blog extra settings html fields
      */
     $this->view->assign('backend_blog_edit', wa()->event('backend_blog_edit', $blog));
     $this->view->assign('posts_total_count', $posts_total_count);
     $this->view->assign('blog_id', $blog_id);
     $this->view->assign('blog', $blog);
     $this->view->assign('colors', $colors);
     $this->view->assign('icons', $icons);
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:85,代码来源:blogBlogSettings.action.php


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