CFM-291_Show_the_count_of_members_on_the_members_tab #184
Merged
arlen
merged 4 commits into
COmanage:develop
from
Ioannis:CFM-291_Show_the_count_of_members_on_the_members_tab
Apr 20, 2024
+166
−19
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
/** | ||
* COmanage Registry Function Utilities | ||
* | ||
* Portions licensed to the University Corporation for Advanced Internet | ||
* Development, Inc. ("UCAID") under one or more contributor license agreements. | ||
* See the NOTICE file distributed with this work for additional information | ||
* regarding copyright ownership. | ||
* | ||
* UCAID licenses this file to you under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with the | ||
* License. You may obtain a copy of the License at: | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* @link https://www.internet2.edu/comanage COmanage Project | ||
* @package registry | ||
* @since COmanage Registry v5.0.0 | ||
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace App\Lib\Util; | ||
|
||
use Cake\ORM\TableRegistry; | ||
use \Cake\Utility\Inflector; | ||
|
||
class FunctionUtilities { | ||
/** | ||
* Create a chained method call | ||
* | ||
* Example: | ||
* $this->getRequest()->getQuery(name: 'group_id) | ||
* $rootObject: $this, | ||
* $chainedDescriptionExample => [ | ||
* // Chain of methods | ||
* 'getRequest', | ||
* 'getQuery' => [ | ||
* // parameter name => parameter value, We are taking advantage the named parameters feature | ||
* 'name' =>'group_id' | ||
* ], | ||
* ] | ||
* | ||
* @param mixed $rootObj Object of the intance method we are calling | ||
* @param array $chainedDescription Description from root to final method call. | ||
* | ||
* @return mixed Return the intermediate objects or the final value | ||
* @since COmanage Registry v5.0.0 | ||
*/ | ||
|
||
public static function dynamicChainedFunction(mixed $rootObj, array $chainedDescription): mixed { | ||
if(!empty($chainedDescription)) { | ||
$key = key($chainedDescription); | ||
// This is the case where we pass a function with no parameters | ||
$funcName = null; | ||
$params = null; | ||
// We pass a function with an array of parameters | ||
if( \is_int($key)) { | ||
$funcName = array_shift($chainedDescription); | ||
} elseif (\is_string($key)) { | ||
$funcName = $key; | ||
$params = array_shift($chainedDescription); | ||
} | ||
|
||
if(!empty($params)) { | ||
$funcCall = $rootObj->$funcName(...$params); | ||
} else { | ||
$funcCall = $rootObj->$funcName(); | ||
} | ||
$value = self::dynamicChainedFunction($funcCall, $chainedDescription); | ||
} | ||
|
||
return !\is_object($rootObj) ? $rootObj : $value; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not use Bootstrap utility classes here - they are fiddly and break the simpler styles. Instead just provide the class "tab-count". Then in co-base.css add the following selectors: