本文整理汇总了PHP中Module类的典型用法代码示例。如果您正苦于以下问题:PHP Module类的具体用法?PHP Module怎么用?PHP Module使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Module类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getControllerActions
/**
* For listing the Module Role table data
* @author Praveen Singh
* @method getModuleRoleData
* @param $id
* @return one row of Module Role table
* @since version 0.0.1
* @version 0.2.9
*/
function getControllerActions($controllerID)
{
App::import("Model", "Module");
$model = new Module();
$datas = $model->find("all", array('conditions' => array('Module.parent_id' => $controllerID)));
return $datas;
}
示例2: canBeAdded
/**
* @param Module $module
* @return bool
*/
private function canBeAdded($module)
{
if ($module->getDependencies()->count()) {
return $this->areAllAlreadyPresent($module->getDependencies());
}
return true;
}
示例3: getViewHelperConfig
/**
* @test
* @covers Cocur\Slugify\Bridge\ZF2\Module::getViewHelperConfig()
*/
public function getViewHelperConfig()
{
$vhConfig = $this->module->getViewHelperConfig();
$this->assertTrue(is_array($vhConfig));
$this->assertArrayHasKey('factories', $vhConfig);
$this->assertArrayHasKey('slugify', $vhConfig['factories']);
}
示例4: linkmanage_creatNav
function linkmanage_creatNav($nav_name)
{
global $zbp, $sysMenu;
$n = linkmanageGetNav();
if (preg_match("/{$nav_name}/", $sysMenu)) {
$zbp->ShowHint('bad', 'ID与系统导航冲突!请更改');
} elseif (isset($n['data'][$nav_name])) {
$zbp->ShowHint('bad', 'ID已存在!请更改');
} else {
$n['data'][$nav_name] = array('id' => $nav_name, 'name' => GetVars('name', 'POST'), 'location' => '');
$n['num'] = count($n['data']);
$zbp->Config('linkmanage')->Nav = json_encode($n);
$zbp->Config('linkmanage')->{$nav_name} = '{}';
//排序值
$zbp->SaveConfig('linkmanage');
//创建模块
if (!isset($zbp->modulesbyfilename[$nav_name])) {
$t = new Module();
$t->Name = '菜单:' . GetVars('name', 'POST');
$t->FileName = $nav_name;
$t->Source = 'plugin_' . $nav_name;
$t->SidebarID = 0;
$t->Content = '';
$t->HtmlID = $nav_name;
$t->Type = 'ul';
$t->Save();
}
Redirect('main.php?id=' . $nav_name);
}
}
示例5: GetModulesDataArray
public function GetModulesDataArray()
{
$counter = 0;
$modulesData = array();
$database = Mysql::getConnection();
$data = $database->Query("SELECT * FROM " . TABLE_PREFIX . "modules ORDER BY moduleName ASC;");
while ($row = $data->fetch_array()) {
$moduleId = $row["moduleId"];
$module = new Module();
$module->GetInfo($moduleId);
$modulesData[$counter]["moduleId"] = $module->moduleId;
$modulesData[$counter]["moduleName"] = $module->moduleName;
$modulesData[$counter]["moduleVersion"] = $module->moduleVersion;
$modulesData[$counter]["moduleAuthor"] = $module->moduleAuthor;
$modulesData[$counter]["moduleDescription"] = $module->moduleDescription;
$modulesData[$counter]["moduleType"] = $module->moduleType;
$modulesData[$counter]["modulePriority"] = $module->modulePriority;
$modulesData[$counter]["moduleAutoStart"] = $module->moduleAutoStart;
$modulesData[$counter]["moduleStatus"] = $module->moduleStatus;
$modulesData[$counter]["moduleStyles"] = $module->moduleStyles;
$modulesData[$counter]["moduleIcon"] = $module->moduleIcon;
$modulesData[$counter]["moduleAdmin"] = $module->moduleAdmin;
$modulesData[$counter]["moduleAdminMenu"] = $module->moduleAdminMenu;
$counter++;
}
return $modulesData;
}
示例6: __construct
/**
* Constructor. Should not be called directly using new Module('name').
* Use $this->pack_module or $this->init_module (inside other module).
*
* @param string $type Module name with submodule class delimited with hash
* @param Module|null $parent Parent module
* @param mixed $name Unique instance name. If null, then it will be generated
* @param bool $clear_vars Clear module variables
*
* @throws Exception Exception is thrown, when instance id cannot be generated.
*/
public final function __construct($type, $parent, $name, $clear_vars)
{
$submodule_delimiter = strpos($type, '#');
$this->type_with_submodule = $main_module = $type;
if ($submodule_delimiter !== false) {
$main_module = substr($type, 0, $submodule_delimiter);
}
parent::__construct($main_module);
if ($parent) {
$this->parent =& $parent;
if (isset($name)) {
$this->instance = (string) preg_replace('/[^A-Z0-9\\_]+/i', '_', $name);
} else {
$this->instance = $parent->get_new_child_instance_id($this->type_with_submodule);
}
$parent->register_child($this);
} elseif (isset($name)) {
$this->instance = (string) $name;
}
$this->path = null;
if (!isset($this->instance)) {
throw new Exception('No instance name or parent specified.');
}
$this->children_count_display = 0;
if ($clear_vars) {
$this->clear_module_variables();
$this->clear_child_vars = true;
}
}
示例7: getModulesByDirct
public static function getModulesByDirct($type)
{
$_modules = array();
$result = opendir(_TM_MODULES_DIR . $type);
while ($dir = readdir($result)) {
if (Validate::isModuleName($dir) && is_dir(_TM_MODULES_DIR . $type . '/' . $dir)) {
include _TM_MODULES_DIR . $type . '/' . $dir . '/config.php';
if (!($mod = Module::existsModule($dir))) {
$module = new Module();
$module->alias = pSQL($dir);
$module->name = pSQL($_modules[$type][$dir]['name']);
$module->type = pSQL($type);
$module->description = pSQL($_modules[$type][$dir]['description']);
$module->active = 0;
$module->add();
$_modules[$type][$dir]['id'] = $module->id;
} else {
$_modules[$type][$dir]['id'] = $mod['id_module'];
$_modules[$type][$dir]['active'] = $mod['active'];
$_modules[$type][$dir]['type'] = $mod['type'];
}
}
}
return $_modules[$type];
}
示例8: limit
function limit()
{
$CI =& get_instance();
$module = new Module();
$module->get_by_module($CI->router->fetch_class());
return $module->listperpage ? $module->listperpage : 20;
}
示例9: setProjectDefaults
/**
* Sets project defaults such as ACL rules, additional content,
* load order of modules etc.
*
* @return null
*/
protected function setProjectDefaults()
{
$guestInherit = $adminInherit = array('group_root');
foreach ($this->_acl->getRoleTree('group_guest', true) as $role) {
array_unshift($guestInherit, $role['name']);
}
foreach ($this->_acl->getRoleTree('group_admin', true) as $role) {
array_unshift($adminInherit, $role['name']);
}
$aclResources = array('layout_controller_456' => $guestInherit, 'layout_controller_974' => $guestInherit, 'layout_controller_110' => $guestInherit, 'layout_controller_119' => $guestInherit, 'layout_controller_168' => $guestInherit, 'layout_controller_409' => $adminInherit, 'layout_controller_909' => $adminInherit, 'layout_controller_425' => $adminInherit, 'layout_controller_551' => $adminInherit);
foreach ($aclResources as $resource => $roles) {
$this->_acl->allowOnly($resource, $roles);
}
// Setup module load order
if (Module::exists('comments')) {
$comments = new Module('comments');
$comments->setLoadOrder(1);
# Should force it below Shareable by default
}
if (Module::exists('contact')) {
// Set the contact form email to be the same as the initial user
try {
$this->_sql->exec('UPDATE {PREFIX}mod_contact
SET email = (SELECT email FROM {PREFIX}users WHERE id = 2)');
} catch (Exception $e) {
}
}
}
示例10: testgetServiceConfig
/**
* @covers RcmSocialButtons\Module
*/
public function testgetServiceConfig()
{
$config = $this->unit->getServiceConfig();
$sm = $this->getServiceManagerMock($config['factories']);
foreach (array_keys($config['factories']) as &$serviceName) {
$this->assertTrue(get_class($sm->get($serviceName)) == $serviceName);
}
}
示例11: test_end_to_end
function test_end_to_end()
{
$module = new Module('foo');
$record = $module->retrieve('/dummy/test/single');
$this->assertEqual('/dummy/test/single', $record['url']);
$this->assertEqual('single', $record['title']);
$this->assertEqual('dummy', $record['module']->name);
}
示例12: addStudentGroupToNewStudent
private function addStudentGroupToNewStudent($userId)
{
$group = new Module();
$studentGroup = "estudante";
$group->addGroupToUser($studentGroup, $userId);
$guestGroup = "convidado";
$group->deleteGroupOfUser($guestGroup, $userId);
}
示例13: form
function form($id = FALSE)
{
$data['level'] = new Level($id);
$data['level']->auth = json_decode($data['level']->auth);
$modules = new Module();
$data['modules'] = $modules->get();
$this->template->append_metadata(js_checkbox());
$this->template->build('admin/level_form', $data);
}
示例14: index
public function index()
{
$semester = new Semester();
$current_semester = $semester->getCurrentSemester();
$group = new Module();
$edit = $group->checkUserGroup('administrador');
$data = array('current_semester' => $current_semester, 'edit' => $edit);
$this->load->template('settings/index', $data);
}
示例15: factory
public static function factory($id = NULL, $connection = 'default')
{
$module = new Module($connection);
if (NULL === $id) {
return $module;
}
$mod = new Module($connection);
return $mod->load($id);
}