コード例 #1
0
ファイル: MonthView_0.php プロジェクト: 62BRAINS/EPESI
 public function applet($conf, &$opts)
 {
     $opts['go'] = false;
     $this->date = $this->get_module_variable_or_unique_href_variable('date');
     if ($this->date == null) {
         $this->date = date('Y-m-15');
     }
     $this->set_module_variable('date', $this->date);
     $this->date = strtotime($this->date);
     $theme = $this->pack_module('Base/Theme');
     $theme->assign('nextyear_href', $this->create_unique_href(array('date' => date('Y-m-15', $this->date + 30 * 24 * 60 * 60))));
     $theme->assign('today_href', $this->create_unique_href(array('date' => date('Y-m-d'))));
     $theme->assign('prevyear_href', $this->create_unique_href(array('date' => date('Y-m-15', $this->date - 30 * 24 * 60 * 60))));
     $link_text = $this->create_unique_href_js(array('date' => '__YEAR__-__MONTH__-__DAY__'));
     $theme->assign('popup_calendar', Utils_PopupCalendarCommon::show('week_selector', $link_text, 'month', null, null, ''));
     $day_headers = array();
     $day = strtotime('Sun');
     $day = strtotime('+' . Utils_PopupCalendarCommon::get_first_day_of_week() . ' days', $day);
     for ($i = 0; $i < 7; $i++) {
         $day_headers[] = __date('D', $day);
         $day = strtotime('+1 day', $day);
     }
     $year = array();
     $me = CRM_ContactsCommon::get_my_record();
     CRM_Calendar_EventCommon::$filter = '(' . $me['id'] . ')';
     $ret = call_user_func(array('CRM_Calendar_EventCommon', 'get_event_days'), date('Y-m-01', $this->date), date('Y-m-d', strtotime(date('Y-m-t', $this->date)) + 86400));
     $month = $this->month_array($this->date, $ret);
     $year[] = array('month' => $month, 'month_link' => Base_BoxCommon::create_href($this, 'CRM_Calendar', null, null, null, array('jump_to_date' => $this->date, 'switch_to_tab' => 'Month')), 'month_label' => __date('F', $this->date), 'year_label' => date('Y', $this->date));
     $theme->assign('year', $year);
     $theme->assign('day_headers', $day_headers);
     $theme->display('year');
 }
コード例 #2
0
ファイル: AccountManager_0.php プロジェクト: cretzu89/EPESI
 public function browse_mode_details($form, $filters, $vals, $crits, $rb_obj)
 {
     $me = CRM_ContactsCommon::get_my_record();
     $rb_obj->custom_defaults['account_manager'] = $me['id'];
     if (!$this->isset_module_variable('def_filter') && Base_User_SettingsCommon::get('CRM_Contacts_AccountManager', 'set_default')) {
         $form->setDefaults(array('filter__account_manager' => '__PERSPECTIVE__'));
         $this->set_module_variable('def_filter', true);
     }
 }
コード例 #3
0
ファイル: Mail_0.php プロジェクト: cretzu89/EPESI
 /**
  * For internal use only.
  */
 public function admin()
 {
     if ($this->is_back()) {
         $this->parent->reset();
         return;
     }
     $form = $this->init_module(Libs_QuickForm::module_name());
     //defaults
     $defaults = array();
     $defaults['mail_method'] = Variable::get('mail_method');
     $defaults['mail_use_replyto'] = Variable::get('mail_use_replyto');
     $defaults['mail_user'] = Variable::get('mail_user');
     $defaults['mail_from_addr'] = Variable::get('mail_from_addr');
     $defaults['mail_from_name'] = Variable::get('mail_from_name');
     $defaults['mail_host'] = Variable::get('mail_host');
     $defaults['mail_security'] = Variable::get('mail_security', false);
     $defaults['mail_auth'] = Variable::get('mail_auth');
     $defaults['mail_password'] = Variable::get('mail_password');
     $form->setDefaults($defaults);
     //form
     $form->addElement('header', null, __('Mail settings'));
     $form->addElement('select', 'mail_method', __('Choose method'), array('smtp' => __('remote smtp server'), 'mail' => __('local php.ini settings')), 'onChange="' . $form->get_submit_form_js(false) . '"');
     $form->addElement('text', 'mail_from_addr', __('Administrator e-mail address'));
     $form->addRule('mail_from_addr', __('Invalid e-mail address'), 'email');
     $form->addRule('mail_from_addr', __('Field required'), 'required');
     $form->addElement('text', 'mail_from_name', __('Send e-mails from name'));
     $form->addElement('text', 'mail_use_replyto', __('Set "Reply-To" email address'));
     $form->addRule('mail_use_replyto', __('Invalid e-mail address'), 'email');
     $method = $form->getElement('mail_method')->getSelected();
     if ($method[0] == 'smtp') {
         $form->addElement('text', 'mail_host', __('SMTP host address'));
         $form->addRule('mail_host', __('Field required'), 'required');
         $form->addElement('select', 'mail_security', __('Security'), array('' => __('None'), 'ssl' => 'SSL', 'ssl_ssc' => 'SSL (self signed certificate)', 'tls' => 'TLS', 'tls_ssc' => 'TLS (self signed certificate)'));
         $form->addElement('checkbox', 'mail_auth', __('SMTP authorization'), '', 'onChange="' . $form->get_submit_form_js(false) . '"');
         $auth = $form->getElement('mail_auth')->getValue();
         if ($auth) {
             $form->addElement('text', 'mail_user', __('Login'));
             $form->addElement('password', 'mail_password', __('Password'));
         }
     }
     Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
     if (ModuleManager::is_installed('CRM_Contacts') >= 0) {
         $me = CRM_ContactsCommon::get_my_record();
         $email = $me['email'];
         Base_ActionBarCommon::add('search', __('Test'), $this->create_callback_href(array($this, 'test_mail_config'), array($email)), __('E-mail will be sent to %s to test the configuration', array('<b>' . $email . '</b>')));
     }
     if ($form->getSubmitValue('submited') && $form->validate() && $form->process(array(&$this, 'submit_admin'))) {
         Base_StatusBarCommon::message(__('Settings saved'));
     }
     $form->display();
 }
