本文整理汇总了PHP中Module::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::factory方法的具体用法?PHP Module::factory怎么用?PHP Module::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module::factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: frontendInterface
function frontendInterface($params, &$smarty)
{
if (isset($smarty->content[$params['class']])) {
return $smarty->content[$params['class']];
} else {
return Module::factory($params['class'])->getUserInterface($params);
}
}
示例2: moduleversions
function moduleversions()
{
$active = Config::getActiveModules();
$versions = array();
foreach ($active as $module) {
$cur = Module::factory($module['module']);
$versions[] = array('name' => $module['module'], 'version' => $cur->version);
unset($cur);
}
return $versions;
}
示例3: catch
public static function &factory($module, $path)
{
try {
$mod = parent::factory($module, $path);
} catch (Exception $e) {
$opt = PEAR::getStaticProperty('m_office', 'options');
$modopt = $opt['modules'][$module];
$mod = new Office_DbModule($module);
$mod->_path = $path;
$mod->setConfig(array_merge($mod->generateOptions(), $modopt));
$mod->startView();
}
return $mod;
}
示例4: smarty_function_block
function smarty_function_block($params, &$smarty)
{
if ($params['class']) {
$module = Module::factory($params['class']);
$module->smarty->assign('module', $module);
$smarty->assign('blockContent', $module->smarty->fetch($params['template']));
} else {
$smarty->assign('blockContent', $smarty->fetch($params['template']));
}
if ($params['blockid']) {
$smarty->assign('blockID', $params['blockid']);
} else {
$smarty->clear_assign('blockID');
}
return $smarty->fetch('block.tpl');
}
示例5: __construct
public function __construct($id = null, $restriction = false)
{
if (!is_null($id)) {
$this->id = $id;
$sql = 'SELECT menu.*, `modules`.module FROM menu, `modules` where menu.module_id=`modules`.id and menu.id=' . $this->id;
$item = Database::singleton()->query_fetch($sql);
// Create a link using the linkHandler callback.
$this->link = Module::factory($item['module'])->linkHandler($item['link']);
$this->display = $item['display'];
$this->status = $item['status'];
$this->sort = $item['sort'];
$this->parent = $item['parent_id'];
$this->linkType = Module::factory($item['module'])->linkType();
$this->target = $item['target'];
$this->link_id = $item['link'];
$this->module_id = $item['module_id'];
}
}
示例6: factory
public static function factory($id, $page = '', $args = array(), $initialize = true)
{
if (!($module = parent::factory($id, 'web'))) {
return false;
}
$module->init($page, $args);
if ($initialize) {
$module->initialize();
}
return $module;
}
示例7: run
public function run()
{
$this->ajaxAuth = true;
if ($this->getOption('auth')) {
$this->ajaxAuth = false;
$subController = new M_Office_Auth($_REQUEST['database']);
if (!key_exists('adminPrivileges', $_SESSION) || key_exists('logout', $_REQUEST)) {
$this->assign('username', User::getInstance('office')->getProperty('username'));
$this->ajaxAuth = true;
} elseif (!User::getInstance('office')->isLoggedIn()) {
$this->ajaxAuth = false;
} else {
$subController->initOptions();
$this->assign('username', User::getInstance('office')->getProperty('username'));
}
}
$not = Notifier::getInstance();
$not->addListener($this);
if ($this->getOption('auth') && !User::getInstance('office')->isLoggedIn()) {
if (self::isAjaxRequest()) {
$this->assign('__action', 'ajaxlogin');
}
return;
}
if (key_exists('updateSuccess', $_REQUEST)) {
$this->say(__('Record was successfully updated'));
M_Office_Util::clearRequest(array('updateSuccess' => 1));
}
if (isset($_REQUEST['module'])) {
$info = M_Office_Util::getModuleInfo($_REQUEST['module']);
$module = $_REQUEST['module'];
if (!$info) {
if (strpos($_REQUEST['module'], ':')) {
$info = array('type' => 'dyn', 'title' => 'Plugin');
$module = $tab[1];
} elseif (preg_match('`^(.+)helper$`', $_REQUEST['module'], $tab)) {
$info = array('type' => 'dyn', 'title' => __("modules.{$tab[1]}helper.title"));
$module = $_REQUEST['module'];
} else {
throw new NotFoundException(__('error.module_not_found', array($_REQUEST['module'])));
}
}
}
if ($this->isAjaxRequest() && $this->ajaxAuth && $info['type'] != 'dyn') {
$this->output = '';
unset($this->localOutput);
}
if (isset($_REQUEST['debug']) && MODE == 'development') {
$debug = (int) $_REQUEST['debug'] % 3;
DB_DataObject::debugLevel($debug);
ini_set('display_errors', 1);
}
if ($_REQUEST['livesearch']) {
$aj = new M_Office_livesearch($_REQUEST['searchtext'], $_REQUEST['expand']);
$this->output = $aj->processRequest();
return;
} elseif ($_REQUEST['treesort']) {
$aj = new M_Office_treesort();
$this->output = $aj->processRequest();
return;
} elseif ($_REQUEST['liveedit']) {
$aj = new M_Office_liveedit($_REQUEST['liveedit']);
$this->output = $aj->processRequest();
return;
} elseif (key_exists('ajaxfromtable', $_REQUEST)) {
$table = $_REQUEST['module'];
$do = DB_DataObject::factory($table);
$do->get($_REQUEST['filterField'], $_REQUEST['filterValue']);
$aj = new M_Office_ajaxFromTable($do, $_REQUEST['module'], $_REQUEST['module'], $_REQUEST['filterField'], $_REQUEST['filterValue']);
$this->output = $aj->processRequest();
return;
}
if (isset($_REQUEST['module'])) {
if (!$info) {
$info = M_Office_Util::getModuleInfo($_REQUEST['module']);
}
switch ($info['type']) {
case 'db':
// TODO ajouter ce path en avant-dernier et non en dernier
Mreg::get('tpl')->addPath(APP_ROOT . 'app/' . APP_NAME . '/templates/' . $info['table'] . '/', 'after');
Mreg::get('tpl')->addPath(APP_ROOT . 'app/' . APP_NAME . '/templates/' . $_REQUEST['module'] . '/', 'after');
$subController = new M_Office_ShowTable($_REQUEST['module'], $filter);
break;
case 'dyn':
// home module = available for everyone
$allowAccess = $_REQUEST['module'] == 'home' || M_Office_Util::getGlobalOption('view', 'showtable', $_REQUEST['module']);
if (!$allowAccess) {
Log::warn('User is NOT allowed to access ' . $_REQUEST['module']);
M_Office_Util::refresh(M_Office::URL(array(), array_keys($_REQUEST)));
} else {
Log::info('User is allowed to access ' . $_REQUEST['module']);
}
$subController = Module::factory($_REQUEST['module'], M::getPaths('module'));
$subController->executeAction($_REQUEST['action'] ? $_REQUEST['action'] : 'index');
$this->assign('__action', 'dyn');
$layout = $subController->getConfig('layout', $_REQUEST['action'] ? $_REQUEST['action'] : 'index');
if ($layout == '__self') {
M_Office::$dsp = '__defaut/ajaxindex';
} elseif ($layout) {
M_Office::$dsp = $layout;
//.........这里部分代码省略.........
示例8: dirname
<?php
/**
* Content Module AJAX
* @author Christopher Troup <chris@norex.ca>
* @package Modules
* @subpackage Content
* @version 2.0
*/
require dirname(__FILE__) . '/../../include/Site.php';
require_once 'Pager/Pager.php';
$module = Module::factory('Content');
switch ($_REQUEST['section']) {
case 'inactive':
switch (@$_REQUEST['action']) {
case 'deleteRev':
$module->deleteRev($_REQUEST['id']);
break;
case 'setActiveRev':
$module->setActiveRev($_REQUEST['id']);
break;
}
$rows = Database::singleton()->query_fetch_all('select content_page_data.*, locale.display_name as locale from content_page_data, locale
WHERE parent_id=' . $_REQUEST['parent_id'] . ' AND locale.id=content_page_data.locale_id and content_page_data.status=0 order by timestamp desc');
$pager_params = array('mode' => 'Sliding', 'append' => false, 'path' => '', 'fileName' => 'javascript:HTML_AJAX.replace(\'inactive\',\'/modules/Content/AJAX_layers.php?section=inactive&parent_id=' . $_REQUEST['parent_id'] . '&pageID=%d\');', 'perPage' => 5, 'delta' => 5, 'itemData' => $rows);
$pager =& Pager::factory($pager_params);
$data = $pager->getPageData();
$module->smarty->assign('layers', $data);
$module->smarty->assign('pager_links', $pager->links);
$module->smarty->assign('parent_id', $_REQUEST['parent_id']);
$module->smarty->assign('page_numbers', array('current' => $pager->getCurrentPageID(), 'total' => $pager->numPages()));
示例9: setWorldMap
function setWorldMap()
{
$data = $this->currentModule->data->getSourceContinentCountries();
$this->setTitleChapter("provenance_mappemonde");
ob_start();
$moduleGR = Module::factory("view_world_map");
$moduleGR->init($this->currentModule->request, null);
$moduleGR->showAll();
$out1 = ob_get_contents();
ob_end_clean();
$this->Image("ssgraphworldmap.pngpmv", 40, $this->GetY(), 0, 200 / PDF_COEF_MM_PX, "pngpmv", "", $out1);
$this->SetY($this->GetY() + 73);
$this->Image(DIR_IMG_MAPS . "/scale.png", 60, $this->GetY(), 0, 7 / PDF_COEF_MM_PX);
$this->SetY($this->GetY() + 10);
$this->setDisplayDataArray("continent", "provenance_continent", $data);
}
示例10: factory
public static function factory($id, $page='', $args=array()) {
$module = parent::factory($id, 'web');
$module->initialize();
if ($page) {
$module->init($page, $args);
}
return $module;
}
示例11: error_reporting
error_reporting(E_ALL);
/*
* Assess whether we are logging in on this page request.
*/
if (isset($_REQUEST['username']) && isset($_REQUEST['password'])) {
$auth_container = new CMSAuthContainer();
$auth = new Auth($auth_container, null, 'authInlineHTML');
$auth->start();
}
if (@(!isset($_REQUEST['module']))) {
$options = Config::singleton()->options;
$_REQUEST['module'] = 'Content';
$_REQUEST['page'] = $options['defaultPage'];
}
require_once 'HTML/AJAX/Helper.php';
$ajaxHelper = new HTML_AJAX_Helper();
if ($ajaxHelper->isAJAX()) {
echo Module::factory($_REQUEST['module'], $smarty)->getUserInterface($_REQUEST);
} else {
//$smarty->addJS('/AJAX/server.php?client=all');
//$smarty->addJS('/js/login.js');
$smarty->addJS('/js/scriptaculous.js');
$smarty->addJS('/modules/Menu/js/sfMenus.js');
//$smarty->addJS('/js/frontend.js');
$smarty->content[$_REQUEST['module']] = Module::factory($_REQUEST['module'], $smarty)->getUserInterface($_REQUEST);
$smarty->assign('module', $_REQUEST['module']);
if (isset($_SESSION['authenticated_user'])) {
$smarty->assign('user', $_SESSION['authenticated_user']);
}
$smarty->render('db:site.tpl');
}
示例12: factory
/**
* Factory method
* @param string $id the module id to load
* @param string $command the command to execute
* @param array $args an array of arguments
* @return APIModule
*/
public static function factory($id, $command = '', $args = array())
{
if (!($module = parent::factory($id, 'api'))) {
return false;
}
if ($command) {
$module->init($command, $args);
}
return $module;
}
示例13: trim
// set a custom compile id to ensure Smarty doesent accidentally overwrite duplicate compiled files.
$smarty->compile_id = 'admin';
// This is currently a hack since my url-rewriting syntax keeps a trailing slash on the module name
$requestedModule = trim(@$_GET['module'], '/');
// assign the requested module
$smarty->assign('module', $requestedModule);
// render the admin page
require_once 'HTML/AJAX/Helper.php';
$ajaxHelper = new HTML_AJAX_Helper();
if ($ajaxHelper->isAJAX()) {
echo Module::factory($requestedModule, $smarty)->getAdminInterface();
die;
} else {
if (!isset($_REQUEST['module'])) {
$requestedModule = 'Dashboard';
$smarty->assign('module', $requestedModule);
$smarty->assign('module_title', 'Dashboard');
} else {
$smarty->content[$requestedModule] = Module::factory($requestedModule, $smarty)->getAdminInterface();
$smarty->assign('module', $requestedModule);
$sql = 'select display_name from modules where module="' . e($requestedModule) . '"';
$r = Database::singleton()->query_fetch($sql);
$smarty->assign('module_title', $r['display_name']);
}
$smarty->addCSS('/css/facebox.css');
$smarty->addJS('/js/facebox.js');
$smarty->addJS('/js/help.js');
$smarty->addJS('/js/admin.js');
$smarty->render('admin.tpl');
}
}
示例14: loadModule
/**
* Charge le module demand�
*
*/
function loadModule()
{
$moduleName = $this->request->getModuleName();
$db =& Db::getInstance();
if (ereg('admin', $moduleName)) {
$this->lang->reloadLangFile();
}
if (!$moduleName) {
$moduleName = $this->defaultModuleName;
}
if ($moduleName == 'list_logos') {
$authorized = true;
} else {
$b_writeDir = checkDirWritable();
/**
* very first : logo selection is allowed
*/
/**
* first look if installation is needed
*/
if (!is_file(INCLUDE_PATH . "/config/config.php") || !defined('DB_HOST') || !defined('SU_LOGIN') || !defined('INSTALL_OK')) {
if (!Request::isCurrentModuleAnInstallModule()) {
Request::redirectToModule('install_welcome');
}
$authorized = true;
} else {
if (!$db->isReady() && substr_count(Request::getCurrentCompleteUrl(), 'mod=login') === 0 && substr_count(Request::getCurrentCompleteUrl(), 'mod=logout') === 0) {
Request::redirectToModule('admin_db_config');
} else {
if ($b_writeDir === false) {
// case there is a write problem, we load server_info page to indicate the user the problem
$moduleName = 'admin_server_info';
$authorized = true;
} else {
if ($db->isReady()) {
if (version_compare($db->getVersion(), PHPMV_VERSION) == -1) {
$moduleName = 'admin_update';
$authorized = true;
} else {
if (version_compare($db->getVersion(), PHPMV_VERSION) == 1) {
trigger_error("There is a problem : your database is more recent than your phpMyVisites files! Try to upload the last release of phpMyVisites on your server.", E_USER_ERROR);
}
}
}
}
}
}
}
/**
* else it's ok! Load module
*/
// update module in the object request, used for hidden field in the login form
$this->request->setModuleName($moduleName);
// manage the user, is he authorized to see this module ?
$me =& User::getInstance();
if (isset($authorized) || $me->isAuthorized($moduleName) || $this->request->isCrontabAllowed()) {
$module = Module::factory($moduleName);
} else {
$module = Module::factory('login');
}
if (!is_subclass_of($module, 'Module')) {
trigger_error('Unable to load: ' . $moduleName . ' module', E_USER_ERROR);
}
$module->init($this->request, null);
$this->module =& $module;
}
示例15: factory
/**
* Factory method
* @param string $id the module id to load
* @param string $command the command to execute
* @param array $args an array of arguments
* @param KurogoShellDispatcher $dispatcher an object of KurogoShellDispatcher
* @return ShellModule
*/
public static function factory($id, $command = '', $args = array(), $dispatcher = null)
{
if (!($module = parent::factory($id, 'shell'))) {
return false;
}
if ($command) {
$module->setDispatcher($dispatcher);
$module->init($command, $args);
}
return $module;
}