本文整理汇总了PHP中Module::getModuleObjects方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::getModuleObjects方法的具体用法?PHP Module::getModuleObjects怎么用?PHP Module::getModuleObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module::getModuleObjects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllModulePoliciesDataByPermitable
/**
* @return array of all policies data
*/
public static function getAllModulePoliciesDataByPermitable(Permitable $permitable)
{
$data = array();
$modules = Module::getModuleObjects();
foreach ($modules as $module) {
if ($module instanceof SecurableModule) {
$moduleClassName = get_class($module);
$policies = $moduleClassName::getPolicyNames();
$policyLabels = $moduleClassName::getTranslatedPolicyLabels();
$reflectionClass = new ReflectionClass($moduleClassName);
$constants = $reflectionClass->getConstants();
if (!empty($policies)) {
foreach ($policies as $policy) {
if (!isset($policyLabels[$policy])) {
throw new NotSupportedException();
}
$explicit = $permitable->getExplicitActualPolicy($moduleClassName, $policy);
$inherited = $permitable->getInheritedActualPolicy($moduleClassName, $policy);
$effective = $permitable->getEffectivePolicy($moduleClassName, $policy);
$constantId = array_search($policy, $constants);
$data[$moduleClassName][$constantId] = array('displayName' => $policyLabels[$policy], 'explicit' => $explicit, 'inherited' => $inherited, 'effective' => $effective);
}
}
}
}
return $data;
}
示例2: renderContent
protected function renderContent()
{
$placedViewTypes = Portlet::getPlacedViewTypesByLayoutIdAndUser($this->uniqueLayoutId, Yii::app()->user->userModel->id);
$content = '<ul class="available-portlets">';
$modules = Module::getModuleObjects();
foreach ($modules as $module) {
if ($module->isEnabled()) {
$p = $module->getParentModule();
$viewClassNames = $module::getViewClassNames();
foreach ($viewClassNames as $className) {
$viewReflectionClass = new ReflectionClass($className);
if (!$viewReflectionClass->isAbstract()) {
$portletRules = PortletRulesFactory::createPortletRulesByView($className);
if ($portletRules != null && $portletRules->allowOnDashboard()) {
if ($portletRules->allowMultiplePlacementOnDashboard() && PortletsSecurityUtil::doesCurrentUserHavePermissionToAddPortlet($portletRules) === true || !$portletRules->allowMultiplePlacementOnDashboard() && !in_array($portletRules->getType(), $placedViewTypes) && PortletsSecurityUtil::doesCurrentUserHavePermissionToAddPortlet($portletRules) === true) {
$metadata = $className::getMetadata();
$url = Yii::app()->createUrl($this->moduleId . '/defaultPortlet/add', array('uniqueLayoutId' => $this->uniqueLayoutId, 'dashboardId' => $this->dashboardId, 'portletType' => $portletRules->getType()));
$onClick = 'window.location.href = "' . $url . '"';
$content .= '<li>';
$title = $metadata['perUser']['title'];
MetadataUtil::resolveEvaluateSubString($title);
$label = '<span>\\</span>' . $title;
$content .= ZurmoHtml::link(Zurmo::t('HomeModule', $label), null, array('onclick' => $onClick));
$content .= '</li>';
}
}
}
}
}
}
$content .= '</ul>';
return $content;
}
示例3: renderContent
protected function renderContent()
{
$placedViewTypes = $this->getPlacedViewTypes();
$modules = Module::getModuleObjects();
foreach ($modules as $module) {
if ($module->isEnabled()) {
$p = $module->getParentModule();
$viewClassNames = $module::getViewClassNames();
foreach ($viewClassNames as $className) {
$viewReflectionClass = new ReflectionClass($className);
if (!$viewReflectionClass->isAbstract()) {
$portletRules = PortletRulesFactory::createPortletRulesByView($className);
if ($portletRules != null && $portletRules->allowOnDashboard()) {
if ($portletRules->allowMultiplePlacementOnDashboard() && PortletsSecurityUtil::doesCurrentUserHavePermissionToAddPortlet($portletRules) === true || !$portletRules->allowMultiplePlacementOnDashboard() && !in_array($portletRules->getType(), $placedViewTypes) && PortletsSecurityUtil::doesCurrentUserHavePermissionToAddPortlet($portletRules) === true) {
$metadata = $className::getMetadata();
$url = Yii::app()->createUrl($this->moduleId . '/defaultPortlet/add', array('uniqueLayoutId' => $this->uniqueLayoutId, 'dashboardId' => $this->dashboardId, 'portletType' => $portletRules->getType()));
if (isset($metadata['perUser']['title'])) {
$title = $metadata['perUser']['title'];
} else {
continue;
}
MetadataUtil::resolveEvaluateSubString($title);
$sortablePortlets[$title] = array('url' => $url, 'title' => $title, 'portletRules' => $portletRules);
}
}
}
}
}
}
return PortletUtil::renderAddPortletsContent($sortablePortlets);
}
示例4: getAllModuleRightsDataByPermitable
/**
* @return array of all module rights data
*/
public static function getAllModuleRightsDataByPermitable(Permitable $permitable)
{
$data = array();
$modules = Module::getModuleObjects();
foreach ($modules as $module) {
if ($module instanceof SecurableModule) {
$moduleClassName = get_class($module);
$rights = $moduleClassName::getRightsNames();
$rightLabels = $moduleClassName::getTranslatedRightsLabels();
$reflectionClass = new ReflectionClass($moduleClassName);
if (!empty($rights)) {
$rightsData = array();
foreach ($rights as $right) {
if (!isset($rightLabels[$right])) {
throw new NotSupportedException($right);
}
$explicit = $permitable->getExplicitActualRight($moduleClassName, $right);
$inherited = $permitable->getInheritedActualRight($moduleClassName, $right);
$effective = $permitable->getEffectiveRight($moduleClassName, $right);
$constants = $reflectionClass->getConstants();
$constantId = array_search($right, $constants);
$rightsData[$constantId] = array('displayName' => $rightLabels[$right], 'explicit' => RightsUtil::getRightStringFromRight($explicit), 'inherited' => RightsUtil::getRightStringFromRight($inherited), 'effective' => RightsUtil::getRightStringFromRight($effective));
}
$data[$moduleClassName] = ArrayUtil::subValueSort($rightsData, 'displayName', 'asort');
}
}
}
return $data;
}
示例5: renderContent
protected function renderContent()
{
$content = $this->renderTitleContent();
$content .= '<ul class="configuration-list">';
$modules = Module::getModuleObjects();
$moduleClassNamesAndLabels = array();
foreach ($modules as $module) {
$moduleTreeMenuItems = $module->getDesignerMenuItems();
if ($module->isEnabled() && !empty($moduleTreeMenuItems)) {
$moduleClassNamesAndLabels[get_class($module)] = $module::getModuleLabelByTypeAndLanguage('Plural');
}
}
asort($moduleClassNamesAndLabels);
foreach ($moduleClassNamesAndLabels as $moduleClassName => $label) {
if (RightsUtil::canUserAccessModule($moduleClassName, Yii::app()->user->userModel)) {
$route = $this->moduleId . '/' . $this->controllerId . '/modulesMenu/';
$content .= ZurmoHtml::openTag('li');
$content .= '<h4>' . $label . '</h4>';
$content .= ZurmoHtml::link(ZurmoHtml::wrapLabel(Zurmo::t('Core', 'Configure')), Yii::app()->createUrl($route, array('moduleClassName' => $moduleClassName)), array('class' => 'white-button'));
$content .= ZurmoHtml::closeTag('li');
}
}
$content .= '</ul>';
return $content;
}
示例6: getImportRulesTypesForCurrentUser
/**
* Based on the current user, return the importRules types and their display labels. Only include import rules
* that the user has a right to access its corresponding module.
* @return array of import rules types and display labels.
*/
public static function getImportRulesTypesForCurrentUser()
{
//todo: cache results to improve performance if needed.
$importRulesTypes = array();
$modules = Module::getModuleObjects();
foreach ($modules as $module) {
$rulesClassNames = $module::getAllClassNamesByPathFolder('rules');
foreach ($rulesClassNames as $ruleClassName) {
$classToEvaluate = new ReflectionClass($ruleClassName);
if (is_subclass_of($ruleClassName, 'ImportRules') && !$classToEvaluate->isAbstract()) {
$moduleClassNames = $ruleClassName::getModuleClassNames();
$addToArray = true;
foreach ($moduleClassNames as $moduleClassNameToCheckAccess) {
if (!RightsUtil::canUserAccessModule($moduleClassNameToCheckAccess, Yii::app()->user->userModel) || !RightsUtil::doesUserHaveAllowByRightName($moduleClassNameToCheckAccess, $moduleClassNameToCheckAccess::getCreateRight(), Yii::app()->user->userModel)) {
$addToArray = false;
}
}
if ($addToArray) {
$importRulesTypes[$ruleClassName::getType()] = $ruleClassName::getDisplayLabel();
}
}
}
}
return $importRulesTypes;
}
示例7: renderContent
protected function renderContent()
{
$placedViewTypes = Portlet::getPlacedViewTypesByLayoutIdAndUser($this->uniqueLayoutId, Yii::app()->user->userModel->id);
$modules = Module::getModuleObjects();
$sortablePortlets = array();
foreach ($modules as $module) {
if ($module->isEnabled()) {
$p = $module->getParentModule();
$viewClassNames = $module::getViewClassNames();
foreach ($viewClassNames as $className) {
$viewReflectionClass = new ReflectionClass($className);
if (!$viewReflectionClass->isAbstract()) {
$portletRules = PortletRulesFactory::createPortletRulesByView($className);
if ($viewReflectionClass->implementsInterface('RelatedPortletViewInterface')) {
if ($this->resolveLayoutIdInAllowedOnPortletViewClassNames($className) && $className::allowMultiplePlacement() == false && !in_array($portletRules->getType(), $placedViewTypes) && PortletsSecurityUtil::doesCurrentUserHavePermissionToAddPortlet($portletRules) === true) {
$metadata = $className::getMetadata();
$url = Yii::app()->createUrl($this->moduleId . '/defaultPortlet/add', array('uniqueLayoutId' => $this->uniqueLayoutId, 'modelId' => $this->modelId, 'portletType' => $portletRules->getType()));
$title = $metadata['perUser']['title'];
MetadataUtil::resolveEvaluateSubString($title);
$sortablePortlets[$title] = array('url' => $url, 'title' => $title, 'portletRules' => $portletRules);
}
}
}
}
}
}
if (empty($sortablePortlets)) {
$messageView = new NoPortletsToPlaceView();
return $messageView->render();
}
//Sort by title
ksort($sortablePortlets);
return PortletUtil::renderAddPortletsContent($sortablePortlets);
}
示例8: getAdministrableModuleClassNames
/**
* @return array of module class names that are available for
* module permissions administration through the user interface
*/
public static function getAdministrableModuleClassNames()
{
$moduleClassNames = array();
$modules = Module::getModuleObjects();
foreach ($modules as $module) {
$classToEvaluate = new ReflectionClass($module);
if (is_subclass_of($module, 'SecurableModule') && !$classToEvaluate->isAbstract() && $module::hasPermissions()) {
$moduleClassNames[] = get_class($module);
}
}
return $moduleClassNames;
}
示例9: load
/**
* Loads all module demo data based on a dependency tree loading the dependent module data first.
* @param object $messageLogger
*/
public static function load(&$messageLogger, $loadMagnitude = null)
{
assert('$messageLogger instanceof MessageLogger');
assert('$loadMagnitude == null || is_int($loadMagnitude)');
Yii::import('application.extensions.zurmoinc.framework.data.*');
$loadedModules = array();
$demoDataHelper = new DemoDataHelper();
$modules = Module::getModuleObjects();
foreach ($modules as $module) {
static::loadByModule($module, $messageLogger, $demoDataHelper, $loadMagnitude);
}
}
示例10: getAdminTabMenuItems
public static function getAdminTabMenuItems($user = null)
{
$tabMenuItems = array(array('label' => "eval:Zurmo::t('DesignerModule', 'Designer')", 'url' => array('/designer/default'), 'right' => self::RIGHT_ACCESS_DESIGNER));
$modules = Module::getModuleObjects();
foreach ($modules as $module) {
$moduleTreeMenuItems = $module->getDesignerMenuItems();
if ($module->isEnabled() && !empty($moduleTreeMenuItems)) {
$tabMenuItems[0]['items'][] = array('label' => Zurmo::t('DesignerModule', $module::getModuleLabelByTypeAndLanguage('Plural')), 'url' => array('/designer/default/modulesMenu', 'moduleClassName' => get_class($module)));
}
}
return $tabMenuItems;
}
示例11: findGlobalSearchScopingModuleNamesAndLabelsDataByUser
protected static function findGlobalSearchScopingModuleNamesAndLabelsDataByUser(User $user)
{
assert('$user->id > 0');
$moduleNamesAndLabels = array();
$modules = Module::getModuleObjects();
foreach ($modules as $module) {
$globalSearchFormClassName = $module::getGlobalSearchFormClassName();
if (GlobalSearchUtil::resolveIfModuleShouldBeGloballySearched($module) && $globalSearchFormClassName != null && RightsUtil::canUserAccessModule(get_class($module), $user)) {
$moduleNamesAndLabels[$module->getName()] = $module::getModuleLabelByTypeAndLanguage('Plural');
}
}
return $moduleNamesAndLabels;
}
示例12: getAcceptableModelsForAttributeNames
protected static function getAcceptableModelsForAttributeNames()
{
$modules = Module::getModuleObjects();
$modelNames = array();
foreach ($modules as $module) {
if (get_class($module) != 'UsersModule') {
try {
$modelNames[] = $module::getPrimaryModelName();
} catch (NotSupportedException $e) {
}
}
}
return $modelNames;
}
示例13: findReadSubscriptionModelClassNames
public static function findReadSubscriptionModelClassNames()
{
$readPermissionsSubscriptionModelClassNames = array();
$modules = Module::getModuleObjects();
foreach ($modules as $module) {
$modelClassNames = $module::getModelClassNames();
foreach ($modelClassNames as $modelClassName) {
if (is_subclass_of($modelClassName, 'OwnedSecurableItem') && $modelClassName::hasReadPermissionsSubscriptionOptimization()) {
$readPermissionsSubscriptionModelClassNames[] = $modelClassName;
}
}
}
return $readPermissionsSubscriptionModelClassNames;
}
示例14: getBadgeRulesData
/**
* @return array of available badge rule class names
*/
public static function getBadgeRulesData()
{
$badgeRulesData = array();
$modules = Module::getModuleObjects();
foreach ($modules as $module) {
$rulesClassNames = $module::getAllClassNamesByPathFolder('rules.badges');
foreach ($rulesClassNames as $ruleClassName) {
$classToEvaluate = new ReflectionClass($ruleClassName);
if (!$classToEvaluate->isAbstract()) {
$badgeRulesData[] = $ruleClassName;
}
}
}
return $badgeRulesData;
}
示例15: getNonMonitorJobsData
/**
* @return array of data for jobs that are not the monitor job. Includes information such as the display label,
* whether it is running or not, and the last completion time.
*/
public static function getNonMonitorJobsData()
{
$jobsData = array();
$modules = Module::getModuleObjects();
foreach ($modules as $module) {
$jobsClassNames = $module::getAllClassNamesByPathFolder('jobs');
foreach ($jobsClassNames as $jobClassName) {
$classToEvaluate = new ReflectionClass($jobClassName);
if (is_subclass_of($jobClassName, 'BaseJob') && !$classToEvaluate->isAbstract() && $jobClassName != 'MonitorJob') {
$jobsData[$jobClassName::getType()] = self::getJobDataByType($jobClassName::getType());
}
}
}
return $jobsData;
}