本文整理匯總了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];
}
}