本文整理汇总了PHP中module::get方法的典型用法代码示例。如果您正苦于以下问题:PHP module::get方法的具体用法?PHP module::get怎么用?PHP module::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module
的用法示例。
在下文中一共展示了module::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_version
/**
* Return the version of the installed module.
* @param string $module_name
*/
static function get_version($module_name)
{
return module::get($module_name)->version;
}
示例2: saveRightsAction
/**
* Save rights
* @param array $type
* @param array $modulerights
* @param array $modelsrights
* @param array $pagesrights
* @return string
*/
protected function saveRightsAction($type, $modulerights = array(), $modelsrights = array(), $pagesrights = array())
{
/* can't update rights for role admin ou his own role */
if (isset($modulerights[1])) {
unset($modulerights[1]);
}
if (isset($modulerights[$_SESSION['id_role']])) {
unset($modulerights[$_SESSION['id_role']]);
}
/* Save rights for modules */
if (!empty($modulerights)) {
foreach (reset($modulerights) as $moduleName => $value) {
$module = \module::get($moduleName);
foreach ($modulerights as $numRole => $rights) {
if ($modulerights[$numRole][$moduleName] === 'on' || $moduleName === 'core') {
$module->setRights($numRole, 1);
} else {
$module->setRights($numRole, 0);
}
}
$module->save();
}
}
/* Save rights for models : entities/fields */
if (!empty($modelsrights)) {
foreach (reset($modelsrights) as $moduleName => $module) {
$moduleObj = \app::getModule($moduleName);
foreach ($modulerights as $numRole => $rights) {
$modelsrights[$numRole][$moduleName] = json_decode($modelsrights[$numRole][$moduleName], TRUE);
}
foreach ($moduleObj->getModel() as $entityName => $entity) {
foreach ($modulerights as $numRole => $rights) {
$entity->setRights($numRole, (int) $modelsrights[$numRole][$moduleName][$entityName]['rights']);
foreach ($modelsrights[$numRole][$moduleName][$entityName]['fields'] as $fieldName => $rights) {
$entity->getField($fieldName)->setRights($numRole, (int) $rights);
}
}
$entity->save();
}
}
}
/* Save rights for pages */
if (!empty($pagesrights)) {
foreach (reset($pagesrights) as $moduleName => $module) {
$moduleObj = \app::getModule($moduleName);
foreach ($module as $pageId => $pages) {
$page = $moduleObj->getPage($pageId);
foreach ($modulerights as $numRole => $rights) {
if ($pagesrights[$numRole][$moduleName][$pageId]['display'] === 'on' || $numRole === 1) {
$page->setRights($numRole, 1);
} else {
$page->setRights($numRole, 0);
}
}
$page->save();
}
}
}
$return = array('notification' => t('The Permissions have been saved'), 'notificationType' => 'positive');
return $this->returnResult($return);
}
示例3: getModule
/**
* Get a module and cache the instance
* @static function
* @param string $module
* @return module object
*/
public static function getModule($module)
{
if (isset(self::$modules[$module])) {
return self::$modules[$module];
} else {
self::$modules[$module] = \module::get($module);
return self::$modules[$module];
}
}