当前位置: 首页>>代码示例>>PHP>>正文


PHP Utils_RecordBrowserCommon::new_record方法代码示例

本文整理汇总了PHP中Utils_RecordBrowserCommon::new_record方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils_RecordBrowserCommon::new_record方法的具体用法?PHP Utils_RecordBrowserCommon::new_record怎么用?PHP Utils_RecordBrowserCommon::new_record使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utils_RecordBrowserCommon的用法示例。


在下文中一共展示了Utils_RecordBrowserCommon::new_record方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create_contact

 public function create_contact($r)
 {
     global $OUTPUT;
     $mail = $r['record']['email'];
     require_once dirname(__FILE__) . '/epesi_contacts_addressbook_backend.php';
     $contacts = new epesi_contacts_addressbook_backend('CRM Contacts');
     $ret = $contacts->search('email', $mail, true, false);
     if (count($ret->records)) {
         $OUTPUT->show_message('contactexists', 'warning');
     } else {
         require_once dirname(__FILE__) . '/epesi_companies_addressbook_backend.php';
         $companies = new epesi_companies_addressbook_backend('CRM Companies');
         $ret = $companies->search('email', $mail, true, false);
         if (count($ret->records)) {
             $OUTPUT->show_message('contactexists', 'warning');
         } else {
             if (isset($r['record']['firstname']) && $r['record']['firstname'] !== "" && isset($r['record']['surname']) && $r['record']['surname'] !== "") {
                 $name = array($r['record']['firstname'], $r['record']['surname']);
             } else {
                 $name = explode(' ', $r['record']['name'], 2);
             }
             if (count($name) < 2) {
                 $OUTPUT->show_message('errorsavingcontact', 'warning');
             } else {
                 $loc = Base_RegionalSettingsCommon::get_default_location();
                 Utils_RecordBrowserCommon::new_record('contact', array('first_name' => $name[0], 'last_name' => $name[1], 'email' => $mail, 'permission' => 0, 'country' => $loc['country']));
                 $OUTPUT->show_message('addedsuccessfully', 'confirmation');
             }
         }
     }
     $OUTPUT->send();
     //    return array('abort'=>true);
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:33,代码来源:epesi_addressbook.php

示例2: install

 public function install()
 {
     Base_ThemeCommon::install_default_theme($this->get_type());
     $fields = array(array('name' => _M('Name'), 'type' => 'text', 'required' => true, 'param' => 16, 'extra' => false, 'visible' => true), array('name' => _M('Description'), 'type' => 'long text', 'required' => false, 'extra' => false), array('name' => _M('Percentage'), 'type' => 'float', 'required' => true, 'extra' => false, 'visible' => true));
     Utils_RecordBrowserCommon::install_new_recordset('data_tax_rates', $fields);
     Utils_RecordBrowserCommon::new_record('data_tax_rates', array('name' => 'Non-taxable', 'percentage' => 0));
     Utils_RecordBrowserCommon::set_caption('data_tax_rates', _M('Tax Rates'));
     Utils_RecordBrowserCommon::set_icon('data_tax_rates', Base_ThemeCommon::get_template_filename('Data/TaxRates', 'icon.png'));
     Utils_RecordBrowserCommon::add_access('data_tax_rates', 'view', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('data_tax_rates', 'add', array('ACCESS:employee', 'ACCESS:manager'));
     Utils_RecordBrowserCommon::add_access('data_tax_rates', 'edit', array('ACCESS:employee', 'ACCESS:manager'));
     Utils_RecordBrowserCommon::add_access('data_tax_rates', 'delete', array('ACCESS:employee', 'ACCESS:manager'));
     return true;
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:14,代码来源:TaxRatesInstall.php

示例3: mobile_rb_edit


//.........这里部分代码省略.........
                         }
                         $comp[$k] = $n;
                         unset($ext_rec[$v['id']]);
                     }
                     if (empty($multi_adv_params['order'])) {
                         natcasesort($comp);
                     }
                 }
                 if ($args['type'] === 'select') {
                     $comp = array('' => '---') + $comp;
                 }
                 $qf->addElement($args['type'], $args['id'], $label, $comp, array('id' => $args['id']));
                 if ($id !== false) {
                     $qf->setDefaults(array($args['id'] => $rec[$args['id']]));
                 }
                 break;
             case 'date':
                 $qf->addElement('date', $args['id'], $label, array('format' => 'd M Y', 'minYear' => date('Y') - 95, 'maxYear' => date('Y') + 5, 'addEmptyOption' => true, 'emptyOptionText' => '--'));
                 if ($val) {
                     $qf->setDefaults(array($args['id'] => $val));
                 }
                 break;
             case 'timestamp':
                 $qf->addElement('date', $args['id'], $label, array('format' => 'd M Y H:i', 'minYear' => date('Y') - 95, 'maxYear' => date('Y') + 5, 'addEmptyOption' => true, 'emptyOptionText' => '--'));
                 if ($val) {
                     $default = Base_RegionalSettingsCommon::time2reg($val, true, true, true, false);
                     $qf->setDefaults(array($args['id'] => $default));
                 }
                 break;
             case 'time':
                 $qf->addElement('date', $args['id'], $label, array('format' => 'H:i', 'addEmptyOption' => true, 'emptyOptionText' => '--'));
                 if ($val) {
                     $default = Base_RegionalSettingsCommon::time2reg($val, true, true, true, false);
                     $qf->setDefaults(array($args['id'] => $default));
                 }
                 break;
             case 'multiselect':
                 //ignore
                 if ($id === false) {
                     continue;
                 }
                 $val = Utils_RecordBrowserCommon::get_val($tab, $field, $rec, true, $args);
                 if ($val === '') {
                     continue;
                 }
                 $qf->addElement('static', $args['id'], $label);
                 $qf->setDefaults(array($args['id'] => $val));
                 unset($defaults[$args['id']]);
                 break;
         }
         if ($args['required']) {
             $qf->addRule($args['id'], __('Field required'), 'required');
         }
     }
     $qf->addElement('submit', 'submit_button', __('Save'), IPHONE ? 'class="button white"' : '');
     if ($qf->validate()) {
         $values = $qf->exportValues();
         foreach ($cols as $v) {
             if ($v['type'] == 'checkbox' && !isset($values[$v['id']])) {
                 $values[$v['id']] = 0;
             } elseif ($v['type'] == 'date') {
                 if (is_array($values[$v['id']]) && $values[$v['id']]['Y'] !== '' && $values[$v['id']]['M'] !== '' && $values[$v['id']]['d'] !== '') {
                     $values[$v['id']] = sprintf("%d-%02d-%02d", $values[$v['id']]['Y'], $values[$v['id']]['M'], $values[$v['id']]['d']);
                 } else {
                     $values[$v['id']] = '';
                 }
             } elseif ($v['type'] == 'timestamp') {
                 if ($values[$v['id']]['Y'] !== '' && $values[$v['id']]['M'] !== '' && $values[$v['id']]['d'] !== '' && $values[$v['id']]['H'] !== '' && $values[$v['id']]['i'] !== '') {
                     $timestamp = $values[$v['id']]['Y'] . '-' . $values[$v['id']]['M'] . '-' . $values[$v['id']]['d'] . ' ' . $values[$v['id']]['H'] . ':' . $values[$v['id']]['i'];
                     $values[$v['id']] = Base_RegionalSettingsCommon::reg2time($timestamp, true);
                 } else {
                     $values[$v['id']] = '';
                 }
             } elseif ($v['type'] == 'time') {
                 if ($values[$v['id']]['H'] !== '' && $values[$v['id']]['i'] !== '') {
                     $time = recalculate_time(date('Y-m-d'), $values[$v['id']]);
                     $timestamp = Base_RegionalSettingsCommon::reg2time(date('1970-01-01 H:i:s', $time), true);
                     $values[$v['id']] = date('1970-01-01 H:i:s', $timestamp);
                 } else {
                     $values[$v['id']] = '';
                 }
             }
         }
         foreach ($defaults as $k => $v) {
             if (!isset($values[$k])) {
                 $values[$k] = $v;
             }
         }
         if ($id !== false) {
             $values['id'] = $id;
             Utils_RecordBrowserCommon::update_record($tab, $id, $values);
         } else {
             $id = Utils_RecordBrowserCommon::new_record($tab, $values);
         }
         return false;
     }
     $renderer =& $qf->defaultRenderer();
     $qf->accept($renderer);
     print $renderer->toHtml();
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:101,代码来源:RecordBrowserCommon_0.php

