summaryrefslogtreecommitdiff
path: root/includes/helper
diff options
context:
space:
mode:
authorBot <bot@myigel.name>2017-01-02 15:43:36 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2017-01-02 15:49:53 +0100
commitd71e7bbfad2f07f82df0c515608996d250fd4182 (patch)
tree5083a17b218c08b3a699a0bf15bec926cc2dd185 /includes/helper
parent7313e15ce8236e19331fb6639a3a5b97c8f06ecd (diff)
Formatting
Diffstat (limited to 'includes/helper')
-rw-r--r--includes/helper/email_helper.php16
-rw-r--r--includes/helper/graph_helper.php27
-rw-r--r--includes/helper/internationalization_helper.php12
-rw-r--r--includes/helper/message_helper.php6
4 files changed, 35 insertions, 26 deletions
diff --git a/includes/helper/email_helper.php b/includes/helper/email_helper.php
index 934193e2..35bdbc9a 100644
--- a/includes/helper/email_helper.php
+++ b/includes/helper/email_helper.php
@@ -3,22 +3,26 @@
function engelsystem_email_to_user($recipient_user, $title, $message, $not_if_its_me = false)
{
global $user;
-
+
if ($not_if_its_me && $user['UID'] == $recipient_user['UID']) {
return true;
}
-
+
gettext_locale($recipient_user['Sprache']);
-
- $message = sprintf(_("Hi %s,"), $recipient_user['Nick']) . "\n\n" . _("here is a message for you from the engelsystem:") . "\n\n" . $message . "\n\n" . _("This email is autogenerated and has not to be signed. You got this email because you are registered in the engelsystem.");
-
+
+ $message = sprintf(_("Hi %s,"), $recipient_user['Nick']) . "\n\n"
+ . _("here is a message for you from the engelsystem:") . "\n\n"
+ . $message . "\n\n"
+ . _("This email is autogenerated and has not to be signed. You got this email because you are registered in the engelsystem.");
+
gettext_locale();
return engelsystem_email($recipient_user['email'], $title, $message);
}
function engelsystem_email($address, $title, $message)
{
- $result = mail($address, $title, $message, "Content-Type: text/plain; charset=UTF-8\r\nFrom: Engelsystem <noreply@engelsystem.de>");
+ $result = mail($address, $title, $message,
+ "Content-Type: text/plain; charset=UTF-8\r\nFrom: Engelsystem <noreply@engelsystem.de>");
if ($result === false) {
engelsystem_error('Unable to send email.');
}
diff --git a/includes/helper/graph_helper.php b/includes/helper/graph_helper.php
index c2d0f8a2..d844213c 100644
--- a/includes/helper/graph_helper.php
+++ b/includes/helper/graph_helper.php
@@ -2,10 +2,11 @@
/**
* Renders a bargraph
- * @param string $key keyname of the x-axis
- * @param array $row_names keynames for the data rows
- * @param unknown $colors colors for the data rows
- * @param unknown $data the data
+ *
+ * @param string $key keyname of the x-axis
+ * @param array $row_names keynames for the data rows
+ * @param unknown $colors colors for the data rows
+ * @param unknown $data the data
*/
function bargraph($dom_id, $key, $row_names, $colors, $data)
{
@@ -13,7 +14,7 @@ function bargraph($dom_id, $key, $row_names, $colors, $data)
foreach ($data as $dataset) {
$labels[] = $dataset[$key];
}
-
+
$datasets = [];
foreach ($row_names as $row_key => $name) {
$values = [];
@@ -21,20 +22,20 @@ function bargraph($dom_id, $key, $row_names, $colors, $data)
$values[] = $dataset[$row_key];
}
$datasets[] = [
- 'label' => $name,
- 'fillColor' => $colors[$row_key],
- 'data' => $values
- ];
+ 'label' => $name,
+ 'fillColor' => $colors[$row_key],
+ 'data' => $values
+ ];
}
-
+
return '<canvas id="' . $dom_id . '" style="width: 100%; height: 300px;"></canvas>
<script type="text/javascript">
$(function(){
var ctx = $("#' . $dom_id . '").get(0).getContext("2d");
var chart = new Chart(ctx).Bar(' . json_encode([
- 'labels' => $labels,
- 'datasets' => $datasets
- ]) . ');
+ 'labels' => $labels,
+ 'datasets' => $datasets
+ ]) . ');
});
</script>';
}
diff --git a/includes/helper/internationalization_helper.php b/includes/helper/internationalization_helper.php
index 4abf8c4d..d4df1cb7 100644
--- a/includes/helper/internationalization_helper.php
+++ b/includes/helper/internationalization_helper.php
@@ -31,7 +31,7 @@ function gettext_init()
if (isset($_REQUEST['set_locale']) && isset($locales[$_REQUEST['set_locale']])) {
$_SESSION['locale'] = $_REQUEST['set_locale'];
- } elseif (! isset($_SESSION['locale'])) {
+ } elseif (!isset($_SESSION['locale'])) {
$_SESSION['locale'] = $default_locale;
}
@@ -51,7 +51,7 @@ function gettext_locale($locale = null)
if ($locale == null) {
$locale = $_SESSION['locale'];
}
-
+
putenv('LC_ALL=' . $locale);
setlocale(LC_ALL, $locale);
}
@@ -65,10 +65,14 @@ function make_langselect()
{
global $locales;
$URL = $_SERVER["REQUEST_URI"] . (strpos($_SERVER["REQUEST_URI"], "?") > 0 ? '&' : '?') . "set_locale=";
-
+
$items = [];
foreach ($locales as $locale => $name) {
- $items[] = toolbar_item_link(htmlspecialchars($URL) . $locale, '', '<img src="pic/flag/' . $locale . '.png" alt="' . $name . '" title="' . $name . '"> ' . $name);
+ $items[] = toolbar_item_link(
+ htmlspecialchars($URL) . $locale,
+ '',
+ '<img src="pic/flag/' . $locale . '.png" alt="' . $name . '" title="' . $name . '"> ' . $name
+ );
}
return $items;
}
diff --git a/includes/helper/message_helper.php b/includes/helper/message_helper.php
index 323eee4d..a085aa0e 100644
--- a/includes/helper/message_helper.php
+++ b/includes/helper/message_helper.php
@@ -5,7 +5,7 @@
*/
function msg()
{
- if (! isset($_SESSION['msg'])) {
+ if (!isset($_SESSION['msg'])) {
return "";
}
$msg = $_SESSION['msg'];
@@ -48,8 +48,8 @@ function alert($class, $msg, $immediatly = false)
}
return '<div class="alert alert-' . $class . '">' . $msg . '</div>';
}
-
- if (! isset($_SESSION['msg'])) {
+
+ if (!isset($_SESSION['msg'])) {
$_SESSION['msg'] = "";
}
$_SESSION['msg'] .= alert($class, $msg, true);