本文整理汇总了PHP中Module::getModules方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::getModules方法的具体用法?PHP Module::getModules怎么用?PHP Module::getModules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module::getModules方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexSection
/**
* Displays all layouts for a site type
*
* @param string $siteType
* @return string
*/
public function indexSection($siteType = null)
{
$this->setOutputType(self::_OT_CONFIG);
// Check if there is a specified site type to manage layout for
if (empty($siteType)) {
try {
$siteType = $this->_input->get('type');
} catch (Input_KeyNoExist $e) {
$siteType = $this->_router->getDefaultSiteType();
}
}
$siteType = strtolower($siteType);
if (!$this->_router->siteTypeExists($siteType)) {
$this->_event->error(t('Selected site type does not exist'));
return zula_redirect($this->_router->makeUrl('content_layout'));
}
$this->setTitle(sprintf(t('"%s" content layouts'), ucfirst($siteType)), false);
// Find out what module is being used in the fpsc layout
$fpsc = new Layout('fpsc-' . $siteType);
$cntrlrs = $fpsc->getControllers('SC');
$fpscCntrlr = reset($cntrlrs);
// Get all modules for the user to choose from, with title
$modules = array();
foreach (Module::getModules() as $mod) {
$modObj = new Module($mod);
$modules[$modObj->name] = $modObj->title;
}
// Gather all layouts and build view
$view = $this->loadView('index/main.html');
$view->assign(array('SITE_TYPE' => $siteType, 'LAYOUTS' => Layout::getAll($siteType), 'FPSC_MODULE' => $fpscCntrlr['mod'], 'MODULES' => $modules));
$view->assignHtml(array('CSRF' => $this->_input->createToken(true)));
return $view->getOutput();
}
示例2: indexSection
/**
* Lists all modules that are avaliable for installation
*
* @return string
*/
public function indexSection()
{
$this->setTitle(t('Install module'));
$this->setOutputType(self::_OT_CONFIG);
$view = $this->loadView('install/list.html');
$view->assign(array('modules' => Module::getModules(Module::_INSTALLABLE)));
return $view->getOutput();
}
示例3: indexSection
/**
* Installs all available modules
*
* @return bool
*/
public function indexSection()
{
$this->setTitle(t('Module installation'));
if ($this->_zula->getMode() != 'cli' && (!isset($_SESSION['installStage']) || $_SESSION['installStage'] !== 4)) {
return zula_redirect($this->_router->makeUrl('install', 'checks'));
}
Module::setDirectory(_REAL_MODULE_DIR);
foreach (Module::getModules(Module::_INSTALLABLE) as $modname) {
$module = new Module($modname);
$module->install();
}
$this->setProjectDefaults();
Module::setDirectory($this->_zula->getDir('modules'));
if (isset($_SESSION['installStage'])) {
++$_SESSION['installStage'];
}
$this->_event->success(t('Installed all available modules'));
return zula_redirect($this->_router->makeUrl('install', 'settings'));
}
示例4: load
/**
* Loads all hook listener file which will in turn
* register methods/functions to a hook
*
* @return int Number of hook files loaded
*/
public static function load()
{
$acl = _ACL_ENABLED ? Registry::get('acl') : null;
$hookPath = Registry::get('zula')->getDir('modules');
$hookCount = 0;
foreach (Module::getModules(Module::_INSTALLED, false, Module::_SORT_ORDER) as $module) {
if (isset($acl) && $acl->resourceExists($module . '_global') && $acl->check($module . '_global')) {
$hook = $hookPath . '/' . $module . '/hooks/listeners.php';
if (is_file($hook)) {
include $hook;
$class = $module . '_hooks';
if (class_exists($class, false)) {
new $class();
$hookCount++;
self::$loadedModules[] = $module;
}
}
}
}
return $hookCount;
}
示例5: __call
/**
* Displays form for attaching a module to the provied
* layout name.
*
* @param string $name
* @param array $args
* @return mixed
*/
public function __call($name, $args)
{
$this->setTitle(t('Attach new module'));
$this->setOutputType(self::_OT_CONFIG);
if (!$this->_acl->check('content_layout_attach_module')) {
throw new Module_NoPermission();
}
/**
* Create the layout object and get all sectors from the theme of
* the site type of this layout
*/
$layout = new Layout(substr($name, 0, -7));
$siteType = substr($layout->getName(), 0, strpos($layout->getName(), '-'));
$theme = new Theme($this->_config->get('theme/' . $siteType . '_default'));
// Build the form with validation
$form = new View_form('attach/attach.html', 'content_layout');
$form->action($this->_router->makeUrl('content_layout', 'attach', $layout->getName()));
$form->addElement('content_layout/module', null, t('Module'), new Validator_InArray(Module::getModules()));
$form->addElement('content_layout/sector', null, t('Sector'), new Validator_InArray(array_keys($theme->getSectors())));
if ($form->hasInput() && $form->isValid()) {
$fd = $form->getValues('content_layout');
// Attach the new module to the correct sector
try {
$cntrlrId = $layout->addController($fd['sector'], array('mod' => $fd['module']));
if ($layout->save()) {
$this->_event->success(t('Successfully added module'));
return zula_redirect($this->_router->makeUrl('content_layout', 'edit', $layout->getName(), null, array('id' => $cntrlrId)));
} else {
$this->_event->error(t('Unable to save content layout file'));
}
} catch (Theme_SectorNoExist $e) {
$this->_event->error(sprintf(t('Unable to attach module. Sector "%s" does not exist'), $fd['sector']));
}
}
// Assign additional data
$form->assign(array('SECTORS' => $theme->getSectors(), 'LAYOUT' => $layout->getName()));
return $form->getOutput();
}
示例6: indexSection
/**
* Displays all of the other modules that he user has permission to
* as well as putting them into the correct Category. From there you can
* either configure the module or configure the permissions that the
* module provides.
*
* @return string
*/
public function indexSection()
{
$this->setTitle(t('Module Manager'));
$this->setOutputType(self::_OT_CONTENT_INDEX);
// Gather all modules
$categories = array();
foreach (Module::getModules() as $module) {
$aclRule = $module . '_global';
if ($this->_acl->resourceExists($aclRule) && $this->_acl->check($aclRule)) {
$tmpModule = new Module($module);
$details = $tmpModule->getDetails();
// Check which controller the icon/button should link to.
if ($tmpModule->controllerExists('config')) {
$details['cntrlr'] = 'config';
} else {
if ($tmpModule->controllerExists('index')) {
$details['cntrlr'] = 'index';
} else {
continue;
}
}
// Build correct category name
$category = trim($tmpModule->category) ? zula_strtolower($tmpModule->category) : t('Unknown');
$categories[$category][] = $details;
}
}
foreach ($categories as $cat => $mod) {
usort($categories[$cat], array($this, 'sort'));
}
ksort($categories);
// Output main view
$this->_theme->addJsFile('general.js');
$this->addAsset('js/filter.js');
$view = $this->loadView('index/main.html');
$view->assign(array('categories' => $categories));
return $view->getOutput();
}
示例7: indexSection
/**
* Displays all of the modules so that a user can disable or
* enable any of them.
*
* @return string
*/
public function indexSection()
{
$this->setTitle(t('Enable/Disable Modules'));
$this->setOutputType(self::_OT_CONFIG);
$view = $this->loadView('config/main.html');
$view->assign(array('DISABLED' => Module::getDisabledModules(), 'ENABLED' => Module::getModules()));
$view->assignHtml(array('CSRF' => array('ENABLE' => $this->_input->createToken(true), 'DISABLE' => $this->_input->createToken(true))));
return $view->getOutput();
}
示例8: function
/**
* Sample group routing with user check in middleware
*/
Route::group('/admin', function () {
if (!Sentry::check()) {
if (Request::isAjax()) {
Response::headers()->set('Content-Type', 'application/json');
Response::setBody(json_encode(array('success' => false, 'message' => 'Session expired or unauthorized access.', 'code' => 401)));
App::stop();
} else {
$redirect = Request::getResourceUri();
Response::redirect(App::urlFor('login') . '?redirect=' . base64_encode($redirect));
}
}
}, function () use($app) {
/** sample namespaced controller */
Route::get('/', 'Admin\\AdminController:index')->name('admin');
foreach (Module::getModules() as $module) {
$module->registerAdminRoute();
}
});
Route::get('/login', 'Admin\\AdminController:login')->name('login');
Route::get('/logout', 'Admin\\AdminController:logout')->name('logout');
Route::post('/login', 'Admin\\AdminController:doLogin');
/** Route to documentation */
Route::get('/doc(/:page+)', 'DocController:index');
foreach (Module::getModules() as $module) {
$module->registerPublicRoute();
}
/** default routing */
Route::get('/', 'HomeController:welcome');
示例9: zula_make_salt
try {
$salt = zula_make_salt();
$configIni = Registry::get('config_ini');
$configIni->update('hashing/salt', $salt);
if (strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'microsoft-iis/6') === 0) {
$configIni->update('url_router/type', 'standard');
}
$configIni->writeIni();
$config->update('hashing/salt', $salt);
} catch (Exception $e) {
}
$ugm = Registry::get('ugmanager');
$rootDetails = $ugm->getUser(Ugmanager::_ROOT_ID);
$ugm->editUser($rootDetails['id'], array('password' => $rootDetails['password']));
// Install all modules
foreach (Module::getModules(Module::_INSTALLABLE) as $modname) {
$module = new Module($modname);
$module->install();
if ($modname == 'comments') {
$module->setLoadOrder(1);
# Should force it below Shareable by default
} else {
if ($modname == 'contact') {
// Update the contact form email address to that of the first user
try {
Registry::get('sql')->exec('UPDATE {PREFIX}mod_contact
SET email = (SELECT email FROM {PREFIX}users WHERE id = 2)');
} catch (Exception $e) {
}
}
}
示例10: modules
public function modules()
{
self::$navbar[] = '<a href="/admin/modules">Admin Panel</a>';
$oIndex = Admin::getIndexTemplate();
$template = new Template('admin/ui.modules.tpl');
$user_str = '';
$users = User::getUsers();
foreach ($users as $user) {
$user_str .= Userpage::getUserTemplate($user);
}
$group_str = '';
$groups = Group::getGroups();
foreach ($groups as $group) {
$group_str .= Groupage::getGroupTemplate($group);
}
$mod_str = '';
$modules = Module::getModules();
foreach ($modules as $module) {
$mod_str .= Modulepage::getModuleTemplate($module);
}
$template->groups = $group_str;
$template->users = $user_str;
$template->modules = $mod_str;
$oIndex->content = $template->parse();
return $this->render($oIndex->parse());
}
示例11: array
* @project XssRat
* @author owlinrye
* @email blackrat.sec@gmail.com
* An easy Xss framework
*/
require_once "../Path.php";
require_once PHP_BASE_DIR . "/db/MySQL.php";
require_once PHP_BASE_DIR . "/entity/Module.php";
error_reporting(E_ALL ^ E_NOTICE);
header("Content-Type: application/json; charset=UTF-8");
$res = array("result" => false, "data" => "");
$db = new MySQL($log);
$mysqli = $db->openDB();
if ($mysqli !== null) {
$module = new Module($mysqli, $log);
$modules = $module->getModules();
if (count($modules) > 0) {
$mds = array();
foreach ($modules as $md) {
$mds[] = $md->getFields();
}
$res["result"] = true;
$res["data"] = $mds;
} else {
$res["data"] = "No Modules";
}
$db->closeDB();
} else {
$res["data"] = "Connect to Database Error";
}
die(json_encode($res));
示例12: foreach
&tree=new&parent=<?php
echo Funcs::$uri[2];
?>
" class="button button_add-section">Добавить элемент</a>
<?php
}
?>
<?php
if (@array_key_exists('module', $_SESSION['user']['access'])) {
?>
<div class="widget_module-list">
<select id="ModuleList" class="jsSelectStyled" onchange="getModuleItems()">
<option value=""></option>
<?php
foreach (Module::getModules() as $item) {
?>
<option value="<?php
echo $item['id'];
?>
" <?php
if ($module['id'] == $item['id']) {
?>
selected<?php
}
?>
><?php
echo $item['name'];
?>
</option>
<?php
示例13: MySQL
* Created on 2014-4-16
*
* @project XssRat
* @author owlinrye
* @email blackrat.sec@gmail.com
* An easy Xss framework
*/
header("Content-Type: application/json; charset=UTF-8");
error_reporting(E_ALL ^ E_NOTICE);
require_once "../Path.php";
require_once PHP_BASE_DIR . "/db/MySQL.php";
require_once PHP_BASE_DIR . "/entity/Module.php";
require_once PHP_BASE_DIR . "/entity/ModuleCategory.php";
$db = new MySQL($log);
if ($mysqli = $db->openDB()) {
$module = new Module($mysqli, $log);
$mCategory = new ModuleCategory($mysqli, $log);
$array_module = array();
$array_category = array();
$array_module = $module->getModules();
$array_category = $mCategory->getCategorys();
$end_category = end($array_category);
$last_id = $end_category["id"];
foreach ($array_module as $m) {
$last_id++;
$category = array("id" => $last_id, "parent" => $m->category_id, "text" => $m->m_name, "icon" => "glyphicon glyphicon-leaf", "risk" => $m->risk, "m_id" => $m->m_id);
array_push($array_category, $category);
}
echo json_encode($array_category);
$db->closeDB();
}
示例14: User
<?php
require_once __DIR__ . "/autoload/session.autoload.php";
require_once __DIR__ . "/autoload/checkconnected-admin.autoload.php";
require_once __DIR__ . "/class/User.class.php";
require_once __DIR__ . "/class/Module.class.php";
require_once __DIR__ . "/class/Access.class.php";
require_once __DIR__ . "/class/Sound.class.php";
$User = new User();
$Access = new Access();
$Sound = new Sound();
$modules = Module::getModules();
?>
<!DOCTYPE html>
<html>
<head>
<?php
require_once __DIR__ . "/template/headcode.template.php";
?>
<body>
<?php
include __DIR__ . "/template/header.template.php";
?>
<div class="container sub-body">
<div class="controls text-align-center margin-top-1 big-text">
<?php
if (isset($_GET['event'])) {
示例15: actionIndex
/**
* Lists all models.
*/
public function actionIndex($id)
{
$criteria=new CDbCriteria();
$criteria->addCondition('course='.$id);
$dataProvider = new CActiveDataProvider('Module', array(
'criteria' =>$criteria,
'pagination'=>false,
'sort'=>array(
'defaultOrder'=>array(
'order'=>CSort::SORT_ASC,
)
)
));
$dataProvider1 = new CActiveDataProvider('Teacher', array(
));
$canEdit = AccessHelper::isAdmin();
$model = Course::model()->findByPk($id);
$modules = Module::getModules($id);
$teachers = TeacherModule::getCourseTeachers($modules);
// $user = Yii::app()->user->getId();
// if ($user = Teacher::isTeacher($user)) {
// if(Teacher::isTeacherCanEdit($user, $modules)){
// $canEdit = true;
// }
// if(count($modules) <= 3){
// $canEdit = true;
// }
// }
$this->render('index',array(
'model'=>$model,
'modules' => $modules,
'dataProvider' => $dataProvider,
'canEdit' => $canEdit,
'dataProvider1' => $dataProvider1,
'teachers' => $teachers,
));
}