+ // makeRecordLabel - builds a human readable label for a row in week view,
+ // which is a combination ot record properties.
+ // Client - Project - Task - Custom field 1.
+ // Note that billable property is not part of the label. Instead, we intend to
+ // identify such records with a different color in week view.
+ static function makeRecordLabel($record) {
+ // TODO: debug this function.
+ global $user;
+ // Start with client.
+ if ($user->isPluginEnabled('cl'))
+ $label = $record['client'];
+
+ // Add project.
+ $project = $record['project'] ? $record['project'] : '';
+ if (!empty($label)) $label .= ' - ';
+ $label .= $project;
+
+ // Add task.
+ $task = $record['task'] ? $record['task'] : '';
+ if (!empty($label)) $label .= ' - ';
+ $label .= $task;
+
+ // Add custom field 1.
+ if ($user->isPluginEnabled('cf')) {
+ if ($record['cf_1_value']) {
+ if (!empty($label)) $label .= ' - ';
+ $label .= $record['cf_1_value'];
+ }
+ }
+
+ return $label;
+ }
+