コード例 #4
0
 public static function has_access_to_report($contact_record = null)
 {
     $has_permission = Base_AclCommon::check_permission('View Activity Report');
     if ($contact_record === null && $has_permission) {
         return true;
     }
     if (isset($contact_record['login']) && $contact_record['login']) {
         if ($has_permission) {
             return true;
         }
         $id = isset($contact_record['id']) ? $contact_record['id'] : false;
         if (!$id) {
             return false;
         }
         $my_record = CRM_ContactsCommon::get_my_record();
         return $id == $my_record['id'];
     }
 }
コード例 #5
0
ファイル: Birthdays_0.php プロジェクト: 62BRAINS/EPESI
 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'];
     // initialize the recordset
     $rb = $this->init_module('Utils/RecordBrowser', 'contact', 'contact');
     $me = CRM_ContactsCommon::get_my_record();
     // $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)
     // TO DO - filter date - today through today+2 weeks
     $dates = array();
     for ($i = 0; $i < $conf['no_of_days']; $i++) {
         $dates[] = DB::Concat(DB::qstr('%'), DB::qstr(date('-m-d', strtotime(Base_RegionalSettingsCommon::time2reg(strtotime('+' . $i . ' days'), false, true, true, false)))));
     }
     if (isset($conf['cont_type']) && $conf['cont_type'] == 'f') {
         $crits = array(':Fav' => true, '"~birth_date' => $dates);
     } else {
         $crits = array('"~birth_date' => $dates);
     }
     // 3rd - sorting
     $sorting = array('last_name' => 'ASC');
     // 4th - function to return tooltip
     $tooltip = 'test';
     // 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 __('Birthdays upcoming in the next: %d days.', array($conf['no_of_days']));
     $this->display_module($rb, $conds, 'mini_view');
 }
コード例 #6
0
ファイル: TasksCommon_0.php プロジェクト: 62BRAINS/EPESI
 public static function crm_new_event($timestamp, $timeless, $id, $object, $cal_obj)
 {
     $x = ModuleManager::get_instance('/Base_Box|0');
     if (!$x) {
         trigger_error('There is no base box module instance', E_USER_ERROR);
     }
     $me = CRM_ContactsCommon::get_my_record();
     $defaults = array('employees' => $me['id'], 'priority' => CRM_CommonCommon::get_default_priority(), 'permission' => 0, 'status' => 0);
     $defaults['deadline'] = date('Y-m-d', $timestamp);
     if ($object) {
         $defaults['employees'] = $object;
     }
     $x->push_main('Utils_RecordBrowser', 'view_entry', array('add', null, $defaults), 'task');
 }