示例4: post_install_process

 public static function post_install_process($val)
 {
     $comp_id = Utils_RecordBrowserCommon::new_record('company', array('company_name' => $val['cname'], 'short_name' => isset($val['sname']) ? $val['sname'] : '', 'address_1' => isset($val['address1']) ? $val['address1'] : '', 'address_2' => isset($val['address2']) ? $val['address2'] : '', 'country' => isset($val['country']) ? $val['country'] : '', 'zone' => isset($val['state']) ? $val['state'] : '', 'city' => isset($val['city']) ? $val['city'] : '', 'postal_code' => isset($val['postal']) ? $val['postal'] : '', 'phone' => isset($val['phone']) ? $val['phone'] : '', 'fax' => isset($val['fax']) ? $val['fax'] : '', 'permission' => '0', 'web_address' => isset($val['web']) ? $val['web'] : '', 'group' => array('other')));
     if (Acl::is_user()) {
         $mail = DB::GetOne('SELECT up.mail FROM user_password up WHERE up.user_login_id=%d', array(Acl::get_user()));
         Utils_RecordBrowserCommon::new_record('contact', array('first_name' => $val['fname'], 'last_name' => $val['lname'], 'address_1' => isset($val['address1']) ? $val['address1'] : '', 'address_2' => isset($val['address2']) ? $val['address2'] : '', 'country' => isset($val['country']) ? $val['country'] : '', 'zone' => isset($val['state']) ? $val['state'] : '', 'city' => isset($val['city']) ? $val['city'] : '', 'postal_code' => isset($val['postal']) ? $val['postal'] : '', 'work_phone' => isset($val['phone']) ? $val['phone'] : '', 'fax' => isset($val['fax']) ? $val['fax'] : '', 'web_address' => isset($val['web']) ? $val['web'] : '', 'company_name' => $comp_id, 'login' => Acl::get_user(), 'permission' => '0', 'email' => $mail, 'group' => array('office', 'field')));
     }
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:8,代码来源:ContactsInstall.php

示例5: view_entry


//.........这里部分代码省略.........

        if (self::$last_record===null) self::$last_record = $defaults;
        if($mode=='add')
            $form->setDefaults($defaults);

        switch ($mode) {
            case 'add':     $this->action = _M('New record'); break;
            case 'edit':    $this->action = _M('Edit record'); break;
            case 'view':    $this->action = _M('View record'); break;
            case 'history':    $this->action = _M('Record history view'); break;
        }

        $this->prepare_view_entry_details($this->record, $mode=='history'?'view':$mode, $id, $form);

        if ($mode==='edit' || $mode==='add')
            foreach($this->table_rows as $field => $args) {
                if (!$access[$args['id']])
                    $form->freeze($args['id']);
            }
        if ($form->exportValue('submited') && $form->validate()) {
            $values = $form->exportValues();
			
			foreach ($defaults as $k=>$v) {
				if (!isset($values[$k]) && isset($this->view_fields_permission[$k]) && !$this->view_fields_permission[$k]) $values[$k] = $v;
				if (isset($access[$k]) && !$access[$k]) $values[$k] = $v;
			}
            foreach ($this->table_rows as $v) {
                if ($v['type']=='checkbox' && !isset($values[$v['id']])) $values[$v['id']]=0;
            }
            $values['id'] = $id;
            foreach ($this->custom_defaults as $k=>$v)
                if (!isset($values[$k])) $values[$k] = $v;
            if ($mode=='add') {
                $id = Utils_RecordBrowserCommon::new_record($this->tab, $values);
                self::$clone_result = $id;
                self::$clone_tab = $this->tab;
                return $this->back();
            }
            $time_from = date('Y-m-d H:i:s', $this->get_module_variable('edit_start_time'));
            $ret = DB::Execute('SELECT * FROM '.$this->tab.'_edit_history WHERE edited_on>=%T AND edited_on<=%T AND '.$this->tab.'_id=%d',array($time_from, date('Y-m-d H:i:s'), $id));
            if ($ret->EOF) {
                $this->update_record($id,$values);
                return $this->back();
            }
            $this->dirty_read_changes($id, $time_from);
        }
		$form->add_error_closing_buttons();

        if (($mode=='edit' || $mode=='add') && $show_actions!==false) {
            Utils_ShortcutCommon::add(array('Ctrl','S'), 'function(){'.$form->get_submit_form_js().'}');
        }
        if ($mode=='edit') {
            $this->set_module_variable('edit_start_time',$time);
        }

        if ($show_actions!==false) {
            if ($mode=='view') {
                if ($this->get_access('edit',$this->record)) {
                    Base_ActionBarCommon::add('edit', __('Edit'), $this->create_callback_href(array($this,'navigate'), array('view_entry','edit',$id)));
                    Utils_ShortcutCommon::add(array('Ctrl','E'), 'function(){'.$this->create_callback_href_js(array($this,'navigate'), array('view_entry','edit',$id)).'}');
                }
                if ($this->get_access('delete',$this->record)) {
                    Base_ActionBarCommon::add('delete', __('Delete'), $this->create_confirm_callback_href(__('Are you sure you want to delete this record?'),array($this,'delete_record'),array($id)));
                }
                if ($this->get_access('add',$this->record)) {
                    Base_ActionBarCommon::add('clone',__('Clone'), $this->create_confirm_callback_href(__('You are about to create a copy of this record. Do you want to continue?'),array($this,'clone_record'),array($id)));
开发者ID:62BRAINS,项目名称:EPESI,代码行数:67,代码来源:RecordBrowser_0.php

示例6: new_record

 /**
  * Add new record to recordset, when array is supplied and return it's object
  * or just returns empty data object to fill it with data and perform save()
  * method.
  * @param array|null $array_or_null associative array of data to or null.
  * @return RBO_Record|null
  */
 public function new_record($array_or_null = null)
 {
     if (is_array($array_or_null)) {
         $id = Utils_RecordBrowserCommon::new_record($this->tab, $array_or_null);
         if (!is_numeric($id)) {
             return null;
         }
         $array_or_null['id'] = $id;
         $array_or_null['created_by'] = Acl::get_user();
         $array_or_null[':active'] = true;
         return $this->record_to_object($array_or_null);
     }
     return $this->record_to_object(array());
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:21,代码来源:Recordset.php

示例7: archive


//.........这里部分代码省略.........
     if (!isset($_SESSION['force_archive'])) {
         $_SESSION['force_archive'] = array();
     }
     foreach ($map as $k => $ret) {
         if (!$ret && !isset($_SESSION['force_archive'][$k]) && $verbose) {
             $_SESSION['force_archive'][$k] = 1;
             $rcmail->output->command('display_message', $this->gettext('contactnotfound'), 'error');
             return false;
         }
     }
     $attachments_dir = DATA_DIR . '/CRM_Roundcube/attachments/';
     $epesi_mails = array();
     if (!file_exists($attachments_dir)) {
         mkdir($attachments_dir);
     }
     foreach ($msgs as $k => $msg) {
         $contacts = $map[$k];
         $mime_map = array();
         foreach ($msg->mime_parts as $mid => $m) {
             $mime_map[$m->mime_id] = md5($k . microtime(true) . $mid);
         }
         if ($msg->has_html_part()) {
             //            $body = $msg->first_html_part();
             foreach ($msg->mime_parts as $mime_id => $part) {
                 $mimetype = strtolower($part->ctype_primary . '/' . $part->ctype_secondary);
                 if ($mimetype == 'text/html') {
                     $body = $rcmail->storage->get_message_part($msg->uid, $mime_id, $part);
                     if (isset($part->replaces)) {
                         $cid_map = $part->replaces;
                     } else {
                         $cid_map = array();
                     }
                     break;
                 }
             }
             foreach ($cid_map as $k => &$v) {
                 if (preg_match('/_part=(.*?)&/', $v, $matches)) {
                     $mid = $matches[1];
                     if (isset($mime_map[$mid])) {
                         $v = 'get.php?' . http_build_query(array('mail_id' => '__MAIL_ID__', 'mime_id' => $mime_map[$mid]));
                     }
                 } else {
                     unset($cid_map[$k]);
                 }
             }
             $body = rcmail_wash_html($body, array('safe' => true, 'inline_html' => true), $cid_map);
         } else {
             $body = '<pre>' . $msg->first_text_part() . '</pre>';
         }
         $date = rcube_imap_generic::strToTime($msg->get_header('DATE'));
         $headers = array();
         foreach ($msg->headers as $k => $v) {
             if (is_string($v) && $k != 'from' && $k != 'to' && $k != 'body_structure') {
                 $headers[] = $k . ': ' . rcube_mime::decode_mime_string((string) $v);
             }
         }
         $message_id = str_replace(array('<', '>'), '', $msg->get_header('MESSAGE-ID'));
         if (Utils_RecordBrowserCommon::get_records_count('rc_mails', array('message_id' => $message_id)) > 0) {
             $rcmail->output->command('display_message', $this->gettext('archived_duplicate'), 'warning');
             return false;
         }
         $employee = DB::GetOne('SELECT id FROM contact_data_1 WHERE active=1 AND f_login=%d', array($E_SESSION['user']));
         $data = array('message_id' => $message_id, 'references' => $msg->get_header('REFERENCES'), 'contacts' => $contacts, 'date' => $date, 'subject' => substr($msg->subject, 0, 256), 'body' => $body, 'headers_data' => implode("\n", $headers), 'from' => $rcmail->storage->decode_header($msg->headers->from), 'to' => $rcmail->storage->decode_header($msg->headers->to), 'employee' => $employee);
         $id = Utils_RecordBrowserCommon::new_record('rc_mails', $data);
         $epesi_mails[] = $id;
         foreach ($contacts as $c) {
             list($rs, $con_id) = explode(':', $c);
             if ($rs == 'P') {
                 Utils_WatchdogCommon::new_event('contact', $con_id, 'N_New mail');
             } else {
                 Utils_WatchdogCommon::new_event('company', $con_id, 'N_New mail');
             }
         }
         Utils_WatchdogCommon::new_event('contact', $employee, 'N_New mail');
         /*DB::Execute('INSERT INTO rc_mails_data_1(created_on,created_by,f_contacts,f_date,f_employee,f_subject,f_body,f_headers_data,f_direction) VALUES(%T,%d,%s,%T,%d,%s,%s,%s,%b)',array(
                       time(),$E_SESSION['user'],$contacts,$date,$employee,substr($msg->subject,0,256),$body,implode("\n",$headers),$sent_mbox));
           $id = DB::Insert_ID('rc_mails_data_1','id');*/
         foreach ($msg->mime_parts as $mid => $m) {
             if (!$m->disposition) {
                 continue;
             }
             if (isset($cid_map['cid:' . $m->content_id])) {
                 $attachment = 0;
             } else {
                 $attachment = 1;
             }
             DB::Execute('INSERT INTO rc_mails_attachments(mail_id,type,name,mime_id,attachment) VALUES(%d,%s,%s,%s,%b)', array($id, $m->mimetype, $m->filename, $mime_map[$m->mime_id], $attachment));
             if (!file_exists($attachments_dir . $id)) {
                 mkdir($attachments_dir . $id);
             }
             $fp = fopen($attachments_dir . $id . '/' . $mime_map[$m->mime_id], 'w');
             $msg->get_part_content($m->mime_id, $fp);
             fclose($fp);
         }
     }
     //$rcmail->output->command('delete_messages');
     $E_SESSION['rc_mails_cp'] = $epesi_mails;
     chdir($path);
     return true;
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:101,代码来源:epesi_archive.php

示例8: submit_contact

 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;
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:98,代码来源:ContactsCommon_0.php

示例9: add

	public static function add($group,$permission,$user,$note=null,$oryg=null,$file=null,$func=null,$args=null,$sticky=false,$note_title='',$crypted=false) {
		if(($oryg && !$file) || ($file && !$oryg))
		    trigger_error('Invalid add attachment call: missing original filename or temporary filepath',E_USER_ERROR);

        $old_user = Acl::get_user();
        if($old_user!=$user) Acl::set_user($user);
        $id = Utils_RecordBrowserCommon::new_record('utils_attachment',array('local'=>$group,'note'=>$note,'permission'=>$permission,'func'=>serialize($func),'args'=>serialize($args),'sticky'=>$sticky?1:0,'title'=>$note_title,'crypted'=>$crypted?1:0));
        if($old_user!=$user) Acl::set_user($old_user);

		if($file)
			self::add_file($id, $user, $oryg, $file);
		return $id;
	}
开发者ID:62BRAINS,项目名称:EPESI,代码行数:13,代码来源:AttachmentCommon_0.php

示例10: install

 public function install()
 {
     $this->create_data_dir();
     // create htaccess to prevent logs to be available on the internet
     $htaccess = $this->get_data_dir() . '.htaccess';
     $f = fopen($htaccess, 'w');
     if ($f === false) {
         print "Cannot create .htaccess file ({$htaccess}). " . "Your Roundcube logs may be available on the internet!";
     } else {
         fwrite($f, "deny from all\n");
         fclose($f);
     }
     Base_ThemeCommon::install_default_theme($this->get_type());
     $this->drop_all_rc_tables();
     if (DB::is_mysql()) {
         $f = file_get_contents('modules/CRM/Roundcube/RC/SQL/mysql.initial.sql');
     } else {
         $f = file_get_contents('modules/CRM/Roundcube/RC/SQL/postgres.initial.sql');
     }
     foreach (explode(';', $f) as $q) {
         $q = trim($q);
         if (!$q) {
             continue;
         }
         DB::Execute($q);
     }
     Utils_CommonDataCommon::new_array('CRM/Roundcube/Security', array('tls' => _M('TLS'), 'ssl' => _M('SSL')), true, true);
     //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('rc_related', $fields);
     Utils_RecordBrowserCommon::set_caption('rc_related', _M('Mail Related Recordsets'));
     Utils_RecordBrowserCommon::register_processing_callback('rc_related', array('CRM_RoundcubeCommon', 'processing_related'));
     Utils_RecordBrowserCommon::add_access('rc_related', 'view', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_related', 'add', 'ADMIN');
     Utils_RecordBrowserCommon::add_access('rc_related', 'edit', 'SUPERADMIN');
     Utils_RecordBrowserCommon::add_access('rc_related', 'delete', 'SUPERADMIN');
     Utils_RecordBrowserCommon::new_record('rc_related', array('recordset' => 'company'));
     Utils_RecordBrowserCommon::new_record('rc_related', array('recordset' => 'contact'));
     //accounts table
     $fields = array(array('name' => _M('EPESI User'), 'type' => 'integer', 'extra' => false, 'visible' => true, 'required' => true, 'display_callback' => array('CRM_RoundcubeCommon', 'display_epesi_user'), 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_epesi_user')), array('name' => _M('Email'), 'type' => 'text', 'extra' => false, 'visible' => true, 'required' => true, 'param' => 128), array('name' => _M('Account Name'), 'type' => 'text', 'extra' => false, 'visible' => true, 'required' => true, 'param' => 32, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_account_name')), array('name' => _M('Server'), 'type' => 'text', 'extra' => false, 'visible' => true, 'param' => '255', 'required' => true), array('name' => _M('Login'), 'type' => 'text', 'required' => true, 'param' => '255', 'extra' => false, 'visible' => true), array('name' => _M('Password'), 'type' => 'text', 'required' => true, 'extra' => false, 'param' => '255', 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_password'), 'display_callback' => array('CRM_RoundcubeCommon', 'display_password')), array('name' => _M('Security'), 'type' => 'commondata', 'param' => array('CRM/Roundcube/Security'), 'extra' => false, 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_security')), array('name' => _M('SMTP Server'), 'type' => 'text', 'extra' => false, 'visible' => false, 'param' => '255', 'required' => true), array('name' => _M('SMTP Auth'), 'type' => 'checkbox', 'extra' => false, 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_smtp_auth')), array('name' => _M('SMTP Login'), 'type' => 'text', 'required' => false, 'param' => '255', 'extra' => false, 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_smtp_login')), array('name' => _M('SMTP Password'), 'type' => 'text', 'extra' => false, 'param' => '255', 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_smtp_password'), 'display_callback' => array('CRM_RoundcubeCommon', 'display_password')), array('name' => _M('SMTP Security'), 'type' => 'commondata', 'param' => array('CRM/Roundcube/Security'), 'extra' => false, 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_smtp_security')), array('name' => _M('Default Account'), 'type' => 'checkbox', 'extra' => false, 'visible' => true, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_default_account')), array('name' => _M('Advanced'), 'type' => 'page_split'), array('name' => _M('Archive on sending'), 'type' => 'checkbox', 'extra' => true, 'visible' => false), array('name' => _M('Use EPESI Archive directories'), 'type' => 'checkbox', 'extra' => true, 'visible' => false), array('name' => _M('IMAP Root'), 'type' => 'text', 'param' => 32, 'extra' => true, 'visible' => false), array('name' => _M('IMAP Delimiter'), 'type' => 'text', 'param' => 8, 'extra' => true, 'visible' => false));
     Utils_RecordBrowserCommon::install_new_recordset('rc_accounts', $fields);
     Utils_RecordBrowserCommon::set_caption('rc_accounts', _M('Mail accounts'));
     Utils_RecordBrowserCommon::register_processing_callback('rc_accounts', array('CRM_RoundcubeCommon', 'submit_account'));
     $fields = array(array('name' => _M('Subject'), 'type' => 'text', 'param' => '256', 'extra' => false, 'visible' => true, 'required' => false, 'display_callback' => array('CRM_RoundcubeCommon', 'display_subject')), array('name' => _M('Count'), 'type' => 'calculated', 'extra' => false, 'visible' => true, 'required' => false, 'display_callback' => array('CRM_RoundcubeCommon', 'display_thread_count'), 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_thread_count')), array('name' => _M('Contacts'), 'type' => 'crm_company_contact', 'param' => array('field_type' => 'multiselect'), 'required' => false, 'extra' => false, 'visible' => true), array('name' => _M('First Date'), 'type' => 'timestamp', 'extra' => false, 'visible' => true, 'required' => false), array('name' => _M('Last Date'), 'type' => 'timestamp', 'extra' => false, 'visible' => true, 'required' => false), array('name' => _M('Attachments'), 'type' => 'calculated', 'extra' => false, 'visible' => true, 'display_callback' => array('CRM_RoundcubeCommon', 'display_thread_attachments'), 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_thread_attachments')));
     Utils_RecordBrowserCommon::install_new_recordset('rc_mail_threads', $fields);
     Utils_RecordBrowserCommon::set_caption('rc_mail_threads', _M('Mail Thread'));
     Utils_RecordBrowserCommon::new_addon('rc_mail_threads', 'CRM/Roundcube', 'thread_addon', _M('E-mails'));
     Utils_RecordBrowserCommon::set_search('rc_mail_threads', 2, -1);
     $fields = array(array('name' => _M('Subject'), 'type' => 'text', 'param' => '256', 'extra' => false, 'visible' => true, 'required' => false, 'display_callback' => array('CRM_RoundcubeCommon', 'display_subject')), array('name' => _M('Contacts'), 'type' => 'crm_company_contact', 'param' => array('field_type' => 'multiselect'), 'required' => false, 'extra' => false, 'visible' => true), array('name' => _M('Employee'), 'type' => 'crm_contact', 'param' => array('field_type' => 'select'), 'extra' => false, 'visible' => true, 'required' => false), array('name' => _M('Related'), 'type' => 'multiselect', 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_related'), 'param' => '__RECORDSETS__::;CRM_RoundcubeCommon::related_crits', 'extra' => false, 'required' => false, 'visible' => true), array('name' => _M('Date'), 'type' => 'timestamp', 'extra' => false, 'visible' => true, 'required' => false), array('name' => _M('Attachments'), 'type' => 'calculated', 'extra' => false, 'visible' => true, 'display_callback' => array('CRM_RoundcubeCommon', 'display_attachments'), 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_attachments')), array('name' => _M('Headers Data'), 'type' => 'long text', 'extra' => false, 'visible' => false, 'required' => false), array('name' => _M('Body'), 'type' => 'long text', 'extra' => false, 'visible' => false, 'required' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_body')), array('name' => _M('From'), 'type' => 'text', 'param' => 128, 'extra' => false, 'visible' => false, 'required' => false), array('name' => _M('To'), 'type' => 'text', 'param' => 4096, 'extra' => false, 'visible' => false, 'required' => false), array('name' => _M('Thread'), 'type' => 'select', 'param' => 'rc_mail_threads::Count', 'extra' => false, 'visible' => false, 'required' => false, 'display_callback' => array('CRM_RoundcubeCommon', 'display_mail_thread'), 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_mail_thread')), array('name' => _M('Message ID'), 'type' => 'text', 'param' => 128, 'extra' => false, 'visible' => false, 'required' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_hidden')), array('name' => _M('References'), 'type' => 'text', 'param' => 4096 * 4, 'extra' => false, 'visible' => false, 'required' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_hidden')));
     Utils_RecordBrowserCommon::install_new_recordset('rc_mails', $fields);
     Utils_RecordBrowserCommon::set_caption('rc_mails', _M('Mails'));
     Utils_RecordBrowserCommon::set_tpl('rc_mails', Base_ThemeCommon::get_template_filename('CRM/Roundcube', 'mails'));
     Utils_RecordBrowserCommon::register_processing_callback('rc_mails', array('CRM_RoundcubeCommon', 'submit_mail'));
     Utils_RecordBrowserCommon::set_search('rc_mails', 2, -1);
     DB::CreateIndex('rc_mails_thread_idx', 'rc_mails_data_1', 'f_thread');
     DB::CreateIndex('rc_mails_msgid_idx', 'rc_mails_data_1', 'f_message_id');
     Utils_RecordBrowserCommon::new_addon('rc_mails', 'CRM/Roundcube', 'mail_body_addon', _M('Body'));
     Utils_RecordBrowserCommon::new_addon('rc_mails', 'CRM/Roundcube', 'attachments_addon', _M('Attachments'));
     Utils_RecordBrowserCommon::new_addon('rc_mails', 'CRM/Roundcube', 'mail_headers_addon', _M('Headers'));
     @DB::DropTable('rc_mails_attachments');
     DB::CreateTable('rc_mails_attachments', '
         mail_id I4 NOTNULL,
         type C(32),
         name C(255),
         mime_id C(32),
         attachment I1 DEFAULT 1', array('constraints' => ', FOREIGN KEY (mail_id) REFERENCES rc_mails_data_1(ID)'));
     DB::CreateTable('rc_mails_attachments_download', '
         mail_id I4 NOTNULL,
         hash C(32),
         created_on T DEFTIMESTAMP', array('constraints' => ', FOREIGN KEY (mail_id) REFERENCES rc_mails_data_1(ID)'));
     Utils_RecordBrowserCommon::new_addon('contact', 'CRM/Roundcube', 'addon', _M('E-mails'));
     Utils_RecordBrowserCommon::new_addon('company', 'CRM/Roundcube', 'addon', _M('E-mails'));
     $fields = array(array('name' => _M('Record Type'), 'type' => 'hidden', 'param' => Utils_RecordBrowserCommon::actual_db_type('text', 64), 'required' => false, 'visible' => false, 'filter' => true, 'extra' => false), array('name' => _M('Record ID'), 'type' => 'hidden', 'param' => Utils_RecordBrowserCommon::actual_db_type('integer'), 'filter' => false, 'required' => false, 'extra' => false, 'visible' => false), array('name' => _M('Nickname'), 'type' => 'text', 'required' => true, 'param' => '64', 'extra' => false, 'visible' => true, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_nickname')), array('name' => _M('Email'), 'type' => 'email', 'required' => true, 'param' => array('unique' => true), 'extra' => false, 'visible' => true));
     Utils_RecordBrowserCommon::install_new_recordset('rc_multiple_emails', $fields);
     Utils_RecordBrowserCommon::set_favorites('rc_multiple_emails', true);
     Utils_RecordBrowserCommon::set_caption('rc_multiple_emails', _M('Mail addresses'));
     Utils_RecordBrowserCommon::set_icon('rc_multiple_emails', Base_ThemeCommon::get_template_filename('CRM/Roundcube', 'icon.png'));
     Utils_RecordBrowserCommon::set_search('rc_multiple_emails', 2, 0);
     Utils_RecordBrowserCommon::new_addon('contact', 'CRM/Roundcube', 'mail_addresses_addon', _M('E-mail addresses'));
     Utils_RecordBrowserCommon::new_addon('company', 'CRM/Roundcube', 'mail_addresses_addon', _M('E-mail addresses'));
     Variable::set('crm_roundcube_global_signature', "Message sent with EPESI - managing business your way!<br /><a href=\"http://epe.si\">http://epe.si</a>");
     Utils_RecordBrowserCommon::add_access('rc_accounts', 'view', 'ACCESS:employee', array('epesi_user' => 'USER_ID'));
     Utils_RecordBrowserCommon::add_access('rc_accounts', 'add', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_accounts', 'edit', 'ACCESS:employee', array(), array('epesi_user'));
     Utils_RecordBrowserCommon::add_access('rc_accounts', 'delete', 'ACCESS:employee', array('epesi_user' => 'USER_ID'));
     Utils_RecordBrowserCommon::add_access('rc_mails', 'view', 'ACCESS:employee', array(), array('headers_data'));
     Utils_RecordBrowserCommon::add_access('rc_mails', 'delete', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_mails', 'edit', 'ACCESS:employee', array(), array('subject', 'employee', 'date', 'headers_data', 'body', 'from', 'to', 'thread', 'message_id', 'references'));
     Utils_RecordBrowserCommon::add_access('rc_mail_threads', 'view', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_mail_threads', 'delete', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_multiple_emails', 'view', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_multiple_emails', 'add', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_multiple_emails', 'edit', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_multiple_emails', 'delete', 'ACCESS:employee');
     return true;
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:96,代码来源:RoundcubeInstall.php

示例11: create_thread

 public static function create_thread($id)
 {
     $m = Utils_RecordBrowserCommon::get_record('rc_mails', $id);
     $thread = $m['thread'];
     if (!$thread && $m['message_id']) {
         $thread = DB::GetOne('SELECT f_thread FROM rc_mails_data_1 WHERE f_references is not null AND f_references LIKE ' . DB::Concat('\'%%\'', '%s', '\'%%\'') . ' AND active=1', array($m['message_id']));
     }
     if (!$thread && $m['references']) {
         $thread = DB::GetOne('SELECT f_thread FROM rc_mails_data_1 WHERE f_message_id is not null AND %s LIKE ' . DB::Concat('\'%%\'', 'f_message_id', '\'%%\'') . ' AND active=1', array($m['references']));
     }
     if (!$thread) {
         $thread = Utils_RecordBrowserCommon::new_record('rc_mail_threads', array('subject' => $m['subject'], 'contacts' => array_unique(array_merge($m['contacts'], array('P:' . $m['employee']))), 'first_date' => $m['date'], 'last_date' => $m['date']));
     }
     Utils_RecordBrowserCommon::update_record('rc_mails', $id, array('thread' => $thread), false, null, true);
     $t = Utils_RecordBrowserCommon::get_record('rc_mail_threads', $thread);
     Utils_RecordBrowserCommon::update_record('rc_mail_threads', $thread, array('contacts' => array_unique(array_merge($t['contacts'], $m['contacts'], array('P:' . $m['employee']))), 'first_date' => strtotime($m['date']) < strtotime($t['first_date']) ? $m['date'] : $t['first_date'], 'last_date' => strtotime($m['date']) > strtotime($t['last_date']) ? $m['date'] : $t['last_date'], 'subject' => trim($m['references']) == '' || mb_strlen($m['subject']) < mb_strlen($t['subject']) ? $m['subject'] : $t['subject']));
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:17,代码来源:RoundcubeCommon_0.php

示例12: count

        $links_qty = $old_checkpoint->get('links_qty');
    } else {
        $links_qty = DB::GetOne('SELECT count(*) FROM utils_attachment_link');
        $old_checkpoint->set('links_qty', $links_qty);
    }
    while ($ret = DB::SelectLimit('SELECT * FROM utils_attachment_link ORDER BY id', 1, $links++)) {
        $link = $ret->FetchRow();
        if (!$link) {
            break;
        }
        Patch::set_message('Processing note: ' . $links . '/' . $links_qty);
        $old_checkpoint->require_time(2);
        $notes = DB::GetAll('SELECT * FROM utils_attachment_note WHERE attach_id=%d ORDER BY revision', $link['id']);
        $note = array_shift($notes);
        Acl::set_user($note['created_by']);
        $rid = Utils_RecordBrowserCommon::new_record('utils_attachment', array('title' => $link['title'], 'note' => $note['text'], 'permission' => $link['permission'], 'sticky' => $link['sticky'], 'crypted' => array('crypted' => $link['crypted']), 'func' => $link['func'], 'args' => $link['args'], '__date' => $note['created_on'], 'local' => $link['local']));
        //    DB::Execute('INSERT INTO utils_attachment_local(local,attachment) VALUES(%s,%d)',array($link['local'],$rid));
        $map[$link['id']] = $rid;
        foreach ($notes as $note) {
            Acl::set_user($note['created_by']);
            Utils_RecordBrowserCommon::update_record('utils_attachment', $rid, array('note' => $note['text'], '__date' => $note['created_on']));
        }
        Acl::set_user($us);
        $old_checkpoint->set('links', $links);
        $old_checkpoint->set('map', $map);
    }
}
$old_checkpoint->done();
Patch::set_message('Updating database');
$delete_old_fk_checkpoint = Patch::checkpoint('delete_old_fk');
if (!$delete_old_fk_checkpoint->is_done()) {
开发者ID:cretzu89,项目名称:EPESI,代码行数:31,代码来源:20140205_rb_rewrite.php

示例13: array

    $rs_checkpoint->done();
}
Patch::set_message('Processing addons');
$old_checkpoint = Patch::checkpoint('old');
if (!$old_checkpoint->is_done()) {
    $old = $old_checkpoint->get('old', array());
    if (empty($old) && ModuleManager::is_installed('Premium/RoundcubeCustomAddons') >= 0) {
        $old = Utils_RecordBrowserCommon::get_records('premium_roundcube_custom_addon');
        ModuleManager::uninstall('Premium/RoundcubeCustomAddons');
    }
    foreach ($old as $i => $r) {
        if ($r['recordset'] == 'company' || $r['recordset'] == 'contact') {
            continue;
        }
        $old_checkpoint->require_time(2);
        Utils_RecordBrowserCommon::new_record('rc_related', array('recordset' => $r['recordset']));
        unset($old[$i]);
        $old_checkpoint->set('old', $old);
    }
    $old_checkpoint->done();
}
Patch::set_message('Processing related');
$related_checkpoint = Patch::checkpoint('related');
if (!$related_checkpoint->is_done()) {
    while (1) {
        $related = $related_checkpoint->get('related', array());
        if (empty($related)) {
            $related = Utils_RecordBrowserCommon::get_records('rc_mails_assoc', array(), array(), array(), 10);
            if (empty($related)) {
                break;
            }
开发者ID:cretzu89,项目名称:EPESI,代码行数:31,代码来源:20150119_related.php


注:本文中的Utils_RecordBrowserCommon::new_record方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。