protected function getContent()
 {
     $content = '<ol class="breadcrumb">
               <li><a href="' . ROOT_DIR . 'admin/courseadmin">' . I18n::t('courseoverview.title') . '</a></li>
               <li><a href="' . ROOT_DIR . 'admin/lessonadmin/' . $this->course->getId() . '">' . $this->course->getName(I18n::getLang()) . '</a></li>
               <li class="active">' . $this->lesson->getName(I18n::getLang()) . '</li>
             </ol>';
     $content .= '<form method="post"><input type="hidden" name="action" value="saveExercises" />
 <table id="exercise-admin-table" class="table table-hover">
 <thead>
 <tr>
 <th>' . I18n::t('admin.exerciseadmin.question') . '</th>
 <th>' . I18n::t('admin.exerciseadmin.answer') . ' (EN)</th>
 <th>' . I18n::t('admin.exerciseadmin.answer') . ' (DE)</th>
 <th>&nbsp;</th>
 </tr>
 </thead>
 <tbody>';
     foreach ((array) Exercise::getMultipleExercises($this->lesson->getId(), 50, 0) as $exercise) {
         $content .= '<tr><input type="hidden" name="exercise_id[]" value="' . $exercise->getId() . '" />
   <td><input type="text" name="question[]" value="' . $exercise->getQuestion() . '" /></td>
   <td><input type="text" name="answer_en[]" value="' . $exercise->getAnswer('en') . '" /></td>
   <td><input type="text" name="answer_de[]" value="' . $exercise->getAnswer('de') . '" /></td>
   </tr>';
     }
     $content .= '</tbody>
 </table>
 <table width="100%">
 <tr><td width="50%" align="left"><button id="exercise-add-btn" class="btn btn-default" type="button">' . I18n::t('button.add') . '</button></td>
 <td width="50%" align="right"><input type="submit" class="btn btn-default" value="' . I18n::t('button.save') . '" /></td></tr>
 </table>
 </form>';
     return $content;
 }
Esempio n. 2
0
 protected function getContent()
 {
     $content = '<ol class="breadcrumb">
               <li><a href="' . ROOT_DIR . 'courseoverview">' . I18n::t('courseoverview.title') . '</a></li>
               <li><a href="' . ROOT_DIR . 'course/' . $this->course->getId() . '">' . $this->course->getName(I18n::getLang()) . '</a></li>
               <li><a href="' . ROOT_DIR . 'lesson/' . $this->lesson->getId() . '">' . $this->lesson->getName(I18n::getLang()) . '</a></li>
               <li class="active">' . I18n::t('exercises.title') . '</li>
             </ol>';
     $content .= '<h1>' . $this->lesson->getName(I18n::getLang()) . ': ' . I18n::t('exercises.title') . '</h1>
 <p>
   &nbsp;
 </p>
 <form method="post" class="form-horizontal"><input type="hidden" name="action" value="evaluate" />
   <div class="form-group">
     <label for="inputPassword3" class="col-sm-3 control-label">' . $this->question . '</label>
     <div class="col-sm-9">
       <input type="text" class="form-control" name="answer" placeholder="' . I18n::t('exercise.youranswer') . '">
     </div>
   </div>
   <div class="form-group">
     <div class="col-sm-offset-3 col-sm-9">
       <button type="submit" class="btn btn-default">' . I18n::t('button.submit') . '</button>
     </div>
   </div>
 </form>';
     return $content;
 }
Esempio n. 3
0
 /**
  * Translate error message
  * 
  * @param string $string    String to translate
  * @param array $opt        Array of arguments to pass to the translation (like field name)
  * @return string           The translated string if exists else the original string
  */
 protected function translate($string, $opt = array())
 {
     $args = !empty($this->fullName) ? array('name' => $this->fullName) : array('name' => $this->fieldName);
     $args = array_merge($args, $opt);
     $moduleName = get_module_name(get_class($this));
     if ($moduleName !== null) {
         $file = MODULES_DIR . DS . $moduleName . DS . 'i18n' . DS . 'rules.' . I18n::getLang() . '.xml';
     } else {
         $file = FW_DIR . DS . 'form' . DS . 'check' . DS . 'i18n' . DS . 'rules.' . I18n::getLang() . '.xml';
     }
     return I18n::t($file, $string, $args, 'en', 'rules', true);
 }
