function smarty_function_notifications($params, &$smarty) { $user = array_required_var($params, 'user', true, 'IUser'); $activity_logs = NotificationsActivityLogs::findRecent($user); $interface = array_var($params, 'interface', AngieApplication::getPreferedInterface(), true); $id = isset($params['id']) && $params['id'] ? $params['id'] : HTML::uniqueId('activity_log'); $wrapper = '<div id="' . $id . '" class="quick_view_item">'; $wrapper .= '</div>'; list($authors, $subjects, $targets) = ActivityLogs::loadRelatedDataFromActivities($activity_logs, $user); // Load related data, so we can pass it to callbacks return $wrapper .= '<script type="text/javascript">$("#' . $id . '").activityLog(' . JSON::encode(array('entries' => $activity_logs, 'authors' => $authors, 'subjects' => $subjects, 'targets' => $targets, 'callbacks' => ActivityLogs::getCallbacks(), 'decorator' => ActivityLogs::getDecorator($interface), 'interface' => $interface)) . ');</script>'; }
/** * Render object estimate value and change option * * @param array $params * @param Smarty $smarty */ function smarty_function_remedia_milestone_estimate_icon($params, &$smarty) { if (AngieApplication::isModuleLoaded('tracking')) { $object = array_required_var($params, 'object', true, 'RemediaMilestone'); $user = array_required_var($params, 'user', true, 'IUser'); $id = isset($params['id']) && $params['id'] ? $params['id'] : HTML::uniqueId('object_estimate'); $estimate = $object->tracking()->getEstimate(); if ($estimate instanceof Estimate) { $estimate_value = $estimate->getValue(); $estimate_autogenerated = $object->tracking()->isEstimateAutogenerated(); } else { $estimate_value = 0; $estimate_autogenerated = false; } // if $settings = array('value' => $estimate_value, 'estimate_autogenerated' => $estimate_autogenerated, 'short_format' => array_var($params, 'short', true), 'can_change' => $object->tracking()->canEstimate($user), 'estimates_url' => $object->tracking()->getEstimatesUrl(), 'set_estimate_url' => $object->tracking()->getSetEstimateUrl()); return '<span id="' . $id . '"></span><script type="text/javascript">$("#' . $id . '").objectEstimateIcon(' . JSON::encode($settings) . ');</script>'; } else { return ''; } // if }