本文整理汇总了PHP中dolGetModulesDirs函数的典型用法代码示例。如果您正苦于以下问题:PHP dolGetModulesDirs函数的具体用法?PHP dolGetModulesDirs怎么用?PHP dolGetModulesDirs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dolGetModulesDirs函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Form
*/
$form = new Form($db);
llxHeader('', $langs->trans("Permissions"));
if ($id) {
$fgroup = new Usergroup($db);
$fgroup->fetch($id);
$fgroup->getrights();
/*
* Affichage onglets
*/
$head = group_prepare_head($fgroup);
$title = $langs->trans("Group");
dol_fiche_head($head, 'rights', $title, 0, 'group');
// Charge les modules soumis a permissions
$modules = array();
$modulesdir = dolGetModulesDirs();
$db->begin();
foreach ($modulesdir as $dir) {
// Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>";
$handle = @opendir(dol_osencode($dir));
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
if (is_readable($dir . $file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
$modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName) {
include_once $dir . "/" . $file;
$objMod = new $modName($db);
// Load all lang files of module
if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
foreach ($objMod->langfiles as $domain) {
示例2: load_arrays
/**
* Load an exportable dataset
*
* @param User $user Object user making export
* @param string $filter Load a particular dataset only
* @return int <0 if KO, >0 if OK
*/
function load_arrays($user, $filter = '')
{
global $langs, $conf, $mysoc;
dol_syslog(get_class($this) . "::load_arrays user=" . $user->id . " filter=" . $filter);
$var = true;
$i = 0;
// Define list of modules directories into modulesdir
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
$modulesdir = dolGetModulesDirs();
foreach ($modulesdir as $dir) {
// Search available exports
$handle = @opendir(dol_osencode($dir));
if (is_resource($handle)) {
// Search module files
while (($file = readdir($handle)) !== false) {
if (is_readable($dir . $file) && preg_match("/^(mod.*)\\.class\\.php\$/i", $file, $reg)) {
$modulename = $reg[1];
// Defined if module is enabled
$enabled = true;
$part = strtolower(preg_replace('/^mod/i', '', $modulename));
if ($part == 'propale') {
$part = 'propal';
}
if (empty($conf->{$part}->enabled)) {
$enabled = false;
}
if ($enabled) {
// Chargement de la classe
$file = $dir . $modulename . ".class.php";
$classname = $modulename;
require_once $file;
$module = new $classname($this->db);
if (isset($module->export_code) && is_array($module->export_code)) {
foreach ($module->export_code as $r => $value) {
//print $i.'-'.$filter.'-'.$modulename.'-'.join(',',$module->export_code).'<br>';
if ($filter && $filter != $module->export_code[$r]) {
continue;
}
// Test if condition to show are ok
if (!empty($module->export_enabled[$r]) && !verifCond($module->export_enabled[$r])) {
continue;
}
// Test if permissions are ok
$bool = true;
foreach ($module->export_permission[$r] as $val) {
$perm = $val;
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
if (!empty($perm[2])) {
$bool = $user->rights->{$perm}[0]->{$perm}[1]->{$perm}[2];
} else {
$bool = $user->rights->{$perm}[0]->{$perm}[1];
}
if ($perm[0] == 'user' && $user->admin) {
$bool = true;
}
if (!$bool) {
break;
}
}
//print $bool." $perm[0]"."<br>";
// Permissions ok
// if ($bool)
// {
// Charge fichier lang en rapport
$langtoload = $module->getLangFilesArray();
if (is_array($langtoload)) {
foreach ($langtoload as $key) {
$langs->load($key);
}
}
// Module
$this->array_export_module[$i] = $module;
// Permission
$this->array_export_perms[$i] = $bool;
// Icon
$this->array_export_icon[$i] = isset($module->export_icon[$r]) ? $module->export_icon[$r] : $module->picto;
// Code du dataset export
$this->array_export_code[$i] = $module->export_code[$r];
// Libelle du dataset export
$this->array_export_label[$i] = $module->getExportDatasetLabel($r);
// Tableau des champ a exporter (cle=champ, valeur=libelle)
$this->array_export_fields[$i] = $module->export_fields_array[$r];
// Tableau des champs a filtrer (cle=champ, valeur1=type de donnees) on verifie que le module a des filtres
$this->array_export_TypeFields[$i] = isset($module->export_TypeFields_array[$r]) ? $module->export_TypeFields_array[$r] : '';
// Tableau des entites a exporter (cle=champ, valeur=entite)
$this->array_export_entities[$i] = $module->export_entities_array[$r];
// Tableau des entites qui requiert abandon du DISTINCT (cle=entite, valeur=champ id child records)
$this->array_export_dependencies[$i] = !empty($module->export_dependencies_array[$r]) ? $module->export_dependencies_array[$r] : '';
// Tableau des operations speciales sur champ
$this->array_export_special[$i] = !empty($module->export_special_array[$r]) ? $module->export_special_array[$r] : '';
// Requete sql du dataset
$this->array_export_sql_start[$i] = $module->export_sql_start[$r];
$this->array_export_sql_end[$i] = $module->export_sql_end[$r];
//.........这里部分代码省略.........
示例3: load_arrays
/**
* Load description int this->array_import_module, this->array_import_fields, ... of an importable dataset
*
* @param User $user Object user making import
* @param string $filter Load a particular dataset only. Index will start to 0.
* @return int <0 if KO, >0 if OK
*/
function load_arrays($user, $filter = '')
{
global $langs, $conf;
dol_syslog(get_class($this) . "::load_arrays user=" . $user->id . " filter=" . $filter);
$var = true;
$i = 0;
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
$modulesdir = dolGetModulesDirs();
// Load list of modules
foreach ($modulesdir as $dir) {
$handle = @opendir(dol_osencode($dir));
if (!is_resource($handle)) {
continue;
}
// Search module files
while (($file = readdir($handle)) !== false) {
if (!preg_match("/^(mod.*)\\.class\\.php/i", $file, $reg)) {
continue;
}
$modulename = $reg[1];
// Defined if module is enabled
$enabled = true;
$part = strtolower(preg_replace('/^mod/i', '', $modulename));
if (empty($conf->{$part}->enabled)) {
$enabled = false;
}
if (empty($enabled)) {
continue;
}
// Init load class
$file = $dir . "/" . $modulename . ".class.php";
$classname = $modulename;
require_once $file;
$module = new $classname($this->db);
if (isset($module->import_code) && is_array($module->import_code)) {
foreach ($module->import_code as $r => $value) {
if ($filter && $filter != $module->import_code[$r]) {
continue;
}
// Test if permissions are ok
/*$perm=$module->import_permission[$r][0];
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
if ($perm[2])
{
$bool=$user->rights->$perm[0]->$perm[1]->$perm[2];
}
else
{
$bool=$user->rights->$perm[0]->$perm[1];
}
if ($perm[0]=='user' && $user->admin) $bool=true;
//print $bool." $perm[0]"."<br>";
*/
// Load lang file
$langtoload = $module->getLangFilesArray();
if (is_array($langtoload)) {
foreach ($langtoload as $key) {
$langs->load($key);
}
}
// Permission
$this->array_import_perms[$i] = $user->rights->import->run;
// Icon
$this->array_import_icon[$i] = isset($module->import_icon[$r]) ? $module->import_icon[$r] : $module->picto;
// Code du dataset export
$this->array_import_code[$i] = $module->import_code[$r];
// Libelle du dataset export
$this->array_import_label[$i] = $module->getImportDatasetLabel($r);
// Array of tables to import (key=alias, value=tablename)
$this->array_import_tables[$i] = $module->import_tables_array[$r];
// Array of tables creator field to import (key=alias, value=creator field)
$this->array_import_tables_creator[$i] = isset($module->import_tables_creator_array[$r]) ? $module->import_tables_creator_array[$r] : '';
// Array of fields to import (key=field, value=label)
$this->array_import_fields[$i] = $module->import_fields_array[$r];
// Array of hidden fields to import (key=field, value=label)
$this->array_import_fieldshidden[$i] = $module->import_fieldshidden_array[$r];
// Tableau des entites a exporter (cle=champ, valeur=entite)
$this->array_import_entities[$i] = $module->import_entities_array[$r];
// Tableau des alias a exporter (cle=champ, valeur=alias)
$this->array_import_regex[$i] = $module->import_regex_array[$r];
// Tableau des alias a exporter (cle=champ, valeur=exemple)
$this->array_import_examplevalues[$i] = $module->import_examplevalues_array[$r];
// Tableau des regles de conversion d'une valeur depuis une autre source (cle=champ, valeur=tableau des regles)
$this->array_import_convertvalue[$i] = isset($module->import_convertvalue_array[$r]) ? $module->import_convertvalue_array[$r] : '';
// Module
$this->array_import_module[$i] = $module;
dol_syslog("Import loaded for module " . $modulename . " with index " . $i . ", dataset=" . $module->import_code[$r] . ", nb of fields=" . count($module->import_fields_array[$r]));
$i++;
}
}
}
closedir($handle);
}
//.........这里部分代码省略.........
示例4: GETPOST
$pagenext = $page + 1;
if (!$sortorder) {
$sortorder = "ASC";
}
if (!$sortfield) {
$sortfield = "email";
}
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$action = GETPOST("action");
$search_lastname = GETPOST("search_lastname");
$search_firstname = GETPOST("search_firstname");
$search_email = GETPOST("search_email");
$search_dest_status = GETPOST('search_dest_status');
// Search modules dirs
$modulesdir = dolGetModulesDirs('/mailings');
$object = new Mailing($db);
/*
* Actions
*/
if ($action == 'add') {
$module = GETPOST("module");
$result = -1;
$var = true;
foreach ($modulesdir as $dir) {
// Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>";
dol_syslog("Scan directory " . $dir . " for modules");
// Loading Class
$file = $dir . "/" . $module . ".modules.php";
$classname = "mailing_" . $module;
示例5: complete_elementList_with_modules
/**
* Add external modules to list of contact element
*
* @param array $elementList elementList
* @return int 1
*/
function complete_elementList_with_modules(&$elementList)
{
global $db, $modules, $conf, $langs;
// Search modules
$filename = array();
$modules = array();
$orders = array();
$categ = array();
$dirmod = array();
$i = 0;
// is a sequencer of modules found
$j = 0;
// j is module number. Automatically affected if module number not defined.
$modulesdir = dolGetModulesDirs();
foreach ($modulesdir as $dir) {
// Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>";
dol_syslog("Scan directory " . $dir . " for modules");
$handle = @opendir(dol_osencode($dir));
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
//print "$i ".$file."\n<br>";
if (is_readable($dir . $file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
$modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName) {
include_once $dir . $file;
$objMod = new $modName($db);
if ($objMod->numero > 0) {
$j = $objMod->numero;
} else {
$j = 1000 + $i;
}
$modulequalified = 1;
// We discard modules according to features level (PS: if module is activated we always show it)
$const_name = 'MAIN_MODULE_' . strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && !$conf->global->{$const_name}) {
$modulequalified = 0;
}
if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && !$conf->global->{$const_name}) {
$modulequalified = 0;
}
//If module is not activated disqualified
if (empty($conf->global->{$const_name})) {
$modulequalified = 0;
}
if ($modulequalified) {
// Load languages files of module
if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
foreach ($objMod->langfiles as $langfile) {
$langs->load($langfile);
}
}
$modules[$i] = $objMod;
$filename[$i] = $modName;
$orders[$i] = $objMod->family . "_" . $j;
// Tri par famille puis numero module
//print "x".$modName." ".$orders[$i]."\n<br>";
if (isset($categ[$objMod->special])) {
$categ[$objMod->special]++;
} else {
$categ[$objMod->special] = 1;
}
$dirmod[$i] = $dirroot;
if (!empty($objMod->module_parts['contactelement'])) {
$elementList[$objMod->name] = $langs->trans($objMod->name);
//exit;
}
$j++;
$i++;
} else {
dol_syslog("Module " . get_class($objMod) . " not qualified");
}
}
}
}
closedir($handle);
} else {
dol_syslog("htdocs/admin/modules.php: Failed to open directory " . $dir . ". See permission and open_basedir option.", LOG_WARNING);
}
}
return 1;
}