本文整理汇总了PHP中Utils_RecordBrowserCommon::update_record方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils_RecordBrowserCommon::update_record方法的具体用法?PHP Utils_RecordBrowserCommon::update_record怎么用?PHP Utils_RecordBrowserCommon::update_record使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils_RecordBrowserCommon
的用法示例。
在下文中一共展示了Utils_RecordBrowserCommon::update_record方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: defined
<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
$mails = Utils_RecordBrowserCommon::get_records('rc_mails');
foreach ($mails as $m) {
Utils_RecordBrowserCommon::update_record('rc_mails', $m['id'], array('message_id' => ltrim(rtrim($m['message_id'], '>'), '<')));
}
foreach ($mails as $m) {
CRM_RoundcubeCommon::create_thread($m['id']);
}
示例2: update_record
public function update_record($id,$values) {
Utils_RecordBrowserCommon::update_record($this->tab, $id, $values);
}
示例3: copy_company_data_subroutine
private static function copy_company_data_subroutine($values)
{
$access = Utils_RecordBrowserCommon::get_access('contact', 'edit', $values);
if (!$access) {
return;
}
/* First click should generate html code for leightbox and show it.
* This function is rarely used and we don't want to increase page size.
* To do this we use REQUEST variable UCD.
*
* We use module variable UCD to indicate that form was shown and we
* must check if it was submitted. If yes - do action. If it wasn't
* we should come back to initial state - do not print LB.
*/
if (!(isset($_REQUEST['UCD']) || Module::static_get_module_variable('CRM/Contacts', 'UCD', 0))) {
if (isset($values['company_name']) && $values['company_name']) {
Base_ActionBarCommon::add('edit', __('Copy company data'), Module::create_href(array('UCD' => true)));
}
}
if (isset($_REQUEST['UCD']) || Module::static_get_module_variable('CRM/Contacts', 'UCD', 0)) {
$ucd = Module::static_get_module_variable('CRM/Contacts', 'UCD', 0);
$ucd++;
if ($ucd > 1) {
Module::static_unset_module_variable('CRM/Contacts', 'UCD');
} else {
Module::static_set_module_variable('CRM/Contacts', 'UCD', $ucd);
}
$lid = 'UCDprompt';
$form = ModuleManager::new_instance('Libs_QuickForm', null, 'QFUCDprompt');
$form->construct();
$sel_val = array();
foreach (array_merge(array($values['company_name']), is_array($values['related_companies']) ? $values['related_companies'] : array()) as $id) {
$sel_val[$id] = self::company_format_default(self::get_company($id), true);
}
$form->addElement('select', 'company', __('Select company:'), $sel_val);
unset($sel_val);
$form->addElement('html', __('Select which fields should be copied:'));
$data = array(array('sid' => 'address_1', 'tid' => 'address_1', 'text' => __('Address 1'), 'checked' => true), array('sid' => 'address_2', 'tid' => 'address_2', 'text' => __('Address 2'), 'checked' => true), array('sid' => 'city', 'tid' => 'city', 'text' => __('City'), 'checked' => true), array('sid' => 'country', 'tid' => 'country', 'text' => __('Country'), 'checked' => true), array('sid' => 'zone', 'tid' => 'zone', 'text' => __('Zone'), 'checked' => true), array('sid' => 'postal_code', 'tid' => 'postal_code', 'text' => __('Postal Code'), 'checked' => true), array('sid' => 'phone', 'tid' => 'work_phone', 'text' => __('Phone as Work Phone'), 'checked' => false), array('sid' => 'fax', 'tid' => 'fax', 'text' => __('Fax'), 'checked' => false));
foreach ($data as $row) {
if (is_array($access) && isset($access[$row['tid']]) && $access[$row['tid']]) {
$form->addElement('checkbox', $row['sid'], $row['text'], '', $row['checked'] ? array('checked' => 'checked') : array());
}
}
$ok = $form->createElement('submit', 'submit', __('Confirm'), array('onclick' => 'leightbox_deactivate("' . $lid . '")'));
$cancel = $form->createElement('button', 'cancel', __('Cancel'), array('onclick' => 'leightbox_deactivate("' . $lid . '")'));
$form->addGroup(array($ok, $cancel));
if ($form->validate()) {
$Uvalues = $form->exportValues();
$fields = array();
foreach ($data as $row) {
if (array_key_exists($row['sid'], $Uvalues)) {
$fields[$row['tid']] = $row['sid'];
}
}
if (isset($Uvalues['company'])) {
$company = CRM_ContactsCommon::get_company($Uvalues['company']);
$new_data = array();
foreach ($fields as $k => $v) {
$new_data[$k] = $company[$v];
}
Utils_RecordBrowserCommon::update_record('contact', $values['id'], $new_data);
}
Module::static_unset_module_variable('CRM/Contacts', 'UCD');
location(array());
}
// set default to main company
if ($mc = self::get_main_company()) {
$form->setDefaults(array('company' => $mc));
}
$html = $form->toHtml();
Libs_LeightboxCommon::display($lid, $html);
Base_ActionBarCommon::add('edit', __('Copy company data'), Libs_LeightboxCommon::get_open_href($lid));
if (isset($_REQUEST['UCD'])) {
eval_js('leightbox_activate(\'' . $lid . '\')');
}
unset($_REQUEST['UCD']);
}
}
示例4: crm_event_update
public static function crm_event_update($id, $start, $duration, $timeless)
{
if (!Utils_RecordBrowserCommon::get_access('task', 'edit', self::get_task($id))) {
return false;
}
$deadline = $timeless ? date('Y-m-d 12:00:00', $start) : date('Y-m-d H:i:s', $start);
$values = array('deadline' => $deadline, 'timeless' => $timeless == true);
Utils_RecordBrowserCommon::update_record('task', $id, $values);
return true;
}
示例5: paste
public function paste($rs, $id)
{
if (isset($_SESSION['rc_mails_cp']) && is_array($_SESSION['rc_mails_cp']) && !empty($_SESSION['rc_mails_cp'])) {
foreach ($_SESSION['rc_mails_cp'] as $mid) {
$mail = Utils_RecordBrowserCommon::get_record('rc_mails', $mid);
if (!in_array($rs . '/' . $id, $mail['related'])) {
$mail['related'][] = $rs . '/' . $id;
Utils_RecordBrowserCommon::update_record('rc_mails', $mid, array('related' => $mail['related']));
}
}
location(array());
}
}
示例6: crm_event_update
public static function crm_event_update($id, $start, $duration, $timeless)
{
if ($timeless) {
return false;
}
if (!Utils_RecordBrowserCommon::get_access('phonecall', 'edit', self::get_phonecall($id))) {
return false;
}
$values = array('date_and_time' => date('Y-m-d H:i:s', $start));
Utils_RecordBrowserCommon::update_record('phonecall', $id, $values);
return true;
}
示例7: update_contacts_address
public function update_contacts_address($company, $fields)
{
$recs = CRM_ContactsCommon::get_contacts(array('company_name' => $company['id']), array('id'));
$new_data = array();
foreach ($fields as $k => $v) {
$new_data[$k] = $company[$v];
}
foreach ($recs as $contact) {
Utils_RecordBrowserCommon::update_record('contact', $contact['id'], $new_data);
}
}
示例8: 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();
}
示例9: defined
<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
//addons table
$fields = array(array('name' => _M('Recordset'), 'type' => 'text', 'param' => 64, 'display_callback' => array('CRM_PhoneCallCommon', 'display_recordset'), 'QFfield_callback' => array('CRM_PhoneCallCommon', 'QFfield_recordset'), 'required' => true, 'extra' => false, 'visible' => true));
Utils_RecordBrowserCommon::install_new_recordset('phonecall_related', $fields);
Utils_RecordBrowserCommon::set_caption('phonecall_related', _M('Meeting 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');
Utils_RecordBrowserCommon::new_record_field('phonecall', array('name' => _M('Related'), 'type' => 'multiselect', 'param' => '__RECORDSETS__::;CRM_PhoneCallCommon::related_crits', 'QFfield_callback' => array('CRM_PhoneCallCommon', 'QFfield_related'), 'extra' => false, 'required' => false, 'visible' => true));
$rel = Utils_RecordBrowserCommon::get_records('phonecall', array('!related_to' => ''));
foreach ($rel as $r) {
$rr = array();
foreach ($r['related_to'] as $id) {
$rr[] = 'contact/' . $id;
}
Utils_RecordBrowserCommon::update_record('phonecall', $r['id'], array('related' => $rr));
}
Utils_RecordBrowserCommon::delete_record_field('phonecall', 'Related to');
示例10: ob_end_clean
ob_end_clean();
print 'alert(\'' . __('This field is not editable') . '\');';
print 'setTimeout("grid_disable_edit(\'' . $element . '\',\'' . $id . '\');",100);';
die;
}
$rb->prepare_view_entry_details($record, 'edit', $id, $form, array($element => true), true);
$more_html = ob_get_clean();
if ($mode == 'submit') {
// && $form->validate()) {
$form->validate();
$vals = $form->exportValues();
if (!isset($vals['__grid_' . $element])) {
trigger_error(print_r($vals, true));
}
$value = $vals['__grid_' . $element];
Utils_RecordBrowserCommon::update_record($tab, $id, array($element => $value));
$record[$element] = $value;
$form = ModuleManager::new_instance('Libs_QuickForm', null, 'grid_form');
$rb = ModuleManager::new_instance('Utils_RecordBrowser', null, 'grid_rb');
$form->construct();
$rb->construct($tab);
$rb->init();
$record = Utils_RecordBrowserCommon::get_record($tab, $id);
$record[$element] = $value;
$rb->record = $record;
$rb->view_fields_permission = $rb->get_access('view', $record);
$rb->prepare_view_entry_details($record, 'view', $id, $form, array($element => true));
$renderer = new HTML_QuickForm_Renderer_TCMSArraySmarty();
$form->accept($renderer);
$data = $renderer->toArray();
$html = $data[$element]['html'];
示例11: while
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()) {
Patch::require_time(5);
if (DB::is_mysql()) {
$a = DB::GetRow('SHOW CREATE TABLE utils_attachment_file');
if (preg_match('/CONSTRAINT (.+) FOREIGN KEY .*attach_id/', $a[1], $m)) {
DB::Execute('alter table `utils_attachment_file` drop foreign key ' . $m[1]);
示例12: array
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;
}
}
foreach ($related as $i => $r) {
$related_checkpoint->require_time(5);
$mail = Utils_RecordBrowserCommon::get_record('rc_mails', $r['mail']);
$mail['related'][] = $r['recordset'] . '/' . $r['record_id'];
Utils_RecordBrowserCommon::update_record('rc_mails', $r['mail'], array('related' => $mail['related']));
Utils_RecordBrowserCommon::delete_record('rc_mails_assoc', $r['id']);
unset($related[$i]);
$related_checkpoint->set('related', $related);
}
}
$related_checkpoint->done();
}
Utils_RecordBrowserCommon::uninstall_recordset('rc_mails_assoc');
Utils_RecordBrowserCommon::delete_addon('rc_mails', CRM_Roundcube::module_name(), 'assoc_addon');
示例13: process_request
public static function process_request($data, $mode)
{
switch ($mode) {
case 'adding':
$data['active'] = true;
break;
case 'added':
Utils_RecordBrowserCommon::update_record('crm_assets', $data['id'], array('asset_id' => self::generate_id($data['id'])), false, null, true);
break;
default:
break;
}
return $data;
}
示例14: crm_event_update
public static function crm_event_update($id, $start, $duration, $timeless)
{
$id = explode('_', $id);
$id = reset($id);
$r = Utils_RecordBrowserCommon::get_record('crm_meeting', $id);
if (!Utils_RecordBrowserCommon::get_access('crm_meeting', 'edit', $r)) {
return false;
}
$sp_start = explode(' ', date('Y-m-d H:i:s', $start));
$values = array();
$values['date'] = $sp_start[0];
$values['time'] = '1970-01-01 ' . $sp_start[1];
if ($timeless) {
$values['duration'] = -1;
unset($values['time']);
} else {
$values['duration'] = $duration > 0 ? $duration : 3600;
}
$r = self::submit_meeting($r, 'editing');
$values = self::submit_meeting($values, 'editing');
$values['recurrence_end'] = $r['recurrence_end'];
$values = Utils_RecordBrowserCommon::update_record('crm_meeting', $id, $values);
if ($r['recurrence_type'] > 0) {
print 'Epesi.updateIndicatorText("Updating calendar");Epesi.request("");';
}
return true;
}
示例15: reload_mails
public static function reload_mails($rs, $id, $email_addresses = null)
{
$prefix = ($rs == 'contact' ? 'P' : 'C') . ':';
if (!$email_addresses) {
$email_addresses = self::get_email_addresses($rs, $id);
}
foreach ($email_addresses as $email) {
$cc = Utils_RecordBrowserCommon::get_records('rc_mails', array('(~from' => '%' . $email . '%', '|~to' => '%' . $email . '%'));
foreach ($cc as $mail) {
if ($rs == 'contact' && $mail['employee'] == $id || in_array($prefix . $id, $mail['contacts'])) {
continue;
}
if (!preg_match('/(^|[\\s,\\<\\;])' . preg_quote($email, '/') . '($|[\\s,\\>\\&])/i', $mail['from'] . ',' . $mail['to'])) {
continue;
}
$mail['contacts'][] = $prefix . $id;
Utils_RecordBrowserCommon::update_record('rc_mails', $mail['id'], array('contacts' => $mail['contacts']));
CRM_RoundcubeCommon::create_thread($mail['id']);
}
}
}