コード例 #7
0
ファイル: PhoneCall_0.php プロジェクト: 62BRAINS/EPESI
 public function addon($r, $rb_parent)
 {
     $rb = $this->init_module('Utils/RecordBrowser', 'phonecall');
     $params = array(array('related' => $rb_parent->tab . '/' . $r['id']), array('related' => false), array('date_and_time' => 'DESC'));
     //look for customers
     $customers = array();
     if (isset($r['customers'])) {
         $customers = $r['customers'];
     } elseif (isset($r['customer'])) {
         $customers = $r['customer'];
     }
     if (!is_array($customers)) {
         $customers = array($customers);
     }
     foreach ($customers as $i => &$customer) {
         if (preg_match('/^(C\\:|company\\/)([0-9]+)$/', $customer, $req)) {
             $customer = $req[2];
         } elseif (is_numeric($customer)) {
             $customer = $customer;
         } else {
             unset($customers[$i]);
         }
     }
     $me = CRM_ContactsCommon::get_my_record();
     $rb->set_defaults(array('related' => $rb_parent->tab . '/' . $r['id'], 'employees' => array($me['id']), 'status' => 0, 'permission' => 0, 'priority' => CRM_CommonCommon::get_default_priority(), 'date_and_time' => date('Y-m-d H:i:s'), 'customer' => array_shift($customers)));
     $this->display_module($rb, $params, 'show_data');
 }
コード例 #8
0
ファイル: MeetingCommon_0.php プロジェクト: 62BRAINS/EPESI
 public static function mobile_meetings()
 {
     $me = CRM_ContactsCommon::get_my_record();
     $defaults = array('employees' => array($me['id']), 'status' => 0, 'permission' => 0, 'priority' => CRM_CommonCommon::get_default_priority());
     Utils_RecordBrowserCommon::mobile_rb('crm_meeting', array('employees' => array($me['id'])), array('date' => 'ASC', 'time' => 'ASC', 'priority' => 'DESC', 'title' => 'ASC'), array('date' => 1, 'time' => 1, 'priority' => 1, 'longterm' => 1), $defaults);
 }
コード例 #9
0
ファイル: RecordPrinter.php プロジェクト: cretzu89/EPESI
 public function sample_data()
 {
     $ret = array();
     $me = CRM_ContactsCommon::get_my_record();
     if ($me) {
         $ret[] = array('tab' => 'contact', 'record_id' => $me['id']);
         if ($me['company_name']) {
             $ret[] = array('tab' => 'company', 'record_id' => $me['company_name']);
         }
     }
     return $ret;
 }
コード例 #10
0
ファイル: EpesiStoreCommon_0.php プロジェクト: cretzu89/EPESI
 public static function user_settings()
 {
     if (!Base_EpesiStoreCommon::admin_access()) {
         return array();
     }
     set_time_limit(0);
     // get default data from user contact
     $my_contact = ModuleManager::is_installed('CRM_Contacts') > -1 ? CRM_ContactsCommon::get_my_record() : array();
     // key = field name from contact => value = field name in settings
     $keys = self::get_payment_data_keys();
     $values = array();
     // do user setting entries from data
     foreach ($keys as $k => $v) {
         $x = array('name' => $v, 'label' => _V(ucwords(str_replace('_', ' ', $v))), 'type' => 'text', 'default' => isset($my_contact[$k]) ? $my_contact[$k] : '');
         if ($k == 'country') {
             $x['type'] = 'select';
             $x['values'] = Utils_CommonDataCommon::get_translated_array('Countries');
         }
         $values[] = $x;
     }
     return array(__('EPESI Store') => array_merge(array(array('name' => 'payments_header', 'label' => '', 'type' => 'header', 'default' => __('Payment credentials'))), $values));
 }
