moved eroles specific code from parent merge class to projectmanager merge class

This commit is contained in:
Christian Binder 2011-01-27 17:08:40 +00:00
parent fa974d0a50
commit 407f7c9440
2 changed files with 9 additions and 14 deletions

View File

@ -37,10 +37,9 @@ class addressbook_merge extends bo_merge
*
* @param int $id id of entry
* @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
*/
protected function get_replacements($id,&$content=null,$eroles=null)
protected function get_replacements($id,&$content=null)
{
if (!($replacements = $this->contact_replacements($id)))
{

View File

@ -69,10 +69,9 @@ abstract class bo_merge
*
* @param int $id id of entry
* @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
*/
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)
@ -124,7 +123,7 @@ abstract class bo_merge
* Return replacements for a contact
*
* @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
*/
public function contact_replacements($contact,$prefix='')
@ -253,10 +252,9 @@ abstract class bo_merge
* @param string &$err error-message on error
* @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 $eroles=null element roles with keys app, app_id and erole_id
* @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)))
{
@ -268,7 +266,7 @@ abstract class bo_merge
{
$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 $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 $eroles=null element roles with keys app, app_id and erole_id
* @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' &&
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;
// 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!');
return false;
@ -637,10 +634,9 @@ abstract class bo_merge
*
* @param string $document vfs-path of document
* @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
*/
public function download($document,$ids,$eroles=null)
public function download($document,$ids)
{
$content_url = egw_vfs::PREFIX.$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');
break;
}
if (!($merged =& $this->merge($content_url,$ids,$err,$mimetype,$fix,$eroles)))
if (!($merged =& $this->merge($content_url,$ids,$err,$mimetype,$fix)))
{
return $err;
}