Skip to content

Commit

Permalink
ICPCO-173 and 174
Browse files Browse the repository at this point in the history
  • Loading branch information
axel committed Oct 12, 2021
1 parent d3fe3fb commit 1f5397c
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 144 deletions.
67 changes: 22 additions & 45 deletions Controller/GrouperGroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,46 +97,20 @@ private function setConnection() {
}

/**
* No true Index page, so sent to default page of Optin
* No true Index page, so sent to default page of My Membership
*
* @return CakeResponse Redirect to Optin page
* @return CakeResponse Redirect to MyMembership page
*/
public function index() {
return $this->redirect(
array('controller' => 'grouper_groups', 'action' => 'groupoptin')
array('controller' => 'grouper_groups', 'action' => 'groupmember')
);
}


/**
* Show all members of group in Grouper Group detail page
* Called from method GroupInfo
*
*/
// public function membersInGroup() {
// $groupName = urldecode($this->request->query['groupname']);
//
// //Set initial
// $scope = [
// 'groupName' => $groupName
// ];
//
// $details = [];
//
// try {
// $details = $this->GrouperGroup->membersInGroup($scope, $this->userId);
//
// } catch (Exception $e) {
// CakeLog::write('error', __METHOD__ . ': ' . var_export($e->getMessage(), true));
//
// $this->Flash->set(_txt('pl.grouperlite.message.flash.group-detail-members-failed'), array('key' => 'error'));
// }
//
// return $details;
// }

/**
* Show all members of group in Grouper Group detail page
* Called from method GroupInfo
* Show all members of a group
* Called from all pages via AJAX call
*
*/
public function groupSubscribers() {
Expand Down Expand Up @@ -376,13 +350,13 @@ public function groupOptin() {
*/
public function groupCreateTemplate() {
if ($this->request->is('post')) {
if (!$this->GrouperGroup->createGroupWithTemplate($this->userId, $this->request->data)) {
$this->Flash->set("Error in creating group!", array('key' => 'error'));
return $this->redirect(array('action' => 'groupoptin'));
$status = $this->GrouperGroup->createGroupWithTemplate($this->userId, $this->request->data);
if ($status['status'] !== true) {
$this->Flash->set($status['message'], array('key' => 'error'));
} else {
$this->Flash->set("Success in creating group!", array('key' => 'success'));
return $this->redirect(array('action' => 'groupoptin'));
}
return $this->redirect(array('action' => 'groupcreatetemplate'));
}
$this->set('title', _txt('pl.grouperlite.title.templatecreate'));
}
Expand All @@ -400,33 +374,39 @@ public function groupDeleteTemplate() {
$this->set('title', _txt('pl.grouperlite.title.templatecreate'));
}


/**
* This method is currently not used.
*
* @return CakeResponse|void|null
*/
public function groupCreate() {
if ($this->request->is('post')) {
if (!$this->GrouperGroup->createUpdateGroup($this->userId, $this->request->data)) {
$this->Flash->set("Error in creating group!", array('key' => 'error'));
return $this->redirect(array('action' => 'groupOwner'));
} else {
$this->Flash->set("Your Group has been created!", array('key' => 'success'));
return $this->redirect(array('action' => 'groupOwner'));
}
return $this->redirect(array('action' => 'groupOwner'));
}

$this->set('title', _txt('pl.grouperlite.title.groupcreate'));
$this->set('grouperstems', $this->GrouperGroup->getOwnedStems($this->userId));
}

//TODO - Finish this call

/**
* This method is currently not used.
* @return CakeResponse|null
*/
public function groupDelete() {
if (!$this->GrouperGroup->deleteGroup($this->userId, $this->request->data)) {
$this->Flash->set("Error in deleting group!", array('key' => 'error'));
return $this->redirect(array('action' => 'groupOwner'));
} else {
$this->Flash->set("Your Group has been deleted!", array('key' => 'success'));
return $this->redirect(array('action' => 'groupOwner'));
}

$this->set('grouperstems', $this->GrouperGroup->getOwnedStems($this->userId));
return $this->redirect(array('action' => 'groupOwner'));
}


Expand All @@ -449,7 +429,6 @@ public function joinGroup() {
CakeLog::write('error', __METHOD__ . ': ' . var_export($e->getMessage(), true));
$this->Flash->set(_txt('pl.grouperlite.message.flash.join-group-error'), array('key' => 'error'));
}

} else {
$this->Flash->set(_txt('pl.grouperlite.message.flash.join-group-error'));
}
Expand Down Expand Up @@ -751,14 +730,12 @@ private function breakoutGroups(array $recordSet, $type = 'basic') {
*
*/
private function hackDescription($description) {

//Verify description has period in it.
if (strpos($description, ".") === false) {
return $description;
}

$newString = substr($description, strpos($description, ".") + 1);
return trim($newString);

}
}
Loading

0 comments on commit 1f5397c

Please sign in to comment.