forked from extern/egroupware
Expansion of link_to custom fields
This commit is contained in:
parent
2bb445453e
commit
4feaa8375e
@ -48,6 +48,11 @@ class addressbook_merge extends bo_merge
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if($content && strpos($content, '$$#') !== 0)
|
||||||
|
{
|
||||||
|
$this->cf_link_to_expand($this->contacts->read($id), $content, $replacements,'addressbook');
|
||||||
|
}
|
||||||
|
|
||||||
// Links
|
// Links
|
||||||
$replacements += array(
|
$replacements += array(
|
||||||
'$$links$$' => $this->get_links('addressbook', $id, '!'.egw_link::VFS_APPNAME),
|
'$$links$$' => $this->get_links('addressbook', $id, '!'.egw_link::VFS_APPNAME),
|
||||||
|
@ -104,13 +104,13 @@ class calendar_merge extends bo_merge
|
|||||||
protected function get_replacements($id,&$content=null)
|
protected function get_replacements($id,&$content=null)
|
||||||
{
|
{
|
||||||
$prefix = '';
|
$prefix = '';
|
||||||
|
|
||||||
// List events ?
|
// List events ?
|
||||||
if(is_array($id) && !$id['id'] && !$id[0]['id'])
|
if(is_array($id) && !$id['id'] && !$id[0]['id'])
|
||||||
{
|
{
|
||||||
$events = $this->bo->search($this->query + $id + array(
|
$events = $this->bo->search($this->query + $id + array(
|
||||||
'offset' => 0,
|
'offset' => 0,
|
||||||
'order' => 'cal_start',
|
'order' => 'cal_start',
|
||||||
|
'cfs' => strpos($content, '#') !== false ? array_keys(config::get_customfields('calendar')) : null
|
||||||
));
|
));
|
||||||
if(strpos($content,'$$calendar/') !== false || strpos($content, '$$table/day') !== false)
|
if(strpos($content,'$$calendar/') !== false || strpos($content, '$$table/day') !== false)
|
||||||
{
|
{
|
||||||
@ -146,7 +146,7 @@ class calendar_merge extends bo_merge
|
|||||||
$n = 0;
|
$n = 0;
|
||||||
foreach($events as $event)
|
foreach($events as $event)
|
||||||
{
|
{
|
||||||
$values = $this->calendar_replacements($event,sprintf($prefix,++$n));
|
$values = $this->calendar_replacements($event,sprintf($prefix,++$n), $content);
|
||||||
if(is_array($id) && $id['start'])
|
if(is_array($id) && $id['start'])
|
||||||
{
|
{
|
||||||
foreach(self::$range_tags as $key => $format)
|
foreach(self::$range_tags as $key => $format)
|
||||||
@ -168,7 +168,7 @@ class calendar_merge extends bo_merge
|
|||||||
* @param boolean $last_event_too=false also include information about the last event
|
* @param boolean $last_event_too=false also include information about the last event
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function calendar_replacements($id,$prefix = '')
|
public function calendar_replacements($id,$prefix = '', &$content = '')
|
||||||
{
|
{
|
||||||
$replacements = array();
|
$replacements = array();
|
||||||
if(!is_array($id) || !$id['start']) {
|
if(!is_array($id) || !$id['start']) {
|
||||||
@ -203,6 +203,11 @@ class calendar_merge extends bo_merge
|
|||||||
$duration = ($event['end'] - $event['start'])/60;
|
$duration = ($event['end'] - $event['start'])/60;
|
||||||
$replacements['$$'.($prefix?$prefix.'/':'').'calendar_duration$$'] = floor($duration/60).lang('h').($duration%60 ? $duration%60 : '');
|
$replacements['$$'.($prefix?$prefix.'/':'').'calendar_duration$$'] = floor($duration/60).lang('h').($duration%60 ? $duration%60 : '');
|
||||||
|
|
||||||
|
if($content && strpos($content, '$$#') !== 0)
|
||||||
|
{
|
||||||
|
$this->cf_link_to_expand($event, $content, $replacements);
|
||||||
|
}
|
||||||
|
|
||||||
$custom = config::get_customfields('calendar');
|
$custom = config::get_customfields('calendar');
|
||||||
foreach($custom as $name => $field)
|
foreach($custom as $name => $field)
|
||||||
{
|
{
|
||||||
@ -270,7 +275,7 @@ class calendar_merge extends bo_merge
|
|||||||
$days = array();
|
$days = array();
|
||||||
$replacements = array();
|
$replacements = array();
|
||||||
$time_format = $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i';
|
$time_format = $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i';
|
||||||
foreach($events as $day => $list)
|
foreach($events as $day => $list)
|
||||||
{
|
{
|
||||||
foreach($list as $key => $event)
|
foreach($list as $key => $event)
|
||||||
{
|
{
|
||||||
@ -369,7 +374,7 @@ class calendar_merge extends bo_merge
|
|||||||
$replacements = array();
|
$replacements = array();
|
||||||
$days = array();
|
$days = array();
|
||||||
$time_format = $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i';
|
$time_format = $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i';
|
||||||
foreach($events as $day => $list)
|
foreach($events as $day => $list)
|
||||||
{
|
{
|
||||||
foreach($list as $key => $event)
|
foreach($list as $key => $event)
|
||||||
{
|
{
|
||||||
|
@ -1121,7 +1121,7 @@ abstract class bo_merge
|
|||||||
|
|
||||||
// Custom field placeholders look like {{#name}}
|
// Custom field placeholders look like {{#name}}
|
||||||
// Placeholders that need expanded will look like {{#name/placeholder}}
|
// Placeholders that need expanded will look like {{#name/placeholder}}
|
||||||
preg_match_all('/[${]{2}(([\w]+\/)*)#([\w]+)\/(.*?)[$}]{2}/', $content, $matches);
|
preg_match_all('/\${2}(([^\/#]*?\/)?)#([^$\/]+)\/(.*?)[$}]{2}/', $content, $matches);
|
||||||
list($placeholders, $prefixes, $pre, $cf, $sub) = $matches;
|
list($placeholders, $prefixes, $pre, $cf, $sub) = $matches;
|
||||||
|
|
||||||
foreach($cf as $index => $field)
|
foreach($cf as $index => $field)
|
||||||
|
@ -60,7 +60,7 @@ class timesheet_merge extends bo_merge
|
|||||||
*/
|
*/
|
||||||
protected function get_replacements($id,&$content=null)
|
protected function get_replacements($id,&$content=null)
|
||||||
{
|
{
|
||||||
if (!($replacements = $this->timesheet_replacements($id)))
|
if (!($replacements = $this->timesheet_replacements($id, '', $content)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ class timesheet_merge extends bo_merge
|
|||||||
* @param string $prefix='' prefix like eg. 'erole'
|
* @param string $prefix='' prefix like eg. 'erole'
|
||||||
* @return array|boolean
|
* @return array|boolean
|
||||||
*/
|
*/
|
||||||
public function timesheet_replacements($id,$prefix='')
|
public function timesheet_replacements($id,$prefix='', &$content = null)
|
||||||
{
|
{
|
||||||
$record = new timesheet_egw_record($id);
|
$record = new timesheet_egw_record($id);
|
||||||
$info = array();
|
$info = array();
|
||||||
@ -110,6 +110,11 @@ class timesheet_merge extends bo_merge
|
|||||||
{
|
{
|
||||||
$selects['ts_'.$name] = $value;
|
$selects['ts_'.$name] = $value;
|
||||||
}
|
}
|
||||||
|
if($content && strpos($content, '#') !== 0)
|
||||||
|
{
|
||||||
|
$this->cf_link_to_expand($record->get_record_array(), $content, $info);
|
||||||
|
}
|
||||||
|
|
||||||
importexport_export_csv::convert($record, $types, 'timesheet', $selects);
|
importexport_export_csv::convert($record, $types, 'timesheet', $selects);
|
||||||
|
|
||||||
$array = $record->get_record_array();
|
$array = $record->get_record_array();
|
||||||
@ -118,6 +123,7 @@ class timesheet_merge extends bo_merge
|
|||||||
{
|
{
|
||||||
$array[$key] = self::number_format($array[$key],2,$this->mimetype);
|
$array[$key] = self::number_format($array[$key],2,$this->mimetype);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set any missing custom fields, or the marker will stay
|
// Set any missing custom fields, or the marker will stay
|
||||||
foreach($this->bo->customfields as $name => $field)
|
foreach($this->bo->customfields as $name => $field)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user