コード例 #11
0
ファイル: Calendar_0.php プロジェクト: cretzu89/EPESI
 public function body($args = array())
 {
     $ev_mod = $this->init_module(CRM_Calendar_Event::module_name());
     $ev_mod->help('Calendar Help', 'main');
     if (isset($_REQUEST['search_date']) && is_numeric($_REQUEST['search_date']) && isset($_REQUEST['ev_id']) && is_numeric($_REQUEST['ev_id'])) {
         $default_date = intval($_REQUEST['search_date']);
         $this->view_event(intval($_REQUEST['ev_id']));
     } else {
         $default_date = null;
     }
     $handlers = DB::GetAll('SELECT id, group_name, handler_callback FROM crm_calendar_custom_events_handlers');
     $this->lp = $this->init_module('Utils_LeightboxPrompt');
     $count = 0;
     foreach ($handlers as $v) {
         $callback = explode('::', $v['handler_callback']);
         if (!is_callable($callback)) {
             continue;
         }
         $new_events = call_user_func($callback, 'new_event_types');
         if ($new_events !== null) {
             foreach ($new_events as $k => $w) {
                 if (!is_array($w)) {
                     $w = array('label' => $w, 'icon' => null);
                 }
                 $this->lp->add_option('new_event__' . $v['id'] . '__' . $k, $w['label'], $w['icon'], null);
                 $count++;
             }
         }
     }
     if ($count < 2) {
         $this->lp = null;
     } else {
         $this->display_module($this->lp, array(__('New Event'), array('timestamp', 'timeless'), '', false));
         $vals = $this->lp->export_values();
         if ($vals) {
             $this->jump_to_new_event($vals['option'], $vals['params']['timestamp'], $vals['params']['timeless']);
             return;
         }
     }
     CRM_Calendar_EventCommon::$filter = CRM_FiltersCommon::get();
     $args_defaults = array('default_view' => Base_User_SettingsCommon::get('CRM_Calendar', 'default_view'), 'first_day_of_week' => Utils_PopupCalendarCommon::get_first_day_of_week(), 'start_day' => Base_User_SettingsCommon::get('CRM_Calendar', 'start_day'), 'end_day' => Base_User_SettingsCommon::get('CRM_Calendar', 'end_day'), 'interval' => Base_User_SettingsCommon::get('CRM_Calendar', 'interval'), 'default_date' => $default_date, 'custom_agenda_cols' => array(array('name' => __('Type'), 'order' => 'cus_col_0', 'width' => 6, 'wrapmode' => 'nowrap'), __('Description'), __('Assigned to'), __('Related with')));
     foreach ($args_defaults as $k => $v) {
         if (!isset($args[$k])) {
             $args[$k] = $args_defaults[$k];
         }
     }
     if (isset($_REQUEST['jump_to_date']) && is_numeric($_REQUEST['jump_to_date']) && isset($_REQUEST['switch_to_tab']) && is_string($_REQUEST['switch_to_tab'])) {
         $args['default_date'] = $_REQUEST['jump_to_date'];
         $args['default_view'] = $_REQUEST['switch_to_tab'];
     }
     $theme = $this->init_module(Base_Theme::module_name());
     $c = $this->init_module(Utils_Calendar::module_name(), array(CRM_Calendar_Event::module_name(), $args, array($this, 'get_new_event_href_js')));
     $view_type = $c->get_current_view();
     CRM_CalendarCommon::$mode = $view_type;
     $theme->assign('calendar', $this->get_html_of_module($c));
     $theme->display();
     $events = $c->get_displayed_events();
     if (!empty($events['events'])) {
         switch ($view_type) {
             case 'Day':
                 $view = __('Daily agenda');
                 break;
             case 'Month':
                 $view = __('Monthly agenda');
                 break;
             case 'Week':
                 $view = __('Weekly agenda');
                 break;
             case 'Agenda':
                 $view = __('Agenda');
                 break;
         }
         if (isset($view)) {
             $pdf = $this->pack_module(Libs_TCPDF::module_name(), null, null, 'L');
             if ($pdf->prepare()) {
                 set_time_limit(0);
                 $start = date('d F Y', Base_RegionalSettingsCommon::reg2time($events['start']));
                 $end = date('d F Y', Base_RegionalSettingsCommon::reg2time($events['end']));
                 $pdf->set_title($view . ', ' . $start . ($view_type != 'Day' ? ' - ' . $end : ''));
                 $filter = CRM_FiltersCommon::get();
                 $me = CRM_ContactsCommon::get_my_record();
                 if (trim($filter, '()') == $me['id']) {
                     $desc = $me['last_name'] . ' ' . $me['first_name'];
                 } else {
                     $desc = CRM_FiltersCommon::get_profile_desc();
                 }
                 $pdf->set_subject(__('CRM Filters: %s', array($desc)));
                 $pdf->prepare_header();
                 $pdf->AddPage();
                 foreach ($events['events'] as $v) {
                     $ev_mod->make_event_PDF($pdf, $v, true, $view_type);
                 }
             }
             $pdf->add_actionbar_icon($view);
         }
     }
 }