Esempio n. 4
0
/**
 * This method will translate or create an enter in the module xliff locale file
 * 
 * @param array $params         An array of parameters to give to i18n::translate()
 * @param string $content       The string to translate {t}...content...{/t}
 * @param Smarty $smarty        The current Smarty instance
 * @param boolean $repeat       Are we in the end of {t} tag
 * @return string               The translated string, else the original string
 */
function smarty_block_t($params, $content, &$smarty, &$repeat)
{
    if ($repeat == false) {
        // we get the template locale if setted by {setLocale} tag
        $srcLocale = isset($smarty->tpl_vars['TPL_LOCALE']) ? $smarty->tpl_vars['TPL_LOCALE']->value : i18n::getDefaultLocale();
        // if template locale is equal to current locale we don't need to translate
        if ($srcLocale === i18n::getLocale()) {
            return i18n::replaceArgs($content, $params);
        }
        // we get the template path
        $path = explode(DS, str_replace(APP_DIR . DS, '', $smarty->template_resource));
        // module var has been setted in smarty
        if (isset($smarty->smarty->module)) {
            $isModule = true;
            $module = $smarty->smarty->module;
        } else {
            $isModule = array_search('module', $path);
            if ($isModule !== false) {
                $module = $path[$isModule + 1];
            }
        }
        // we are in a module, we can translate
        if ($isModule !== false) {
            // Get locale file with full locale code (ex : fr_CA) for overloading
            if ($file = get_module_file($module, '/i18n/templates.' . $srcLocale . '.xml')) {
                $str = I18n::t($file, $content, $params, $srcLang, end($path));
                if ($str !== $string) {
                    return $str;
                }
                // There is a specific translation for full locale code, return
            }
            // get the lang code
            preg_match('/^([a-z]{2,3})[_-]([A-Z]{2})$/', $srcLocale, $m);
            $srcLang = $m[0];
            // If default lang is equal to the current lang : return
            if ($srcLang == i18n::getLang()) {
                return i18n::replaceArgs($content, $params);
            }
            // Get locale file with only lang code (ex : fr) or create it
            $file = get_module_file($module, '/i18n/templates.' . I18n::getLang() . '.xml', false);
            return I18n::t($file, $content, $params, $srcLang, end($path));
        }
        return i18n::replaceArgs($content, $params);
    }
}
 protected function getContent()
 {
     $content = '<ol class="breadcrumb">
               <li><a href="' . ROOT_DIR . 'admin/courseadmin">' . I18n::t('courseoverview.title') . '</a></li>
               <li class="active">' . $this->course->getName(I18n::getLang()) . '</li>
             </ol>';
     $content .= '<table class="table table-hover">
     <thead>
       <tr>
         <th>' . I18n::t('admin.lessonadmin.lessonnr') . '</th>
         <th>Name EN</th>
         <th>Name DE</th>
         <th>' . I18n::t('admin.lessonadmin.points') . '</th>
         <th>' . I18n::t('admin.lessonadmin.added') . '</th>
         <th colspan="2">' . I18n::t('text.edit') . '</th>
       </tr>
     </thead>
     <tbody>';
     foreach ((array) Lesson::getMultipleLessons($this->course->getId(), 50, 0) as $lesson) {
         $content .= '<tr>
                 <td>' . $lesson->getLessonNr() . '</td>
                 <td>' . $lesson->getName('en') . '</td>
                 <td>' . $lesson->getName('de') . '</td>
                 <td>' . $lesson->getPoints() . '</td>
                 <td>' . $lesson->timestampAdded() . '</td>
                 <td><a class="btn btn-default btn-sm" href="' . ROOT_DIR . 'admin/tutorialadmin/' . $lesson->getId() . '">Tutorial</a></td>
                 <td><a class="btn btn-default btn-sm" href="' . ROOT_DIR . 'admin/exerciseadmin/' . $lesson->getId() . '">' . I18n::t('exercises.title') . '</a></td>
                 <td><form method="post">
                   <input type="hidden" name="action" value="deleteLesson" />
                   <input type="hidden" name="lessonId" value="' . $lesson->getId() . '" />
                   <input type="submit" class="btn btn-default btn-sm" value="' . I18n::t('button.delete') . '" />
                 </form></td>
               </tr>';
     }
     $content .= '</tbody>
   </table>';
     return $content;
 }
 public function evaluate()
 {
     if (isset($_POST['answer']) && !empty($_POST['answer'])) {
         $input = $this->secureString($_POST['answer']);
         $correct = $_SESSION['currentExercise']->getAnswer(I18n::getLang());
         // trim whitespaces, remove not relevant characters in order to be more flexible with user input
         $removedChars = '/(\\W+)|[0-9]|_/';
         $input = trim($input);
         $input = preg_replace($removedChars, '', $input);
         $correct = trim($correct);
         $correct = preg_replace($removedChars, '', $correct);
         if (strtolower($input) === strtolower($correct)) {
             $updated = Exercise::addCorrectAnswer($_SESSION['user']->getEmail(), $_SESSION['currentExercise']->getId());
             if (!$updated) {
                 $this->getView()->addErrorMessage('Could not update DB.');
             }
             $this->getView()->addSuccessMessage(I18n::t('exercise.correct'));
         } else {
             $this->getView()->addErrorMessage(I18n::t('exercise.wrong'));
         }
     }
     $this->defaultAction();
 }
