commit bf0bec05b832dcf2a13024f8322ae023fd2352ab
parent a85a797d65ea867da7de0da78659ccbda3754aac
Author: Jan Dankert <devnull@localhost>
Date: Wed, 29 Nov 2017 22:25:48 +0100
Komponente "user" umgestellt auf eine Klasse.
Diffstat:
4 files changed, 37 insertions(+), 19 deletions(-)
diff --git a/model/Object.class.php b/model/Object.class.php
@@ -327,9 +327,9 @@ SQL
'desc' =>$this->desc,
'description' =>$this->desc,
'create_date' =>$this->createDate,
- 'create_user' =>$this->createUser,
+ 'create_user' =>$this->createUser->getProperties(),
'lastchange_date' =>$this->lastchangeDate,
- 'lastchange_user' =>$this->lastchangeUser,
+ 'lastchange_user' =>$this->lastchangeUser->getProperties(),
'isFolder' =>$this->isFolder,
'isFile' =>$this->isFile,
'isLink' =>$this->isLink,
diff --git a/themes/default/include/html/user/User.class.php b/themes/default/include/html/user/User.class.php
@@ -0,0 +1,17 @@
+<?php
+
+class UserComponent extends Component
+{
+ public $user;
+ public $id;
+
+ protected function begin()
+ {
+ parent::include('user/component-user.php');
+
+ echo '<?php component_user('.$this->value($this->user).') ?>';
+ }
+}
+
+
+?>+
\ No newline at end of file
diff --git a/themes/default/include/html/user/component-user.php b/themes/default/include/html/user/component-user.php
@@ -0,0 +1,16 @@
+<?php
+function component_user( $user )
+{
+ extract( $user );
+
+ if ( empty($name) )
+ $name = lang('GLOBAL_UNKNOWN');
+ if ( empty($fullname) )
+ $fullname = lang('GLOBAL_NO_DESCRIPTION_AVAILABLE');
+
+ if ( !empty($mail) && config('security','user','show_mail' ) )
+ echo "<a href=\"mailto:$mail\" title=\"$fullname\">$name</a>";
+ else
+ echo "<span title=\"$fullname\">$name</span>";
+}
+?>+
\ No newline at end of file
diff --git a/themes/default/include/html/user/user-begin.inc.php b/themes/default/include/html/user/user-begin.inc.php
@@ -1,16 +0,0 @@
-<?php
- if ( is_object($attr_user) )
- $user = $attr_user;
- else
- $user = $$attr_user;
-
- if ( empty($user->name) )
- $user->name = lang('GLOBAL_UNKNOWN');
- if ( empty($user->fullname) )
- $user->fullname = lang('GLOBAL_NO_DESCRIPTION_AVAILABLE');
-
- if ( !empty($user->mail) && $conf['security']['user']['show_mail'] )
- echo '<a href="mailto:'.$user->mail.'" title="'.$user->fullname.'">'.$user->name.'</a>';
- else
- echo '<span title="'.$user->fullname.'">'.$user->name.'</span>';
-?>-
\ No newline at end of file