当前位置: 首页>>代码示例>>PHP>>正文


PHP module::get方法代码示例

本文整理汇总了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;
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:8,代码来源:module.php

示例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);
 }
开发者ID:saitinet,项目名称:parsimony,代码行数:69,代码来源:module.php

示例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];
     }
 }
开发者ID:saitinet,项目名称:parsimony,代码行数:15,代码来源:app.php


注:本文中的module::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。