本文整理汇总了PHP中ModuleManager类的典型用法代码示例。如果您正苦于以下问题:PHP ModuleManager类的具体用法?PHP ModuleManager怎么用?PHP ModuleManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModuleManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: instance
public static function instance()
{
if (self::$instance == null) {
self::$instance = new ModuleManager();
}
return self::$instance;
}
示例2: body
public function body()
{
$t = $this->pack_module('Base/Theme');
//caption
$box_module = ModuleManager::get_instance('/Base_Box|0');
if ($box_module) {
$active_module = $box_module->get_main_module();
}
if ($active_module && is_callable(array($active_module, 'caption'))) {
$caption = $active_module->caption();
if (Variable::get('show_module_indicator')) {
$t->assign('text', $caption);
} else {
$t->assign('text', '');
}
$show_caption = Variable::get('show_caption_in_title');
$maintenance_mode = MaintenanceMode::is_on() ? ' (Maintenance mode)' : '';
$base_title = Variable::get('base_page_title') . $maintenance_mode;
if ($show_caption || strlen($base_title) > 0) {
if ($show_caption && strlen($base_title) > 0) {
$caption = $base_title . ' - ' . $caption;
} elseif (strlen($base_title) > 0) {
$caption = $base_title;
}
eval_js('document.title=\'' . addslashes($caption) . '\'');
}
} else {
$t->assign('text', '');
eval_js('document.title=\'' . addslashes(Variable::get('base_page_title')) . '\'');
}
$t->display();
}
示例3: submit_contact
public static function submit_contact($values, $mode)
{
if ($mode == 'display') {
$ret = array();
$in = self::Instance();
$filename = self::get_photo($values['id']);
if ($filename) {
$file = $in->get_data_dir() . $filename;
} else {
$file = Base_ThemeCommon::get_template_file('CRM/Contacts/Photo', 'placeholder.png');
$ret['photo_note'] = __('Click to change');
}
$ret['photo_link'] = Module::create_href(array('upload_new_photo' => $values['id'])) . ' ' . Utils_TooltipCommon::open_tag_attrs(__('Click to change the photo'), false);
$ret['photo_src'] = $file;
} else {
$ret = $values;
}
if (isset($_REQUEST['upload_new_photo']) && $_REQUEST['upload_new_photo'] == $values['id']) {
unset($_REQUEST['upload_new_photo']);
$x = ModuleManager::get_instance('/Base_Box|0');
if (!$x) {
trigger_error('There is no base box module instance', E_USER_ERROR);
}
$x->push_main('CRM/Contacts/Photo', 'body', array($values));
}
return $ret;
}
示例4: mobile_menu
function mobile_menu()
{
$menus = ModuleManager::call_common_methods('mobile_menu');
global $menus_out, $menus_out_tmp;
$menus_out = array();
foreach ($menus as $m => $r) {
if (!is_array($r)) {
continue;
}
foreach ($r as $cap => $met) {
if (is_array($met)) {
if (!isset($met['func'])) {
continue;
}
$method = array($m . 'Common', $met['func']);
$args = isset($met['args']) ? $met['args'] : array();
$weight = isset($met['weight']) ? $met['weight'] : 0;
$color = isset($met['color']) ? $met['color'] : 'white';
} else {
$method = array($m . 'Common', $met);
$args = array();
$weight = 0;
$color = 'white';
}
$menus_out[$cap] = array($method, $args, $weight, $color);
}
}
$menus_out_tmp = $menus_out;
uksort($menus_out, 'sort_menus_cmp');
foreach ($menus_out as $cap => $met) {
print '<a ' . mobile_stack_href($met[0], $met[1], $cap) . ' ' . (IPHONE ? ' class="button ' . $met[3] . '"' : '') . '>' . $cap . '</a>' . (IPHONE ? '' : '<br>');
}
}
示例5: get_installed_applets_html
public static function get_installed_applets_html()
{
$colors = Base_DashboardCommon::get_available_colors();
$app_cap = ModuleManager::call_common_methods('applet_caption');
asort($app_cap);
$app_info = ModuleManager::call_common_methods('applet_info');
$html = '';
foreach ($app_cap as $name => $cap) {
if (!$cap) {
continue;
}
$th = Base_ThemeCommon::init_smarty();
$id = str_replace('_', '-', $name);
if (!isset($app_info[$name])) {
$app_info[$name] = '';
}
$th->assign('content', '<div class="content" style="padding:4px;" id="dashboard_applet_content_' . $id . '">' . $app_info[$name] . '</div>');
$th->assign('handle_class', 'handle');
$th->assign('caption', $cap);
$th->assign('color', $colors[0]['class']);
$remove_button = Base_DashboardCommon::get_remove_applet_button($id, false);
$th->assign('remove', $remove_button);
$th->assign('__link', array('remove' => Base_ThemeCommon::parse_links('remove', $remove_button)));
//print('<xmp>'.self::get_remove_applet_button(null, false).'</xmp><br>');
$th->assign('actions', array());
$th->assign('config_mode', true);
$html .= '<div class="applet" searchkey="' . strtolower($cap ? $cap : $name) . ';' . strtolower($app_info[$name]) . '" id="ab_item_' . 'new_' . $id . '">';
ob_start();
Base_ThemeCommon::display_smarty($th, 'Base_Dashboard', 'default');
$html .= ob_get_clean();
$html .= '</div>';
}
return $html;
}
示例6: format_values
protected function format_values($tab, $record_id)
{
$rb_obj = new RBO_RecordsetAccessor($tab);
$record = $rb_obj->get_record($record_id);
if (!$record) {
return array();
}
$access = Utils_RecordBrowserCommon::get_access($tab, 'view', $record);
if (!$access) {
return array();
}
// use RB object instance for better display callback compatibility
// some of them uses Utils_RecordBrowser::$rb_obj instance
$rb = ModuleManager::new_instance('Utils_RecordBrowser', null, 'rb');
$rb->construct($tab);
$rb->init($tab);
$fields = Utils_RecordBrowserCommon::init($tab);
$printable_data = array();
foreach ($fields as $f) {
if ($access[$f['id']]) {
$printable_data[] = array('label' => _V($f['name']), 'value' => $record->get_val($f['id'], true));
}
}
// fill rows - it's easier here than in template
if ($this->fill_empty_rows()) {
while (count($printable_data) % $this->cols() != 0) {
$printable_data[] = array('label' => '', 'value' => '');
}
}
return $printable_data;
}
示例7: database_initialize
/**
* Perform database initialization.
*
* @param boolean $create_database
* @return boolean
*/
function database_initialize($create_database)
{
global $db, $db_config, $data_path;
$result = false;
$database_exists = false;
$sql_file = 'units/database/init.sql';
$xml_file = $data_path . 'system_init.xml';
if (!file_exists($sql_file) || !file_exists($xml_file)) {
trigger_error('Can not initialize database, missing configuration!', E_USER_ERROR);
return $result;
}
// make a log entry
trigger_error('Initializing database: ' . $db_config['name'], E_USER_NOTICE);
// get initialization SQL
$sql = file_get_contents($sql_file);
// create database if needed
if ($create_database) {
try {
$db->create($db_config['name']);
$db->select($db_config['name']);
$database_exists = true;
} catch (Exception $error) {
$database_exists = false;
}
} else {
$database_exists = true;
}
// create database
if ($database_exists && $db->multi_query($sql)) {
$module_manager = ModuleManager::getInstance();
$module_handler = ModuleHandler::getInstance();
$admin_manager = UserManager::getInstance();
// populate tables
$raw_data = file_get_contents($xml_file);
$data = new XMLParser($raw_data, $xml_file);
$data->parse();
// go over XML file and insert data
foreach ($data->document->tagChildren as $item) {
switch ($item->tagName) {
case 'module':
// insert data
$module_manager->insertData(array('name' => $item->tagAttrs['name'], 'order' => $item->tagAttrs['order'], 'preload' => $item->tagAttrs['preload'] == 'yes' ? 1 : 0, 'active' => 1));
// initialize module
$module = $module_handler->_loadModule($item->tagAttrs['name']);
if (!is_null($module)) {
$module->onInit();
}
break;
case 'user':
$salt = hash('sha256', UserManager::SALT . strval(time()));
$password = hash_hmac('sha256', $item->tagAttrs['password'], $salt);
$admin_manager->insertData(array('username' => $item->tagAttrs['username'], 'password' => $password, 'fullname' => $item->tagAttrs['fullname'], 'level' => $item->tagAttrs['level'], 'verified' => 1, 'salt' => $salt));
break;
}
}
// set result
$result = true;
}
return $result;
}
示例8: body
public function body()
{
ob_start();
//create default module form
print '<div class="title">Select modules to disable</div>';
print 'Selected modules will be marked as not installed but uninstall methods will not be called. Any database tables and other modifications made by modules\' install methods will not be reverted.<br><br>';
print 'To uninstall module please use Modules Administration in Application.';
print '<hr/><br/>';
$form = new HTML_QuickForm('modulesform', 'post', $_SERVER['PHP_SELF'] . '?' . http_build_query($_GET), '', null, true);
$states = array(ModuleManager::MODULE_ENABLED => 'Active', ModuleManager::MODULE_DISABLED => 'Inactive');
$modules = DB::GetAssoc('SELECT * FROM modules ORDER BY state, name');
foreach ($modules as $m) {
$name = $m['name'];
$state = isset($m['state']) ? $m['state'] : ModuleManager::MODULE_ENABLED;
if ($state == ModuleManager::MODULE_NOT_FOUND) {
$state = ModuleManager::MODULE_DISABLED;
}
$form->addElement('select', $name, $name, $states);
$form->setDefaults(array($name => $state));
}
$form->addElement('button', 'submit_button', 'Save', array('class' => 'button', 'onclick' => 'if(confirm("Are you sure?")) document.modulesform.submit();'));
//validation or display
if ($form->validate()) {
//uninstall
$vals = $form->exportValues();
foreach ($vals as $k => $v) {
if (isset($modules[$k]['state']) && $modules[$k]['state'] != $v) {
ModuleManager::set_module_state($k, $v);
}
}
}
$form->display();
return ob_get_clean();
}
示例9: user_settings
public static function user_settings()
{
if (Acl::is_user()) {
$methods = array('none' => __('None'), 'callto' => __('Skype and other "callto" protocol applications')) + ModuleManager::call_common_methods('dialer_description');
return array(__('Dialing') => array(array('name' => 'method', 'label' => __('Dialing Method'), 'type' => 'select', 'values' => $methods, 'default' => 'none')), __('Misc') => array(array('name' => 'default_record_permission', 'label' => __('Default Records Permission'), 'type' => 'select', 'default' => 0, 'values' => Utils_CommonDataCommon::get_translated_array('CRM/Access', false))));
}
return array();
}
示例10: back_to_calendar
public function back_to_calendar()
{
$x = ModuleManager::get_instance('/Base_Box|0');
if (!$x) {
trigger_error('There is no base box module instance', E_USER_ERROR);
}
$x->pop_main();
}
示例11: push_box0
public function push_box0($func, $args, $const_args)
{
$x = ModuleManager::get_instance('/Base_Box|0');
if (!$x) {
trigger_error('There is no base box module instance', E_USER_ERROR);
}
$x->push_main('Utils/Messenger', $func, $args, $const_args);
}
示例12: action
public function action()
{
set_time_limit(0);
Cache::clear();
ModuleManager::create_common_cache();
Base_ThemeCommon::themeup();
return true;
}
示例13: manage_filters
public function manage_filters()
{
$x = ModuleManager::get_instance('/Base_Box|0');
if (!$x) {
trigger_error('There is no base box module instance', E_USER_ERROR);
}
$x->push_main($this->get_type(), 'edit', array(false));
}
示例14: install
public function install()
{
Base_ThemeCommon::install_default_theme($this->get_type());
ModuleManager::include_common($this->get_type(), 0);
Base_PrintCommon::register_document_type(new Base_Print_Document_HTML());
Base_PrintCommon::register_document_type(new Base_Print_Document_PDF());
return true;
}
示例15: getInstance
/**
* Initialising the ModuleManger
*
* The ModuleManager reads the possible Modules from the ModulesDirectory
* @return ModuleManager
*/
public static function getInstance()
{
if (!isset(self::$instance))
{
self::$instance = new ModuleManager();
}
return self::$instance;
}