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


PHP PHPWS_DB::setGroupConj方法代码示例

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


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

示例1: getEvents

 public function getEvents($start_search, $end_search)
 {
     if (empty($start_search) || empty($end_search)) {
         return null;
     }
     $event_table = $this->getEventTable();
     if (!$event_table) {
         return null;
     }
     PHPWS_Core::initModClass('calendar', 'Event.php');
     $db = new PHPWS_DB($event_table);
     $db->addWhere('start_time', $start_search, '>=', null, 'start');
     $db->addWhere('start_time', $end_search, '<', 'AND', 'start');
     $db->addWhere('end_time', $end_search, '<=', null, 'end');
     $db->addWhere('end_time', $start_search, '>', 'AND', 'end');
     $db->addWhere('start_time', $start_search, '<', null, 'middle');
     $db->addWhere('end_time', $end_search, '>', 'AND', 'middle');
     $db->setGroupConj('end', 'OR');
     $db->setGroupConj('middle', 'OR');
     $db->addOrder('start_time');
     $db->addOrder('end_time desc');
     $db->setIndexBy('id');
     $result = $db->getObjects('Calendar_Event', $this);
     if (PHPWS_Error::logIfError($result)) {
         return null;
     }
     return $result;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:28,代码来源:Schedule.php

示例2: show

 public static function show($start_date = null, $end_date = null)
 {
     if (!Blog_User::allowView()) {
         return null;
     }
     $db = new PHPWS_DB('blog_entries');
     if ($start_date) {
         $db->addWhere('publish_date', $start_date, '>=', 'and', 2);
     }
     if ($end_date) {
         $db->addWhere('publish_date', $end_date, '<=', 'and', 2);
     }
     $db->addWhere('approved', 1);
     $db->addWhere('publish_date', time(), '<');
     $db->addWhere('expire_date', time(), '>', 'and', 1);
     $db->addWhere('expire_date', 0, '=', 'or', 1);
     $db->setGroupConj(1, 'and');
     Key::restrictView($db, 'blog');
     $total_entries = Blog_User::totalEntries($db);
     $limit = PHPWS_Settings::get('blog', 'blog_limit');
     if (isset($_GET['page'])) {
         $page = $_GET['page'];
     } else {
         $page = 0;
     }
     if (!is_numeric($page) || $page < 2) {
         $offset = $page = 0;
     } else {
         $offset = ($page - 1) * $limit;
     }
     Layout::addStyle('blog');
     $result = Blog_User::getEntries($db, $limit, $offset);
     if ($page > 0 && empty($result)) {
         PHPWS_Core::reroute('blog/action/view/page/1');
     }
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         return NULL;
     }
     if (empty($result)) {
         if (Current_User::allow('blog')) {
             MiniAdmin::add('blog', PHPWS_Text::secureLink(dgettext('blog', 'Create first blog entry!'), 'blog', array('action' => 'admin', 'command' => 'new')));
         }
         return NULL;
     }
     if ($page < 2) {
         $past_entries = PHPWS_Settings::get('blog', 'past_entries');
         if ($past_entries) {
             $db->setLimit($past_entries, $limit);
             $past = $db->getObjects('Blog');
             if (PHPWS_Error::isError($past)) {
                 PHPWS_Error::log($past);
             } elseif ($past) {
                 Blog_User::showPast($past);
             }
         }
     }
     $rss = false;
     foreach ($result as $blog) {
         if (!$rss) {
             if (PHPWS_Core::moduleExists('rss')) {
                 PHPWS_Core::initModClass('rss', 'RSS.php');
                 $key = new Key($blog->key_id);
                 RSS::showIcon($key);
                 $rss = true;
             }
         }
         $view = $blog->view();
         if (!empty($view)) {
             $list[] = $view;
         }
     }
     $page_vars['action'] = 'view';
     if ($page > 1) {
         $page_vars['page'] = $page - 1;
         $tpl['PREV_PAGE'] = PHPWS_Text::moduleLink(dgettext('blog', 'Previous page'), 'blog', $page_vars);
         if ($limit + $offset < $total_entries) {
             $page_vars['page'] = $page + 1;
             $tpl['NEXT_PAGE'] = PHPWS_Text::moduleLink(dgettext('blog', 'Next page'), 'blog', $page_vars);
         }
     } elseif ($limit + $offset < $total_entries) {
         $page_vars['page'] = 2;
         $tpl['NEXT_PAGE'] = PHPWS_Text::moduleLink(dgettext('blog', 'Next page'), 'blog', $page_vars);
     }
     $tpl['ENTRIES'] = implode('', $list);
     $content = PHPWS_Template::process($tpl, 'blog', 'list_view.tpl');
     if (Current_User::allow('blog', 'edit_blog')) {
         Blog_User::miniAdminList();
         $vars['action'] = 'admin';
         $vars['command'] = 'new';
         $link[] = PHPWS_Text::secureLink(dgettext('blog', 'Add new blog'), 'blog', $vars);
         MiniAdmin::add('blog', $link);
     }
     return $content;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:95,代码来源:Blog_User.php


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