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


PHP Gdn::Sql方法代码示例

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


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

示例1: ToString

    public function ToString($Results)
    {
        $UserIDs = array();
        foreach ($Results as $Row) {
            $UserIDs[] = $Row->{SS_ATTR_USERID};
            ///IMPORTANT, this is lowercase since grab results directly from sphinx
        }
        // print_r($Return); die;
        $Sql = clone Gdn::Sql();
        $Users = $Sql->Select('Photo, UserID, Name')->From('User')->WhereIn('UserID', $UserIDs)->Get()->ResultObject();
        ob_start();
        ?>
        <div id="People" class="Box People">
            <h4 class="Header"><?php 
        echo T('People');
        ?>
</h4>
            <ul class="PanelInfo PanelDiscussions">
                <?php 
        foreach ($Users as $Row) {
            ?>
                    <li class="Item">
                        <?php 
            $User = UserBuilder($Row);
            ?>
                        <?php 
            echo UserPhoto($User);
            echo UserAnchor($User);
            ?>
                    </li>
                <?php 
        }
        ?>
            </ul>
        </div>
        <?php 
        $String = ob_get_contents();
        @ob_end_clean();
        return $String;
    }
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:40,代码来源:class.widget.member.php

示例2: _SetTagSql

 /**
  *
  * @param Gdn_SQLDriver $Sql
  */
 protected function _SetTagSql($Sql, $Tag, &$Limit, &$Offset = 0, $Op = 'or')
 {
     $SortField = 'd.DateLastComment';
     $SortDirection = 'desc';
     $TagSql = clone Gdn::Sql();
     if ($DateFrom = Gdn::Request()->Get('DateFrom')) {
         // Find the discussion ID of the first discussion created on or after the date from.
         $DiscussionIDFrom = $TagSql->GetWhere('Discussion', array('DateInserted >= ' => $DateFrom), 'DiscussionID', 'asc', 1)->Value('DiscussionID');
         $SortField = 'd.DiscussionID';
     }
     $Tags = array_map('trim', explode(',', $Tag));
     $TagIDs = $TagSql->Select('TagID')->From('Tag')->WhereIn('Name', $Tags)->Get()->ResultArray();
     $TagIDs = ConsolidateArrayValuesByKey($TagIDs, 'TagID');
     if ($Op == 'and' && count($Tags) > 1) {
         $DiscussionIDs = $TagSql->Select('DiscussionID')->Select('TagID', 'count', 'CountTags')->From('TagDiscussion')->WhereIn('TagID', $TagIDs)->GroupBy('DiscussionID')->Having('CountTags >=', count($Tags))->Limit($Limit, $Offset)->OrderBy('DiscussionID', 'desc')->Get()->ResultArray();
         $Limit = '';
         $Offset = 0;
         $DiscussionIDs = ConsolidateArrayValuesByKey($DiscussionIDs, 'DiscussionID');
         $Sql->WhereIn('d.DiscussionID', $DiscussionIDs);
         $SortField = 'd.DiscussionID';
     } else {
         $Sql->Join('TagDiscussion td', 'd.DiscussionID = td.DiscussionID')->Limit($Limit, $Offset)->WhereIn('td.TagID', $TagIDs);
         if ($Op == 'and') {
             $SortField = 'd.DiscussionID';
         }
     }
     // Set up the sort field and direction.
     SaveToConfig(array('Vanilla.Discussions.SortField' => $SortField, 'Vanilla.Discussions.SortDirection' => $SortDirection), '', FALSE);
 }
开发者ID:3marproof,项目名称:vanilla,代码行数:33,代码来源:class.tagging.plugin.php

示例3: get_user_token_for_user_id

 public function get_user_token_for_user_id($user_id)
 {
     // Read the user_id for this login_token
     $result = Gdn::Sql()->Select('user_token')->From('oasl_user')->Where('user_id', intval($user_id))->Get()->Result(DATASET_TYPE_ARRAY);
     foreach ($result as $row) {
         $user_token = GetValue('user_token', $row);
         if ($user_token !== FALSE) {
             return $user_token;
         }
     }
     // Not found
     return FALSE;
 }
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:13,代码来源:class.sociallogin.php


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