本文整理汇总了PHP中Utils_RecordBrowserCommon::get_value方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils_RecordBrowserCommon::get_value方法的具体用法?PHP Utils_RecordBrowserCommon::get_value怎么用?PHP Utils_RecordBrowserCommon::get_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils_RecordBrowserCommon
的用法示例。
在下文中一共展示了Utils_RecordBrowserCommon::get_value方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: make_event_PDF
public function make_event_PDF($pdf, $id, $no_details = false, $type = 'Event')
{
$custom_event = false;
if (!is_array($id)) {
$check = explode('#', $id);
if (isset($check[1])) {
$callback = DB::GetOne('SELECT handler_callback FROM crm_calendar_custom_events_handlers WHERE id=%d', $check[0]);
$callback = explode('::', $callback);
$ev = call_user_func($callback, 'get', $check[1]);
$no_details = true;
$custom_event = true;
} else {
trigger_error('Invalid event id: ' . $id, E_USER_ERROR);
}
} else {
$ev = $id;
$id = $ev['id'];
$id = explode('_', $id);
$id = $id[0];
/* $ev_details = DB::GetRow('SELECT *, starts AS start, ends AS end FROM crm_calendar_event WHERE id=%d', array($id));
foreach ($ev_details as $k=>$v)
if (!isset($ev[$k])) $ev[$k] = $v;*/
$ev['title'] = strip_tags($ev['title']);
$check = explode('#', $id);
if (isset($check[1])) {
$no_details = true;
$custom_event = true;
}
}
$pdf_theme = $this->pack_module('Base/Theme');
$pdf_theme->assign('description', array('label' => __('Description'), 'value' => str_replace("\n", '<br/>', htmlspecialchars($ev['description']))));
if (!$no_details) {
$ev['status'] = Utils_CommonDataCommon::get_value('CRM/Status/' . $ev['status'], true);
$ev['access'] = self::$access[$ev['access']];
$ev['priority'] = self::$priority[$ev['priority']];
foreach (array('access' => __('Access'), 'priority' => __('Priority'), 'status' => __('Status')) as $v => $label) {
$pdf_theme->assign($v, array('label' => $label, 'value' => $ev[$v]));
}
$created_by = CRM_ContactsCommon::get_contact_by_user_id($ev['created_by']);
if ($created_by !== null) {
$created_by = $created_by['last_name'] . ' ' . $created_by['first_name'];
} else {
$created_by = Base_UserCommon::get_user_login($ev['created_by']);
}
$created_on = Base_RegionalSettingsCommon::time2reg($ev['created_on'], false);
$pdf_theme->assign('created_on', array('label' => __('Created on'), 'value' => $created_on));
$pdf_theme->assign('created_by', array('label' => __('Created by'), 'value' => $created_by));
if ($ev['edited_by'] != null) {
$edited_by = CRM_ContactsCommon::get_contact_by_user_id($ev['edited_by']);
if ($edited_by !== null) {
$edited_by = $edited_by['last_name'] . ' ' . $edited_by['first_name'];
} else {
$edited_by = Base_UserCommon::get_user_login($ev['edited_by']);
}
$edited_on = Base_RegionalSettingsCommon::time2reg($ev['edited_on'], false);
} else {
$edited_by = '--';
$edited_on = '--';
}
$pdf_theme->assign('edited_on', array('label' => __('Edited on'), 'value' => $edited_on));
$pdf_theme->assign('edited_by', array('label' => __('Edited by'), 'value' => $edited_by));
$pdf_theme->assign('printed_on', array('label' => __('Printed on'), 'value' => Base_RegionalSettingsCommon::time2reg(time())));
}
$emps = array();
$cuss = array();
$cus_cmps = array();
if (isset($ev['employees']) && !empty($ev['employees'])) {
foreach ($ev['employees'] as $v) {
$c = CRM_ContactsCommon::get_contact($v);
$emps[] = array('name' => $c['last_name'] . ' ' . $c['first_name'], 'mphone' => $c['mobile_phone'], 'wphone' => $c['work_phone'], 'hphone' => $c['home_phone']);
}
}
if (isset($ev['customers']) && !empty($ev['customers'])) {
foreach ($ev['customers'] as $v) {
$det = explode(':', $v);
if (isset($det[1])) {
$v = $det[1];
} else {
$v = $det[0];
$det[0] = 'P';
}
if ($det[0] == 'P') {
$c = CRM_ContactsCommon::get_contact($v);
$company_name = isset($c['company_name']) && is_numeric($c['company_name']) ? array(Utils_RecordBrowserCommon::get_value('company', $c['company_name'], 'Company Name')) : '---';
$cuss[] = array('name' => $c['last_name'] . ' ' . $c['first_name'], 'mphone' => $c['mobile_phone'], 'wphone' => $c['work_phone'], 'hphone' => $c['home_phone'], 'company_name' => $company_name);
}
if ($det[0] == 'C') {
$c = array('company_name' => array($v));
}
if (is_array($c['company_name'])) {
foreach ($c['company_name'] as $v2) {
if (!isset($cus_cmps[$v2])) {
$cus_cmps[$v2] = CRM_ContactsCommon::get_company($v2);
}
}
}
}
}
$pdf_theme->assign('employees', array('main_label' => __('Employees'), 'name_label' => __('Name'), 'mphone_label' => __('Mobile Phone'), 'wphone_label' => __('Work Phone'), 'hphone_label' => __('Home Phone'), 'lp_label' => __('Lp'), 'data' => $emps));
$pdf_theme->assign('customers', array('main_label' => __('Customers'), 'name_label' => __('Name'), 'mphone_label' => __('Mobile Phone'), 'wphone_label' => __('Work Phone'), 'hphone_label' => __('Home Phone'), 'company_name' => __('Company Name'), 'lp_label' => __('Lp'), 'data' => $cuss));
//.........这里部分代码省略.........
示例2: subscribed_employees
public static function subscribed_employees($v)
{
if (!is_array($v)) {
return;
}
foreach ($v['employees'] as $k) {
$user = Utils_RecordBrowserCommon::get_value('contact', $k, 'Login');
if ($user !== false && $user !== null) {
Utils_WatchdogCommon::user_subscribe($user, 'task', $v['id']);
}
}
}
示例3: validate_single
protected function validate_single(Utils_RecordBrowser_CritsSingle $crits, $record)
{
$id = isset($record['id']) ? $record['id'] : '';
list($field, $subfield) = Utils_RecordBrowser_CritsSingle::parse_subfield($crits->get_field());
$field = ltrim(Utils_RecordBrowserCommon::get_field_id($field), '_');
$subfield = ltrim(Utils_RecordBrowserCommon::get_field_id($subfield), '_');
$r_val = isset($record[$field]) ? $record[$field] : '';
$crit_value = $crits->get_value();
$field_definition = $this->get_field_definition($field);
if ($subfield && $field_definition) {
$sub_tab = isset($field_definition['ref_table']) ? $field_definition['ref_table'] : false;
if ($sub_tab) {
if (is_array($r_val)) {
foreach ($r_val as $k => $v) {
$r_val[$k] = Utils_RecordBrowserCommon::get_value($sub_tab, $v, $subfield);
}
} else {
if ($r_val) {
$r_val = Utils_RecordBrowserCommon::get_value($sub_tab, $r_val, $subfield);
} else {
$r_val = '';
}
if (substr($r_val, 0, 2) == '__') {
$r_val = Utils_RecordBrowserCommon::decode_multi($r_val);
}
// FIXME need better check
}
}
}
$k = strtolower($field);
$record[$k] = $r_val;
$result = false;
$transform_date = false;
if ($k == 'created_on') {
$transform_date = 'timestamp';
} elseif ($k == 'edited_on') {
$details = Utils_RecordBrowserCommon::get_record_info($this->tab, $id);
$record[$k] = $details['edited_on'];
$transform_date = 'timestamp';
} elseif ($field_definition) {
$type = $field_definition['type'];
if ($type == 'timestamp') {
$transform_date = 'timestamp';
} elseif ($type == 'date') {
$transform_date = 'date';
}
}
if ($transform_date == 'timestamp' && $crit_value) {
$crit_value = Base_RegionalSettingsCommon::reg2time($crit_value, false);
$crit_value = date('Y-m-d H:i:s', $crit_value);
} else {
if ($transform_date == 'date' && $crit_value) {
$crit_value = Base_RegionalSettingsCommon::reg2time($crit_value, false);
$crit_value = date('Y-m-d', $crit_value);
}
}
$vv = explode('::', $crit_value, 2);
if (isset($vv[1]) && is_callable($vv)) {
$result = call_user_func_array($vv, array($this->tab, &$record, $k, $crits));
} else {
if (is_array($record[$k])) {
if ($crit_value) {
$result = in_array($crit_value, $record[$k]);
} else {
$result = empty($record[$k]);
}
if ($crits->get_operator() == '!=') {
$result = !$result;
}
} else {
switch ($crits->get_operator()) {
case '>':
$result = $record[$k] > $crit_value;
break;
case '>=':
$result = $record[$k] >= $crit_value;
break;
case '<':
$result = $record[$k] < $crit_value;
break;
case '<=':
$result = $record[$k] <= $crit_value;
break;
case '!=':
$result = $record[$k] != $crit_value;
break;
case '=':
$result = $record[$k] == $crit_value;
break;
case 'LIKE':
$result = self::check_like_match($record[$k], $crit_value);
break;
case 'NOT LIKE':
$result = !self::check_like_match($record[$k], $crit_value);
break;
}
}
}
if ($crits->get_negation()) {
$result = !$result;
//.........这里部分代码省略.........
示例4: send_email_notifications
public static function send_email_notifications($event_id)
{
$event = DB::GetRow('SELECT * FROM utils_watchdog_event WHERE id=%d', array($event_id));
if (!$event) {
return;
}
$category_id = $event['category_id'];
$id = $event['internal_id'];
$message = $event['message'];
$subscribers = self::get_subscribers($category_id, $id);
$c_user = Acl::get_user();
self::email_mode(true);
foreach ($subscribers as $user_id) {
$wants_email = Base_User_SettingsCommon::get('Utils_Watchdog', 'email', $user_id);
if (!$wants_email) {
continue;
}
Acl::set_user($user_id);
Base_LangCommon::load();
$email_data = self::display_events($category_id, array($event_id => $message), $id, true);
if (!$email_data) {
continue;
}
$contact = Utils_RecordBrowserCommon::get_id('contact', 'login', $user_id);
if (!$contact) {
continue;
}
$email = Utils_RecordBrowserCommon::get_value('contact', $contact, 'email');
if (!$email) {
continue;
}
$title = __('%s notification - %s - %s', array(EPESI, $email_data['category'], strip_tags($email_data['title'])));
Base_MailCommon::send($email, $title, $email_data['events'], null, null, true);
}
Acl::set_user($c_user);
Base_LangCommon::load();
self::email_mode(false);
}
示例5: display_note
public static function display_note($row, $nolink = false, $a=null,$view=false) {
$inline_img = '';
$link_href = '';
$link_img = '';
$icon = '';
$crypted = Utils_RecordBrowserCommon::get_value('utils_attachment',$row['id'],'crypted');
if(!$crypted || isset($_SESSION['client']['cp'.$row['id']])) {
$files = DB::GetAll('SELECT id, created_by, created_on, original, (SELECT count(*) FROM utils_attachment_download uad WHERE uaf.id=uad.attach_file_id) as downloads FROM utils_attachment_file uaf WHERE uaf.attach_id=%d AND uaf.deleted=0', array($row['id']));
foreach ($files as $f) {
$f_filename = DATA_DIR.'/Utils_Attachment/'.$row['id'].'/'.$f['id'];
if(file_exists($f_filename)) {
$filename = $f['original'];
$filetooltip = __('Filename: %s',array($filename)).'<br>'.__('File size: %s',array(filesize_hr($f_filename))).'<hr>'.
__('Last uploaded by %s', array(Base_UserCommon::get_user_label($f['created_by'], true))).'<br/>'.
__('On: %s',array(Base_RegionalSettingsCommon::time2reg($f['created_on']))).'<br/>'.
__('Number of downloads: %d',array($f['downloads']));
$view_link = '';
$lb = array();
$lb['aid'] = $row['id'];
$lb['crypted'] = $crypted;
$lb['original'] = $f['original'];
$lb['id'] = $f['id'];
$link_href = Utils_TooltipCommon::open_tag_attrs($filetooltip).' '.self::get_file_leightbox($lb,$view_link);
$link_img = Base_ThemeCommon::get_template_file('Utils_Attachment','z-attach.png');
if(Utils_AttachmentCommon::is_image($filename) && $view_link)
$inline_img .= '<hr><a href="'.$view_link.'" target="_blank"><img src="'.$view_link.'" style="max-width:700px" /></a><br>';
} else {
$filename = __('Missing file: %s',array($f_filename));
$link_href = Utils_TooltipCommon::open_tag_attrs($filename);
$link_img = Base_ThemeCommon::get_template_file('Utils_Attachment','z-attach-off.png');
}
if ($link_href)
$icon .= '<div class="file_link"><a '.$link_href.'><img src="'.$link_img.'"><span class="file_name">'.$filename.'</span></a></div>';
}
}
if($crypted) {
$text = false;
if(isset($_SESSION['client']['cp'.$row['id']])) {
$note_pass = $_SESSION['client']['cp'.$row['id']];
$decoded = Utils_AttachmentCommon::decrypt($row['note'],$note_pass);
if($decoded!==false) {
$text = $decoded;
Utils_WatchdogCommon::notified('utils_attachment', $row['id']); // notified only when decrypted
}
}
if($text===false) {
$text = '<div id="note_value_'.$row['id'].'"><a href="javascript:void(0);" onclick="utils_attachment_password(\''.Epesi::escapeJS(__('Password').':').'\',\''.Epesi::escapeJS(__('OK')).'\','.$row['id'].')" style="color:red">'.__('Note encrypted').'</a></div>';
$icon = '';
$files = array();
} else {
$text = Utils_BBCodeCommon::parse($text);
}
} else {
$text = $row['note'];
$text = Utils_BBCodeCommon::parse($text);
// mark as read all 'browsed' records
foreach (self::$mark_as_read as $note_id) {
Utils_WatchdogCommon::notified('utils_attachment', $note_id);
}
self::$mark_as_read = array();
}
$text = (!$view?'<b style="float:left;margin-right:30px;">'.$row['title'].'</b> ':'').$text.$icon.$inline_img;
if($row['sticky']) $text = '<img src="'.Base_ThemeCommon::get_template_file('Utils_Attachment','sticky.png').'" hspace=3 align="left"> '.$text;
return $text;
}
示例6: submit_mail
public static function submit_mail($param, $mode)
{
if ($mode == 'add') {
$param['message_id'] = ltrim(rtrim($param['message_id'], '>'), '<');
} else {
if ($mode == 'added') {
self::create_thread($param['id']);
self::subscribe_users_to_record($param);
} else {
if ($mode == 'edit') {
$old_related = Utils_RecordBrowserCommon::get_value('rc_mails', $param['id'], 'related');
$old_related = Utils_RecordBrowserCommon::decode_multi($old_related);
$new_related = $param['related'];
$new_related = Utils_RecordBrowserCommon::decode_multi($new_related);
$subscribers = array();
foreach ($new_related as $rel) {
if (in_array($rel, $old_related)) {
continue;
}
list($recordset, $record_id) = explode('/', $rel);
$subscribers = array_merge($subscribers, Utils_WatchdogCommon::get_subscribers($recordset, $record_id));
}
foreach (array_unique($subscribers) as $user_id) {
Utils_WatchdogCommon::user_subscribe($user_id, 'rc_mails', $param['id']);
}
}
}
}
return $param;
}
示例7: new_event
public static function new_event($category_name, $id, $message) {
if(self::$disabled) return;
$category_id = self::get_category_id($category_name, false);
if (!$category_id) return;
DB::Execute('INSERT INTO utils_watchdog_event (category_id, internal_id, message, event_time) VALUES (%d,%d,%s,%T)',array($category_id,$id,$message,time()));
$event_id = DB::Insert_ID('utils_watchdog_event', 'id');
Utils_WatchdogCommon::notified($category_name,$id);
$count = DB::GetOne('SELECT COUNT(*) FROM utils_watchdog_event WHERE category_id=%d AND internal_id=%d', array($category_id,$id));
if ($count==1) {
$subscribers = self::get_subscribers($category_id);
foreach ($subscribers as $s)
self::user_subscribe($s, $category_name, $id);
}
$subscribers = self::get_subscribers($category_name, $id);
$c_user = Acl::get_user();
self::email_mode(true);
foreach ($subscribers as $user_id) {
if ($user_id==$c_user) continue;
$wants_email = Base_User_SettingsCommon::get('Utils_Watchdog', 'email', $user_id);
if (!$wants_email) continue;
Acl::set_user($user_id);
Base_LangCommon::load();
$email_data = self::display_events($category_id, array($event_id => $message), $id, true);
if (!$email_data) continue;
$contact = Utils_RecordBrowserCommon::get_id('contact', 'login', $user_id);
if (!$contact) continue;
$email = Utils_RecordBrowserCommon::get_value('contact', $contact, 'email');
if (!$email) continue;
$title = __('%s notification - %s - %s', array(EPESI, $email_data['category'], strip_tags($email_data['title'])));
Base_MailCommon::send($email, $title, $email_data['events'], null, null, true);
}
Acl::set_user($c_user);
Base_LangCommon::load();
self::email_mode(false);
}