Beispiel #1
0
 public static function admin_caption()
 {
     if (ModuleManager::is_installed('Base_EpesiStore') >= 0 && Base_EpesiStoreCommon::admin_access()) {
         return null;
     }
     return array('label' => __('Modules Administration'), 'section' => __('Server Configuration'));
 }
Beispiel #2
0
 /**
  * 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();
 }
Beispiel #3
0
 public static function drawLeightbox($prefix)
 {
     if (MOBILE_DEVICE) {
         return;
     }
     $meetings = ModuleManager::is_installed('CRM/Meeting') >= 0;
     $tasks = ModuleManager::is_installed('CRM/Tasks') >= 0;
     $phonecall = ModuleManager::is_installed('CRM/PhoneCall') >= 0;
     self::check_location();
     if (!isset(self::$leightbox_ready[$prefix])) {
         self::$leightbox_ready[$prefix] = true;
         $theme = Base_ThemeCommon::init_smarty();
         eval_js_once($prefix . '_followups_deactivate = function(){leightbox_deactivate(\'' . $prefix . '_followups_leightbox\');}');
         if ($meetings) {
             $theme->assign('new_meeting', array('open' => '<a id="' . $prefix . '_new_meeting_button" onclick="' . $prefix . '_set_action(\'new_meeting\');' . $prefix . '_submit_form();">', 'text' => __('New Meeting'), 'close' => '</a>'));
             eval_js('Event.observe(\'' . $prefix . '_new_meeting_button\',\'click\', ' . $prefix . '_followups_deactivate)');
         }
         if ($tasks) {
             $theme->assign('new_task', array('open' => '<a id="' . $prefix . '_new_task_button" onclick="' . $prefix . '_set_action(\'new_task\');' . $prefix . '_submit_form();">', 'text' => __('New Task'), 'close' => '</a>'));
             eval_js('Event.observe(\'' . $prefix . '_new_task_button\',\'click\', ' . $prefix . '_followups_deactivate)');
         }
         if ($phonecall) {
             $theme->assign('new_phonecall', array('open' => '<a id="' . $prefix . '_new_phonecall_button" onclick="' . $prefix . '_set_action(\'new_phonecall\');' . $prefix . '_submit_form();">', 'text' => __('New Phonecall'), 'close' => '</a>'));
             eval_js('Event.observe(\'' . $prefix . '_new_phonecall_button\',\'click\', ' . $prefix . '_followups_deactivate)');
         }
         $theme->assign('just_close', array('open' => '<a id="' . $prefix . '_just_close_button" onclick="' . $prefix . '_set_action(\'none\');' . $prefix . '_submit_form();">', 'text' => __('Save'), 'close' => '</a>'));
         eval_js('Event.observe(\'' . $prefix . '_just_close_button\',\'click\', ' . $prefix . '_followups_deactivate)');
         eval_js($prefix . '_submit_form = function () {' . '$(\'' . $prefix . '_follow_up_form\').submited.value=1;Epesi.href($(\'' . $prefix . '_follow_up_form\').serialize(), \'processing...\');$(\'' . $prefix . '_follow_up_form\').submited.value=0;' . '}');
         eval_js($prefix . '_set_action = function (arg) {' . 'document.forms["' . $prefix . '_follow_up_form"].action.value = arg;' . '}');
         eval_js($prefix . '_set_id = function (id) {' . 'document.forms["' . $prefix . '_follow_up_form"].id.value = id;' . '$("' . $prefix . '_closecancel").value=3;' . '$("' . $prefix . '_note").value="";' . '}');
         $theme->assign('form_open', '<form id="' . $prefix . '_follow_up_form" name="' . $prefix . '_follow_up_form" method="POST">' . '<input type="hidden" name="submited" value="0" />' . '<input type="hidden" name="form_name" value="' . $prefix . '_follow_up_form" />' . '<input type="hidden" name="id" value="" />' . '<input type="hidden" name="action" value="" />');
         $status_select_options = '';
         $statuses = Utils_CommonDataCommon::get_translated_array('CRM/Status');
         foreach ($statuses as $key => $value) {
             $status_select_options .= '<option value="' . htmlspecialchars($key) . '"' . ($key == 3 ? ' selected="1"' : '') . '>' . htmlspecialchars($value) . '</option>';
         }
         $theme->assign('form_closecancel', array('label' => __('Status'), 'html' => '<select name="closecancel" id="' . $prefix . '_closecancel" value="0">' . $status_select_options . '</select>'));
         $theme->assign('form_note', array('label' => __('Note'), 'html' => '<textarea name="note" id="' . $prefix . '_note"></textarea>'));
         $theme->assign('form_close', '</form>');
         ob_start();
         Base_ThemeCommon::display_smarty($theme, 'CRM_Followup', 'leightbox');
         $profiles_out = ob_get_clean();
         Libs_LeightboxCommon::display($prefix . '_followups_leightbox', $profiles_out, __('Follow-up'));
     }
 }
Beispiel #4
0
    public static function prepare_header(& $tcpdf, $title='', $subject='', $printed_by=true, $logo_filename=null, $l = array()) {
        if ($title!==null) {
            if ($logo_filename===null) $logo_filename = Libs_TCPDFCommon::get_logo_filename();
            if ($logo_filename!==false && !file_exists($logo_filename)) {
                $logo_filename = Base_ThemeCommon::get_template_file('Libs/TCPDF','logo-small.png');
            }
            $margins = $tcpdf->getMargins();
            if($logo_filename) {
                $logo_size = getimagesize($logo_filename);
                $logo_height = $logo_size[1] * PDF_HEADER_LOGO_WIDTH / $logo_size[0];
            } else {
                $logo_height = 0;
            }
            $tcpdf->SetHeaderMargin(10);
            $tcpdf->SetTopMargin($logo_height + $margins['top']);
            $tcpdf->SetHeaderData($logo_filename, $logo_filename?PDF_HEADER_LOGO_WIDTH:0, $title, $subject);
        } else {
            $tcpdf->setPrintHeader(false);
        }

        //set some language-dependent strings
        $l['a_meta_charset'] = "UTF-8";
        $l['a_meta_dir'] = "ltr";
        $l['a_meta_language'] = "pl";

        $who = null;
        if (ModuleManager::is_installed('CRM/Contacts') >= 0) {
            $who = CRM_ContactsCommon::get_contact_by_user_id(Acl::get_user());
        }
        if ($who!==null) $who = $who['last_name'].' '.$who['first_name'];
        else $who= Base_UserCommon::get_user_login(Acl::get_user());
        $when = date('Y-m-d H:i:s');
        if (!isset($l['w_page'])) {
			$l['w_page'] = '';
			if ($printed_by) $l['w_page'] .= __('Printed with %s by %s, on %s, ',array('EPESI (http://epe.si)',$who,$when));
			$l['w_page'] .= __('Page');
		}
        $tcpdf->setLanguageArray($l);

        self::SetFont($tcpdf, self::$default_font, '', 9);
    }
Beispiel #5
0
 public function install()
 {
     //addons table
     $fields = array(array('name' => _M('Recordset'), 'type' => 'text', 'param' => 64, 'display_callback' => array($this->get_type() . 'Common', 'display_recordset'), 'QFfield_callback' => array($this->get_type() . 'Common', 'QFfield_recordset'), 'required' => true, 'extra' => false, 'visible' => true));
     Utils_RecordBrowserCommon::install_new_recordset('phonecall_related', $fields);
     Utils_RecordBrowserCommon::set_caption('phonecall_related', _M('Phonecalls Related Recordsets'));
     Utils_RecordBrowserCommon::register_processing_callback('phonecall_related', array('CRM_PhoneCallCommon', 'processing_related'));
     Utils_RecordBrowserCommon::add_access('phonecall_related', 'view', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('phonecall_related', 'add', 'ADMIN');
     Utils_RecordBrowserCommon::add_access('phonecall_related', 'edit', 'SUPERADMIN');
     Utils_RecordBrowserCommon::add_access('phonecall_related', 'delete', 'SUPERADMIN');
     // ************ phone calls ************** //
     Base_ThemeCommon::install_default_theme(CRM_PhoneCallInstall::module_name());
     $fields = array(array('name' => _M('Subject'), 'type' => 'text', 'required' => true, 'param' => '64', 'extra' => false, 'visible' => true, 'display_callback' => array('CRM_PhoneCallCommon', 'display_subject')), array('name' => _M('Contact Name'), 'type' => 'hidden', 'extra' => false, 'visible' => true, 'display_callback' => array('CRM_PhoneCallCommon', 'display_contact_name')), array('name' => _M('Phone Number'), 'type' => 'hidden', 'extra' => false, 'visible' => true, 'display_callback' => array('CRM_PhoneCallCommon', 'display_phone_number')), array('name' => _M('Customer'), 'type' => 'crm_company_contact', 'param' => array('field_type' => 'select'), 'extra' => false), array('name' => _M('Other Customer'), 'type' => 'checkbox', 'extra' => false, 'QFfield_callback' => array('CRM_PhoneCallCommon', 'QFfield_other_contact')), array('name' => _M('Other Customer Name'), 'type' => 'text', 'param' => '64', 'extra' => false), array('name' => _M('Permission'), 'type' => 'commondata', 'required' => true, 'param' => array('order_by_key' => true, 'CRM/Access'), 'extra' => false), array('name' => _M('Employees'), 'type' => 'crm_contact', 'param' => array('field_type' => 'multiselect', 'crits' => array('CRM_PhoneCallCommon', 'employees_crits'), 'format' => array('CRM_ContactsCommon', 'contact_format_no_company')), 'required' => true, 'extra' => false, 'visible' => true, 'filter' => true), array('name' => _M('Status'), 'type' => 'commondata', 'required' => true, 'filter' => true, 'param' => array('order_by_key' => true, 'CRM/Status'), 'extra' => false, 'visible' => true, 'display_callback' => array('CRM_PhoneCallCommon', 'display_status')), array('name' => _M('Priority'), 'type' => 'commondata', 'required' => true, 'param' => array('order_by_key' => true, 'CRM/Priority'), 'extra' => false), array('name' => _M('Phone'), 'type' => 'integer', 'extra' => false, 'QFfield_callback' => array('CRM_PhoneCallCommon', 'QFfield_phone'), 'display_callback' => array('CRM_PhoneCallCommon', 'display_phone')), array('name' => _M('Other Phone'), 'type' => 'checkbox', 'extra' => false, 'QFfield_callback' => array('CRM_PhoneCallCommon', 'QFfield_other_phone')), array('name' => _M('Other Phone Number'), 'type' => 'text', 'param' => '64', 'extra' => false), array('name' => _M('Date and Time'), 'type' => 'timestamp', 'required' => true, 'extra' => false, 'visible' => true), array('name' => _M('Description'), 'type' => 'long text', 'required' => false, 'param' => '255', 'extra' => false), array('name' => _M('Related'), 'type' => 'multiselect', 'QFfield_callback' => array('CRM_PhoneCallCommon', 'QFfield_related'), 'param' => '__RECORDSETS__::;CRM_PhoneCallCommon::related_crits', 'extra' => false, 'required' => false, 'visible' => true));
     Utils_RecordBrowserCommon::install_new_recordset('phonecall', $fields);
     Utils_RecordBrowserCommon::set_tpl('phonecall', Base_ThemeCommon::get_template_filename(CRM_PhoneCallInstall::module_name(), 'default'));
     Utils_RecordBrowserCommon::register_processing_callback('phonecall', array('CRM_PhoneCallCommon', 'submit_phonecall'));
     Utils_RecordBrowserCommon::set_icon('phonecall', Base_ThemeCommon::get_template_filename(CRM_PhoneCallInstall::module_name(), 'icon.png'));
     Utils_RecordBrowserCommon::set_recent('phonecall', 5);
     Utils_RecordBrowserCommon::set_caption('phonecall', _M('Phonecalls'));
     Utils_RecordBrowserCommon::enable_watchdog('phonecall', array('CRM_PhoneCallCommon', 'watchdog_label'));
     Utils_RecordBrowserCommon::set_search('phonecall', 2, 0);
     // ************ addons ************** //
     Utils_AttachmentCommon::new_addon('phonecall');
     Utils_RecordBrowserCommon::new_addon('phonecall', CRM_PhoneCallInstall::module_name(), 'messanger_addon', _M('Alerts'));
     CRM_RoundcubeCommon::new_addon('phonecall');
     // ************ other ************** //
     CRM_CalendarCommon::new_event_handler(_M('Phonecalls'), array('CRM_PhoneCallCommon', 'crm_calendar_handler'));
     Utils_BBCodeCommon::new_bbcode('phone', 'CRM_PhoneCallCommon', 'phone_bbcode');
     if (ModuleManager::is_installed('Premium_SalesOpportunity') >= 0) {
         Utils_RecordBrowserCommon::new_record_field('phonecall', _M('Opportunity'), 'select', true, false, 'premium_salesopportunity::Opportunity Name;Premium_SalesOpportunityCommon::crm_opportunity_reference_crits', '', false);
     }
     Utils_RecordBrowserCommon::add_access('phonecall', 'view', 'ACCESS:employee', array('(!permission' => 2, '|employees' => 'USER'));
     Utils_RecordBrowserCommon::add_access('phonecall', 'add', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('phonecall', 'edit', 'ACCESS:employee', array('(permission' => 0, '|employees' => 'USER', '|customer' => 'USER'));
     Utils_RecordBrowserCommon::add_access('phonecall', 'delete', 'ACCESS:employee', array(':Created_by' => 'USER_ID'));
     Utils_RecordBrowserCommon::add_access('phonecall', 'delete', array('ACCESS:employee', 'ACCESS:manager'));
     return true;
 }
Beispiel #6
0
 public static function user_search($search = null)
 {
     $myid = Base_AclCommon::get_user();
     if (Base_User_SettingsCommon::get('Apps_Shoutbox', 'enable_im')) {
         $adm = Base_User_SettingsCommon::get_admin('Apps_Shoutbox', 'enable_im');
         if (ModuleManager::is_installed('CRM_Contacts') >= 0) {
             $emps = DB::GetAssoc('SELECT l.id,' . DB::ifelse('cd.f_last_name!=\'\'', DB::concat('cd.f_last_name', DB::qstr(' '), 'cd.f_first_name'), 'l.login') . ' as name FROM user_login l LEFT JOIN contact_data_1 cd ON (cd.f_login=l.id AND cd.active=1) LEFT JOIN base_user_settings us ON (us.user_login_id=l.id AND module=\'Apps_Shoutbox\' AND variable=\'enable_im\') WHERE l.active=1 AND l.id!=%d AND (us.value=%s OR us.value is ' . ($adm ? '' : 'not ') . 'null) AND (cd.f_first_name ' . DB::like() . ' ' . DB::concat(DB::qstr("%%"), "%s", DB::qstr("%%")) . ' OR cd.f_last_name ' . DB::like() . ' ' . DB::concat(DB::qstr("%%"), "%s", DB::qstr("%%")) . ') ORDER BY name', array($myid, serialize(1), $search, $search));
         } else {
             $emps = DB::GetAssoc('SELECT l.id,l.login FROM user_login l LEFT JOIN base_user_settings us ON (us.user_login_id=l.id AND module=\'Apps_Shoutbox\' AND variable=\'enable_im\') WHERE l.active=1 AND l.id!=%d AND (us.value=%s OR us.value is ' . ($adm ? '' : 'not ') . 'null) AND l.login ' . DB::like() . ' ' . DB::concat(DB::qstr("%%"), "%s", DB::qstr("%%")) . ' ORDER BY l.login', array($myid, serialize(1), $search));
         }
     } else {
         $emps = array();
     }
     if (ModuleManager::is_installed('Tools_WhoIsOnline') >= 0) {
         $online = Tools_WhoIsOnlineCommon::get_ids();
         foreach ($online as $id) {
             if (isset($emps[$id])) {
                 $emps[$id] = '* ' . $emps[$id];
             }
         }
     }
     return $emps;
 }
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
$module_name = 'Utils/QueryBuilder';
if (ModuleManager::is_installed($module_name) < 0) {
    ModuleManager::install($module_name);
}
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
if (ModuleManager::is_installed('Base_Help') >= 0) {
    return;
}
ModuleManager::install('Base_Help');
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
if (ModuleManager::is_installed('Base_Cron') >= 0) {
    return;
}
ModuleManager::install('Base_Cron');
Beispiel #10
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
if (ModuleManager::is_installed('CRM_Meeting') == -1) {
    return;
}
Utils_RecordBrowserCommon::new_filter('crm_meeting', 'Date');
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
if (ModuleManager::is_installed('CRM_Roundcube') >= 0) {
    foreach (DB::GetCol('SELECT id FROM user_login') as $id) {
        $identity = DB::GetOne("SELECT " . DB::Concat('f_first_name', DB::qstr(' '), 'f_last_name') . " FROM contact_data_1 WHERE f_login =%d", array($id));
        foreach (DB::GetCol("SELECT f_email FROM rc_accounts_data_1 WHERE f_epesi_user=%d", array($id)) as $f_email) {
            DB::Execute('UPDATE rc_identities SET name=%s WHERE email=%s', array($identity, $f_email));
        }
    }
}
Beispiel #12
0
 public static function submit_meeting($values, $mode)
 {
     $me = CRM_ContactsCommon::get_my_record();
     switch ($mode) {
         case 'delete':
             Utils_MessengerCommon::delete_by_id('CRM_Calendar_Event:' . $values['id']);
             break;
         case 'display':
             $pdf = Utils_RecordBrowser::$rb_obj->pack_module('Libs/TCPDF', 'L');
             if ($pdf->prepare()) {
                 $pdf->set_title($values['title']);
                 $pdf->set_subject('');
                 $pdf->prepare_header();
                 $pdf->AddPage();
                 $v = CRM_Calendar_EventCommon::get(DB::GetOne('SELECT id FROM crm_calendar_custom_events_handlers WHERE group_name=%s', array('Meetings')) . '#' . $values['id']);
                 $ev_mod = Utils_RecordBrowser::$rb_obj->init_module('CRM/Calendar/Event');
                 $ev_mod->make_event_PDF($pdf, $v, true, 'view');
             }
             $pdf->add_actionbar_icon('Print');
             if (isset($_REQUEST['day'])) {
                 $values['date'] = $_REQUEST['day'];
             }
             $ret = array();
             if ($values['time']) {
                 // normal event
                 $start = $values['time'];
                 // time in unix timestamp UTC
                 $start_disp = strtotime(Base_RegionalSettingsCommon::time2reg($start, true, true, true, false));
             } else {
                 // when event is timeless - all day event
                 $time = $values['date'] . ' 00:00:01';
                 $start = Base_RegionalSettingsCommon::reg2time($time);
                 $start_disp = strtotime($time);
             }
             $end = strtotime('+' . $values['duration'] . ' seconds', $start);
             $ret['day_details'] = array('start' => array('day' => '<a ' . Base_BoxCommon::create_href(null, 'CRM/Calendar', 'body', array(array('default_view' => 'day', 'default_date' => strtotime($values['date']))), array()) . '>' . date('j', $start_disp) . '</a>', 'month' => '<a ' . Base_BoxCommon::create_href(null, 'CRM/Calendar', 'body', array(array('default_view' => 'month', 'default_date' => strtotime($values['date']))), array()) . '>' . __date('F', $start_disp) . '</a>', 'year' => '<a ' . Base_BoxCommon::create_href(null, 'CRM/Calendar', 'body', array(array('default_view' => 'year', 'default_date' => strtotime($values['date']))), array()) . '>' . date('Y', $start_disp) . '</a>', 'weekday' => '<a ' . Base_BoxCommon::create_href(null, 'CRM/Calendar', 'body', array(array('default_view' => 'week', 'default_date' => strtotime($values['date']))), array()) . '>' . __date('l', $start_disp) . '</a>'));
             if (!isset($values['timeless']) || !$values['timeless']) {
                 $ret['event_info'] = array('start_time' => Base_RegionalSettingsCommon::time2reg($start, 2, false), 'end_time' => Base_RegionalSettingsCommon::time2reg($end, 2, false), 'duration' => Base_RegionalSettingsCommon::seconds_to_words($values['duration']), 'start_date' => '-', 'end_date' => '-');
             }
             $ret['form_data']['timeless'] = array('label' => __('Timeless'), 'html' => 'value');
             $ret['toggle_duration'] = 'tog';
             $ret['duration_block_id'] = '1';
             $ret['event_end_block_id'] = '2';
             $values['title'] = __('Follow-up') . ': ' . $values['title'];
             $values['status'] = 0;
             $cus = reset($values['customers']);
             if (ModuleManager::is_installed('CRM/Meeting') >= 0) {
                 $ret['new']['event'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('New Meeting')) . ' ' . Utils_RecordBrowserCommon::create_new_record_href('crm_meeting', 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, 'employees' => $values['employees'], 'customers' => $values['customers'], 'status' => 0), 'none', false) . '><img border="0" src="' . Base_ThemeCommon::get_template_file('CRM_Calendar', 'icon-small.png') . '" /></a>';
             }
             if (ModuleManager::is_installed('CRM/Tasks') >= 0) {
                 $ret['new']['task'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('New Task')) . ' ' . Utils_RecordBrowserCommon::create_new_record_href('task', array('title' => $values['title'], 'permission' => $values['permission'], 'priority' => $values['priority'], 'description' => $values['description'], 'employees' => $values['employees'], 'customers' => $values['customers'], 'status' => 0, 'deadline' => date('Y-m-d', strtotime('+1 day')))) . '><img border="0" src="' . Base_ThemeCommon::get_template_file('CRM_Tasks', 'icon-small.png') . '"></a>';
             }
             if (ModuleManager::is_installed('CRM/PhoneCall') >= 0) {
                 $ret['new']['phonecall'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('New Phonecall')) . ' ' . Utils_RecordBrowserCommon::create_new_record_href('phonecall', 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'], 'customer' => $cus, 'status' => 0), '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('crm_meeting/' . $values['id']);
             return $ret;
         case 'edit':
             self::subscribed_employees($values);
             $alarms = Utils_MessengerCommon::get_alarms('CRM_Calendar_Event:' . $values['id']);
             $old = Utils_RecordBrowserCommon::get_record('crm_meeting', $values['id']);
             $old_time = strtotime($old['date'] . ' ' . date('H:i:s', strtotime($old['time'])));
             $new_time = strtotime($values['date'] . ' ' . date('H:i:s', strtotime($values['time'])));
             foreach ($alarms as $id => $time) {
                 $time = strtotime($time);
                 $diff = $old_time - $time;
                 Utils_MessengerCommon::update_time($id, $new_time - $diff);
             }
         case 'add':
             if (isset($values['duration_switch']) && !$values['duration_switch']) {
                 $values['duration'] = strtotime($values['end_time']) - strtotime($values['time']);
                 if ($values['duration'] < 0) {
                     $values['duration'] += 60 * 60 * 24;
                 }
                 // failsafe
             }
             if (isset($values['timeless']) && $values['timeless']) {
                 $values['duration'] = -1;
             }
             $new = '';
             foreach (array(0 => 'Mon', 1 => 'Tue', 2 => 'Wed', 3 => 'Thu', 4 => 'Fri', 5 => 'Sat', 6 => 'Sun') as $k => $v) {
                 if (isset($values['recurrence_hash_' . $k]) && $values['recurrence_hash_' . $k]) {
                     $new .= '1';
                 } else {
                     $new .= '0';
                 }
             }
             if ($new != '0000000') {
                 $values['recurrence_hash'] = $new;
             }
             if ($values['duration'] != -1) {
                 if (isset($values['modded'])) {
                     $time = Base_RegionalSettingsCommon::time2reg($values['time'], true, true, true, false);
                     $reg_timestamp = $values['date'] . ' ' . date('H:i:s', strtotime($time));
                     $timestamp = Base_RegionalSettingsCommon::reg2time($reg_timestamp);
                     $values['date'] = date('Y-m-d', $timestamp);
                     $values['time'] = date('Y-m-d H:i:s', $timestamp);
                     if (isset($values['recurrence_end']) && $values['recurrence_end']) {
                         $values['recurrence_end'] = date('Y-m-d', Base_RegionalSettingsCommon::reg2time($values['recurrence_end'] . ' ' . date('H:i:s', strtotime($time))));
                         if ($values['recurrence_end'] < $values['date']) {
                             $values['recurrence_end'] = $values['date'];
                         }
                         if ($values['recurrence_type'] == 8) {
                             $date = date('Y-m-d', strtotime('+6 days', strtotime($values['date'])));
                             if ($values['recurrence_end'] < $date) {
                                 $values['recurrence_end'] = $date;
                             }
                         }
                     }
                 }
             } else {
                 $values['time'] = '';
             }
             break;
         case 'adding':
             $values['permission'] = Base_User_SettingsCommon::get('CRM_Common', 'default_record_permission');
         case 'editing':
         case 'view':
             $values['modded'] = 1;
             if (!isset($values['date'])) {
                 $values['date'] = date('Y-m-d');
             }
             if (!isset($values['time'])) {
                 $values['time'] = time();
             }
             if (!isset($values['duration'])) {
                 $values['duration'] = 3600;
             }
             if (!is_numeric($values['time'])) {
                 $values['time'] = strtotime($values['time']);
             }
             if ($values['duration'] != -1) {
                 if (isset($values['date']) && $values['date']) {
                     $values['date'] = Base_RegionalSettingsCommon::time2reg($values['date'] . ' ' . date('H:i:s', $values['time']), false, true, true, false);
                     $values['time'] = Base_RegionalSettingsCommon::time2reg($values['date'] . ' ' . date('H:i:s', $values['time']), true, false, true, false);
                     $values['time'] = Base_RegionalSettingsCommon::reg2time($values['date'] . ' ' . $values['time']);
                 }
                 if (isset($values['recurrence_end']) && $values['recurrence_end']) {
                     $values['recurrence_end'] = Base_RegionalSettingsCommon::time2reg($values['recurrence_end'] . ' ' . date('H:i:s', $values['time']), false, true, true, false);
                 }
             }
             break;
         case 'added':
             if (isset($values['follow_up'])) {
                 CRM_FollowupCommon::add_tracing_notes($values['follow_up'][0], $values['follow_up'][1], $values['follow_up'][2], 'meeting', $values['id'], $values['title']);
             }
             self::subscribed_employees($values);
             $related = array_merge($values['employees'], $values['customers']);
             foreach ($related as $v) {
                 if ($mode === 'edit' && in_array($v, $old_related)) {
                     continue;
                 }
                 if (!is_numeric($v)) {
                     list($t, $id) = explode(':', $v);
                 } else {
                     $t = 'P';
                     $id = $v;
                 }
                 if ($t == 'P') {
                     $t = 'contact';
                 } else {
                     $t = 'company';
                 }
                 $subs = Utils_WatchdogCommon::get_subscribers($t, $id);
                 foreach ($subs as $s) {
                     Utils_WatchdogCommon::user_subscribe($s, 'crm_meeting', $values['id']);
                 }
             }
             if (isset($values['messenger_on']) && $values['messenger_on'] != 'none') {
                 $start = strtotime($values['date'] . ' ' . date('H:i:s', strtotime($values['time'])));
                 if ($values['messenger_on'] == 'me') {
                     Utils_MessengerCommon::add('CRM_Calendar_Event:' . $values['id'], 'CRM_Meeting', $values['messenger_message'], $start - $values['messenger_before'], array('CRM_MeetingCommon', 'get_alarm'), array($values['id']));
                 } else {
                     $eee = array();
                     foreach ($values['employees'] as $v) {
                         $c = CRM_ContactsCommon::get_contact($v);
                         if (isset($c['login'])) {
                             $eee[] = $c['login'];
                         }
                     }
                     Utils_MessengerCommon::add('CRM_Calendar_Event:' . $values['id'], 'CRM_Meeting', $values['messenger_message'], $start - $values['messenger_before'], array('CRM_MeetingCommon', 'get_alarm'), array($values['id']), $eee);
                 }
             }
             break;
     }
     return $values;
 }
Beispiel #13
0
 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));
 }
Beispiel #14
0
 public static function get_lang_code()
 {
     if (defined('FORCE_LANG_CODE')) {
         return FORCE_LANG_CODE;
     }
     if (!isset(self::$lang_code)) {
         if (!Acl::is_user() || ModuleManager::is_installed('Base/User/Settings') == -1 || !Variable::get('allow_lang_change', false)) {
             return Variable::get('default_lang');
         }
         if (class_exists('Base_User_SettingsCommon')) {
             self::$lang_code = Base_User_SettingsCommon::get('Base_Lang_Administrator', 'language');
         }
     }
     return self::$lang_code;
 }
Beispiel #15
0
 public static function get_record_by_email($email, $rset = null, $rid = null)
 {
     if ($rid == null) {
         $rset = null;
     }
     $cont = DB::GetRow('SELECT id, created_on, created_by FROM contact_data_1 WHERE active=1 AND f_email ' . DB::like() . ' %s AND id!=%d', array($email, $rset == 'contact' ? $rid : -1));
     if ($cont) {
         return array('contact', $cont['id']);
     }
     if (ModuleManager::is_installed('CRM_Roundcube') >= 0) {
         $vals = array($email);
         $where_id = '';
         if ($rid != null) {
             if ($rset == 'rc_multiple_emails') {
                 $vals[] = $rid;
                 $where_id = ' AND id!=%d';
             } else {
                 $vals[] = $rset;
                 $vals[] = $rid;
                 $where_id = ' AND (f_record_type!=%s OR f_record_id!=%d)';
             }
         }
         $tmp = DB::GetRow('SELECT id, f_record_id, f_record_type FROM rc_multiple_emails_data_1 WHERE active=1 AND f_email ' . DB::like() . ' %s' . $where_id . ' ORDER BY f_record_type DESC', $vals);
         if ($tmp) {
             return array($tmp['f_record_type'], $tmp['f_record_id']);
         }
     }
     $comp = DB::GetRow('SELECT id, created_on, created_by FROM company_data_1 WHERE active=1 AND f_email ' . DB::like() . ' %s AND id!=%d', array($email, $rset == 'company' ? $rid : -1));
     if ($comp) {
         return array('company', $comp['id']);
     }
     return false;
 }
Beispiel #16
0
 public function display_dashboard($tab_id)
 {
     //		Base_ActionBarCommon::add('add',__('Add applet'),$this->create_callback_href(array($this,'applets_list'),$tab_id));
     $default_dash = $this->get_module_variable('default');
     $colors = Base_DashboardCommon::get_available_colors();
     $applets = array(0 => array(), 1 => array(), 2 => array());
     $config_mode = $this->get_module_variable('config_mode', false);
     if ($default_dash || !Base_DashboardCommon::has_permission_to_manage_applets()) {
         $ret = DB::Execute('SELECT col,id,module_name,color FROM base_dashboard_default_applets WHERE tab=%d ORDER BY col,pos', array($tab_id));
     } else {
         $ret = DB::Execute('SELECT col,id,module_name,color FROM base_dashboard_applets WHERE user_login_id=%d AND tab=%d ORDER BY pos', array(Base_AclCommon::get_user(), $tab_id));
     }
     while ($row = $ret->FetchRow()) {
         $applets[$row['col']][] = $row;
     }
     print '<div id="dashboard" style="width: 100%;">';
     for ($j = 0; $j < 3; $j++) {
         print '<div id="dashboard_applets_' . $tab_id . '_' . $j . '" style="width:33%;min-height:200px;padding-bottom:10px;vertical-align:top;display:inline-block">';
         foreach ($applets[$j] as $row) {
             if (!is_callable(array($row['module_name'] . 'Common', 'applet_caption'))) {
                 continue;
             }
             $cap = call_user_func(array($row['module_name'] . 'Common', 'applet_caption'));
             if (!$cap || ModuleManager::is_installed($row['module_name']) == -1) {
                 //if its invalid entry
                 continue;
             }
             $m = $this->init_module($row['module_name'], null, $row['id']);
             $opts = array();
             $opts['title'] = $cap;
             $opts['toggle'] = true;
             $opts['href'] = null;
             $opts['go'] = false;
             $opts['go_function'] = 'body';
             $opts['go_arguments'] = array();
             $opts['go_constructor_arguments'] = array();
             $opts['actions'] = array();
             $opts['id'] = $row['id'];
             $th = $this->init_module(Base_Theme::module_name());
             if ($config_mode || !$m) {
                 $content = '';
             } else {
                 $content = $this->get_html_of_module($m, array($this->get_values($row['id'], $row['module_name']), &$opts, $row['id']), 'applet');
             }
             $th->assign('content', '<div class="content">' . $content . '</div>');
             $th->assign('handle_class', 'handle');
             $th->assign('fixed', !($default_dash || Base_DashboardCommon::has_permission_to_manage_applets()));
             if ($opts['toggle'] && !$config_mode) {
                 $th->assign('toggle', '<a class="toggle" ' . Utils_TooltipCommon::open_tag_attrs(__('Toggle')) . '>=</a>');
             }
             foreach ($opts['actions'] as $k => $v) {
                 if (!$v) {
                     unset($opts['actions'][$k]);
                 }
             }
             if ($opts['go']) {
                 $opts['href'] = $this->create_main_href($row['module_name'], $opts['go_function'], $opts['go_arguments'], $opts['go_constructor_arguments']);
             }
             if ($opts['href']) {
                 $th->assign('href', '<a class="href" ' . Utils_TooltipCommon::open_tag_attrs(__('Fullscreen')) . ' ' . $opts['href'] . '>G</a>');
             }
             if ($default_dash || Base_DashboardCommon::has_permission_to_manage_applets()) {
                 $th->assign('remove', Base_DashboardCommon::get_remove_applet_button($row['id'], $default_dash));
                 if (!$config_mode) {
                     $th->assign('configure', '<a class="configure" ' . Utils_TooltipCommon::open_tag_attrs(__('Configure')) . ' ' . $this->create_callback_href(array($this, 'configure_applet'), array($row['id'], $row['module_name'])) . '>c</a>');
                 }
             }
             $th->assign('caption', $opts['title']);
             $th->assign('color', $colors[$row['color']]['class']);
             $th->assign('actions', $opts['actions']);
             $th->assign('config_mode', $config_mode);
             print '<div class="applet" id="ab_item_' . $row['id'] . '">';
             $th->display();
             print '</div>';
         }
         print '</div>';
     }
     print '</div>';
 }
Beispiel #17
0
 private function display_module_entry($module)
 {
     $installed = ModuleManager::is_installed($module) >= 0;
     $install_href = $installed ? '' : $this->create_callback_href(array($this, '_install_module'), array($module));
     $install_link = " - " . ($install_href ? "<a {$install_href}>" . __('Install module') . "</a>" : 'Module already installed');
     print htmlspecialchars($module) . "{$install_link}<br/>";
 }
Beispiel #18
0
 public function chat($big = false, $uid = null)
 {
     $to =& $this->get_module_variable('to', "all");
     eval_js('shoutbox_uid="' . $to . '"');
     if (Base_AclCommon::is_user()) {
         //initialize HTML_QuickForm
         $qf = $this->init_module(Libs_QuickForm::module_name());
         /*            $myid = Base_AclCommon::get_user();
                 	if(Base_User_SettingsCommon::get('Apps_Shoutbox','enable_im')) {
                 	    $adm = Base_User_SettingsCommon::get_admin('Apps_Shoutbox','enable_im');
                 	    if(ModuleManager::is_installed('CRM_Contacts')>=0) {
                     	    $emps = DB::GetAssoc('SELECT l.id,IF(cd.f_last_name!=\'\',CONCAT(cd.f_last_name,\' \',cd.f_first_name,\' (\',l.login,\')\'),l.login) as name FROM user_login l LEFT JOIN contact_data_1 cd ON (cd.f_login=l.id AND cd.active=1) LEFT JOIN base_user_settings us ON (us.user_login_id=l.id AND module=\'Apps_Shoutbox\' AND variable=\'enable_im\') WHERE l.active=1 AND l.id!=%d AND (us.value=%s OR us.value is '.($adm?'':'not ').'null) ORDER BY name',array($myid,serialize(1)));			    
         		        } else
             		        $emps = DB::GetAssoc('SELECT l.id,l.login FROM user_login l LEFT JOIN base_user_settings us ON (us.user_login_id=l.id AND module=\'Apps_Shoutbox\' AND variable=\'enable_im\') WHERE l.active=1 AND l.id!=%d AND (us.value=%s OR us.value is '.($adm?'':'not ').'null) ORDER BY l.login',array($myid,serialize(1)));
             		} else $emps = array();
             		if(ModuleManager::is_installed('Tools_WhoIsOnline')>=0) {
             		    $online = Tools_WhoIsOnlineCommon::get_ids();
             		    foreach($online as $id) {
             		        if(isset($emps[$id])) 
             		            $emps[$id] = '* '.$emps[$id] ;
             		    }
             		}
                		$qf->addElement('select','to',__('To'),array('all'=>'['.__('All').']')+$emps,array('id'=>'shoutbox_to'.($big?'_big':''),'onChange'=>'shoutbox_uid=this.value;shoutbox_refresh'.($big?'_big':'').'()'));*/
         $myid = Base_AclCommon::get_user();
         if (Base_User_SettingsCommon::get('Apps_Shoutbox', 'enable_im') && ModuleManager::is_installed('Tools_WhoIsOnline') >= 0) {
             $adm = Base_User_SettingsCommon::get_admin('Apps_Shoutbox', 'enable_im');
             $online = Tools_WhoIsOnlineCommon::get_ids();
             if ($online) {
                 if (ModuleManager::is_installed('CRM_Contacts') >= 0) {
                     $emps = DB::GetAssoc('SELECT l.id,' . DB::Concat(DB::qstr("* "), DB::ifelse('cd.f_last_name!=\'\'', DB::concat('cd.f_last_name', DB::qstr(' '), 'cd.f_first_name', DB::qstr(' ('), 'l.login', DB::qstr(')')), 'l.login')) . ' as name FROM user_login l LEFT JOIN contact_data_1 cd ON (cd.f_login=l.id AND cd.active=1) LEFT JOIN base_user_settings us ON (us.user_login_id=l.id AND module=\'Apps_Shoutbox\' AND variable=\'enable_im\') WHERE l.active=1 AND l.id!=%d AND (us.value=%s OR us.value is ' . ($adm ? '' : 'not ') . 'null) AND l.id IN (' . implode(',', $online) . ') ORDER BY name', array($myid, serialize(1)));
                 } else {
                     $emps = DB::GetAssoc('SELECT l.id,' . DB::Concat(DB::qstr("* "), 'l.login') . ' FROM user_login l LEFT JOIN base_user_settings us ON (us.user_login_id=l.id AND module=\'Apps_Shoutbox\' AND variable=\'enable_im\') WHERE l.active=1 AND l.id!=%d AND (us.value=%s OR us.value is ' . ($adm ? '' : 'not ') . 'null) AND l.id IN (' . implode(',', $online) . ') ORDER BY l.login', array($myid, serialize(1)));
                 }
             } else {
                 $emps = array();
             }
         } else {
             $emps = array();
         }
         $e = $qf->addElement('autoselect', 'shoutbox_to', __('To'), array('all' => '[' . __('All') . ']') + $emps, array(array($this->get_type() . 'Common', 'user_search'), array()), array($this->get_type() . 'Common', 'user_format'));
         $e->setAttribute('id', 'shoutbox_to' . ($big ? '_big' : ''));
         $e->setAttribute('onChange', 'shoutbox_uid=this.value;shoutbox_refresh' . ($big ? '_big' : '') . '()');
         if (!Base_User_SettingsCommon::get('Apps_Shoutbox', 'enable_im')) {
             $qf->freeze(array('shoutbox_to'));
         }
         //create text box
         $qf->addElement($big ? 'textarea' : 'textarea', 'post', __('Message'), 'class="border_radius_6px" id="shoutbox_text' . ($big ? '_big' : '') . '"');
         $qf->addRule('post', __('Field required'), 'required');
         //create submit button
         $qf->addElement('submit', 'submit_button', __('Send'), 'id="shoutbox_button' . ($big ? '_big' : '') . '"');
         //add it
         $qf->setRequiredNote(null);
         $qf->setDefaults(array('shoutbox_to' => $to));
         $theme = $this->init_module(Base_Theme::module_name());
         $qf->assign_theme('form', $theme);
         //confirm when sending messages to all
         eval_js("jq('#shoutbox_button, #shoutbox_button_big').click(function() {\n      \t\t\t\t\tvar submit = true;\n\t\t    \t\t\tif (jq('#shoutbox_to').val() == 'all' && !confirm('" . __('Send message to all?') . "')) {\n         \t\t\t\t\tsubmit = false;\n      \t\t\t\t\t}\n\t\t    \n\t\t    \t\t\treturn submit;\t\t    \t\t\t\n\t\t\t\t\t});");
         //if submited
         if ($qf->validate()) {
             //get post group
             $msg = $qf->exportValue('post');
             $to = $qf->exportValue('shoutbox_to');
             //get msg from post group
             $msg = Utils_BBCodeCommon::optimize($msg);
             //get logged user id
             $user_id = Base_AclCommon::get_user();
             //clear text box and focus it
             eval_js('$(\'shoutbox_text' . ($big ? '_big' : '') . '\').value=\'\';focus_by_id(\'shoutbox_text' . ($big ? '_big' : '') . '\');shoutbox_uid="' . $to . '"');
             //insert to db
             DB::Execute('INSERT INTO apps_shoutbox_messages(message,base_user_login_id,to_user_login_id) VALUES(%s,%d,%d)', array(htmlspecialchars($msg, ENT_QUOTES, 'UTF-8'), $user_id, is_numeric($to) ? $to : null));
         }
     } else {
         print __('Please log in to post message') . '<br>';
         return;
     }
     $theme->assign('board', '<div id=\'shoutbox_board' . ($big ? '_big' : '') . '\'></div>');
     $theme->assign('header', __('Shoutbox'));
     $theme->display('chat_form' . ($big ? '_big' : ''));
     //if shoutbox is diplayed, call myFunctions->refresh from refresh.php file every 5s
     eval_js_once('shoutbox_refresh' . ($big ? '_big' : '') . ' = function(){if(!$(\'shoutbox_board' . ($big ? '_big' : '') . '\')) return;' . 'new Ajax.Updater(\'shoutbox_board' . ($big ? '_big' : '') . '\',\'modules/Apps/Shoutbox/refresh.php\',{method:\'get\', parameters: { uid: shoutbox_uid }});' . '};setInterval(\'shoutbox_refresh' . ($big ? '_big' : '') . '()\',' . ($big ? '10000' : '30000') . ')');
     eval_js('shoutbox_refresh' . ($big ? '_big' : '') . '()');
 }
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
//ModuleManager::uninstall($module_to_uninstall);
if (ModuleManager::is_installed('Base_EpesiStore') === -1) {
    ModuleManager::install('Base_EpesiStore');
    ModuleManager::create_load_priority_array();
} else {
    PatchUtil::db_alter_column('epesi_store_modules', 'version', 'C(10)');
}
Beispiel #20
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
$modules = array('Apps_Forum', 'Apps_Gallery', 'Apps_StaticPage', 'Apps_TwisterGame', 'Base_ModuleManager', 'Libs_Lytebox', 'Tests_BookmarkBrowser', 'Utils_BookmarkBrowser', 'Tests_Lytebox', 'Tools_FontSize', 'Utils_Gallery', 'Utils_BookmarkBrowser');
foreach ($modules as $m) {
    if (DB::GetOne('SELECT 1 FROM modules WHERE name=%s', array($m)) && !is_dir('modules/' . str_replace('_', '/', $m))) {
        DB::Execute('DELETE FROM modules WHERE name=%s', array($m));
        Base_ThemeCommon::uninstall_default_theme($m);
        ModuleManager::remove_data_dir($m);
    }
}
if (ModuleManager::is_installed('Utils_RecordBrowser_RecordPickerFS') < 0) {
    ModuleManager::install('Utils_RecordBrowser_RecordPickerFS', 0, false);
}
if (ModuleManager::is_installed('Utils_RecordBrowser_RecordPicker') < 0) {
    ModuleManager::install('Utils_RecordBrowser_RecordPicker');
}
Beispiel #21
0
 public function filters()
 {
     $form = $this->init_module('Libs/QuickForm');
     $form->addElement('header', 'display', __('Show'));
     if (ModuleManager::is_installed('CRM/Meeting') != -1) {
         $form->addElement('checkbox', 'events', __('Meetings'), null, array('onchange' => $form->get_submit_form_js()));
     }
     if (ModuleManager::is_installed('CRM/Tasks') != -1) {
         $form->addElement('checkbox', 'tasks', __('Tasks'), null, array('onchange' => $form->get_submit_form_js()));
     }
     if (ModuleManager::is_installed('CRM/PhoneCall') != -1) {
         $form->addElement('checkbox', 'phonecalls', __('Phonecalls'), null, array('onchange' => $form->get_submit_form_js()));
     }
     $form->addElement('select', 'activities_date', str_replace(' ', '&nbsp;', __('Activities date')), array(0 => __('Future'), 1 => __('Past'), 2 => __('All time')), array('onchange' => $form->get_submit_form_js()));
     $form->addElement('checkbox', 'closed', __('Closed'), null, array('onchange' => $form->get_submit_form_js()));
     $old_display = $this->get_module_variable('display_options', array('events' => ModuleManager::is_installed('CRM/Meeting') != -1, 'tasks' => ModuleManager::is_installed('CRM/Tasks') != -1, 'phonecalls' => ModuleManager::is_installed('CRM/PhoneCall') != -1, 'closed' => 1, 'activities_date' => 2));
     $form->setDefaults($old_display);
     $form->assign_theme('form', $this->theme);
     if ($form->validate()) {
         $this->display = $form->exportValues();
         foreach (array('events', 'tasks', 'phonecalls', 'closed', 'activities_date') as $v) {
             if (!isset($this->display[$v])) {
                 $this->display[$v] = false;
             }
         }
     } else {
         $this->display = $old_display;
     }
     $this->activities_date = isset($this->display['activities_date']) ? $this->display['activities_date'] : 0;
     $this->set_module_variable('display_options', $this->display);
 }
