Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Set Owner for notes in documents. Added utility function for user inf…

…o+smarty wrapper. Display owner name.
  • Loading branch information...
commit 857a1d34492d8dace1b269fc3f3adae88f323d07 1 parent 08a8c59
@yehster yehster authored
View
1  controllers/C_Document.class.php
@@ -247,6 +247,7 @@ function note_action_process($patient_id) {
return;
$n = new Note();
+ $n->set_owner($_SESSION['authUserID']);
parent::populate_object($n);
$n->persist();
View
45 library/plugins/function.user_info.php
@@ -0,0 +1,45 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ * user_info() version for smarty templates
+ * Kevin Yeh 2013
+ */
+
+
+/**
+ * Smarty {user_info} function plugin
+ *
+ * Type: function<br>
+ * Name: user_info<br>
+ * Purpose: Return the user info for a given ID<br>
+ *
+ * Examples:
+ *
+ * {user_info id=1}
+ *
+ * @param array
+ * @param Smarty
+ */
+
+require_once(dirname(__FILE__) . '../../user.inc');
+
+function smarty_function_user_info($params, &$smarty)
+{
+ if (empty($params['id'])) {
+ $smarty->trigger_error("user_info: missing 'id' parameter");
+ return;
+ } else {
+ $user_id = $params['id'];
+ }
+
+ $user_info=getUserIDInfo($user_id);
+ if($user_info)
+ {
+ echo $user_info['fname']." ".$user_info['lname'];
+ }
+}
+
+
+?>
View
6 library/user.inc
@@ -138,4 +138,10 @@ function removeUserSetting($label,$user=NULL) {
}
}
+
+function getUserIDInfo($id)
+{
+ $res= sqlStatement("SELECT fname,lname,username FROM users where id=?",array($id));
+ return sqlFetchArray($res);
+}
?>
View
5 templates/documents/general_view.html
@@ -161,9 +161,12 @@
{xl t='Note'} #{$note->get_id()}
{xl t='Date:'} {$note->get_date()}
{$note->get_note()}
+ {if $note->get_owner()}
+ &nbsp;-{user_info id=$note->get_owner()}
+ {/if}
</div>
{/foreach}
- {/if}
+ {/if}
</div>
</div>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.