Esempio n. 7
0
if (!isset($_GET['id']) || empty($_GET['id'])) {
    die("Please first select a lesson!");
}
$lessonId = htmlspecialchars($_GET['id']);
$lessonId = DB::escapeString($lessonId);
$lesson = Lesson::getLesson($lessonId);
$course = Course::getCourseById($lesson->getCourseId());
if (!isset($lesson)) {
    die("This lesson was not found!");
}
$courseId = $lesson->getCourseId();
$filePath = PAGE_DIR . "lessons/{$courseId}-{$lessonId}.html";
$exerciseComponent = '<div class="well ui">
    <form action="' . ROOT_DIR . 'exercises/' . $lessonId . '" method="post">
      <button type="submit" class="btn btn-default btn-block">' . I18n::t('lesson.startexercises') . '</button>
    </form>
  </div>';
// display content
echo '<ol class="breadcrumb">
                <li><a href="' . ROOT_DIR . 'courseoverview">' . I18n::t('courseoverview.title') . '</a></li>
                <li><a href="' . ROOT_DIR . 'course/' . $course->getId() . '">' . $course->getName(I18n::getLang()) . '</a></li>
                <li class="active">' . $lesson->getName(I18n::getLang()) . '</li>
              </ol>';
echo $exerciseComponent;
echo '<h1>' . $lesson->getName(I18n::getLang()) . '</h1>';
if (file_exists($filePath) && filesize($filePath) > 1) {
    echo '<h2>Tutorial</h2>';
    echo file_get_contents($filePath);
    echo $exerciseComponent;
}
Esempio n. 8
0
?>
</li>
</ol>

<h1><?php 
echo $course->getName(I18n::getLang());
?>
</h1>

<p>
  <?php 
echo I18n::t('course.text');
?>
</p>

<?php 
$lessons = Lesson::getMultipleLessons($courseId, 20, 0);
foreach ($lessons as $lesson) {
    $percentage = Exercise::getPercentageCorrect($_SESSION['user']->getEmail(), $lesson->getId());
    $width = $percentage > 3 ? $percentage : 3;
    echo '<a href="' . ROOT_DIR . 'lesson/' . $lesson->getId() . '">
            <div class="jumbotron course">
              ' . $lesson->getLessonNr() . ') ' . $lesson->getName(I18n::getLang()) . '
              <div class="progress">
                <div class="progress-bar" role="progressbar" aria-valuenow="' . $percentage . '" aria-valuemin="0" aria-valuemax="100" style="width: ' . $width . '%;">
                  ' . $percentage . '%
                </div>
              </div>
            </div>
          </a>';
}
Esempio n. 9
0
<h1>Impressum</h1>

