mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 16:03:47 +01:00
moved eroles specific code from parent merge class to projectmanager merge class
This commit is contained in:
parent
fa974d0a50
commit
407f7c9440
@ -37,10 +37,9 @@ class addressbook_merge extends bo_merge
|
|||||||
*
|
*
|
||||||
* @param int $id id of entry
|
* @param int $id id of entry
|
||||||
* @param string &$content=null content to create some replacements only if they are use
|
* @param string &$content=null content to create some replacements only if they are use
|
||||||
* @param array $eroles=null element roles with keys app, app_id and erole_id
|
|
||||||
* @return array|boolean
|
* @return array|boolean
|
||||||
*/
|
*/
|
||||||
protected function get_replacements($id,&$content=null,$eroles=null)
|
protected function get_replacements($id,&$content=null)
|
||||||
{
|
{
|
||||||
if (!($replacements = $this->contact_replacements($id)))
|
if (!($replacements = $this->contact_replacements($id)))
|
||||||
{
|
{
|
||||||
|
@ -69,10 +69,9 @@ abstract class bo_merge
|
|||||||
*
|
*
|
||||||
* @param int $id id of entry
|
* @param int $id id of entry
|
||||||
* @param string &$content=null content to create some replacements only if they are use
|
* @param string &$content=null content to create some replacements only if they are use
|
||||||
* @param array $eroles=null element roles with keys app, app_id and erole_id
|
|
||||||
* @return array|boolean array with replacements or false if entry not found
|
* @return array|boolean array with replacements or false if entry not found
|
||||||
*/
|
*/
|
||||||
abstract protected function get_replacements($id,&$content=null,$eroles=null);
|
abstract protected function get_replacements($id,&$content=null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return if merge-print is implemented for given mime-type (and/or extension)
|
* Return if merge-print is implemented for given mime-type (and/or extension)
|
||||||
@ -124,7 +123,7 @@ abstract class bo_merge
|
|||||||
* Return replacements for a contact
|
* Return replacements for a contact
|
||||||
*
|
*
|
||||||
* @param int|string|array $contact contact-array or id
|
* @param int|string|array $contact contact-array or id
|
||||||
* @param string $prefix='' prefix like eg. 'user' or 'erole'
|
* @param string $prefix='' prefix like eg. 'user'
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function contact_replacements($contact,$prefix='')
|
public function contact_replacements($contact,$prefix='')
|
||||||
@ -253,10 +252,9 @@ abstract class bo_merge
|
|||||||
* @param string &$err error-message on error
|
* @param string &$err error-message on error
|
||||||
* @param string $mimetype mimetype of complete document, eg. text/*, application/vnd.oasis.opendocument.text, application/rtf
|
* @param string $mimetype mimetype of complete document, eg. text/*, application/vnd.oasis.opendocument.text, application/rtf
|
||||||
* @param array $fix=null regular expression => replacement pairs eg. to fix garbled placeholders
|
* @param array $fix=null regular expression => replacement pairs eg. to fix garbled placeholders
|
||||||
* @param array $eroles=null element roles with keys app, app_id and erole_id
|
|
||||||
* @return string|boolean merged document or false on error
|
* @return string|boolean merged document or false on error
|
||||||
*/
|
*/
|
||||||
public function &merge($document,$ids,&$err,$mimetype,array $fix=null,array $eroles=null)
|
public function &merge($document,$ids,&$err,$mimetype,array $fix=null)
|
||||||
{
|
{
|
||||||
if (!($content = file_get_contents($document)))
|
if (!($content = file_get_contents($document)))
|
||||||
{
|
{
|
||||||
@ -268,7 +266,7 @@ abstract class bo_merge
|
|||||||
{
|
{
|
||||||
$mimetype = 'application/rtf';
|
$mimetype = 'application/rtf';
|
||||||
}
|
}
|
||||||
return $this->merge_string($content,$ids,$err,$mimetype,$fix,$eroles);
|
return $this->merge_string($content,$ids,$err,$mimetype,$fix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -279,10 +277,9 @@ abstract class bo_merge
|
|||||||
* @param string &$err error-message on error
|
* @param string &$err error-message on error
|
||||||
* @param string $mimetype mimetype of complete document, eg. text/*, application/vnd.oasis.opendocument.text, application/rtf
|
* @param string $mimetype mimetype of complete document, eg. text/*, application/vnd.oasis.opendocument.text, application/rtf
|
||||||
* @param array $fix=null regular expression => replacement pairs eg. to fix garbled placeholders
|
* @param array $fix=null regular expression => replacement pairs eg. to fix garbled placeholders
|
||||||
* @param array $eroles=null element roles with keys app, app_id and erole_id
|
|
||||||
* @return string|boolean merged document or false on error
|
* @return string|boolean merged document or false on error
|
||||||
*/
|
*/
|
||||||
public function &merge_string($content,$ids,&$err,$mimetype,array $fix=null,array $eroles=null)
|
public function &merge_string($content,$ids,&$err,$mimetype,array $fix=null)
|
||||||
{
|
{
|
||||||
if ($mimetype == 'application/xml' &&
|
if ($mimetype == 'application/xml' &&
|
||||||
preg_match('/'.preg_quote('<?mso-application progid="').'([^"]+)'.preg_quote('"?>').'/',substr($content,0,200),$matches))
|
preg_match('/'.preg_quote('<?mso-application progid="').'([^"]+)'.preg_quote('"?>').'/',substr($content,0,200),$matches))
|
||||||
@ -358,7 +355,7 @@ abstract class bo_merge
|
|||||||
if ($lableprint) $content = $Labelrepeat;
|
if ($lableprint) $content = $Labelrepeat;
|
||||||
|
|
||||||
// generate replacements
|
// generate replacements
|
||||||
if(!($replacements = $this->get_replacements($id,$content,is_array($eroles) ? $eroles : null)))
|
if(!($replacements = $this->get_replacements($id,$content)))
|
||||||
{
|
{
|
||||||
$err = lang('Entry not found!');
|
$err = lang('Entry not found!');
|
||||||
return false;
|
return false;
|
||||||
@ -637,10 +634,9 @@ abstract class bo_merge
|
|||||||
*
|
*
|
||||||
* @param string $document vfs-path of document
|
* @param string $document vfs-path of document
|
||||||
* @param array $ids array with contact id(s)
|
* @param array $ids array with contact id(s)
|
||||||
* @param array $eroles=null element roles with keys app, app_id and erole_id
|
|
||||||
* @return string with error-message on error, otherwise it does NOT return
|
* @return string with error-message on error, otherwise it does NOT return
|
||||||
*/
|
*/
|
||||||
public function download($document,$ids,$eroles=null)
|
public function download($document,$ids)
|
||||||
{
|
{
|
||||||
$content_url = egw_vfs::PREFIX.$document;
|
$content_url = egw_vfs::PREFIX.$document;
|
||||||
switch (($mimetype = egw_vfs::mime_content_type($document)))
|
switch (($mimetype = egw_vfs::mime_content_type($document)))
|
||||||
@ -687,7 +683,7 @@ abstract class bo_merge
|
|||||||
$content_url = 'zip://'.$archive.'#'.($content_file = 'xl/sharedStrings.xml');
|
$content_url = 'zip://'.$archive.'#'.($content_file = 'xl/sharedStrings.xml');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!($merged =& $this->merge($content_url,$ids,$err,$mimetype,$fix,$eroles)))
|
if (!($merged =& $this->merge($content_url,$ids,$err,$mimetype,$fix)))
|
||||||
{
|
{
|
||||||
return $err;
|
return $err;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user