public function testHas() { $this->setLoadAllExpectation(false); $this->setLoadConfigExpectation(); $this->assertTrue($this->model->has('foo')); $this->assertFalse($this->model->has('bar')); }
public function testGetModuleWhenDataIsNotCached() { $moduleData = array('name' => 'declared_module', 'version' => '1.0.0.0', 'active' => false); $data = array('declared_module' => $moduleData); $cacheId = 'global::modules_declaration_cache'; $this->cacheMock->expects($this->once())->method('load')->with($cacheId); $this->readerMock->expects($this->once())->method('read')->with('global')->will($this->returnValue($data)); $this->cacheMock->expects($this->once())->method('save')->with(serialize($data), $cacheId); $model = new ModuleList($this->readerMock, $this->cacheMock); $this->assertEquals($moduleData, $model->getModule('declared_module')); $this->assertNull($model->getModule('not_declared_module')); }
/** * @param string $hook * @param bool $sort * * @return array */ private function discoverImplementations($hook, $sort) { # StaticCallLog::addCall(); // The hook is not cached, so ensure that whether or not it has // implementations, that the cache is updated at the end of the request. $this->writeCache = TRUE; $hook_info = $this->moduleHookInfo(); $implementations = array(); $list = $this->moduleList->moduleList(FALSE, FALSE, $sort); if ('modules_enabled' === $hook) { # HackyLog::logx($list); } foreach ($list as $module) { $include_file = isset($hook_info[$hook]['group']) && module_load_include('inc', $module, $module . '.' . $hook_info[$hook]['group']); // Since module_hook() may needlessly try to load the include file again, // function_exists() is used directly here. if (function_exists($module . '_' . $hook)) { $implementations[$module] = $include_file ? $hook_info[$hook]['group'] : FALSE; } } // Allow modules to change the weight of specific implementations but avoid // an infinite loop. if ($hook != 'module_implements_alter') { $this->hookSystem->drupalAlter('module_implements', $implementations, $hook); } return $implementations; }
public function deactivation($page_id = null) { $result = false; // доступно дл¤ пользователей первой роли (например, Ђ–еактивуї) $role_id = Users::model()->findByPk(Yii::app()->user->id)->role_id; if ($role_id < 2 && !is_null($page_id) && Pages::model()->existsPage($page_id)) { $link_id = ModulesInPages::model()->getLink($page_id, $this->id); if ($link_id) { $result = ModuleList::model()->deactivation($link_id, $this->id); } } return $result; }
/** * @see bootstrap_invoke_all() * * @param string $hook */ private function bootstrapInvokeAll($hook) { // Bootstrap modules should have been loaded when this function is called, so // we don't need to tell module_list() to reset its internal list (and we // therefore leave the first parameter at its default value of FALSE). We // still pass in TRUE for the second parameter, though; in case this is the // first time during the bootstrap that module_list() is called, we want to // make sure that its internal cache is primed with the bootstrap modules // only. foreach ($this->moduleList->moduleList(FALSE, TRUE) as $module) { $this->drupalLoad->drupalLoad('module', $module); PureFunctions::moduleInvoke($module, $hook); } }
/** * The command handler */ public static function requestList() { self::$pTempObject = array(); $pInstance = Core::getCurrentInstance(); $pSocket = $pInstance->getCurrentSocket(); $pSocket->Output("LIST"); $pSocket->executeCapture(array(__CLASS__, "parseLineResponse")); usort(self::$pTempObject, function ($pChannelA, $pChannelB) { if ($pChannelA->count == $pChannelB->count) { return 0; } return $pChannelA->count < $pChannelB->count ? 1 : -1; }); return self::$pTempObject; }
/** * @param string $extension * @param bool $install * * @see module_enable() */ private function enableModule($extension, $install) { $filename = $this->drupalGetFilename->drupalGetFilename('module', $extension); // Include module files. require_once $filename; if (file_exists($install_file = dirname($filename) . '/' . $extension . '.install')) { require_once $install_file; } // Update status in system table $this->systemTable->moduleSetEnabled($extension); // Clear various caches, especially hook_module_implements() $this->systemListReset->systemListReset(); $this->moduleList->moduleList(TRUE); $this->hookSystem->moduleImplementsReset(); $this->systemUpdateBootstrapStatus->systemUpdateBootstrapStatus(); // Update the registry to include it. # registry_update(); // Refresh the schema to include it. # drupal_get_schema(NULL, TRUE); // Update the theme registry to include it. # drupal_theme_rebuild(); // Clear entity cache. # entity_info_cache_clear(); if ($install) { PureFunctions::moduleInvoke($extension, 'schema'); $this->systemTable->moduleSetSchemaVersion($extension, 7000); PureFunctions::moduleInvoke($extension, 'update_last_removed'); // Optional hook_install().. PureFunctions::moduleInvoke($extension, 'install'); // Optional watchdog() $this->hookSystem->moduleInvokeAll('watchdog'); } // hook_enable() PureFunctions::moduleInvoke($extension, 'enable'); // watchdog() $this->hookSystem->moduleInvokeAll('watchdog'); }
<div align="center"><h2><font color="#CAA778">Menü</font></h2></div> <?php require_once "module.inc.php"; require_once "link_array.inc.php"; require_once "acl.inc.php"; require_once "user.inc.php"; function getaccess(&$test) { if ($test->acl_id != 0) { return true; } return false; } echo "<font color=\"#CAA778\">"; $modul = new ModuleList(); $modul->selectAll(); $anz = count($modul->list); for ($i = 0; $i < $anz; $i++) { $acl = new ACL(); $acl = @$_SESSION["user"]->getACLByPath($modul->list[$i]->pathname); if (getaccess($acl)) { echo $linkRechteListe[$modul->list[$i]->pathname]; } } echo "</font>"; ?> <div align="center"><a href="profile.php" style="color: #CAA778;">Benutzerprofil</a></div><br /> <div align="center"><a href="index.php" style="color: #CAA778;">Home</a></div><br /> </td>
protected function moduleList($data) { $pages = $data['pages']; $mpage_id = ModulesInPages::model()->getLink($data['doc_id_last'], 'list'); $lenta = new ModuleList(); $data['lenta'] = ModuleList::model()->getList($mpage_id, 0, 0, 1); $data['url_for_menu'] = substr(substr($data['pages']->make_url($data['doc_id_last']), 0, -1), 1); $this->render('list1', $data); }
private function getMasterview($controller, $hasUser) { global $INK_User; $controllerName = $controller->GetName(); $javaScripts = new JS($controllerName); $cssfiles = new CSS($controllerName); //set master statically, we may want to change this to a user controller thing later. //May be usefull for access controll as well. $masterview = new ViewTemplate(); if ($hasUser) { $modules = $INK_User->getModules(); $customermodules = from('$module')->in($modules)->where('$module => $module->SystemStatus() == 0')->select('$module'); $systemmodules = from('$module')->in($modules)->where('$module => $module->SystemStatus() == 1')->select('$module'); $moduleList = new ModuleList($customermodules, $controllerName, array('id' => 'navigation')); $masterview->SysModules = $systemmodules; $masterview->sites = $INK_User->getRole()->getSites(); $masterview->INK_User = $INK_User; $masterview->modules = $moduleList->getList(); } $masterview->javascripts = $javaScripts->getScripts(); $masterview->cssfiles = $cssfiles->getFiles(); $masterview->hasUser = $hasUser; //show the view and return the result as a string $viewview = $this->getView(); ob_start(); try { $viewview->show($this->controller->getName(), $this->resolveAction()); } catch (Exception $e) { throw $e; } $masterview->maincontent = ob_get_clean(); return $masterview; }
public function testHasFalse() { $this->assertFalse($this->moduleList->has('No_Such_Module')); }
?> </div> <?php if (Yii::app()->user->hasFlash($this->module_id . '_add_message')) { echo Yii::app()->user->getFlash($this->module_id . '_add_message'); } ?> <?php $this->endWidget(); ?> </div> </div> <div class="catalog"> <?php $mpage_id = ModulesInPages::model()->getLink($page_id, $this->module_id); $data = ModuleList::model()->getList($mpage_id); if (count($data) > 0) { ?> <ul class="<?php echo count($data) > 1 ? 'sortable' : ''; ?> type_1"> <?php foreach ($data as $item_id => $item) { ?> <li data-id="<?php echo $item->id; ?> " class="link ids"> <div class="act_block"> <?php
public function actionDeactivation($page_id = null) { $result = false; // доступно для пользователей первой роли (например, «Реактиву») $role_id = Users::model()->findByPk(Yii::app()->user->id)->role_id; if ($role_id < 2 && !is_null($page_id) && Pages::model()->existsPage($page_id)) { $link_id = ModulesInPages::model()->getLink($page_id, $this->module->id); if ($link_id) { $result = ModuleList::model()->deactivation($link_id, $this->module->id); } } if ($result) { $this->redirect(Yii::app()->baseUrl . '?r=pages/update&id=' . $page_id . '&/#!/tab_fourth'); } else { $this->redirect(Yii::app()->request->baseUrl . '/admin.php'); } }