本文整理汇总了PHP中Kernel::getModAvailable方法的典型用法代码示例。如果您正苦于以下问题:PHP Kernel::getModAvailable方法的具体用法?PHP Kernel::getModAvailable怎么用?PHP Kernel::getModAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kernel
的用法示例。
在下文中一共展示了Kernel::getModAvailable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAdmin
public function processAdmin()
{
//check if the user is admin :
if (!Kernel::isAdmin()) {
return $this->error('charte.noRight', true, '||');
}
$ppo = new CopixPPO();
$ppo->errors = isset($this->flash->errors) ? $this->flash->errors : null;
$ppo->success = isset($this->flash->success) ? $this->flash->success : null;
$ppo->chartes = $this->service('CharteService')->getChartesTypes();
$ppo->radio = array(1 => 'oui', 0 => 'non');
$ppo->idClasseur = $ppo->idMalle = null;
$modsAvailable = Kernel::getModAvailable($this->user->type);
$malleAvailable = Kernel::filterModuleList($modsAvailable, 'MOD_MALLE');
// Malle activée
if (!empty($malleAvailable)) {
$modsEnabled = Kernel::getModEnabled($this->user->type, $this->user->idEn);
$mal = Kernel::filterModuleList($modsEnabled, 'MOD_MALLE');
// Si la malle est bien initialisée
if (!empty($mal)) {
$ppo->idMalle = $mal[0]->module_id;
} else {
return $this->error('charte.admin.noMalle', true, 'malle||');
}
} else {
$classeurAvailable = Kernel::filterModuleList($modsAvailable, 'MOD_CLASSEUR');
// Classeur activé
if (!empty($classeurAvailable)) {
Kernel::createMissingModules($this->user->type, $this->user->idEn);
$modsEnabled = Kernel::getModEnabled($this->user->type, $this->user->idEn);
$classeur = Kernel::filterModuleList($modsEnabled, 'MOD_CLASSEUR');
if (!empty($classeur)) {
$ppo->idClasseur = $classeur[0]->module_id;
}
}
}
CopixHTMLHeader::addCSSLink(_resource("styles/module_charte.css"));
return _arPPO($ppo, 'charte.admin.tpl');
}
示例2: createMissingModules
public function createMissingModules($node_type, $node_id)
{
$modavailable = Kernel::getModAvailable($node_type);
$modenabled = Kernel::getModEnabled($node_type, $node_id, _currentUser()->getExtra('type'), _currentUser()->getExtra('id'), 1);
$modinstalled = array();
foreach ($modenabled as $module) {
$modinstalled[] = strtolower($module->module_type);
}
//var_dump($modinstalled);
$nodeInfo = Kernel::getNodeInfo($node_type, $node_id);
if ($node_type == 'CLUB') {
foreach ($modavailable as $module) {
// echo "<li>".$module->module_type."</li>";
if ($module->module_type == 'MOD_MAGICMAIL') {
$modname = 'magicmail';
// _dump($modinstalled);
// if( array_search("mod_magicmail", $modinstalled)===false ) echo "magicmail ";
// if( array_search("mod_blog", $modinstalled)!==false ) echo "blog ";
if (array_search("mod_magicmail", $modinstalled) === false && array_search("mod_blog", $modinstalled) !== false) {
$file =& CopixSelectorFactory::create($modname . "|" . $modname);
$filePath = $file->getPath() . COPIX_CLASSES_DIR . "kernel" . strtolower($file->fileName) . '.class.php';
//var_dump($filePath);
if (is_readable($filePath)) {
$modservice =& CopixClassesFactory::Create($modname . '|kernel' . $modname);
if (method_exists($modservice, "create")) {
$subtitle = $node_type == 'BU_ECOLE' && isset($nodeInfo['ALL']->eco_type) ? $nodeInfo['ALL']->eco_type : '';
$prenom = isset($nodeInfo['prenom']) ? $nodeInfo['prenom'] : '';
$modid = $modservice->create(array('title' => trim($prenom . ' ' . $nodeInfo['nom']), 'subtitle' => $subtitle, 'node_type' => $node_type, 'node_id' => $node_id));
if ($modid != null) {
// _dump( array( $module->module_type, $modid, $node_type, $node_id ));
Kernel::registerModule($module->module_type, $modid, $node_type, $node_id);
}
}
}
}
}
}
return false;
}
foreach ($modavailable as $module) {
//var_dump($module);
if (preg_match("/^MOD_(.+)\$/", $module->module_type, $modinfo)) {
$modname = strtolower($modinfo[1]);
if (array_search("mod_" . $modname, $modinstalled) === false) {
$file =& CopixSelectorFactory::create($modname . "|" . $modname);
$filePath = $file->getPath() . COPIX_CLASSES_DIR . "kernel" . strtolower($file->fileName) . '.class.php';
//var_dump($filePath);
if (is_readable($filePath)) {
$modservice =& CopixClassesFactory::Create($modname . '|kernel' . $modname);
if (method_exists($modservice, "create")) {
$subtitle = $node_type == 'BU_ECOLE' && isset($nodeInfo['ALL']->eco_type) ? $nodeInfo['ALL']->eco_type : '';
$prenom = isset($nodeInfo['prenom']) ? $nodeInfo['prenom'] : '';
$modid = $modservice->create(array('title' => trim($prenom . ' ' . $nodeInfo['nom']), 'subtitle' => $subtitle, 'node_type' => $node_type, 'node_id' => $node_id));
if ($modid != null) {
Kernel::registerModule($module->module_type, $modid, $node_type, $node_id);
}
}
}
}
}
}
}