コード例 #12
0
ファイル: Administrator_0.php プロジェクト: 62BRAINS/EPESI
 public function translations()
 {
     global $translations;
     global $custom_translations;
     load_js('modules/Base/Lang/Administrator/js/main.js');
     eval_js('translate_init();');
     $lp = $this->init_module('Utils/LeightboxPrompt');
     $form = $this->init_module('Libs/QuickForm', null, 'translations_sending');
     $desc = '<div id="trans_sett_info" style="line-height:17px;">';
     $desc .= __('You have now option to contribute with your translations to help us deliver EPESI in various languages. You can opt in to send your translations to EPESI central database, allowing to deliver EPESI in your language to other users.') . '<br>';
     $desc .= __('Please note that the translations you submit aren\'t subject to copyright. EPESI Team will distribute the translations free of charge to the end users.') . '<br>';
     $desc .= __('The only data being sent is the values of the fields presented below and the translated strings, we do not receive any other information contained in EPESI.') . '<br>';
     $desc .= __('You can also change your Translations Contribution settings at later time.') . '<br>';
     $desc .= '</div>';
     eval_js('$("trans_sett_info").up("td").setAttribute("colspan",2);');
     eval_js('$("trans_sett_info").up("td").style.borderRadius="0";');
     // Not really nice, but will have to do for now
     eval_js('$("decription_label").up("td").hide();');
     eval_js('function update_credits(){$("contact_email").disabled=$("credits_website").disabled=!$("include_credits").checked||!$("allow").checked;}');
     eval_js('update_credits();');
     $ip = gethostbyname($_SERVER['SERVER_NAME']);
     $me = CRM_ContactsCommon::get_my_record();
     $form->addElement('static', 'header', '<div id="decription_label" />', $desc);
     $form->addElement('checkbox', 'allow', __('Enable sending translations'), null, array('id' => 'allow', 'onchange' => '$("include_credits").disabled=$("first_name").disabled=$("last_name").disabled=!this.checked;update_credits();'));
     $form->addElement('text', 'first_name', __('First Name'), array('id' => 'first_name'));
     $form->addElement('text', 'last_name', __('Last Name'), array('id' => 'last_name'));
     $form->addElement('checkbox', 'include_credits', __('Include in credits'), null, array('id' => 'include_credits', 'onchange' => 'update_credits();'));
     $form->addElement('text', 'credits_website', __('Credits website'), array('id' => 'credits_website'));
     $form->addElement('text', 'contact_email', __('Contact e-mail'), array('id' => 'contact_email'));
     $form->addElement('static', 'IP', __('IP'), $ip);
     $lp->add_option(null, null, null, $form);
     eval_js('$("first_name").disabled=$("last_name").disabled=!$("allow").checked;');
     $vals = $lp->export_values();
     if ($vals) {
         $values = $vals['form'];
         if (!isset($values['allow'])) {
             $values['allow'] = 0;
         }
         if (!isset($values['first_name'])) {
             $values['first_name'] = '';
         }
         if (!isset($values['last_name'])) {
             $values['last_name'] = '';
         }
         if (!isset($values['include_credits'])) {
             $values['include_credits'] = 0;
         }
         if (!isset($values['credits_website'])) {
             $values['credits_website'] = '';
         }
         if (!isset($values['contact_email'])) {
             $values['contact_email'] = '';
         }
         DB::Execute('DELETE FROM base_lang_trans_contrib WHERE user_id=%d', array(Acl::get_user()));
         DB::Execute('INSERT INTO base_lang_trans_contrib (user_id, allow, first_name, last_name, credits, credits_website, contact_email) VALUES (%d, %d, %s, %s, %d, %s, %s)', array(Acl::get_user(), $values['allow'], $values['first_name'], $values['last_name'], $values['include_credits'], $values['credits_website'], $values['contact_email']));
     }
     $allow_sending = Base_Lang_AdministratorCommon::allow_sending(true);
     if ($allow_sending === null || $allow_sending === false) {
         $form->setDefaults(array('allow' => 0, 'first_name' => $me['first_name'], 'last_name' => $me['last_name'], 'contact_email' => $me['email']));
     } else {
         $r = DB::GetRow('SELECT * FROM base_lang_trans_contrib WHERE user_id=%d', array(Acl::get_user()));
         if (!$r['first_name']) {
             $r['first_name'] = $me['first_name'];
         }
         if (!$r['last_name']) {
             $r['last_name'] = $me['last_name'];
         }
         if (!$r['contact_email']) {
             $r['contact_email'] = $me['email'];
         }
         $form->setDefaults(array('allow' => $r['allow'], 'first_name' => $r['first_name'], 'last_name' => $r['last_name'], 'contact_email' => $r['contact_email'], 'credits_website' => $r['credits_website'], 'include_credits' => $r['credits']));
     }
     Base_ActionBarCommon::add('settings', __('Translations Contributions'), $lp->get_href());
     $this->display_module($lp, array(__('Translations Contributions settings')));
     if (Base_AdminCommon::get_access('Base_Lang_Administrator', 'new_langpack')) {
         Base_ActionBarCommon::add('add', __('New langpack'), $this->create_callback_href(array($this, 'new_lang_pack')));
     }
     if (Base_AdminCommon::get_access('Base_Lang_Administrator', 'select_language')) {
         Base_ActionBarCommon::add('refresh', __('Refresh languages'), $this->create_callback_href(array('Base_LangCommon', 'refresh_cache')));
     }
     $form2 = $this->init_module('Libs/QuickForm', null, 'translaction_filter');
     $form2->addElement('select', 'lang_filter', __('Filter'), array(__('Show all'), __('Show with custom translation'), __('Show with translation'), __('Show without translation')), array('onchange' => $form2->get_submit_form_js()));
     if ($form2->validate()) {
         $vals = $form2->exportValues();
         $this->set_module_variable('filter', $vals['lang_filter']);
     }
     $filter = $this->get_module_variable('filter', 0);
     $form2->setDefaults(array('lang_filter' => $filter));
     ob_start();
     $form2->display_as_row();
     $trans_filter = ob_get_clean();
     if (!isset($_SESSION['client']['base_lang_administrator']['currently_translating'])) {
         $_SESSION['client']['base_lang_administrator']['currently_translating'] = Base_LangCommon::get_lang_code();
     }
     if (!isset($_SESSION['client']['base_lang_administrator']['notice'])) {
         print '<span class="important_notice">' . __('Please make sure the correct language is selected in the box below before you start translating') . ' <a style="float:right;" ' . $this->create_callback_href(array($this, 'hide_notice')) . '>' . __('Discard') . '</a>' . '</span>';
     }
     if (Base_AdminCommon::get_access('Base_Lang_Administrator', 'translate')) {
         $langs = Base_LangCommon::get_installed_langs();
         $form = $this->init_module('Libs/QuickForm', null, 'language_selected');
         $form->addElement('select', 'lang_code', __('Currently Translating'), $langs, array('onchange' => $form->get_submit_form_js()));
         $currently_translating = $_SESSION['client']['base_lang_administrator']['currently_translating'];
         $form->setDefaults(array('lang_code' => $currently_translating));
         if ($form->validate()) {
             $form->process(array($this, 'submit_language_select'));
         }
         if ($allow_sending) {
             $warning_mgs = __('All custom translations will be sent to our server right after you will input them. Use this mode only, if you wish to contribute your translations. If you are going to change meaning of any string, then please disable sending translations.');
             print "<h1 style=\"color:red; width: 70%\">{$warning_mgs}</h1>";
         } else {
             $contribution_mgs = __('If you wish to help us with translating EPESI to your language, then click Translation Contribution in the Action Bar.');
             print "<h3>{$contribution_mgs}</h3>";
         }
         $form->display_as_column();
         if ($allow_sending) {
             $href = $this->create_confirm_callback_href(__('Are you sure?'), array($this, 'send_lang_ajax'), array($currently_translating));
             print "<h4><a {$href}>" . __('Send all your custom translations for language %s', array($langs[$currently_translating])) . "</a></h4>";
         }
         $help_msg = __('You can open next string to translate with space button');
         print "<p>{$help_msg}</p>";
     }
     Base_LangCommon::load($_SESSION['client']['base_lang_administrator']['currently_translating']);
     $data = array();
     foreach ($custom_translations as $o => $t) {
         if ($t || !isset($translations[$o])) {
             $translations[$o] = $t;
         }
     }
     foreach ($translations as $o => $t) {
         if (isset($custom_translations[$o]) && $custom_translations[$o]) {
             $t = $custom_translations[$o];
         } else {
             if ($filter == 1) {
                 continue;
             }
         }
         if ($filter == 2 && !$t) {
             continue;
         }
         if ($filter == 3 && $t) {
             continue;
         }
         $span_id = 'trans__' . md5($o);
         if (Base_AdminCommon::get_access('Base_Lang_Administrator', 'translate')) {
             $org = '<a href="javascript:void(0);" onclick="lang_translate(\'' . Epesi::escapeJS(htmlspecialchars($o)) . '\',\'' . $span_id . '\');">' . $o . '</a>';
             $t = '<span id="' . $span_id . '">' . $t . '</span>';
         }
         eval_js('translate_add_id("' . $span_id . '","' . Epesi::escapeJS($o) . '");');
         $data[] = array($org, $t);
     }
     $gb = $this->init_module('Utils/GenericBrowser', null, 'lang_translations');
     $gb->set_custom_label($trans_filter);
     $gb->set_table_columns(array(array('name' => __('Original'), 'order_preg' => '/^<[^>]+>([^<]*)<[^>]+>$/i', 'search' => 'original'), array('name' => __('Translated'), 'search' => 'translated')));
     //$limit = $gb->get_limit(count($data));
     $id = 0;
     foreach ($data as $v) {
         //if ($id>=$limit['offset'] && $id<$limit['offset']+$limit['numrows'])
         $gb->add_row_array($v);
         $id++;
     }
     Base_LangCommon::load();
     $this->display_module($gb, array(true), 'automatic_display');
     Utils_ShortcutCommon::add(array(' '), 'translate_first_on_the_list', array('disable_in_input' => 1));
 }
