Ejemplo n.º 1
0
 /**
  * Returns a set of modules available and have Configuration sections.
  *
  * @return array Array with 'name' and 'label'.
  */
 public function getModules()
 {
     $results = array();
     // System settings
     $model = Phprojekt_Loader::getModel('Core', 'General_Configuration');
     if ($model) {
         $results[] = array('name' => 'General', 'label' => Phprojekt::getInstance()->translate('General'));
     }
     // Module Configuration
     foreach (scandir(PHPR_CORE_PATH) as $dir) {
         $path = PHPR_CORE_PATH . DIRECTORY_SEPARATOR . $dir;
         if ($dir == '.' || $dir == '..' || in_array($dir, self::$_excludePaths)) {
             continue;
         }
         if (is_dir($path)) {
             $configClass = Phprojekt_Loader::getModelClassname($dir, 'Configuration');
             if (Phprojekt_Loader::tryToLoadClass($configClass)) {
                 $results[] = array('name' => $dir, 'label' => Phprojekt::getInstance()->translate($dir, null, $dir));
             }
         }
     }
     return $results;
 }
Ejemplo n.º 2
0
 /**
  * Returns a set of modules available that have Setting.php files.
  *
  * @return array Array with 'name' and 'label'.
  */
 public function getModules()
 {
     $results = array();
     // System settings
     $model = Phprojekt_Loader::getModel('Core', 'User_Setting');
     if ($model) {
         $results[] = array('name' => 'User', 'label' => Phprojekt::getInstance()->translate('User'));
     }
     $modelNotification = Phprojekt_Loader::getModel('Core', 'Notification_Setting');
     if ($modelNotification) {
         $results[] = array('name' => 'Notification', 'label' => Phprojekt::getInstance()->translate('Notification'));
     }
     // System modules settings
     foreach (scandir(PHPR_CORE_PATH) as $dir) {
         $path = PHPR_CORE_PATH . DIRECTORY_SEPARATOR . $dir;
         if ($dir == '.' || $dir == '..' || in_array($dir, self::$_excludePaths)) {
             continue;
         }
         if (is_dir($path)) {
             $settingClass = Phprojekt_Loader::getModelClassname($dir, 'Setting');
             if (Phprojekt_Loader::tryToLoadClass($settingClass)) {
                 $results[] = array('name' => $dir, 'label' => Phprojekt::getInstance()->translate($dir, null, $dir));
             }
         }
     }
     // User modules settings
     foreach (scandir(PHPR_USER_CORE_PATH) as $dir) {
         $path = PHPR_USER_CORE_PATH . $dir;
         if ($dir == '.' || $dir == '..') {
             continue;
         }
         if (is_dir($path)) {
             $settingClass = Phprojekt_Loader::getModelClassname($dir, 'Setting');
             if (Phprojekt_Loader::tryToLoadClass($settingClass, false, true)) {
                 $results[] = array('name' => $dir, 'label' => Phprojekt::getInstance()->translate($dir, null, $dir));
             }
         }
     }
     return $results;
 }