Beispiel #22
0
 public function body()
 {
     if (isset(Base_BoxCommon::$override_box_main)) {
         $this->pack_module(Base_BoxCommon::$override_box_main);
         return;
     }
     $theme = $this->pack_module(Base_Theme::module_name());
     $ini = Base_BoxCommon::get_ini_file();
     if (!$ini) {
         print __('Unable to read Base/Box/default.ini file! Please create one, or change theme.');
         $this->pack_module(Base_Theme_Administrator::module_name(), null, 'admin');
         return;
     }
     $ini_file = parse_ini_file($ini, true);
     $logged = Base_AclCommon::is_user();
     $theme->assign('logged', $logged);
     $containers = array();
     $containers['main'] = array('module' => null, 'name' => '');
     //so 'main' is first in array
     $name = 0;
     foreach ($ini_file as $tag => $opts) {
         $name++;
         if ($logged && $opts['display'] == 'anonymous' || !$logged && $opts['display'] == 'logged') {
             continue;
         }
         if (isset($opts['function'])) {
             $containers[$tag]['function'] = $opts['function'];
             $containers[$tag]['arguments'] = null;
         }
         if (isset($opts['arguments'])) {
             $containers[$tag]['arguments'] = $opts['arguments'];
         }
         if (isset($opts['module'])) {
             $containers[$tag]['module'] = $opts['module'];
         } else {
             trigger_error('No module specified.', E_USER_ERROR);
         }
         $containers[$tag]['name'] = $tag;
     }
     if (isset($containers['main'])) {
         $containers['main']['name'] = 'main_0';
     }
     if (isset($_REQUEST['base_box_pop_main'])) {
         $pop_main = $_REQUEST['base_box_pop_main'];
         unset($_REQUEST['base_box_pop_main']);
     } else {
         $pop_main = false;
     }
     if ($this->isset_module_variable('main')) {
         $mains = $this->get_module_variable('main');
         if ($pop_main) {
             while ($pop_main--) {
                 array_pop($mains);
             }
             $pop_main = true;
         }
         $main = array_pop($mains);
         if (isset($main['module']) && $main['module'] != null) {
             $containers['main'] =& $main;
         }
         foreach ($mains as $k => $m) {
             if (ModuleManager::is_installed($m['module']) >= 0) {
                 $this->freeze_module($m['module'], isset($m['name']) ? $m['name'] : null);
             }
         }
     } else {
         $mains = array();
     }
     if (isset($_REQUEST['box_main_href'])) {
         if (!isset($_SESSION['client']['base_box_hrefs'])) {
             $_SESSION['client']['base_box_hrefs'] = array();
         }
         $hs =& $_SESSION['client']['base_box_hrefs'];
         if (isset($hs[$_REQUEST['box_main_href']])) {
             $rh = $hs[$_REQUEST['box_main_href']];
             $href = $rh['m'];
             $containers['main']['module'] = $href;
             if (isset($rh['f'])) {
                 $containers['main']['function'] = $rh['f'];
             } else {
                 unset($containers['main']['function']);
             }
             if (isset($rh['a'])) {
                 $containers['main']['arguments'] = $rh['a'];
             } else {
                 unset($containers['main']['arguments']);
             }
             if (isset($rh['c'])) {
                 $containers['main']['constructor_arguments'] = $rh['c'];
             } else {
                 unset($containers['main']['constructor_arguments']);
             }
             $mains = array();
             $pop_main = true;
         }
         unset($_REQUEST['box_main_href']);
         $hs = array();
     }
     array_push($mains, $containers['main']);
     $main_length = count($mains);
     $this->set_module_variable('main', $mains);
     //      Epesi::alert(print_r($mains,true));
     //      $containers['main']['name'] .= '_'.$main_length;
     //print_r($containers);
     $this->modules = array();
     foreach ($containers as $k => $v) {
         ob_start();
         if (ModuleManager::is_installed($v['module']) != -1) {
             $module_type = str_replace('/', '_', $v['module']);
             if (!isset($v['name'])) {
                 $v['name'] = null;
             }
             if (isset($href) && $k == 'main') {
                 $this->modules[$k] = $this->init_module($module_type, isset($v['constructor_arguments']) ? $v['constructor_arguments'] : null, $v['name'], true);
             } else {
                 $this->modules[$k] = $this->init_module($module_type, isset($v['constructor_arguments']) ? $v['constructor_arguments'] : null, $v['name']);
             }
             if ($k == 'main' && $pop_main) {
                 $this->modules[$k]->set_reload(true);
             }
             if (isset($v['function'])) {
                 $this->display_module($this->modules[$k], isset($v['arguments']) ? $v['arguments'] : null, $v['function']);
             } elseif (isset($v['arguments'])) {
                 $this->display_module($this->modules[$k], $v['arguments']);
             } else {
                 $this->display_module($this->modules[$k]);
             }
         }
         $theme->assign($k, ob_get_contents());
         ob_end_clean();
     }
     //main output
     $version_no = Base_BoxCommon::update_version_check_indicator();
     if (SUGGEST_DONATION) {
         $theme->assign('donate', Utils_TooltipCommon::create('<a target="_blank" href="http://epe.si/donate/">' . __('Support EPESI!') . '</a>', '<center>' . __('If you find our software useful, please support us by making a %s.', array(__('donation'))) . '<br/>' . __('Your funding will help to ensure continued development of this project.') . '<br/>' . __('Click for details.') . '</center>', false, 500));
     }
     // Consider moving this code properly as initated module by *.ini file
     $theme->assign('home', array('href' => Base_HomePageCommon::get_href(), 'label' => __('Home')));
     $theme->assign('version_no', $version_no);
     $theme->display();
 }