コード例 #13
0
ファイル: FiltersCommon_0.php プロジェクト: cretzu89/EPESI
 public static function get_my_profile()
 {
     $me = CRM_ContactsCommon::get_my_record();
     return $me['id'];
 }
コード例 #14
0
ファイル: ContactsCommon_0.php プロジェクト: 62BRAINS/EPESI
 public static function submit_contact($values, $mode)
 {
     switch ($mode) {
         case 'cloning':
             $values['login'] = '';
             return $values;
         case 'display':
             // display copy company data button and do update if needed
             self::copy_company_data_subroutine($values);
             $is_employee = false;
             if (isset($values['related_companies']) && is_array($values['related_companies']) && in_array(CRM_ContactsCommon::get_main_company(), $values['related_companies'])) {
                 $is_employee = true;
             }
             if (isset($values['company_name']) && $values['company_name'] == CRM_ContactsCommon::get_main_company()) {
                 $is_employee = true;
             }
             $me = CRM_ContactsCommon::get_my_record();
             $emp = array($me['id']);
             $cus = array();
             if ($is_employee) {
                 $emp[] = $values['id'];
             } else {
                 $cus[] = 'P:' . $values['id'];
             }
             $ret = array();
             $ret['new'] = array();
             $ret['new']['crm_filter'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('Set CRM Filter')) . ' ' . Module::create_href(array('set_crm_filter' => 1)) . '>F</a>';
             if (isset($_REQUEST['set_crm_filter'])) {
                 CRM_FiltersCommon::set_profile('c' . $values['id']);
             }
             if (ModuleManager::is_installed('CRM/Meeting') !== -1 && Utils_RecordBrowserCommon::get_access('crm_meeting', 'add')) {
                 $ret['new']['event'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('New Meeting')) . ' ' . Utils_RecordBrowserCommon::create_new_record_href('crm_meeting', array('employees' => $emp, 'customers' => $cus, 'status' => 0, 'priority' => 1, 'permission' => 0)) . '><img border="0" src="' . Base_ThemeCommon::get_template_file('CRM_Calendar', 'icon-small.png') . '"></a>';
             }
             if (ModuleManager::is_installed('CRM/Tasks') !== -1 && Utils_RecordBrowserCommon::get_access('task', 'add')) {
                 $ret['new']['task'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('New Task')) . ' ' . Utils_RecordBrowserCommon::create_new_record_href('task', array('employees' => $emp, 'customers' => $cus, 'status' => 0, 'priority' => 1, 'permission' => 0)) . '><img border="0" src="' . Base_ThemeCommon::get_template_file('CRM_Tasks', 'icon-small.png') . '"></a>';
             }
             if (ModuleManager::is_installed('CRM/PhoneCall') !== -1 && Utils_RecordBrowserCommon::get_access('phonecall', 'add')) {
                 $ret['new']['phonecall'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('New Phonecall')) . ' ' . Utils_RecordBrowserCommon::create_new_record_href('phonecall', array('date_and_time' => date('Y-m-d H:i:s'), 'customer' => 'P:' . $values['id'], 'employees' => $me['id'], 'status' => 0, 'permission' => 0, 'priority' => 1), 'none', false) . '><img border="0" src="' . Base_ThemeCommon::get_template_file('CRM_PhoneCall', 'icon-small.png') . '"></a>';
             }
             $ret['new']['note'] = Utils_RecordBrowser::$rb_obj->add_note_button('contact/' . $values['id']);
             return $ret;
         case 'adding':
             $values['permission'] = Base_User_SettingsCommon::get('CRM_Common', 'default_record_permission');
             break;
         case 'add':
             if (isset($values['email']) && $values['email'] == '' && $values['login'] != 0 && $mode == 'add') {
                 $values['email'] = DB::GetOne('SELECT mail FROM user_password WHERE user_login_id=%d', array($values['login']));
             }
         case 'edit':
             if (isset($values['create_company'])) {
                 $comp_id = Utils_RecordBrowserCommon::new_record('company', array('company_name' => $values['create_company_name'], 'address_1' => $values['address_1'], 'address_2' => $values['address_2'], 'country' => $values['country'], 'city' => $values['city'], 'zone' => isset($values['zone']) ? $values['zone'] : '', 'postal_code' => $values['postal_code'], 'phone' => $values['work_phone'], 'fax' => $values['fax'], 'web_address' => $values['web_address'], 'permission' => $values['permission']));
                 if (!isset($values['company_name'])) {
                     $values['company_name'] = null;
                 }
                 if (!isset($values['related_companies'])) {
                     $values['related_companies'] = array();
                 }
                 if (!is_array($values['related_companies'])) {
                     $values['related_companies'] = array($values['related_companies']);
                 }
                 if (!$values['company_name']) {
                     $values['company_name'] = $comp_id;
                 } else {
                     $values['related_companies'][] = $comp_id;
                 }
             }
             if (Base_AclCommon::i_am_admin()) {
                 if ($values['login'] == 'new') {
                     if (!$values['set_password']) {
                         $values['set_password'] = null;
                     }
                     Base_User_LoginCommon::add_user($values['username'], $values['email'], $values['set_password']);
                     $values['login'] = Base_UserCommon::get_user_id($values['username']);
                 } else {
                     if ($values['login']) {
                         Base_User_LoginCommon::change_user_preferences($values['login'], isset($values['email']) ? $values['email'] : '', isset($values['set_password']) ? $values['set_password'] : null);
                         if (isset($values['username']) && $values['username']) {
                             Base_UserCommon::rename_user($values['login'], $values['username']);
                         }
                     }
                 }
                 if (Base_AclCommon::i_am_sa() && $values['login'] && isset($values['admin']) && $values['admin'] !== '') {
                     $old_admin = Base_AclCommon::get_admin_level($values['login']);
                     if ($old_admin != $values['admin']) {
                         $admin_arr = array(0 => 'No', 1 => 'Administrator', 2 => 'Super Administrator');
                         if (Base_UserCommon::change_admin($values['login'], $values['admin']) !== true) {
                             Utils_RecordBrowserCommon::new_record_history('contact', $values['id'], 'Admin set from "' . $admin_arr[$old_admin] . '" to "' . $admin_arr[$values['admin']]);
                         }
                     }
                 }
             }
             unset($values['admin']);
             unset($values['username']);
             unset($values['set_password']);
             unset($values['confirm_password']);
     }
     return $values;
 }
