function home_main() { global $config, $files_dir, $mapping; if ($m = readConf("admin_message")) { addErrorMessage($m); } checkFilesDir(); $btns = churchcore_getModulesSorted(); if (isset($_SESSION["family"])) { addInfoMessage(t('there.are.more.users.with.the.same.email')); } $txt = ' <div class="hero-unit hidden-phone"> <h1>' . $config["welcome"] . '</h1> <p class="hidden-phone">' . $config["welcome_subtext"] . '</p> <p>'; foreach ($btns as $key) { if (isset($config[$key . "_startbutton"]) && $config[$key . "_startbutton"] == "1" && user_access("view", $key)) { $txt .= '<a class="btn btn-large" href="?q=' . $key . '">' . $config[$key . "_name"] . '</a> '; } } $txt .= '</p>'; $txt .= '</div>'; $txt .= '<div class="well visible-phone"> <h1>' . t("welcome") . '!</h1> <p>' . $_SESSION["user"]->vorname . ', ' . t("chose.your.possibilities") . ':</p> <ul class="nav nav-pills nav-stacked">'; foreach ($btns as $key) { if (isset($config[$key . "_name"]) && $config[$key . "_name"] != "" && user_access("view", $key)) { include_once SYSTEM . '/' . $mapping[$key]; $txt .= '<li><a class="btn btn-large" href="?q=' . $key . '">' . $config[$key . "_name"] . '</a> '; } } $txt .= '</ul>'; $txt .= '</div>'; // blocks[]: label, col(1,2,3) sortkey, html $blocks = null; foreach ($btns as $key) { if (!empty($config[$key . "_name"])) { include_once SYSTEM . '/' . $mapping[$key]; if (function_exists($key . "_blocks")) { $b = call_user_func($key . "_blocks"); foreach ($b as $block) { $blocks[$block["col"]][] = $block; } } } } $txt .= '<div class="row-fluid">'; for ($i = 1; $i <= 3; $i++) { $txt .= '<ul class="span4">'; if (isset($blocks[$i])) { churchcore_sort($blocks[$i], "sortkey"); foreach ($blocks[$i] as $block) { if ($block["html"] != null && $block["html"] != "") { $txt .= '<li class="ct_whitebox'; if (isset($block["class"])) { $txt .= ' ' . $block["class"]; } $txt .= '">'; $txt .= '<label class="ct_whitebox_label">' . $block["label"] . "</label>"; if (isset($block["help"])) { $txt .= '<div style="float:right;margin:-34px -12px">'; $txt .= '<a href="http://intern.churchtools.de?q=help&doc=' . $block["help"] . '" title="' . t("open.help") . '" target="_clean"><i class="icon-question-sign"></i></a>'; $txt .= '</div>'; } $txt .= $block["html"]; } } } $txt .= '</ul>'; } $txt .= '</div>'; drupal_add_js(MAIN . '/home.js'); return $txt; }
/** * home main function * * @return string html content */ function home_main() { global $config, $files_dir, $mapping; if ($m = getConf("admin_message")) { addErrorMessage($m); } checkFilesDir(); $modules = churchcore_getModulesSorted(); if (isset($_SESSION["family"])) { addInfoMessage(t('there.are.more.users.with.the.same.email')); } // Start buttons for Desktop-View $txt = ' <div class="hero-unit hidden-phone"> <h1>' . getVar("welcome", "", $config) . '</h1> <p class="hidden-phone">' . getVar("welcome_subtext", "", $config) . '</p> <p>'; // module buttons normal foreach ($modules as $m) { if (getConf($m . "_startbutton") && user_access("view", $m)) { $txt .= "<a class='btn btn-large' href='?q={$m}'>" . $config[$m . "_name"] . '</a> '; } } $txt .= ' </p> </div>'; // Start buttons for Mobile-View $txt .= ' <div class="well visible-phone"> <h1>' . t("welcome") . '!</h1> <p>' . $_SESSION["user"]->vorname . ', ' . t("chose.your.possibilities") . ':</p> <ul class="nav nav-pills nav-stacked">'; // module buttons mobile foreach ($modules as $m) { if (getConf($m . "_name") && getConf($m . "_startbutton") == "1" && user_access("view", $m)) { $txt .= "<li><a class='btn btn-large' href='?q={$m}'>" . $config[$m . "_name"] . '</a> '; } } $txt .= '</ul>' . NL; $txt .= '</div>' . NL; // blocks[]: label, col(1,2,3) sortkey, html $blocks = null; foreach ($modules as $m) { if (getConf($m . "_name")) { include_once SYSTEM . '/' . $mapping[$m]; //TODO: this functions are actually only config arrays - handle them as such and put them on a place a admin may even change them. if (function_exists($m . "_blocks")) { $b = call_user_func($m . "_blocks"); foreach ($b as $block) { $blocks[$block["col"]][] = $block; } } } } $txt .= '<div class="row-fluid">'; for ($i = 1; $i <= 3; $i++) { $txt .= '<ul class="span4">'; if (isset($blocks[$i])) { churchcore_sort($blocks[$i], "sortkey"); //TODO: why not put them in the right order where they are defined? foreach ($blocks[$i] as $block) { if ($block["html"]) { $txt .= '<li class="ct_whitebox ' . $block["class"] . '">'; $txt .= '<label class="ct_whitebox_label">' . $block["label"] . "</label>"; if (isset($block["help"])) { $txt .= '<div style="float:right;margin:-34px -12px">'; $txt .= '<a href="http://intern.churchtools.de?q=help&doc=' . $block["help"] . '" title="' . t("open.help") . '" target="_clean"><i class="icon-question-sign"></i></a>'; $txt .= '</div>'; } $txt .= $block["html"]; } } } $txt .= '</ul>' . NL; } $txt .= '</div>' . NL; drupal_add_js(MAIN . '/home.js'); return $txt; }