當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Groups::get方法代碼示例

本文整理匯總了PHP中Groups::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Groups::get方法的具體用法?PHP Groups::get怎麽用?PHP Groups::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Groups的用法示例。


在下文中一共展示了Groups::get方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: is_user

 public function is_user($user)
 {
     if (is_null($user)) {
         $user = Session::get_user();
     }
     if ($this->get_parentid()) {
         $parent = Groups::get($this->get_parentid());
     }
     $result = DigiplayDB::select("* FROM usersgroups WHERE (groupid = " . $this->get_id() . ") AND userid = '" . $user->get_id() . "'");
     if ($result) {
         return true;
     } else {
         if (isset($parent)) {
             return $parent->is_user($user);
         }
     }
     return false;
 }
開發者ID:radiowarwick,項目名稱:digiplay,代碼行數:18,代碼來源:Group.php

示例2: makeOrderRecalc

 public function makeOrderRecalc()
 {
     $obj = new Groups();
     $obj->isRecalc = false;
     $groups = $obj->get();
     $orderArr = $atLast = [];
     foreach ($groups as $gr) {
         if ($gr->order_id == null) {
             $atLast[] = $gr->id;
         } else {
             $orderArr[$gr->order_id] = $gr->id;
         }
     }
     ksort($orderArr);
     $newOrderArr = array_values($orderArr);
     $finalOrderArr = array_merge($newOrderArr, $atLast);
     foreach ($finalOrderArr as $orderId => $id) {
         $obj->update(['id' => $id], ['order_id' => $orderId]);
     }
 }
開發者ID:Nordager,項目名稱:setget,代碼行數:20,代碼來源:Groups.php

示例3: getGroupsOrder

    public function getGroupsOrder()
    {
        $groupsObj = new Groups();
        $groups = $groupsObj->get();
        $start = 0;
        $finish = count($groups) - 1;
        $ordered = [];
        foreach ($groups as $gr) {
            $ordered[$gr->order_id] = $gr;
        }
        if (count($ordered)) {
            ksort($ordered);
        }
        foreach ($ordered as $key => $gr) {
            ?>
            <div class="sg-controls" id="sg-group-<?php 
            echo $gr->id;
            ?>
">
                <a class="sg-delete sg-red" href="#" onclick="if (confirm('<?php 
            _e('Будут удалены все значения в этой группе. Действительно удалить? ');
            ?>
')) {sgDeleteGroup(<?php 
            echo $gr->id;
            ?>
, '<?php 
            echo wp_create_nonce('sg-delete-group');
            ?>
)}; return false;">&times;</a>
                <?php 
            if ($gr->order_id == $start) {
                ?>
                    <span class="sg-array">&uarr;</span>
                    <a class="sg-array" href="#" onclick="sgChangeGroupOrder(<?php 
                echo $gr->id;
                ?>
, 'down', '<?php 
                echo wp_create_nonce('sg-change-group-order');
                ?>
' ); return false;">&darr;</a>
                    <?php 
            } elseif ($gr->order_id == $finish) {
                ?>
                    <a class="sg-array" href="#" onclick="sgChangeGroupOrder(<?php 
                echo $gr->id;
                ?>
, 'up', '<?php 
                echo wp_create_nonce('sg-change-group-order');
                ?>
'); return false;">&uarr;</a>
                    <span class="sg-array">&darr;</span>
                    <?php 
            } else {
                ?>
                    <a class="sg-array" href="#" onclick="sgChangeGroupOrder(<?php 
                echo $gr->id;
                ?>
, 'up', '<?php 
                echo wp_create_nonce('sg-change-group-order');
                ?>
'); return false;">&uarr;</a>
                    <a class="sg-array" href="#" onclick="sgChangeGroupOrder(<?php 
                echo $gr->id;
                ?>
, 'down', '<?php 
                echo wp_create_nonce('sg-change-group-order');
                ?>
'); return false;">&darr;</a>
                    <?php 
            }
            ?>
                <a class="sg-name" href="#" onclick="sgChangeGroupName(<?php 
            echo $gr->id;
            ?>
, '<?php 
            echo wp_create_nonce('sg-edit-group-by-id');
            ?>
'); return false;"><?php 
            echo $gr->name;
            ?>
</a>
            </div>
            <?php 
        }
    }
開發者ID:Nordager,項目名稱:setget,代碼行數:85,代碼來源:Group.php

示例4: sgChangeGroupOrder

 public function sgChangeGroupOrder()
 {
     $this->checkPermissions($_POST['_wpnonce'], 'sg-change-group-order');
     $groupsObj = new Groups();
     $groupsObj->isRecalc = false;
     $groupsObj->returnMessages = true;
     $newGroupsObj = new Groups();
     $newGroupsObj->isRecalc = false;
     $current = $newGroupsObj->get(['id' => $_POST['id']], ['order_id']);
     if ($_POST['direction'] == 'up' && $newGroupsObj->update(['order_id' => $current[0]->order_id - 1], ['order_id' => $current[0]->order_id])) {
         $output = $groupsObj->update(['id' => $_POST['id']], ['order_id' => $current[0]->order_id - 1]);
         $output['messages'] = $output['messages']['error'];
     } elseif ($_POST['direction'] == 'down' && ($val = $newGroupsObj->update(['order_id' => $current[0]->order_id + 1], ['order_id' => $current[0]->order_id]))) {
         $output = $groupsObj->update(['id' => $_POST['id']], ['order_id' => $current[0]->order_id + 1]);
         $output['messages'] = $output['messages']['error'];
     } else {
         $output['result'] = 0;
         $output['messages'] = [];
     }
     echo json_encode($output, JSON_UNESCAPED_UNICODE);
     die;
 }
開發者ID:Nordager,項目名稱:setget,代碼行數:22,代碼來源:Ajax.php

示例5: viewGroupLinks

 public function viewGroupLinks()
 {
     $groups = new Groups();
     $groupArr = $groups->get();
     $orderedGroups = [];
     foreach ($groupArr as $gr) {
         $orderedGroups[$gr->order_id] = $gr;
     }
     if (count($orderedGroups)) {
         ksort($orderedGroups);
     }
     $newQuery = ['page' => 'setget'];
     if ($this->currentGroup) {
         $queryViewAll = $newQuery;
         $queryViewAll['group'] = 0;
         echo '<a class="sg-group-link" href="' . $_SERVER['PHP_SELF'] . '?' . http_build_query($queryViewAll) . '">Все</a>';
         foreach ($orderedGroups as $group) {
             if ($this->currentGroup == $group->id) {
                 echo '<span class="sg-group-link">' . $group->name . '</span>';
             } else {
                 $newQuery['group'] = $group->id;
                 echo '<a class="sg-group-link" href="' . $_SERVER['PHP_SELF'] . '?' . http_build_query($newQuery) . '">' . $group->name . '</a>';
             }
         }
     } else {
         echo '<span class="sg-group-link" >Все</span>';
         foreach ($orderedGroups as $group) {
             $newQuery['group'] = $group->id;
             echo '<a class="sg-group-link" href="' . $_SERVER['PHP_SELF'] . '?' . http_build_query($newQuery) . '">' . $group->name . '</a>';
         }
     }
 }
開發者ID:Nordager,項目名稱:setget,代碼行數:32,代碼來源:Main.php


注:本文中的Groups::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。