コード例 #15
0
	public static function decode_access($str, $manage_permissions=false) {
		if (is_numeric($str)) return $str;
		// FIXME should be moved to CRM_Contacts, but only after editor is ready and there's synatx to retrieve all needed info
		if ($manage_permissions) {
			if ($str=='USER_ID') return __('User Login');
			if (class_exists('CRM_ContactsCommon')) { 
				$me = CRM_ContactsCommon::get_my_record();
				if ($str=='USER') return __('User Contact');
				if ($str=='USER_COMPANY') return __('User Company');
			}
		} else {
			if ($str=='USER_ID') return Acl::get_user();
			if (class_exists('CRM_ContactsCommon')) {
				$me = CRM_ContactsCommon::get_my_record();
				if ($str=='USER') return $me['id']?$me['id']:-1;
				if ($str=='USER_COMPANY') return (isset($me['company_name']) && $me['company_name'])?$me['company_name']:-1;
			}
		}
		return $str;
	}
コード例 #16
0
ファイル: Contacts_0.php プロジェクト: 62BRAINS/EPESI
 public function companies_actions($r, $gb_row)
 {
     $me = CRM_ContactsCommon::get_my_record();
     $emp = array($me['id']);
     $cus = array();
     $cus[] = 'C:' . $r['id'];
     if (ModuleManager::is_installed('CRM/Meeting') !== -1 && Utils_RecordBrowserCommon::get_access('crm_meeting', 'add')) {
         $gb_row->add_action(Utils_RecordBrowserCommon::create_new_record_href('crm_meeting', array('employees' => $emp, 'customers' => $cus, 'status' => 0, 'priority' => 1, 'permission' => 0)), __('New Meeting'), null, Base_ThemeCommon::get_template_file('CRM_Calendar', 'icon-small.png'));
     }
     if (ModuleManager::is_installed('CRM/Tasks') !== -1 && Utils_RecordBrowserCommon::get_access('task', 'add')) {
         $gb_row->add_action(Utils_RecordBrowserCommon::create_new_record_href('task', array('employees' => $emp, 'customers' => $cus, 'status' => 0, 'priority' => 1, 'permission' => 0)), __('New Task'), null, Base_ThemeCommon::get_template_file('CRM_Tasks', 'icon-small.png'));
     }
     if (ModuleManager::is_installed('CRM/PhoneCall') !== -1 && Utils_RecordBrowserCommon::get_access('phonecall', 'add')) {
         $gb_row->add_action(Utils_RecordBrowserCommon::create_new_record_href('phonecall', array('date_and_time' => date('Y-m-d H:i:s'), 'customer' => 'C:' . $r['id'], 'employees' => $me['id'], 'status' => 0, 'permission' => 0, 'priority' => 1), 'none', array('date_and_time')), __('New Phonecall'), null, Base_ThemeCommon::get_template_file('CRM_PhoneCall', 'icon-small.png'));
     }
     $gb_row->add_action(Utils_RecordBrowser::$rb_obj->add_note_button_href('company/' . $r['id']), __('New Note'), null, Base_ThemeCommon::get_template_file('Utils_Attachment', 'icon_small.png'));
 }