本文整理汇总了PHP中Group类的典型用法代码示例。如果您正苦于以下问题:PHP Group类的具体用法?PHP Group怎么用?PHP Group使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Group类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateGroupParticipations
function CreateGroupParticipations(mysqli $objAcsDatabase, Group $objGroup, GroupRole $objRole, $intAcsGroupId, $intAcsReserveId)
{
print "Adding for Group: " . $objGroup->Name . "\r\n ";
if ($intAcsReserveId) {
$objResult = $objAcsDatabase->query(sprintf('select * from awgrrost where groupid=%s AND reserveid1=%s', $intAcsGroupId, $intAcsReserveId));
} else {
$objResult = $objAcsDatabase->query(sprintf('select * from awgrrost where groupid=%s', $intAcsGroupId));
}
while ($objRow = $objResult->fetch_array()) {
$objAttributeValueArray = AttributeValue::QueryArray(QQ::AndCondition(QQ::Equal(QQN::AttributeValue()->AttributeId, 2), QQ::Equal(QQN::AttributeValue()->TextValue, $objRow['indvid'])));
if (count($objAttributeValueArray) != 1) {
printf("Issue with awgrrost.pkid of %s - IndvId %s for Group %s - AVCount of %s\r\n", $objRow['pkid'], $objRow['indvid'], $objGroup->Name, count($objAttributeValueArray));
} else {
$objPerson = $objAttributeValueArray[0]->Person;
$dttStartDate = new QDateTime($objRow['dateadded']);
if ($objRow['dateremoved']) {
$dttEndDate = new QDateTime($objRow['dateremoved']);
} else {
$dttEndDate = null;
}
$objGroup->AddPerson($objPerson, $objRole->Id, $dttStartDate, $dttEndDate);
print "*";
}
}
print "\r\n Done.\r\n\r\n";
}
示例2: add_members_to_customer_group
static function add_members_to_customer_group()
{
$gp = DataObject::get_one("Group", "\"Title\" = '" . self::get_group_name() . "'");
if (!$gp) {
$gp = new Group();
$gp->Title = self::get_group_name();
$gp->Sort = 999998;
$gp->write();
}
$allCombos = DB::query("Select \"ID\", \"MemberID\", \"GroupID\" FROM \"Group_Members\" WHERE \"Group_Members\".\"GroupID\" = " . $gp->ID . ";");
//make an array of all combos
$alreadyAdded = array();
$alreadyAdded[-1] = -1;
if ($allCombos) {
foreach ($allCombos as $combo) {
$alreadyAdded[$combo["MemberID"]] = $combo["MemberID"];
}
}
$extraWhere = $unlistedMembers = DataObject::get("Member", $where = "\"Member\".\"ID\" NOT IN (" . implode(",", $alreadyAdded) . ")", $sort = null, $join = "INNER JOIN \"Order\" ON \"Order\".\"MemberID\" = \"Member\".\"ID\"");
//add combos
if ($unlistedMembers) {
$existingMembers = $gp->Members();
foreach ($unlistedMembers as $member) {
$existingMembers->add($member);
}
}
}
示例3: requireDefaultRecords
public function requireDefaultRecords()
{
parent::requireDefaultRecords();
// Add default author group if no other group exists
$frontend_group = Group::get()->filter("Code", "users-frontend");
if (!$frontend_group->exists()) {
$frontend_group = new Group();
$frontend_group->Code = 'users-frontend';
$frontend_group->Title = "Frontend Users";
$frontend_group->Sort = 1;
$frontend_group->write();
Permission::grant($frontend_group->ID, 'USERS_MANAGE_ACCOUNT');
DB::alteration_message('Front end users group created', 'created');
}
// Add a verified users group (only used if we turn on
// verification)
$verify_group = Group::get()->filter("Code", "users-verified");
if (!$verify_group->exists()) {
$verify_group = new Group();
$verify_group->Code = 'users-verified';
$verify_group->Title = "Verified Users";
$verify_group->Sort = 1;
$verify_group->write();
Permission::grant($verify_group->ID, 'USERS_VERIFIED');
DB::alteration_message('Verified users group created', 'created');
}
}
示例4: run
public function run()
{
$model = new Group();
$groups_count = $model->countGroups();
$data = array('groups_count' => $groups_count);
$this->render('WGroupSidebar', $data);
}
示例5: processRecord
public function processRecord($record, $columnMap, &$results, $preview = false)
{
$objID = parent::processRecord($record, $columnMap, $results, $preview);
$_cache_groupByCode = array();
// Add to predefined groups
$member = DataObject::get_by_id($this->objectClass, $objID);
foreach ($this->groups as $group) {
// TODO This isnt the most memory effective way to add members to a group
$member->Groups()->add($group);
}
// Add to groups defined in CSV
if (isset($record['Groups']) && $record['Groups']) {
$groupCodes = explode(',', $record['Groups']);
foreach ($groupCodes as $groupCode) {
$groupCode = Convert::raw2url($groupCode);
if (!isset($_cache_groupByCode[$groupCode])) {
$group = Group::get()->filter('Code', $groupCode)->first();
if (!$group) {
$group = new Group();
$group->Code = $groupCode;
$group->Title = $groupCode;
$group->write();
}
$member->Groups()->add($group);
$_cache_groupByCode[$groupCode] = $group;
}
}
}
$member->destroy();
unset($member);
return $objID;
}
示例6: showForGroup
static function showForGroup(Group $group)
{
global $DB;
$ID = $group->getField('id');
if (!$group->can($ID, READ)) {
return false;
}
$canedit = $group->can($ID, UPDATE);
if ($canedit) {
// Get data
$item = new self();
if (!$item->getFromDB($ID)) {
$item->getEmpty();
}
$rand = mt_rand();
echo "<form name='group_level_form{$rand}' id='group_level_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<input type='hidden' name='" . self::$items_id . "' value='{$ID}' />";
echo "<div class='spaced'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th>" . __('Level attribution', 'itilcategorygroups') . "</th></tr>";
echo "<tr class='tab_bg_2'><td class='center'>";
Dropdown::showFromArray('lvl', array(NULL => "---", 1 => __('Level 1', 'itilcategorygroups'), 2 => __('Level 2', 'itilcategorygroups'), 3 => __('Level 3', 'itilcategorygroups'), 4 => __('Level 4', 'itilcategorygroups')), array('value' => $item->fields['lvl']));
echo "</td></tr>";
echo "</td><td class='center'>";
if ($item->fields["id"]) {
echo "<input type='hidden' name='id' value='" . $item->fields["id"] . "'>";
echo "<input type='submit' name='update' value=\"" . __('Save') . "\"\n class='submit'>";
} else {
echo "<input type='submit' name='add' value=\"" . __('Save') . "\" class='submit'>";
}
echo "</td></tr>";
echo "</table></div>";
Html::closeForm();
}
}
示例7: destroy
public static function destroy($id)
{
self::check_logged_in();
$group = new Group(array('id' => $id));
$group->destroy();
Redirect::to('/group', array('message' => 'Ryhmä poistettu'));
}
示例8: addChair
/**
* @param $member
* @param $category_id
* @throws ValidationException
* @throws null
*/
public static function addChair($member, $category_id)
{
$priorChair = SummitTrackChair::get()->filter('MemberID', $member->ID)->first();
$category = PresentationCategory::get()->byID($category_id);
if (!$priorChair) {
$chair = new self();
$chair->MemberID = $member->ID;
$chair->write();
$chair->Categories()->add($category);
//Find or create the 'track-chairs' group
if (!($Group = Group::get()->filter('Code', 'track-chairs')->first())) {
$Group = new Group();
$Group->Code = "track-chairs";
$Group->Title = "Track Chairs";
$Group->Write();
$member->Groups()->add($Group);
}
//Add member to the group
$member->Groups()->add($Group);
return $chair->ID;
} else {
$priorChair->Categories()->add($category);
$priorChair->Member()->addToGroupByCode('track-chairs');
return $priorChair->ID;
}
}
示例9: create
public function create()
{
if (!$this->valid_logged_in) {
redirect('users/login');
}
$this->load->library('form_validation');
if ($this->form_validation->run('groups_create') == FALSE) {
$this->load->library('table');
$data['visibility_options'] = $this->visibility_options;
// Load group creation form
$data['title'] = "Create Group";
$data['content'] = 'groups/create';
$this->load->view('master', $data);
} else {
// Create group
$name = $this->input->post('name');
$description = $this->input->post('description');
$visibility = $this->input->post('visibility');
$group = new Group();
$group->name = $name;
$group->description = $description;
$group->visibility = $visibility;
$user = new User($this->user_id);
$group->save($user);
redirect("groups/view/{$group->id}");
}
}
示例10: calculateValues
function calculateValues(Group $objGroup)
{
global $startDate;
global $endDate;
//global $tempDate;
global $objPersonArray;
global $monthCount;
$objGroupParticipationArray = $objGroup->GetGroupParticipationArray();
foreach ($objGroupParticipationArray as $objParticipation) {
// If role is Volunteer or Volunteer Leader
if ($objParticipation->GroupRole->GroupRoleTypeId == 1 || $objParticipation->GroupRole->GroupRoleTypeId == 3) {
// If a volunteer, then instantiate arrays
$tempDate = new QDateTime($startDate);
while ($tempDate->IsEarlierOrEqualTo($endDate)) {
if ($objParticipation->DateStart < $tempDate && ($objParticipation->DateEnd > $tempDate || $objParticipation->DateEnd == null)) {
// Verify unique person each time
if (!in_array($objParticipation->PersonId, $objPersonArray[$tempDate->__toString('MMM YYYY')])) {
$objPersonArray[$tempDate->__toString('MMM YYYY')][] = $objParticipation->PersonId;
$monthCount[$tempDate->__toString('MMM YYYY')]++;
}
}
$tempDate->AddMonths(1);
}
}
}
}
示例11: delete
public function delete()
{
$Group = new Group($this->data->id);
$Group->delete();
$go = '>auth/Group/formFind';
$this->renderPrompt('information', "Group [{$this->data->idGroup}] removido.", $go);
}
示例12: getIndex
public function getIndex()
{
$action = $_GET['action'];
if ($action == "update") {
$to = $_GET['to'];
$id = $_GET['id'];
$groupEntry = Group::find($id);
$groupEntry->name = $to;
$groupEntry->save();
} else {
if ($action == "delete") {
$id = $_GET['id'];
$groupEntry = Group::find($id);
$groupEntry->delete();
} else {
if ($action == "insert") {
$name = $_GET['name'];
$group = new Group();
$group->name = $name;
$group->save();
}
}
}
return View::make('admin');
}
示例13: doRegister
function doRegister($data, Form $form)
{
//Check for existing member email address
if ($member = DataObject::get_one("Member", "`Email` = '" . Convert::raw2sql($data['Email']) . "'")) {
//Set error message
$form->sessionMessage($data['Email'] . ". Sorry, that email address already exists. Please choose another.", 'bad');
//Return back to form
return $this->redirectBack();
//return Director::redirectBack();
} else {
//Otherwise create new member and log them in
$Member = new Member();
$form->saveInto($Member);
$Member->write();
$Member->login();
//Find or create the 'user' group
if (!($userGroup = DataObject::get_one('Group', "Code = 'users'"))) {
$userGroup = new Group();
$userGroup->Code = "users";
$userGroup->Title = "users";
$userGroup->Write();
$userGroup->Members()->add($Member);
}
//Add member to user group
$userGroup->Members()->add($Member);
//Get profile page
if ($ProfilePage = DataObject::get_one('EditProfilePage')) {
//echo "profile page exists";
//Redirect to profile page with success message
return $this->redirect($ProfilePage->Link());
}
}
}
示例14: StartSurvey
function StartSurvey($data, $form)
{
//Check for existing member email address
if ($member = Member::get()->filter('Email', Convert::raw2sql($data['Email']))->first()) {
//Set error message
$form->AddErrorMessage('Email', "Sorry, that email address already exists. Please choose another or login with that email.", 'bad');
//Set form data from submitted values
Session::set("FormInfo.Form_DeploymentSurveyRegistrationForm.data", $data);
//Return back to form
return Controller::curr()->redirectBack();
}
//Otherwise create new member and log them in
$Member = new Member();
$form->saveInto($Member);
$Member->write();
//Find or create the 'user' group
if (!($userGroup = Group::get()->filter('Code', 'users')->first())) {
$userGroup = new Group();
$userGroup->Code = "users";
$userGroup->Title = "Users";
$userGroup->Write();
$Member->Groups()->add($userGroup);
}
//Add member to user group
$Member->Groups()->add($userGroup);
$BackURL = Controller::curr()->Link('AboutYou');
return OpenStackIdCommon::loginMember($Member, $BackURL);
}
示例15: render
function render()
{
global $login_uid;
if ($this->type == 'group') {
$this->view_all_url = "showcontent.php?gid={$this->gid}";
$group = new Group();
$group->collection_id = $this->gid;
$this->links = $group->get_contents_for_collection($type = 'all', $cnt = FALSE, $show = 5, $page = 1, $sort_by = 'created', $direction = 'DESC', TRUE);
//$type = 'all',$cnt=FALSE, $show='ALL', $page=0, $sort_by='created', $direction='DESC'
} else {
if ($this->type == 'homepage') {
//if homepage then do some additional filter
//Fix for homepage
// DISPLAY_ON_HOMEPAGE has value 0
// It means the posts whose display_on = 0 they will show up on the homepage
$this->links = Content::get_recent_posts(array('show' => 5, 'sort_by' => 'RT.created', 'page' => 1, 'direction' => 'DESC'), 'collection_id=-1');
} else {
if ($this->type == 'permalink') {
$this->links = Content::get_recent_posts(array('show' => 5, 'sort_by' => 'RT.created', 'page' => 1, 'direction' => 'DESC'), 'collection_id=-1 ');
} else {
$this->links = Content::get_recent_posts(array('show' => 5, 'sort_by' => 'RT.created', 'page' => 1, 'direction' => 'DESC'), 'collection_id=-1 ');
}
}
}
$this->view_all_url = count($this->links) > 0 ? $this->view_all_url : '';
$this->inner_HTML = $this->generate_inner_html($this->links);
$content = parent::render();
return $content;
}