本文整理汇总了PHP中ModuleManager::get_instance方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleManager::get_instance方法的具体用法?PHP ModuleManager::get_instance怎么用?PHP ModuleManager::get_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModuleManager
的用法示例。
在下文中一共展示了ModuleManager::get_instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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;
}
示例3: 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();
}
示例4: 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));
}
示例5: 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);
}
示例6: this_stack
public function this_stack()
{
$x = ModuleManager::get_instance('/Base_Box|0');
if (!$x) {
trigger_error('There is no base box module instance', E_USER_ERROR);
}
$x->push_main('Tests/Callbacks', 'body');
return true;
}
示例7: fax_file
public static function fax_file($f, $oryg)
{
$tmp = self::Instance()->get_data_dir() . $oryg;
copy($f, $tmp);
$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_Fax', 'send', $tmp);
}
示例8: view_event
public static function view_event($func, $def)
{
$x = ModuleManager::get_instance('/Base_Box|0');
if (!$x) {
trigger_error('There is no base box module instance', E_USER_ERROR);
}
if ($func == 'add') {
$def = array(date('Y-m-d H:i:s'), false, $def);
}
$x->push_main('CRM_Calendar_Event', $func, $def);
}
示例9: body
public function body($record)
{
$form = $this->init_module('Utils/FileUpload', array(false));
$form->addElement('header', 'upload', __('Upload new photo') . ': ' . $record['last_name'] . ' ' . $record['first_name']);
$form->set_upload_button_caption(__('Save'));
$form->add_upload_element();
Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
if (CRM_Contacts_PhotoCommon::get_photo($record['id'])) {
Base_ActionBarCommon::add('delete', __('Clear'), $this->create_confirm_callback_href(__('Are you sure?'), array($this, 'clear_photo'), array($record['id'])));
}
$this->display_module($form, array(array($this, 'submit_attach'), $record));
if ($this->is_back() || $this->submitted) {
$x = ModuleManager::get_instance('/Base_Box|0');
if (!$x) {
trigger_error('There is no base box module instance', E_USER_ERROR);
}
return $x->pop_main();
}
}
示例10: body
public function body()
{
/* Do not delete anything - all messages are kept in history
// to allow delete by admin uncomment below lines
// if i am admin add "clear shoutbox" actionbar button
if(Base_AclCommon::i_am_admin())
Base_ActionBarCommon::add('delete',__('Clear shoutbox'),$this->create_callback_href(array($this,'delete_all')));
*/
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
if ($this->is_back()) {
$x = ModuleManager::get_instance('/Base_Box|0');
if (!$x) {
trigger_error('There is no base box module instance', E_USER_ERROR);
}
$x->pop_main();
return;
}
$tb = $this->init_module(Utils_TabbedBrowser::module_name());
$tb->set_tab(__('Chat'), array($this, 'chat'), true, null);
$tb->set_tab(__('History'), array($this, 'history'), null);
$this->display_module($tb);
}
示例11: body
public function body($branch = null, $admin_settings = false)
{
$branch = $this->get_module_variable_or_unique_href_variable('settings_branch', $branch);
if ($branch !== null && $this->is_back()) {
$branch = null;
}
if ($branch === null) {
if ($this->is_back()) {
if ($this->parent->get_type() == 'Base_Admin') {
$this->parent->reset();
} else {
location(array());
}
return;
}
if ($this->parent->get_type() == 'Base_Admin') {
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
}
}
$this->set_module_variable('settings_branch', $branch);
$this->get_module_variable('admin_settings', $admin_settings);
if (!$branch) {
$x = ModuleManager::get_instance('/Base_Box|0');
if (!$x) {
trigger_error('There is no base box module instance', E_USER_ERROR);
}
$mains = $x->get_module_variable('main');
if (count($mains) > 1) {
$x->pop_main();
} else {
$this->main_page();
}
return;
}
$f = $this->init_module('Libs/QuickForm', __('Saving settings'), 'settings');
$f->addElement('header', null, $branch);
$this->indicator = ': ' . $branch;
$this->settings_fields = array();
$this->set_default_js = '';
$us = ModuleManager::call_common_methods('user_settings');
foreach ($us as $name => $menu) {
if (!is_array($menu)) {
continue;
}
foreach ($menu as $k => $v) {
if ($k == $branch) {
if (is_string($v)) {
Base_BoxCommon::location($name, $v);
} else {
$this->add_module_settings_to_form($v, $f, $name);
}
}
}
}
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
Base_ActionBarCommon::add('save', __('Save'), $f->get_submit_form_href());
Base_ActionBarCommon::add('settings', __('Restore Defaults'), 'href="javascript:void(0)" onClick="' . $this->set_default_js . '"');
if ($f->validate()) {
$this->submit_settings($f->exportValues());
$this->set_back_location();
} else {
$f->display();
}
return;
}
示例12: _base_box_instance
private static function _base_box_instance()
{
$x = ModuleManager::get_instance('/Base_Box|0');
if (!$x) {
trigger_error('There is no base box module instance', E_USER_ERROR);
}
return $x;
}
示例13: edit_user_form
public function edit_user_form($edit_id)
{
if ($this->is_back()) {
if ($this->parent->get_type() != 'Base_Admin') {
$x = ModuleManager::get_instance('/Base_Box|0');
if (!$x) {
trigger_error('There is no base box module instance', E_USER_ERROR);
}
$x->pop_main();
}
return false;
}
$form = $this->init_module(Libs_QuickForm::module_name(), $edit_id >= 0 ? __('Applying changes') : __('Creating new user'));
//create new user
$form->addElement('header', null, $edit_id >= 0 ? __('Edit user') : __('Create new user'));
$form->addElement('hidden', $this->create_unique_key('edit_user'), $edit_id);
$form->addElement('text', 'username', __('Username'));
// require a username
$form->addRule('username', __('A username must be between 3 and 32 chars'), 'rangelength', array(3, 32));
$form->addRule('username', __('Field required'), 'required');
$form->addElement('text', 'mail', __('E-mail'));
$form->addRule('mail', __('Field required'), 'required');
$form->addRule('mail', __('Invalid e-mail address'), 'email');
$form->addElement('select', 'admin', __('Administrator'), array(0 => __('No'), 1 => __('Administrator'), 2 => __('Super Administrator')));
if ($edit_id < 0) {
$form->addElement('html', '<tr><td colspan=2><b>' . __('If you leave password fields empty random password is automatically generated and e-mailed to the user.') . '</b></td></tr>');
} else {
$form->addElement('html', '<tr><td colspan=2><b>' . __('If you leave password fields empty, password is not changed.') . '</b></td></tr>');
}
//$form->addElement('header',null,__('If you leave this fields empty, password is not changed.'));
$form->addElement('password', 'pass', __('Password'));
$form->addElement('password', 'pass_c', __('Confirm Password'));
$form->addRule(array('pass', 'pass_c'), __('Passwords don\'t match'), 'compare');
$form->addRule('pass', __('Your password must be longer then 5 chars'), 'minlength', 5);
if ($edit_id >= 0) {
$form->addElement('select', 'active', __('Active'), array(1 => __('Yes'), 0 => __('No')));
//set defaults
$ret = DB::Execute('SELECT u.login, p.mail, u.active, u.admin FROM user_login u INNER JOIN user_password p ON (p.user_login_id=u.id) WHERE u.id=%d', $edit_id);
if ($ret && ($row = $ret->FetchRow())) {
$form->setDefaults(array('username' => $row['login'], 'mail' => $row['mail'], 'active' => $row['active'], 'admin' => $row['admin']));
}
}
$form->registerRule('check_username', 'callback', 'check_username_free', 'Base_User_LoginCommon');
$form->addRule(array('username', $this->create_unique_key('edit_user')), __('Username already taken'), 'check_username');
if ($form->validate()) {
if ($form->process(array(&$this, 'submit_edit_user_form'))) {
if ($this->parent->get_type() != 'Base_Admin') {
$x = ModuleManager::get_instance('/Base_Box|0');
if (!$x) {
trigger_error('There is no base box module instance', E_USER_ERROR);
}
$x->pop_main();
}
return false;
}
} else {
$form->display();
}
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
if (Base_AclCommon::i_am_sa() && $edit_id >= 0) {
Base_ActionBarCommon::add('settings', __('Log as user'), $this->create_callback_href(array($this, 'log_as_user'), $edit_id));
}
return true;
}
示例14: company_addon_new_contact
public function company_addon_new_contact($id)
{
$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', 'new_contact', $id, array());
return false;
}
示例15: file_history
public function file_history($attachment)
{
if ($this->is_back()) {
$x = ModuleManager::get_instance('/Base_Box|0');
if (!$x) {
trigger_error('There is no base box module instance', E_USER_ERROR);
}
return $x->pop_main();
}
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
$id = $attachment['id'];
$tb =& $this->init_module(Utils_TabbedBrowser::module_name());
$tb->start_tab('File history');
$gb = $this->init_module(Utils_GenericBrowser::module_name(), null, 'hua' . $id);
$gb->set_inline_display();
$gb->set_table_columns(array(array('name' => __('Deleted'), 'order' => 'deleted', 'width' => 10), array('name' => __('Date'), 'order' => 'upload_on', 'width' => 25), array('name' => __('Who'), 'order' => 'upload_by', 'width' => 25), array('name' => __('Attachment'), 'order' => 'uaf.original')));
$gb->set_default_order(array(__('Date') => 'DESC'));
$ret = $gb->query_order_limit('SELECT uaf.id,uaf.deleted,uaf.filestorage_id,uaf.created_on as upload_on,uaf.created_by as upload_by,uaf.original FROM utils_attachment_file uaf WHERE uaf.attach_id=' . $id, 'SELECT count(*) FROM utils_attachment_file uaf WHERE uaf.attach_id=' . $id);
while ($row = $ret->FetchRow()) {
$r = $gb->get_new_row();
if ($row['deleted']) {
$r->add_action($this->create_confirm_callback_href(__('Are you sure you want to restore attached file?'), array($this, 'restore_file'), array($row['id'])), 'restore', __('Restore'));
}
$view_link = '';
$lb = array();
$lb['aid'] = $id;
$lb['crypted'] = $attachment['crypted'];
$lb['original'] = $row['original'];
$lb['id'] = $row['id'];
$lb['filestorage_id'] = $row['filestorage_id'];
$file = '<a ' . Utils_AttachmentCommon::get_file_leightbox($lb, $view_link) . '>' . $row['original'] . '</a>';
$r->add_data($row['deleted'] ? __('Yes') : __('No'), Base_RegionalSettingsCommon::time2reg($row['upload_on']), Base_UserCommon::get_user_label($row['upload_by']), $file);
}
$this->display_module($gb);
$tb->end_tab();
$tb->start_tab('File access history');
$gb = $this->init_module(Utils_GenericBrowser::module_name(), null, 'hda' . $id);
$gb->set_inline_display();
$gb->set_table_columns(array(array('name' => __('Create date'), 'order' => 'created_on', 'width' => 15), array('name' => __('Download date'), 'order' => 'download_on', 'width' => 15), array('name' => __('Who'), 'order' => 'created_by', 'width' => 15), array('name' => __('IP Address'), 'order' => 'ip_address', 'width' => 15), array('name' => __('Host Name'), 'order' => 'host_name', 'width' => 15), array('name' => __('Method description'), 'order' => 'description', 'width' => 20), array('name' => __('Remote'), 'order' => 'remote', 'width' => 10)));
$gb->set_default_order(array(__('Create date') => 'DESC'));
$query = 'SELECT uad.created_on,uad.download_on,(SELECT l.login FROM user_login l WHERE uad.created_by=l.id) as created_by,uad.remote,uad.ip_address,uad.host_name,uad.description FROM utils_attachment_download uad INNER JOIN utils_attachment_file uaf ON uaf.id=uad.attach_file_id WHERE uaf.attach_id=' . $id;
$query_qty = 'SELECT count(*) FROM utils_attachment_download uad INNER JOIN utils_attachment_file uaf ON uaf.id=uad.attach_file_id WHERE uaf.attach_id=' . $id;
if (Base_AclCommon::check_permission('Attachments - view full download history')) {
$ret = $gb->query_order_limit($query, $query_qty);
} else {
print 'You are allowed to see your own downloads only';
$who = ' AND uad.created_by=' . Acl::get_user();
$ret = $gb->query_order_limit($query . $who, $query_qty . $who);
}
while ($row = $ret->FetchRow()) {
$r = $gb->get_new_row();
$r->add_data(Base_RegionalSettingsCommon::time2reg($row['created_on']), $row['remote'] != 1 ? Base_RegionalSettingsCommon::time2reg($row['download_on']) : '', $row['created_by'], $row['ip_address'], $row['host_name'], $row['description'], $row['remote'] == 0 ? 'no' : 'yes');
}
$this->display_module($gb);
$tb->end_tab();
$this->display_module($tb);
$this->caption = 'Note history';
return true;
}