本文整理汇总了PHP中Groups::getGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP Groups::getGroups方法的具体用法?PHP Groups::getGroups怎么用?PHP Groups::getGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Groups
的用法示例。
在下文中一共展示了Groups::getGroups方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMyOrganisations
public static function getMyOrganisations($detail = FALSE)
{
if ($detail) {
return Groups::getGroups(_ORGANISATION_GROUP);
} else {
$user_id = $GLOBALS['user']->uid;
$table = tableName(_ORGANISATION_GROUP);
$orgids = db_query("SELECT o.org_id from {$table} as o " . "LEFT JOIN soc_user_membership as um on o.org_id = um.group_id " . "WHERE um.uid = {$user_id} AND um.type = :organisation", array(':organisation' => _ORGANISATION_GROUP))->fetchCol();
}
return $orgids;
}
示例2: renderOrganisations
function renderOrganisations($type = '', $organisations = '', $organisation_head = '', $target = '')
{
//If no organisations dataset is passed on, retrieve them based on the other arguments
if (!$organisations) {
$organisations = Groups::getGroups($type, $organisation_head);
if (!($organisations && $organisations->rowCount())) {
$organisations = null;
}
}
if ($organisations && $organisations->rowCount()) {
$key = Groups::keyField($type);
$s = "<ul class='grouplist'>";
foreach ($organisations as $member) {
$id = $member->{$key};
$s .= "<li>";
$s .= "<a href='javascript:void(0);' onclick=\"ajaxCall('administration', 'view', {type:'{$type}', id:{$id}, target:'{$target}'}, '{$target}');\">" . $member->name . "</a>";
$s .= "</li>";
}
$s .= "</ul>";
return $s;
} else {
$type = $type ?: _STUDENT_GROUP;
return $organisation_head ? tt('You have no %1$s yet.', t_type($type)) : tt('There is no %1$s yet.', t_type($type));
}
}
示例3:
echo $formInstanceRequest->relateDoc('b6d45f3c-1183-e511-bf05-9c4e36b08790', '23b654e5-9b76-e511-beff-da1558d6bba3');
echo $formInstanceRequest->relateProject('b6d45f3c-1183-e511-bf05-9c4e36b08790', '6CC8C82B-1C83-E511-BF05-9C4E36B08790');
echo $formInstanceRequest->unrelateForm('b6d45f3c-1183-e511-bf05-9c4e36b08790', 'bb6c2903-1383-e511-bf05-9c4e36b08790');
echo $formInstanceRequest->unrelateDoc('b6d45f3c-1183-e511-bf05-9c4e36b08790', '23b654e5-9b76-e511-beff-da1558d6bba3');
echo $formInstanceRequest->unrelateProject('b6d45f3c-1183-e511-bf05-9c4e36b08790', '6CC8C82B-1C83-E511-BF05-9C4E36B08790');
// FORM TEMPLATES
echo $formTemplatesRequest->getFormTemplates();
echo $formTemplatesRequest->getFormTemplatesId('c8a59b9f-5c7e-e511-bf02-008cfa482110');
echo $formTemplatesRequest->getFields('38341b08-1183-e511-bf05-9c4e36b08790');
echo $formTemplatesRequest->getForms('38341b08-1183-e511-bf05-9c4e36b08790');
echo $formTemplatesRequest->getFormsId('38341b08-1183-e511-bf05-9c4e36b08790', 'b6d45f3c-1183-e511-bf05-9c4e36b08790');
echo $formTemplatesRequest->postForm('c8a59b9f-5c7e-e511-bf02-008cfa482110', ['favLang' => 'spanish yaa', 'favTeam' => 'Raiders', 'likeBlack' => 'si']);
echo $formTemplatesRequest->reviseFormInstance('c8a59b9f-5c7e-e511-bf02-008cfa482110', 'bb6c2903-1383-e511-bf05-9c4e36b08790', ['favLang' => 'now italian', 'favTeam' => 'still Raiders', 'likeCoffeeBlack' => 'claro']);
echo $formTemplatesRequest->embedForm('9d4d2408-1183-e511-bf05-9c4e36b08790', '6ccf5264-4f8d-e511-bf05-9c4e36b08790');
// GROUPS
echo $groupsRequest->getGroups();
echo $groupsRequest->getGroupsId('3b0d5cd7-2c83-e511-bf05-9c4e36b08790');
echo $groupsRequest->getGroupsUsers('10000000-1000-3000-1111-100000000023');
echo $groupsRequest->getGroupsUsersId('10000000-1000-3000-1111-100000000023', '8dd06446-1179-e511-bf01-a1bb68598c42');
echo $groupsRequest->postGroups('phpGroup2', 'a group from php', '8be2a9c6-2c83-e511-bf05-9c4e36b08790');
echo $groupsRequest->putGroups('22dbf0ca-c783-e511-bf05-9c4e36b08790', 'Python Group 2', 'python2');
// INDEX FIELDS
echo $indexFieldsRequest->getIndexFields();
echo $indexFieldsRequest->postIndexFields('favorite foods2', 'a list of favorite foods', 2, '00000000-0000-0000-0000-000000000000', '390A1704-B481-E511-BF03-008CFA482110', true, 'pakistani');
echo $indexFieldsRequest->putIndexFields('0ca8c2ae-3778-e511-bf00-bfff3cb84a46', 'departments list', 'new description', 2, 'd19af16a-3678-e511-bf00-bfff3cb84a46', 'd19af16a-3678-e511-bf00-bfff3cb84a46', true, 'default');
echo $indexFieldsRequest->relateIndexFields('0ca8c2ae-3778-e511-bf00-bfff3cb84a46', '40ac2b37-9a72-e511-befe-98991b71acc0');
// META
echo $metaRequest->getMeta();
echo $metaRequest->getMetaData('PersistedData');
// PARSE
$r = $docRequest->getDocIndexFields('3c7168e7-4b82-e511-bf04-008cfa482110');
示例4: Groups
<?php
require_once '../classes/db/Groups.php';
require_once '../classes/Helper.php';
Helper::checkAuthorisation();
if ($_GET) {
$groups = new Groups();
switch ($_GET['type']) {
case 'id':
Helper::checkGetParameter('id');
$group = $groups->getGroup($_GET['id']);
echo json_encode($group);
break;
case 'driver':
Helper::checkGetParameter('driver_id');
$response = ['list' => $groups->getGroups($_GET['driver_id'])];
echo json_encode($response);
break;
case 'all':
$response = ['list' => $groups->getAllGroups()];
echo json_encode($response);
break;
}
}
示例5: initBrowseProposalsByTypeLayout
//.........这里部分代码省略.........
$("#organisation").change(function(e) {
e.preventDefault();
loadFilteredProposals();
});
$("#proposal_filter").submit(function(e){
e.preventDefault();
loadFilteredProposals()
});
});
</script><?php
} else {
if (hasRole(array(_INSTADMIN_TYPE)) || hasRole(array(_SUPERVISOR_TYPE))) {
$studentgroup_id = 0;
if (isset($_GET['group'])) {
$studentgroup_id = $_GET['group'];
}
echo "<a href='" . _WEB_URL . "/dashboard/proposals/browsebytype'>" . t('Show all proposals from my Institution') . "</a>";
echo " | ";
echo "<a href='" . _WEB_URL . "/dashboard/proposals/browsebytype/mine'>" . t('Show only mine') . "</a>";
?>
<div class="filtering" style="width: 800px;">
<span id="infotext" style="margin-left: 34px"></span>
<form id="proposal_filter">
<?php
echo t('Filter by Group');
?>
:
<?php
// echo t('Organisations');
$option_text = (bool) $owner_only ? t('All My Groups') : t('All Groups from my Institution');
if ($owner_only) {
$result = Groups::getGroups(_STUDENT_GROUP, $GLOBALS['user']->uid);
} else {
$institutes = Users::getInstituteForUser($GLOBALS['user']->uid);
if ($institutes->rowCount() > 0) {
$result = Groups::getGroups(_STUDENT_GROUP, 'all', $institutes->fetchObject()->inst_id);
} else {
// give up, just get their own
$result = Groups::getGroups(_STUDENT_GROUP, $GLOBALS['user']->uid);
}
}
?>
<select id="group" name="group">
<option
<?php
echo !$studentgroup_id ? 'selected="selected"' : '';
?>
value="0"><?php
echo $option_text;
?>
</option><?php
foreach ($result as $record) {
$selected = $record->studentgroup_id == $studentgroup_id ? 'selected="selected" ' : '';
echo '<option ' . $selected . 'value="' . $record->studentgroup_id . '">' . $record->name . '</option>';
}
?>
</select>
</form>
</div>
<div id="TableContainer" style="width: 800px;"></div>
<script type="text/javascript">
jQuery(document).ready(function($){
window.view_settings = {};
示例6: getStudentsAndProposalCountByCriteria
public static function getStudentsAndProposalCountByCriteria($group, $sorting = 'p.pid', $startIndex = 1, $pageSize = 10, $mine_only = false)
{
if (!$group) {
$group = array();
if ($mine_only) {
$result = Groups::getGroups(_STUDENT_GROUP, $GLOBALS['user']->uid);
} else {
$institutes = Users::getInstituteForUser($GLOBALS['user']->uid);
if ($institutes->rowCount() > 0) {
$result = Groups::getGroups(_STUDENT_GROUP, 'all', $institutes->fetchObject()->inst_id);
} else {
// give up, just get their own
$result = Groups::getGroups(_STUDENT_GROUP, $GLOBALS['user']->uid);
}
}
foreach ($result as $record) {
array_push($group, $record->studentgroup_id);
}
}
$role = _STUDENT_ROLE_ID;
$query = "\n \t\tSELECT u.uid,u.name as username, sg.name as groupname,COUNT(v.proposal_id) AS proposal_count\n\t\t\tFROM users AS u\n\t\t\tLEFT JOIN soc_proposals AS v ON ( u.uid = v.owner_id )\n\t\t\tLEFT JOIN users_roles as r ON (u.uid = r.uid)\n\t\t\tLEFT JOIN soc_user_membership as m ON (u.uid = m.uid)\n\t\t\tLEFT JOIN soc_studentgroups AS sg ON (sg.studentgroup_id = m.group_id)" . ($group ? "WHERE sg.studentgroup_id IN (:grps) AND " : "WHERE ") . " r.rid = {$role} AND m.type = 'studentgroup'\n\t\t\tGROUP BY username";
if (!$sorting) {
$sorting = 'groupname ASC, username ASC';
}
$query .= " ORDER BY " . $sorting . " LIMIT " . $startIndex . "," . $pageSize . ";";
//echo $query;
$students = db_query($query, array(':grps' => $group))->fetchAll();
return $students;
}
示例7: showOrganisationPage
function showOrganisationPage($show_action, $show_last = FALSE)
{
//Get my organisations
$my_id = Users::getMyId();
$organisations = Groups::getGroups(_ORGANISATION_GROUP, $my_id);
if (!$organisations->rowCount()) {
if (Users::isOrganisationAdmin() || user_access('vals admin register')) {
echo t('You have no organisation yet registered');
echo '<h2>' . t('Add your organisation') . '</h2>';
$tab_prefix = 'organisation_page-';
$target = "{$tab_prefix}1";
$form = drupal_get_form('vals_soc_organisation_form', '', $target);
$add_tab = renderForm($form, $target, true);
$data = array();
$data[] = array(1, 'Add', 'add', _ORGANISATION_GROUP, null, "target=admin_container&show_action={$show_action}", true, 'adding_to_the right');
echo renderTabs(1, null, $tab_prefix, _ORGANISATION_GROUP, $data, null, TRUE, $add_tab);
?>
<script type="text/javascript">
transform_into_rte();
activatetabs('tab_', ['<?php
echo $target;
?>
']);
</script><?php
} else {
echo t('You have not registered yourself to an organisation yet. ');
echo tt('Register yourself with your organisation at %1$s using the code you got from a colleague.', '<a href="' . _WEB_URL . "/user/{$my_id}/edit\">" . t('your account') . '</a>');
}
} else {
if ($show_action == 'administer') {
showOrganisationAdminPage($organisations, $show_action, $show_last);
} elseif ($show_action == 'view') {
showOrganisationAdminPage($organisations, $show_action, $show_last);
} elseif ($show_action == 'members') {
showOrganisationMembersPage($organisations);
} elseif ($show_action == 'overview') {
showOrganisationOverviewPage($organisations);
//showInstituteGroupsAdminPage($my_institute, $show_last);
} else {
echo tt('There is no such action possible %1$s', $show_action);
}
}
}
示例8: showProjectPage
function showProjectPage($show_last = FALSE, $owner_only = false)
{
global $base_url;
//TODO check for the role of current user
$role = getRole();
if (!Users::isMentor()) {
//true for both mentors and organisation admins. Also, they will see their own stuff only
echo t('You are not allowed to see the projects in this view.');
return;
}
//Get my groups
$my_organisations = Groups::getGroups(_ORGANISATION_GROUP);
if (!$my_organisations->rowCount()) {
//There are no organisations yet for this user
if ($role == _ORGADMIN_TYPE) {
echo t('You have no organisation yet.') . '<br/>';
echo "<a href='" . _WEB_URL . "/dashboard/organisation/administer'>" . t('Please go to the organisation register page') . "</a>";
} else {
echo t('You are not connected to any organisation yet.') . '<br/>';
echo "<a href='" . _WEB_URL . "/user/" . Users::getMyId() . "/edit'>" . t('Please edit your account to connect') . "</a>";
}
} else {
$show_all = !(bool) $owner_only;
$owner_id = $GLOBALS['user']->uid;
$orgs = array();
$orgids = array();
foreach ($my_organisations as $org) {
$orgs[] = $org;
$orgids[] = $org->org_id;
}
$projects = Project::getProjectsByUser($owner_id, $orgids, $show_all);
//$my_organisations->fetchCol());
if (!$projects) {
echo $owner_only ? t('You have no project yet registered') : t('There are no projects yet registered.');
echo $owner_only ? "<BR>" . '<a href="' . $base_url . '/dashboard/projects/administer" ' . 'title="Manage all my organisation\'s projects">Manage all my organisation\'s projects</a>' : '';
echo '<h2>' . t('Add a project') . '</h2>';
$tab_prefix = 'project_page-';
$target = "{$tab_prefix}1";
$form = drupal_get_form("vals_soc_project_form", '', 'project_page-1');
$form['submit'] = ajax_pre_render_element($form['submit']);
$add_tab = renderForm($form, $target, true);
$data = array();
$data[] = array(1, 'Add', 'add', _PROJECT_OBJ, '0', "target=admin_container", true, 'adding from the right');
echo renderTabs(1, null, 'project_page-', _PROJECT_OBJ, $data, null, TRUE, $add_tab, 1, _PROJECT_OBJ);
?>
<script type="text/javascript">
transform_into_rte();
activatetabs('tab_', ['project_page-1']);
</script><?php
} else {
echo "<a href='" . _WEB_URL . "/dashboard/projects/administer'>" . t('Show all') . "</a>";
echo " | ";
echo "<a href='" . _WEB_URL . "/dashboard/projects/administer/mine'>" . t('Show only mine') . "</a>";
$org = 1;
$show_org_title = $my_organisations->rowCount() > 1;
$org_key = AbstractEntity::keyField(_ORGANISATION_GROUP);
foreach ($orgs as $organisation) {
$projects = Project::getProjectsByUser($owner_id, array($organisation->{$org_key}), $show_all);
showOrganisationProjects($org, $projects, $organisation, $show_org_title, $show_last, TRUE, $owner_only);
$org++;
}
}
}
}