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


PHP Groups::findAll方法代码示例

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


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

示例1: select_users_or_groups

/**
 * Returns a control to select multiple users or groups
 *
 * @param string $name
 * 		Name for the control
 * @param array $workspaces
 * 		Array of workspaces to choose from. If null the workspaces from the WorkspacePanel will be loaded.
 * @param array $selected
 * 		Array of workspaces selected by default
 * @return string
 * 		HTML for the control
 */
function select_users_or_groups($name = "", $users = null, $selected = null, $id = null)
{
    require_javascript('og/UserGroupPicker.js');
    if (!isset($id)) {
        $id = gen_id();
    }
    $selectedCSV = "";
    if (is_array($selected)) {
        foreach ($selected as $s) {
            if ($s instanceof Project) {
                if ($selectedCSV != "") {
                    $selectedCSV .= ",";
                }
                $selectedCSV .= $s->getId();
            }
        }
    }
    $json = array();
    if (logged_user()->isMemberOfOwnerCompany()) {
        $companies = Companies::findAll(array('order' => 'name ASC'));
    } else {
        $companies = array(owner_company(), logged_user()->getCompany());
    }
    foreach ($companies as $company) {
        $company_users = $company->getUsers();
        if (count($company_users) > 0) {
            $json[] = array('p' => 'users', 't' => 'company', 'id' => 'c' . $company->getId(), 'n' => $company->getName());
            foreach ($company_users as $u) {
                $json[] = array('p' => 'c' . $company->getId(), 't' => 'user', 'g' => $u->isGuest() ? 1 : 0, 'id' => $u->getId(), 'n' => $u->getDisplayName());
            }
        }
    }
    $groups = Groups::findAll(array('order' => 'name ASC'));
    foreach ($groups as $group) {
        $json[] = array('p' => 'groups', 't' => 'group', 'id' => $group->getId(), 'n' => $group->getName());
    }
    $jsonUsers = json_encode($json);
    $output = "<div id=\"{$id}-user-picker\"></div>\n\t\t\t<input id=\"{$id}-field\" type=\"hidden\" value=\"{$selectedCSV}\" name=\"{$name}\"></input>\n\t\t<script>\n\t\tvar userPicker = new og.UserPicker({\n\t\t\trenderTo: '{$id}-user-picker',\n\t\t\tfield: '{$id}-field',\n\t\t\tid: '{$id}',\n\t\t\tusers: {$jsonUsers},\n\t\t\theight: 320,\n\t\t\twidth: 210\n\t\t});\n\t\t</script>\n\t";
    return $output;
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:52,代码来源:application.php

示例2: getGroupsByUser

 /**
  * Returns all groups a user belongs to
  *
  * @param $user_id
  * @return unknown
  */
 static function getGroupsByUser($user_id)
 {
     return Groups::findAll(array('conditions' => array('`id` IN (SELECT `group_id` FROM `' . TABLE_PREFIX . 'group_users` WHERE `user_id` = ?)', $user_id)));
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:10,代码来源:GroupUsers.class.php

示例3: getAll

 /**
  * Return all registered groups
  *
  * @param void
  * @return array
  */
 static function getAll()
 {
     return Groups::findAll();
     // findAll
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:11,代码来源:Groups.class.php


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