Beispiel #23
0
    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());

        $form = $this->init_module('Libs/QuickForm');
        $opts = Utils_RecordBrowserCommon::list_installed_recordsets('%caption (%tab)');
		asort($opts);
		$first = array_keys($opts);
		$first = reset($first);
        $form->addElement('select', 'recordset', __('Recordset'), $opts, array('onchange'=>$form->get_submit_form_js()));
        if ($form->validate()) {
            $tab = $form->exportValue('recordset');
            $this->set_module_variable('admin_browse_recordset', $tab);
        }
        $tab = $this->get_module_variable('admin_browse_recordset', $first);
        $form->setDefaults(array('recordset'=>$tab));
        $form->display_as_column();
        if ($tab) {
			$this->record_management($tab);
		}
        $custom_recordsets_module = 'Utils/RecordBrowser/CustomRecordsets';
        if (ModuleManager::is_installed($custom_recordsets_module) >= 0) {
            $href = $this->create_callback_href(array('Base_BoxCommon', 'push_module'), array($custom_recordsets_module, 'admin'));
            Base_ActionBarCommon::add('settings', __('Custom Recordsets'), $href);
        }
    }
Beispiel #24
0
 public static function submit_task($values, $mode)
 {
     $me = CRM_ContactsCommon::get_my_record();
     switch ($mode) {
         case 'display':
             $values['title'] = __('Follow-up') . ': ' . $values['title'];
             $values['status'] = 0;
             $values['deadline'] = date('Y-m-d', strtotime('+1 day'));
             $ret = array();
             $cus = reset($values['customers']);
             if (ModuleManager::is_installed('CRM/Meeting') >= 0) {
                 $ret['new']['event'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('New Meeting')) . ' ' . Utils_RecordBrowserCommon::create_new_record_href('crm_meeting', 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, 'employees' => $values['employees'], 'customers' => $values['customers'], 'status' => 0), 'none', false) . '><img border="0" src="' . Base_ThemeCommon::get_template_file('CRM_Calendar', 'icon-small.png') . '" /></a>';
             }
             $ret['new']['task'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('New Task')) . ' ' . Utils_RecordBrowserCommon::create_new_record_href('task', $values) . '><img border="0" src="' . Base_ThemeCommon::get_template_file('CRM_Tasks', 'icon-small.png') . '" /></a>';
             if (ModuleManager::is_installed('CRM/PhoneCall') >= 0) {
                 $ret['new']['phonecall'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('New Phonecall')) . ' ' . Utils_RecordBrowserCommon::create_new_record_href('phonecall', 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'], 'customer' => $cus, 'status' => 0), '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('task/' . $values['id']);
             return $ret;
         case 'adding':
             $values['deadline_time'] = strtotime(date('Y-m-d') . ' 23:59:59');
             $values['permission'] = Base_User_SettingsCommon::get('CRM_Common', 'default_record_permission');
             break;
         case 'add':
             break;
         case 'edit':
             $old_values = Utils_RecordBrowserCommon::get_record('task', $values['id']);
             $old_related = array_merge($old_values['employees'], $old_values['customers']);
         case 'added':
             if (isset($values['follow_up'])) {
                 CRM_FollowupCommon::add_tracing_notes($values['follow_up'][0], $values['follow_up'][1], $values['follow_up'][2], 'task', $values['id'], $values['title']);
             }
             self::subscribed_employees($values);
             $related = array_merge($values['employees'], $values['customers']);
             foreach ($related as $v) {
                 if ($mode === 'edit' && in_array($v, $old_related)) {
                     continue;
                 }
                 if (!is_numeric($v)) {
                     list($t, $id) = explode(':', $v);
                 } else {
                     $t = 'P';
                     $id = $v;
                 }
                 if ($t == 'P') {
                     $t = 'contact';
                 } else {
                     $t = 'company';
                 }
                 $subs = Utils_WatchdogCommon::get_subscribers($t, $id);
                 foreach ($subs as $s) {
                     Utils_WatchdogCommon::user_subscribe($s, 'task', $values['id']);
                 }
             }
             break;
     }
     return $values;
 }
Beispiel #25
0
 public function quick_access_menu()
 {
     $this->set_inline_display(true);
     // preparing quick access menu
     if (ModuleManager::is_installed(Base_Menu_QuickAccessCommon::module_name()) >= 0) {
         $qaccess_menu = Base_Menu_QuickAccessCommon::quick_access_menu();
         if (is_array($qaccess_menu)) {
             Base_MenuCommon::add_default_menu($qaccess_menu, Base_Menu_QuickAccessCommon::module_name());
         } else {
             $qaccess_menu = array();
         }
     } else {
         $qaccess_menu = array();
     }
     if (empty($qaccess_menu)) {
         return;
     }
     $menu_mod = $this->init_module("Utils/Menu", "horizontal");
     $this->build_menu($menu_mod, $qaccess_menu, false);
     $theme = $this->init_module(Base_Theme::module_name());
     $menu_mod->set_inline_display();
     $theme->assign('menu', $this->get_html_of_module($menu_mod));
     $theme->display();
 }
Beispiel #26
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
if (ModuleManager::is_installed('CRM_Tasks') == -1) {
    return;
}
Utils_RecordBrowserCommon::set_tpl('task', '');
Beispiel #27
0
 public function register_form($data = null)
 {
     if ($this->is_back()) {
         return false;
     }
     Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     $f = $this->init_module(Libs_QuickForm::module_name());
     $admin_email_tooltip = '<img ' . Utils_TooltipCommon::open_tag_attrs(__('This email will be used to send registation link and to contact Administator directly.'), false) . ' src="' . Base_ThemeCommon::get_icon('info') . '"/> ';
     $tax_id_tooltip = '<img ' . Utils_TooltipCommon::open_tag_attrs(__('Your company Tax ID for invoices.'), false) . ' src="' . Base_ThemeCommon::get_icon('info') . '"/> ';
     $f->addElement('text', 'company_name', __('Company Name'), array('maxlength' => 128));
     $f->addRule('company_name', __('Field required'), 'required');
     $f->addRule('company_name', __('Max length exceeded'), 'maxlength', 128);
     $f->addElement('text', 'short_name', __('Short Name'), array('maxlength' => 64));
     $f->addRule('short_name', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'phone', __('Phone'), array('maxlength' => 64));
     $f->addRule('phone', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'fax', __('Fax'), array('maxlength' => 64));
     $f->addRule('fax', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'email', __('Company email'), array('maxlength' => 128));
     $f->addRule('email', __('Max length exceeded'), 'maxlength', 128);
     $f->addRule('email', __('Invalid e-mail address'), 'email');
     $f->addElement('text', 'web_address', __('Web address'), array('maxlength' => 64));
     $f->addRule('web_address', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'address_1', __('Address 1'), array('maxlength' => 64));
     $f->addRule('address_1', __('Field required'), 'required');
     $f->addRule('address_1', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'address_2', __('Address 2'), array('maxlength' => 64));
     $f->addRule('address_2', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'city', __('City'), array('maxlength' => 64));
     $f->addRule('city', __('Field required'), 'required');
     $f->addRule('city', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('commondata', 'country', __('Country'), 'Countries');
     $f->addRule('country', __('Field required'), 'required');
     $f->addElement('commondata', 'zone', __('Zone'), array('Countries', 'country'), array('empty_option' => true));
     $f->addElement('text', 'postal_code', __('Postal Code'), array('maxlength' => 64));
     $f->addRule('postal_code', __('Field required'), 'required');
     $f->addRule('postal_code', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'tax_id', $tax_id_tooltip . __('Tax ID'), array('maxlength' => 64));
     $f->addRule('admin_email', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'admin_first_name', __('Administrator\'s first name'), array('maxlength' => 64));
     $f->addRule('admin_first_name', __('Field required'), 'required');
     $f->addRule('admin_first_name', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'admin_last_name', __('Administrator\'s last name'), array('maxlength' => 64));
     $f->addRule('admin_last_name', __('Field required'), 'required');
     $f->addRule('admin_last_name', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'admin_email', $admin_email_tooltip . __('Administrator\'s email'), array('maxlength' => 128));
     $f->addRule('admin_email', __('Field required'), 'required');
     $f->addRule('admin_email', __('Max length exceeded'), 'maxlength', 128);
     $f->addRule('admin_email', __('Invalid e-mail address'), 'email');
     if ($f->validate()) {
         $ret = $f->exportValues();
         $ret = Base_EssClientCommon::server()->register_installation_request($ret);
         if ($ret) {
             if (is_string($ret)) {
                 Base_EssClientCommon::set_license_key($ret);
             }
             location(array());
             return false;
         }
     }
     // set defaults
     print '<div class="important_notice">';
     print __('Enter Company and Administrator details. This data will be sent to EPESI Store Server to provide us with contact information. The data sent to EPESI Store Server is limited only to the data you enter using this form and what modules are being purchased and downloaded.');
     print '<br>';
     if ($data) {
         $f->setDefaults($data);
     } else {
         if (ModuleManager::is_installed('CRM_Contacts') > -1) {
             print '<span style="color:gray;font-size:10px;">' . __('Data below was auto-filled based on Main Company and first Super administrator. Make sure that the data is correct and change it if necessary.') . '</span>';
             $defaults = Base_EssClientCommon::get_possible_admin();
             $mc = CRM_ContactsCommon::get_main_company();
             if ($mc > 0) {
                 $company = CRM_ContactsCommon::get_company($mc);
                 if ($company) {
                     $defaults = array_merge($company, $defaults);
                 }
             }
             $f->setDefaults($defaults);
         }
     }
     if ($data) {
         if (isset($data['status']) && strcasecmp($data['status'], 'Confirmed') == 0) {
             print '<div style="color:gray;font-size:10px;">' . __('Updating Company data will require re-validation by our representative.') . '</div>';
         }
         print '<div style="color:red;font-size:10px;">' . __('Changing Administrator e-mail address will require e-mail confirmation.') . '</div>';
     }
     print '<center>';
     $f->addElement('submit', 'submit', $data ? __('Update') : __('Register'));
     $f->display_as_column();
     print '</center>';
     print '</div>';
     return true;
 }
Beispiel #28
0
 public function validate($data)
 {
     if (DEMO_MODE) {
         print 'You cannot modify installed modules in demo';
         return false;
     }
     @set_time_limit(0);
     $installed = array();
     $install = array();
     $uninstall = array();
     $anonymous_setup = false;
     foreach ($data as $k => $v) {
         ${$k} = $v;
     }
     foreach ($installed as $name => $new_version) {
         $old_version = ModuleManager::is_installed($name);
         if ($old_version == $new_version) {
             continue;
         }
         if ($old_version == -1 && $new_version >= 0) {
             $install[$name] = $new_version;
             continue;
         }
         if ($new_version == -2) {
             $uninstall[$name] = 1;
             $install[$name] = $old_version;
             continue;
         }
         if ($old_version >= 0 && $new_version == -1) {
             $uninstall[$name] = 1;
             continue;
         }
         if ($old_version < $new_version) {
             if (!ModuleManager::upgrade($name, $new_version)) {
                 return false;
             }
             continue;
         }
         if ($old_version > $new_version) {
             if (!ModuleManager::downgrade($name, $new_version)) {
                 return false;
             }
             continue;
         }
     }
     //uninstall
     $modules_prio_rev = array();
     foreach (ModuleManager::$modules as $k => $v) {
         $modules_prio_rev[] = $k;
     }
     $modules_prio_rev = array_reverse($modules_prio_rev);
     foreach ($modules_prio_rev as $k) {
         if (array_key_exists($k, $uninstall)) {
             if (!ModuleManager::uninstall($k)) {
                 return false;
             }
             if (count(ModuleManager::$modules) == 0) {
                 print 'No modules installed';
             }
         }
     }
     //install
     foreach ($install as $i => $v) {
         $post_install[$i] = $v;
         if (isset($uninstall[$i])) {
             if (!ModuleManager::install($i, $v, true, false)) {
                 return false;
             }
         } else {
             if (!ModuleManager::install($i, $v)) {
                 return false;
             }
         }
     }
     $processed = ModuleManager::get_processed_modules();
     $this->set_module_variable('post-install', $processed['install']);
     Base_ThemeCommon::create_cache();
     if (empty($post_install)) {
         Epesi::redirect();
     }
     return true;
 }
Beispiel #29
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
if (ModuleManager::is_installed('Base_Acl') == -1) {
    return;
}
@DB::DropTable('base_acl_clearance');
DB::CreateTable('base_acl_clearance', 'id I4 AUTO KEY,' . 'callback C(128)', array('constraints' => ''));
DB::Execute('INSERT INTO base_acl_clearance (callback) VALUES (%s)', array('Base_AclCommon::basic_clearance'));
if (ModuleManager::is_installed('CRM_Contacts') == -1) {
    return;
}
DB::Execute('INSERT INTO base_acl_clearance (callback) VALUES (%s)', array('CRM_ContactsCommon::crm_clearance'));
Beispiel #30
0
 public function construct($ev_mod, array $settings = null, $custom_new_event_href_js = null)
 {
     $this->custom_new_event_href_js = $custom_new_event_href_js;
     $this->settings = array_merge($this->settings, $settings);
     $this->event_module = str_replace('/', '_', $ev_mod);
     if (ModuleManager::is_installed($this->event_module) == -1) {
         trigger_error('Invalid event module: ' . $this->event_module, E_USER_ERROR);
     }
     $this->set_module_variable('event_module', $this->event_module);
     if (!is_array($this->settings['custom_rows'])) {
         $this->settings['custom_rows'] = array('timeless' => __('Timeless'));
     }
     //default views
     if ($this->settings['views'] === null) {
         $this->settings['views'] =& self::$views;
     }
     //default date
     if ($this->settings['default_date'] === null) {
         $this->settings['default_date'] = time();
     }
     $this->date =& $this->get_module_variable('date', $this->settings['default_date']);
     $this->date = strtotime(date('Y-m-d', $this->date));
     if ($this->isset_unique_href_variable('date')) {
         $this->set_date($this->get_unique_href_variable('date'));
     }
     if ($this->isset_unique_href_variable('week_date')) {
         $this->set_week_date($this->get_unique_href_variable('week_date'));
     }
     if ($this->isset_unique_href_variable('shift_week_day')) {
         $this->shift_week_day($this->get_unique_href_variable('shift_week_day'));
     }
     if (count($this->settings['views']) > 1) {
         $this->tb = $this->init_module(Utils_TabbedBrowser::module_name());
         foreach ($this->settings['views'] as $k => $v) {
             if (!in_array($v, self::$views)) {
                 trigger_error('Invalid view: ' . $v, E_USER_ERROR);
             }
             switch ($v) {
                 case 'Day':
                     $label = __('Day');
                     break;
                 case 'Week':
                     $label = __('Week');
                     break;
             }
             $this->tb->set_tab($label, array($this, strtolower($v)));
             if (strcasecmp($v, $this->settings['default_view']) == 0) {
                 $def_tab = $k;
             }
         }
         if (isset($def_tab)) {
             $this->tb->set_default_tab($def_tab);
         }
     }
     if ($this->isset_unique_href_variable('action')) {
         switch ($this->get_unique_href_variable('action')) {
             case 'add':
                 $this->push_event_action('add', array($this->get_unique_href_variable('time'), $this->get_unique_href_variable('timeless') == '0' ? false : $this->get_unique_href_variable('timeless')));
                 return;
             case 'switch':
                 $views = array_flip($this->settings['views']);
                 $view = $this->get_unique_href_variable('tab');
                 if (isset($views[$view])) {
                     $this->tb->switch_tab($views[$view]);
                 } else {
                     break;
                 }
                 $this->date = $this->get_unique_href_variable('time');
                 break;
         }
     } elseif (isset($_REQUEST['UCaction']) && isset($_REQUEST['UCev_id'])) {
         switch ($_REQUEST['UCaction']) {
             case 'delete':
                 $this->delete_event($_REQUEST['UCev_id']);
                 break;
             case 'move':
                 $this->move_event($_REQUEST['UCev_id'], $_REQUEST['UCdate']);
                 break;
             case 'view':
             case 'edit':
                 $this->push_event_action($_REQUEST['UCaction'], array($_REQUEST['UCev_id']));
                 return;
         }
     }
 }