<?php 
if (I18n::getLang() === 'de') {
    ?>

<h3>Verantwortung für die Website</h3>
<p>Steven Cardini, Bern, Schweiz</p>
<p><a href="<?php 
    echo ROOT_DIR;
    ?>
feedback">Zum Kontaktformular</a></p>

<h3>Haftungsausschluss</h3>
<p>Wir veröffentlichen die Informationen auf unseren Webseiten mit Sorgfalt. Die Autoren übernehmen jedoch keinerlei Gewähr hinsichtlich der inhaltlichen Richtigkeit, Genauigkeit, Aktualität, Zuverlässigkeit und Vollständigkeit der Informationen.</p>
<p>Haftungsansprüche gegen die Autoren wegen Schäden materieller oder immaterieller Art, welche aus dem Zugriff oder der Nutzung bzw. Nichtnutzung der veröffentlichten Informationen, durch Missbrauch der Verbindung oder durch technische Störungen entstanden sind, werden ausgeschlossen.</p>
<p>Alle Angebote sind unverbindlich. Die Autoren behalten es sich ausdrücklich vor, Teile der Seiten oder das gesamte Angebot ohne gesonderte Ankündigung zu verändern, zu ergänzen, zu löschen oder die Veröffentlichung zeitweise oder endgültig einzustellen.</p>

<h3>Haftung für Links</h3>
<p>Verweise und Links auf Webseiten Dritter liegen ausserhalb unseres Verantwortungsbereichs. Der Zugriff und die Nutzung solcher Webseiten erfolgen auf eigene Gefahr des Nutzers oder der Nutzerin. Die Autoren erklären ausdrücklich, dass sie keinerlei Einfluss auf die Gestaltung, den Inhalt und die Angebote der verknüpften Seiten haben. Informationen und Dienstleistungen von verknüpften Webseiten liegen vollumfänglich in der Verantwortung des jeweiligen Dritten.</p>
<p>Es wird jegliche Verantwortung für solche Webseiten abgelehnt.</p>

<h3>Urheberrechte</h3>
<p>© 2015 - 2016, Steven Cardini, Bern, Schweiz</p>
<p>Die auf unseren Websites enthaltenen Informationen werden der Öffentlichkeit zugänglich gemacht. Durch das Herunterladen oder Kopieren von Inhalten, Bildern, Fotos oder anderen Dateien werden keinerlei Rechte bezüglich der Inhalte übertragen.</p>
<p>Die Urheber- und alle anderen Rechte an Inhalten, Bildern, Fotos oder anderen Dateien auf unseren Websites gehören ausschliesslich den Autoren oder den speziell genannten Rechtsinhabern. Für die Reproduktion jeglicher Elemente ist die schriftliche Zustimmung der Urheberrechtsträger im Voraus einzuholen.</p>

<h3>Datenschutz</h3>
<p>Gestützt auf Artikel 13 der schweizerischen Bundesverfassung und die datenschutzrechtlichen Bestimmungen des Bundes (Datenschutzgesetz, DSG) hat jede Person Anspruch auf Schutz ihrer Privatsphäre sowie auf Schutz vor Missbrauch ihrer persönlichen Daten. Wir halten diese Bestimmungen ein. Persönliche Daten werden streng vertraulich behandelt und weder an Dritte verkauft noch weiter gegeben.</p>
<p>In enger Zusammenarbeit mit unseren Hosting-Providern bemühen wir uns, die Datenbanken so gut wie möglich vor fremden Zugriffen, Verlusten, Missbrauch oder vor Fälschung zu schützen.</p>
<p>Beim Zugriff auf unsere Webseiten werden folgende Daten auf unserem Webserver gespeichert: IP-Adresse, Datum, Uhrzeit, Browser-Anfrage und allg. übertragene Informationen zum Betriebssystem resp. Browser. Diese Nutzungsdaten bilden die Basis für statistische, anonyme Auswertungen, so dass Trends erkennbar sind, anhand derer wir unsere Angebote entsprechend verbessern können.</p>
Esempio n. 10
0
    <?php 
require_once TEMPLATE_DIR . 'maincontent.php';
// include main content
?>
  </div>
  <?php 
require_once TEMPLATE_DIR . 'footer.php';
// include footer
?>

  <script>var ROOT_DIR = <?php 
echo json_encode(ROOT_DIR);
?>
</script>
  <script>var LANGUAGE = <?php 
echo json_encode(I18n::getLang());
?>
</script>
  <script src="<?php 
echo ROOT_DIR . LIB_DIR;
?>
ext/jquery-1.11.3.min.js"></script>
  <script src="<?php 
echo ROOT_DIR . LIB_DIR;
?>
ext/bootstrap-3.3.5-dist/js/bootstrap.min.js"></script>
  <script src="<?php 
echo ROOT_DIR . JS_DIR;
?>
application.js" type="text/javascript"></script>
  <?php 
Esempio n. 11
0
<h1><?php 
echo I18n::t('courseoverview.title');
?>
</h1>

<p>
  <?php 
echo I18n::t('courseoverview.text');
?>
</p>

<?php 
$courses = Course::getMultipleCourses(20, 0);
foreach ($courses as $course) {
    echo '<a href="' . ROOT_DIR . 'course/' . $course->getId() . '">
            <div class="jumbotron course">
              ' . $course->getName(I18n::getLang()) . '
            </div>
          </a>';
}