public function assets_addon($arg) { $rb = $this->init_module(Utils_RecordBrowser::module_name(), 'crm_assets', 'crm_assets_addon'); $rb->set_header_properties(array('asset_id' => array('width' => 10), 'category' => array('width' => 10), 'asset_name' => array('width' => 15), 'active' => array('width' => 7), 'general_info' => array('width' => 70))); $rb->set_defaults(array('company' => $arg['id'])); $this->display_module($rb, array(array('company' => array($arg['id'])), array('company' => false, 'active' => true), array('asset_name' => 'ASC')), 'show_data'); }
public function manage_recordset($recordset) { if ($this->is_back()) { return false; } Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href()); $this->pack_module(Utils_RecordBrowser::module_name(), $recordset, 'record_management'); return true; }
public function body($arg = null, $rb = null, $uid = null) { if (isset($arg) && isset($rb)) { $this->group = $rb->tab . '/' . $arg['id']; if (Utils_WatchdogCommon::get_category_id($rb->tab) !== null) { $this->watchdog_category = $rb->tab; $this->watchdog_id = $arg['id']; } $this->set_view_func(array('Utils_RecordBrowserCommon', 'create_default_linked_label'), array($rb->tab, $arg['id'])); } if (!isset($this->group) && !$uid) { trigger_error('Key not given to attachment module', E_USER_ERROR); } $_SESSION['client']['utils_attachment_group'] = $this->group; load_js('modules/Utils/Attachment/attachments.js'); Base_ThemeCommon::load_css('Utils_Attachment', 'browse'); $this->rb = $this->init_module(Utils_RecordBrowser::module_name(), 'utils_attachment', 'utils_attachment'); $defaults = array('permission' => Base_User_SettingsCommon::get('CRM_Common', 'default_record_permission'), 'func' => serialize($this->func), 'args' => serialize($this->args)); $rb_cols = array(); $single_group = is_string($this->group) || count($this->group) == 1; if ($this->force_multiple) { $single_group = false; } if ($single_group) { $group = is_string($this->group) ? $this->group : reset($this->group); $defaults['local'] = $group; } else { // force attached to display $rb_cols['attached_to'] = true; $this->rb->set_button(false); } $this->rb->set_defaults($defaults); $this->rb->set_additional_actions_method(array($this, 'add_actions')); $this->rb->set_header_properties(array('sticky' => array('width' => 1, 'display' => false), 'attached_to' => array('width' => "16em"), 'edited_on' => array('width' => "12em"), 'title' => array('width' => "20em"))); if ($uid) { $this->rb->set_button(false); $this->rb->disable_actions(array('delete')); $this->display_module($this->rb, array(array(':Created_by' => $uid), $rb_cols, array('sticky' => 'DESC', 'edited_on' => 'DESC')), 'show_data'); } else { $crits = array(); if (!is_array($this->group)) { $this->group = array($this->group); } if (isset($_SESSION['attachment_copy']) && count($this->group) == 1 && $_SESSION['attachment_copy']['group'] != $this->group) { $this->rb->new_button(Base_ThemeCommon::get_template_file(Utils_Attachment::module_name(), 'link.png'), __('Paste'), Utils_TooltipCommon::open_tag_attrs($_SESSION['attachment_copy']['text']) . ' ' . $this->create_callback_href(array($this, 'paste'))); } if ($this->group) { $g = array_map(array('DB', 'qstr'), $this->group); $crits['id'] = DB::GetCol('SELECT attachment FROM utils_attachment_local WHERE local IN (' . implode(',', $g) . ')'); } else { $crits['id'] = 0; } $this->display_module($this->rb, array($crits, $rb_cols, array('sticky' => 'DESC', 'edited_on' => 'DESC')), 'show_data'); } }
public function show($tab, $crits = array(), $cols = array(), $order = array(), $filters = array(), $filters_defaults = array(), $path = null) { $rb = $this->init_module(Utils_RecordBrowser::module_name(), $tab, $tab . '_picker'); if ($filters_defaults) { $rb->set_filters_defaults($filters_defaults); } // $rb->adv_search = true; $rb->disable_actions(); $this->display_module($rb, array($crits, $cols, $order, $filters, $path), 'recordpicker_fs'); Base_ActionBarCommon::add('save', __('Commit Selection'), $this->create_callback_href(array($this, 'back'))); Base_ActionBarCommon::add('back', __('Cancel'), $this->create_callback_href(array($this, 'cancel'))); }
public function body($tab, $element, $format = array(), $crits = array(), $cols = array(), $order = array(), $filters = array(), $filters_defaults = array(), $custom_filters = array()) { Module::$disable_confirm_leave = true; $rb = $this->init_module(Utils_RecordBrowser::module_name(), $tab, $tab . '_picker'); $rb->adv_search = true; $rb->set_filters_defaults($filters_defaults); $rb->disable_actions(); foreach ($custom_filters as $field => $arr) { $rb->set_custom_filter($field, $arr); } $this->element = $element; Libs_LeightboxCommon::display('rpicker_leightbox_' . $element, $this->get_html_of_module($rb, array($element, $format, $crits, $cols, $order, $filters), 'recordpicker'), __('Select'), true); Module::$disable_confirm_leave = false; }
public function admin() { if ($this->is_back()) { if ($this->parent->get_type() == 'Base_Admin') { $this->parent->reset(); } else { location(array()); } return; } Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href()); $this->rb = $this->init_module(Utils_RecordBrowser::module_name(), 'data_tax_rates', 'data_tax_rates_module'); $this->display_module($this->rb); }
public function applet($conf, &$opts) { //available applet options: toggle,href,title,go,go_function,go_arguments,go_contruct_arguments $opts['go'] = false; // enable/disable full screen $opts['title'] = $conf['title']; $title = __('Birthdays upcoming in the next: %d days.', array($conf['no_of_days'])); $sort_order = 'ASC'; // initialize the recordset $rb = $this->init_module(Utils_RecordBrowser::module_name(), 'contact', 'contact'); // $conds - parameters for the applet // 1st - table field names, width, truncate // 2nd - criteria (filter) // 3rd - sorting // 4th - function to return tooltip // 5th - limit how many records are returned, null = no limit // 6th - Actions icons - default are view + info (with tooltip) // 1st - table field names $cols = array(array('field' => 'last_name', 'width' => 15), array('field' => 'first_name', 'width' => 15), array('field' => 'birth_date', 'width' => 15)); // 2nd - criteria (filter) if ($conf['no_of_days'] < 0) { $title = __('Birthdays from the last %d days.', array(-$conf['no_of_days'])); $sort_order = 'DESC'; } $dates = array(); $now = strtotime(Base_RegionalSettingsCommon::time2reg(null, false, true, true, false)); foreach (range(0, $conf['no_of_days']) as $day) { $dates[] = date('%%-%m-%d', strtotime("+{$day} days", $now)); } $crits = array("~birth_date" => $dates); if (isset($conf['cont_type']) && $conf['cont_type'] == 'f') { $crits[':Fav'] = true; } // 3rd - sorting $sorting = array('birth_date' => $sort_order); // 4th - function to return tooltip $tooltip = null; // 5th - limit how many records are returned, null = no limit $limit = null; // 6th - Actions icons - default are view + info (with tooltip) $conds = array($cols, $crits, $sorting, $tooltip, $limit, $conf, &$opts); // initialize miniview print $title; $this->display_module($rb, $conds, 'mini_view'); }
public function company_bugtrack_addon($arg) { $rb = $this->init_module(Utils_RecordBrowser::module_name(), 'bugtrack'); $proj = array(array('company_name' => $arg['id']), array('company_name' => false), array('Fav' => 'DESC')); $this->display_module($rb, $proj, 'show_data'); }
/** * Get Utils/RecordBrowser instance for current Recordset. * @param Module $parent_module Parent module used to create Utils/RecordBrowser instance. Usually $this. * @param string $unique_instance_name unique name of Utils/RecordBrowser instance. * @return Utils_RecordBrowser */ public function create_rb_module($parent_module, $unique_instance_name = null) { return $parent_module->init_module(Utils_RecordBrowser::module_name(), $this->tab, $unique_instance_name); }
public static function display_status($record, $nolink, $desc) { $prefix = 'crm_tasks_leightbox'; $v = $record[$desc['id']]; if (!$v) { $v = 0; } $status = Utils_CommonDataCommon::get_translated_array('CRM/Status'); if ($v >= 3 || $nolink) { return $status[$v]; } CRM_FollowupCommon::drawLeightbox($prefix); if (!Utils_RecordBrowserCommon::get_access('task', 'edit', $record) && !Base_AclCommon::i_am_admin()) { return $status[$v]; } if (isset($_REQUEST['form_name']) && $_REQUEST['form_name'] == $prefix . '_follow_up_form' && $_REQUEST['id'] == $record['id']) { unset($_REQUEST['form_name']); $v = $_REQUEST['closecancel']; $action = $_REQUEST['action']; $note = $_REQUEST['note']; if ($note) { if (get_magic_quotes_gpc()) { $note = stripslashes($note); } $note = str_replace("\n", '<br />', $note); Utils_AttachmentCommon::add('task/' . $record['id'], 0, Acl::get_user(), $note); } if ($action == 'set_in_progress') { $v = 1; } Utils_RecordBrowserCommon::update_record('task', $record['id'], array('status' => $v)); if ($action == 'set_in_progress') { location(array()); } $values = $record; $values['date_and_time'] = date('Y-m-d H:i:s'); $values['title'] = __('Follow-up') . ': ' . $values['title']; $values['status'] = 0; if ($action != 'none') { $x = ModuleManager::get_instance('/Base_Box|0'); $values['follow_up'] = array('task', $record['id'], $record['title']); if ($action == 'new_task') { $x->push_main(Utils_RecordBrowser::module_name(), 'view_entry', array('add', null, $values), array('task')); } if ($action == 'new_meeting') { $x->push_main(Utils_RecordBrowser::module_name(), 'view_entry', array('add', null, array('title' => $values['title'], 'permission' => $values['permission'], 'priority' => $values['priority'], 'description' => $values['description'], 'date' => date('Y-m-d'), 'time' => date('H:i:s'), 'duration' => 3600, 'status' => 0, 'employees' => $values['employees'], 'customers' => $values['customers'], 'follow_up' => $values['follow_up'])), array('crm_meeting')); } if ($action == 'new_phonecall') { $x->push_main(Utils_RecordBrowser::module_name(), 'view_entry', array('add', null, array('subject' => $values['title'], 'permission' => $values['permission'], 'priority' => $values['priority'], 'description' => $values['description'], 'date_and_time' => date('Y-m-d H:i:s'), 'employees' => $values['employees'], 'status' => 0, 'customer' => !empty($values['customers']) ? array_pop($values['customers']) : '', 'follow_up' => $values['follow_up'])), array('phonecall')); } return false; } location(array()); } if ($v == 0) { return '<a href="javascript:void(0)" onclick="' . $prefix . '_set_action(\'set_in_progress\');' . $prefix . '_set_id(\'' . $record['id'] . '\');' . $prefix . '_submit_form();">' . $status[$v] . '</a>'; } return '<a href="javascript:void(0)" class="lbOn" rel="' . $prefix . '_followups_leightbox" onMouseDown="' . $prefix . '_set_id(' . $record['id'] . ');">' . $status[$v] . '</a>'; }
public function account_manager($pushed_on_top = false) { if ($pushed_on_top) { if ($this->is_back()) { Base_BoxCommon::pop_main(); return; } Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href()); } else { Base_ActionBarCommon::add('back', __('Back'), $this->create_main_href('Base_User_Settings')); } $this->rb = $this->init_module(Utils_RecordBrowser::module_name(), 'rc_accounts', 'rc_accounts'); $this->rb->set_defaults(array('epesi_user' => Acl::get_user())); $order = array(array('login' => 'DESC'), array('epesi_user' => Acl::get_user()), array('epesi_user' => false)); $this->display_module($this->rb, $order); // other settings $qf = $this->init_module(Libs_QuickForm::module_name()); $qf->addElement('advcheckbox', 'standard_mailto', __("Use standard mailto links"), null, array('onchange' => $qf->get_submit_form_js())); $use_standard_mailto = CRM_RoundcubeCommon::use_standard_mailto(); $qf->setDefaults(array('standard_mailto' => $use_standard_mailto)); if ($qf->validate()) { CRM_RoundcubeCommon::set_standard_mailto($qf->exportValue('standard_mailto')); } $qf->display_as_row(); }
public function admin() { if ($this->is_back()) { $this->parent->reset(); return; } $rb = $this->init_module(Utils_RecordBrowser::module_name(), 'task_related', 'task_related'); $this->display_module($rb); Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href()); }
public function parent_company_addon($arg) { $rb = $this->init_module(Utils_RecordBrowser::module_name(), 'company', 'parent_company_addon'); $rb->set_defaults(array('country' => Base_User_SettingsCommon::get('Base_RegionalSettings', 'default_country'), 'zone' => Base_User_SettingsCommon::get('Base_RegionalSettings', 'default_state'), 'permission' => Base_User_SettingsCommon::get('CRM_Common', 'default_record_permission'), 'parent_company' => $arg['id'])); $this->display_module($rb, array(array('parent_company' => $arg['id']), array(), array('company_name' => 'ASC')), 'show_data'); }
public function new_contact($company) { CRM_ContactsCommon::$paste_or_new = $company; $rb = $this->init_module(Utils_RecordBrowser::module_name(), 'contact', 'contact'); $this->rb = $rb; $this->display_module($rb, array('add', null, array('company_name' => $company, 'country' => Base_User_SettingsCommon::get('Base_RegionalSettings', 'default_country'), 'zone' => Base_User_SettingsCommon::get('Base_RegionalSettings', 'default_state'), 'permission' => '0')), 'view_entry'); $this->set_module_variable('view_or_add', 'add'); }
public static function check_for_jump() { if (isset($_REQUEST['__jump_to_RB_table']) && isset($_REQUEST['__jump_to_RB_record'])) { $tab = $_REQUEST['__jump_to_RB_table']; $id = $_REQUEST['__jump_to_RB_record']; $action = $_REQUEST['__jump_to_RB_action']; if (!is_numeric($id)) { return false; } Utils_RecordBrowserCommon::check_table_name($tab); if (!self::get_access($tab, 'browse')) { return false; } if (!DB::GetOne('SELECT id FROM ' . $tab . '_data_1 WHERE id=%d', $id)) { return false; } unset($_REQUEST['__jump_to_RB_record']); unset($_REQUEST['__jump_to_RB_table']); unset($_REQUEST['__jump_to_RB_action']); $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_RecordBrowser::module_name(), 'view_entry_with_REQUEST', array($action, $id, array(), true, $_REQUEST), array($tab)); return true; } return false; }
public function search_by_id_form($label) { $message = ''; $form = $this->init_module(Libs_QuickForm::module_name()); $theme = $this->init_module(Base_Theme::module_name()); $form->addElement('text', 'record_id', $label); $form->addRule('record_id', __('Must be a number'), 'numeric'); $form->addRule('record_id', __('Field required'), 'required'); $ret = false; if ($form->isSubmitted()) { $ret = true; } if ($form->validate()) { $id = $form->exportValue('record_id'); if (!is_numeric($id)) { trigger_error('Invalid id', E_USER_ERROR); } $r = Utils_RecordBrowserCommon::get_record($this->tab, $id); if (!$r || empty($r)) { $message = __('There is no such record') . '<br>'; } else { if (!$r[':active']) { $message = __('This record was deleted from the system') . '<br>'; } else { $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_RecordBrowser::module_name(), 'view_entry', array('view', $id), array($this->tab)); return; } } } $form->assign_theme('form', $theme); $theme->assign('message', $message); $theme->display('search_by_id'); return $ret; }
<?php /** * @author Arkadiusz Bisaga <*****@*****.**> * @copyright Copyright © 2008, Telaxus LLC * @license Commercial * @version 1.0 * @package epesi-utils * @subpackage recordbrowser */ if (!isset($_POST['tab']) || !isset($_POST['value']) || !isset($_POST['cid'])) { die('Invalid request: ' . print_r($_POST, true)); } define('JS_OUTPUT', 1); define('CID', $_POST['cid']); define('READ_ONLY_SESSION', true); require_once '../../../include.php'; ModuleManager::load_modules(); if (!Acl::is_user()) { die(''); } $tab = json_decode($_POST['tab']); $value = json_decode($_POST['value']); if (!is_numeric($value) || !is_string($tab)) { die('Invalid request'); } Base_User_SettingsCommon::save(Utils_RecordBrowser::module_name(), $tab . '_show_filters', $value);