Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Kevin Yeh authored February 22, 2013
1  controllers/C_Document.class.php
@@ -247,6 +247,7 @@ function note_action_process($patient_id) {
247 247
 			return;
248 248
 			
249 249
 		$n = new Note();
  250
+                $n->set_owner($_SESSION['authUserID']);
250 251
 		parent::populate_object($n);
251 252
 		$n->persist();
252 253
 		
45  library/plugins/function.user_info.php
... ...
@@ -0,0 +1,45 @@
  1
+<?php
  2
+/**
  3
+ * Smarty plugin
  4
+ * @package Smarty
  5
+ * @subpackage plugins
  6
+ * user_info() version for smarty templates
  7
+ * Kevin Yeh 2013
  8
+ */
  9
+
  10
+
  11
+/**
  12
+ * Smarty {user_info} function plugin
  13
+ *
  14
+ * Type:     function<br>
  15
+ * Name:     user_info<br>
  16
+ * Purpose:  Return the user info for a given ID<br>
  17
+ * 
  18
+ * Examples:
  19
+ * 
  20
+ * {user_info id=1}
  21
+ * 
  22
+ * @param array
  23
+ * @param Smarty
  24
+ */
  25
+
  26
+require_once(dirname(__FILE__) . '../../user.inc');
  27
+
  28
+function smarty_function_user_info($params, &$smarty)
  29
+{
  30
+	if (empty($params['id'])) {
  31
+		$smarty->trigger_error("user_info: missing 'id' parameter");
  32
+        	return;
  33
+	} else {
  34
+        	$user_id = $params['id'];
  35
+	}
  36
+
  37
+        $user_info=getUserIDInfo($user_id);
  38
+        if($user_info)
  39
+        {
  40
+            echo $user_info['fname']." ".$user_info['lname'];            
  41
+        }
  42
+}
  43
+
  44
+
  45
+?>
6  library/user.inc
@@ -138,4 +138,10 @@ function removeUserSetting($label,$user=NULL) {
138 138
   }
139 139
 }
140 140
 
  141
+
  142
+function getUserIDInfo($id)
  143
+{
  144
+    $res= sqlStatement("SELECT fname,lname,username FROM users where id=?",array($id));
  145
+    return sqlFetchArray($res);
  146
+}
141 147
 ?>
5  templates/documents/general_view.html
@@ -161,9 +161,12 @@
161 161
                         {xl t='Note'} #{$note->get_id()}
162 162
                         {xl t='Date:'} {$note->get_date()}
163 163
                         {$note->get_note()}
  164
+                        {if $note->get_owner()}
  165
+                            &nbsp;-{user_info id=$note->get_owner()}
  166
+                        {/if}
164 167
                         </div>
165 168
                         {/foreach}
166  
-                        {/if}
  169
+                    {/if}
167 170
                     </div>
168 171
                 </div>
169 172
             </div>

0 notes on commit 857a1d3

Please sign in to comment.
Something went wrong with that request. Please try again.