示例#1
0
function editworkentry_GET(Web $w)
{
    list($workentry_id) = $w->pathMatch("id");
    if (empty($workentry_id)) {
        $w->error("Missing an ID");
    }
    $workentry = $w->Bend->getWorkEntryForId($workentry_id);
    if (empty($workentry)) {
        $w->error("No work entry found for this id: " . $workentry_id);
    }
    $category = $workentry->getWorkCategory();
    list($category_1, $category_2, $category_3) = $category->getPath();
    $form["Work Hours"] = array(array($w->Auth->hasRole("bend_admin") ? array("Who did the work?", "select", "user_id", $workentry->user_id, $w->Bend->getOccupantUsers()) : array("Who did the work?", "static", "", $w->Auth->getUser($workentry->user_id)->getFullName()), array("Who to credit to", "select", "attributed_user_id", $workentry->attributed_user_id, $w->Bend->getOccupantUsers()), array("Date", "date", "d_date", formatDate($workentry->d_date)), array("Hours", "text", "hours", $workentry->hours)), array(array("Focus Group", "select", "category_1", defaultVal($category_1->id), $w->Bend->getTopLevelWorkCategories()), array("Team or Activity", "select", "category_2", defaultVal($category_2->id), !empty($category_1) ? $category_1->getChildren() : null), array("Activity", "select", "category_3", defaultVal($category_3->id), !empty($category_2) ? $category_2->getChildren() : null)), array(array("Description", "text", "description", $workentry->description)));
    $w->ctx("form", Html::multiColForm($form, "/bend-workhours/editworkentry/{$workentry_id}", "POST", "Save"));
}
示例#2
0
function setLanguage()
{
    $defaultLang = "fr_FR";
    $language = defaultVal($_SESSION, "language", $defaultLang);
    if (isset($_GET["lang"])) {
        $lang = filter_input(INPUT_GET, 'lang', FILTER_SANITIZE_STRING);
        if (strpos($lang, "en") === 0) {
            $language = "en_US";
        } else {
            $language = $defaultLang;
        }
    }
    putenv("LANG=" . $language);
    setlocale(LC_ALL, $language);
    //echo "Setting language to " . $language;
    // Set the text domain as "messages"
    $domain = "messages";
    bindtextdomain($domain, "locale");
    //bind_textdomain_codeset($domain, 'UTF-8');
    textdomain($domain);
    // Just return fr or en
    return substr($language, 0, 2) === "en" ? ENGLISH : FRENCH;
}
示例#3
0
文件: req-cv.php 项目: zfadade/cmform
<?php 
require_once "includes/php_utils.php";
//require './vendor/autoload.php';
// i18n:
$language = setLanguage();
$nameErr = $emailErr = "";
$clientName = defaultVal($_SESSION, "clientName", "");
$clientEmail = defaultVal($_SESSION, "clientEmail", "");
$clientComment = defaultVal($_SESSION, "clientComment", "");
// The form has been submitted.  Do error correction, and act on data if it's good
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    echo 'Form got submitted' . "<br>";
    // Verify client name
    $clientName = filter_input(INPUT_POST, 'clientName', FILTER_SANITIZE_STRING);
    if (empty($clientName)) {
        $nameErr = _("nom_obligatoire");
    } else {
        if (!preg_match("/^[a-zA-Z0-9 .]*\$/", $clientName)) {
            $nameErr = _("courriel_chars");
            $clientName = "";
            //$nameErr = "Only letters, numbers and white space allowed";
        }
    }
    // Verify client email
    $clientEmail = filter_input(INPUT_POST, 'clientEmail', FILTER_SANITIZE_STRING);
    if (empty($clientEmail)) {
        $emailErr = _("courriel_obligatoire");
    } else {
        if (!filter_var($clientEmail, FILTER_VALIDATE_EMAIL)) {
            $emailErr = _("courriel_invalide");
示例#4
0
 public function testBody()
 {
     return $this->renderBody(json_decode(defaultVal($this->test_body_json, "[]"), true));
 }
示例#5
0
<!doctype html>
<html class="no-js" lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Foundation | Welcome</title>
    <link rel="stylesheet" href="/modules/frontend/assets/css/foundation.css" />
    <script src="/modules/frontend/assets/js/vendor/modernizr.js"></script>
  </head>
  <body>
    
    <?php 
echo defaultVal($body);
?>
    
    <script src="/modules/frontend/assets/js/vendor/jquery.js"></script>
    <script src="/modules/frontend/assets/js/foundation.min.js"></script>
    <script>
      $(document).foundation();
    </script>
  </body>
</html>
示例#6
0
<?php

if (!isset($_SESSION)) {
    session_start();
}
require_once "includes/php_utils.php";
$thankYouName = defaultVal($_SESSION, "thankYouName", "");
?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Elorac Reyem - Merci </title>
    <link rel="stylesheet" href="style/normalize.css">
    <link rel="stylesheet" href="style/main.css">
</head>
<body>

	<div id="wrapper">
		<h1> 
		<?php 
echo "Merci " . $thankYouName . " pour votre int&eacute;r&ecirc;t";
?>
		</h1>

	</div>

</body>