コード例 #1
0
ファイル: LoginView.php プロジェクト: jne21/WBT
 static function get($data)
 {
     $application = Application::getInstance();
     $registry = Registry::getInstance();
     $tpl = new Template($registry->get('template_path') . 'login.htm');
     return $tpl->apply(['message' => $data['message'], 'loginError' => $_SESSION['login_error'], 'site_root' => $application->siteRoot]);
 }
コード例 #2
0
ファイル: ExerciseEditView.php プロジェクト: jne21/WBT
 static function get($data)
 {
     $application = Application::getInstance();
     $registry = Registry::getInstance();
     $exercise = $data['exercise'];
     $tpl = new Template($registry->get('template_path') . 'exercise_edit.htm');
     return $tpl->apply(['id' => $exercise->id, 'name' => htmlspecialchars($exercise->name), 'description' => htmlspecialchars($exercise->description), 'controller' => htmlspecialchars($exercise->controller), 'config_template' => htmlspecialchars($exercise->configTemplate), 'site_root' => $application->siteRooot]);
 }
コード例 #3
0
ファイル: RouterEditView.php プロジェクト: jne21/WBT
 static function get($data)
 {
     $application = Application::getInstance();
     $registry = Registry::getInstance();
     $router = $data['router'];
     $tpl = new Template($registry->get('template_path') . 'router_edit.htm');
     return $tpl->apply(['id' => $router->id, 'name' => htmlspecialchars($router->name), 'url' => htmlspecialchars($router->url), 'controller' => $router->controller, 'site_root' => $application->siteRooot]);
 }
コード例 #4
0
ファイル: CourseListView.php プロジェクト: jne21/WBT
 static function get($data)
 {
     $registry = Registry::getInstance();
     $application = Application::getInstance();
     $localeId = $registry->get('locale');
     $localeData = LocaleManager::getLocaleData($localeId);
     $tpl = new Template($registry->get('template_path') . 'course.htm');
     $tpli = new template($registry->get('template_path') . 'course_item.htm');
     $listItems = '';
     foreach ($data['list'] as $item) {
         $listItems .= $tpli->apply(['id' => $item->id, 'name' => $item->l10n->get('name', $localeId), 'owner' => $data['ownerList'][$item->ownerId]->name, 'dateCreate' => date($localeData['dateFormat'], $item->dateCreate), 'dateUpdate' => $item->dateUpdate ? date($localeData['dateFormat'], $item->dateUpdate) : '', 'active' => $item->state, 'rights' => $item->rights]);
     }
     return $tpl->apply(['items' => $listItems, 'site_root' => $application->siteRoot]);
 }
コード例 #5
0
ファイル: ExerciseListView.php プロジェクト: jne21/WBT
 static function get($data)
 {
     $application = Application::getInstance();
     $registry = Registry::getInstance();
     $tpl = new Template($registry->get('template_path') . 'exercise.htm');
     $tpli = new Template($registry->get('template_path') . 'exercise_item.htm');
     $list = $data['list'];
     $cnt = count($data['list']);
     $listItems = '';
     foreach ($list as $line) {
         $listItems .= $tpli->apply(['id' => $line->id, 'name' => $line->name, 'description' => $line->description, 'controller' => $line->controller, 'configTemplate' => $line->configTemplate]);
     }
     return $tpl->apply(['count' => $cnt, 'items' => $listItems, 'site_root' => $application->siteRoot]);
 }
コード例 #6
0
ファイル: AdminListView.php プロジェクト: jne21/WBT
 static function get($data)
 {
     $application = Application::getInstance();
     $registry = Registry::getInstance();
     $i18n = new I18n($registry->get('i18n_path') . 'admin.xml');
     $localeData = LocaleManager::getLocaleData($registry->get('locale'));
     $tpl = new Template($registry->get('template_path') . 'admin.htm');
     $tpli = new template($registry->get('template_path') . 'admin_item.htm');
     $listItems = '';
     foreach ($data['list'] as $item) {
         $listItems .= $tpli->apply(['id' => $item->id, 'description' => $item->description, 'email' => $item->email, 'login' => $item->login, 'name' => $item->name, 'state' => $i18n->get('state' . $item->state), 'rights' => $item->rights, 'dateCreate' => date($localeData['dateFormat'], $item->dateCreate), 'dateLogin' => $item->dateLogin ? date($localeData['dateFormat'], $item->dateLogin) : '', 'locale' => $item->locale]);
     }
     return $tpl->apply(['items' => $listItems, 'site_root' => $application->siteRoot]);
 }
コード例 #7
0
ファイル: RendererCMSView.php プロジェクト: jne21/WBT
 static function get($data)
 {
     $registry = Registry::getInstance();
     switch ($data['pageMode']) {
         case Page::MODE_POPUP:
             $templateFileName = 'popup.htm';
             break;
         case Page::MODE_NORMAL:
         default:
             $templateFileName = 'main.htm';
     }
     $tpl = new TemplateFile($registry->get('template_path') . $templateFileName);
     return $tpl->getContent();
 }
コード例 #8
0
ファイル: AdminEditView.php プロジェクト: jne21/WBT
 static function get($data)
 {
     $application = Application::getInstance();
     $registry = Registry::getInstance();
     $locale = $registry->get('locale');
     $locales = LocaleManager::getLocales();
     $tplso = new Template($registry->get('template_path') . 'select_option.htm');
     $admin = $data['admin'];
     $localeItems = '';
     foreach ($locales as $locale => $localeData) {
         $localeItems .= $tplso->apply(['name' => $localeData['name'], 'value' => $locale, 'selected' => $locale == $admin->locale]);
     }
     $localeData = LocaleManager::getLocaleData($registry->get('locale'));
     $tpl = new Template($registry->get('template_path') . 'admin_edit.htm');
     return $tpl->apply(['id' => $admin->id, 'description' => htmlspecialchars($admin->description), 'email' => htmlspecialchars($admin->email), 'login' => htmlspecialchars($admin->login), 'name' => htmlspecialchars($admin->name), 'rights' => $admin->rights, 'state' => $admin->state, 'localeItems' => $localeItems, 'dateCreate' => date($localeData['dateFormat'], $admin->dateCreate), 'dateLogin' => $admin->dateLogin ? date($localeData['dateFormat'] . ' H:i', $admin->dateLogin) : '', 'site_root' => $application->siteRoot]);
 }
コード例 #9
0
ファイル: StageEditView.php プロジェクト: jne21/WBT
 static function get($data)
 {
     $registry = Registry::getInstance();
     $application = Application::getInstance();
     $locales = LocaleManager::getLocales();
     $locale = $registry->get('locale');
     $tpl = new Template($registry->get('template_path') . 'stage_edit.htm');
     $tplTab = new Template($registry->get('template_path') . 'stage_edit_tab.htm');
     $tplTabContent = new Template($registry->get('template_path') . 'stage_edit_tab_content.htm');
     $tplMaterialItem = new Template($registry->get('template_path') . 'material_item.htm');
     $tplMaterialL10hHeaderItem = new Template($registry->get('template_path') . 'material_l10n_header_item.htm');
     $tplMaterialL10nItem = new Template($registry->get('template_path') . 'material_l10n_item.htm');
     $tplMaterialAddItem = new Template($registry->get('template_path') . 'material_add_item.htm');
     $tplMaterialAddL10nItem = new Template($registry->get('template_path') . 'material_add_l10n_item.htm');
     $tplso = new Template($registry->get('template_path') . 'select_option.htm');
     $stage = $data['stage'];
     $tabItems = '';
     $tabContentItems = '';
     $materialL10nItems = '';
     foreach ($locales as $localeId => $localeData) {
         $tabItems .= $tplTab->apply(['localeId' => $localeId, 'name' => $localeData['name']]);
         $tabContentItems .= $tplTabContent->apply(['name' => htmlspecialchars($stage->l10n->get('name', $localeId)), 'meta' => htmlspecialchars($stage->l10n->get('meta', $localeId)), 'description' => htmlspecialchars($stage->l10n->get('description', $localeId)), 'brief' => htmlspecialchars($stage->l10n->get('brief', $localeId)), 'url' => htmlspecialchars($stage->l10n->get('url', $localeId)), 'title' => htmlspecialchars($stage->l10n->get('title', $localeId)), 'localeId' => $localeId]);
         $materialL10nHeaderItems .= $tplMaterialL10hHeaderItem->apply(['locale' => $localeData['name']]);
     }
     $materialItems = '';
     foreach ($data['materials'] as $materialId => $material) {
         $materialL10nItems = '';
         foreach ($locales as $localeId => $localeData) {
             $materialL10nItems .= $tplMaterialL10nItem->apply(['localeId' => $localeId, 'materialId' => $material->id, 'mimeType' => $material->l10n->get('mimeType', $localeId)]);
         }
         $materialItems .= $tplMaterialItem->apply(['id' => $materialId, 'hash' => $material->hash, 'name' => $material->l10n->get('name', $registry->get('locale')), 'description' => $material->l10n->get('description', $registry->get('locale')), 'l10nItems' => $materialL10nItems]);
     }
     $materialAddL10nItems = '';
     foreach ($locales as $localeId => $localeData) {
         $materialAddL10nItems .= $tplMaterialAddL10nItem->apply(['materialId' => 0, 'localeId' => $localeId]);
     }
     $materialItems = $tplMaterialAddItem->apply(['l10nItems' => $materialAddL10nItems]);
     if (!$stage->id) {
         $exerciseItems = '';
         foreach ($data['exercises'] as $exerciseId => $exercise) {
             $exerciseItems .= $tplso->apply(['name' => $exercise->name, 'value' => $exerciseId, 'selected' => FALSE]);
         }
     }
     return $tpl->apply(['id' => $stage->id, 'lessonId' => $data['lessonId'], 'name' => $stage->name, 'config' => $stage->settings, 'tabItems' => $tabItems, 'tabContentItems' => $tabContentItems, 'materialL10nHeaderItems' => $materialL10nHeaderItems, 'materialItems' => $materialItems, 'exerciseName' => $data['exerciseName'], 'exerciseItems' => $exerciseItems, 'site_root' => $application->siteRoot]);
 }
コード例 #10
0
ファイル: SetupController.php プロジェクト: jne21/WBT
 function getList()
 {
     $registry = Registry::getInstance();
     $application = Application::getInstance();
     $i18n = new I18n($registry->get('i18n_path') . 'setup.xml');
     $tpl = new Template($registry->get('template_path') . 'setup.htm');
     $tpli = new Template($registry->get('template_path') . 'setup_item.htm');
     $listItems = '';
     $setup = new Setup();
     foreach ($setup->getList() as $variable) {
         $listItems .= $tpli->apply(['name' => htmlspecialchars($variable->getProperty('name')), 'value' => htmlspecialchars($variable->getProperty('value')), 'desc' => $variable->getProperty('description')]);
     }
     $renderer = new Renderer(Page::MODE_NORMAL);
     $pTitle = $i18n->get('title');
     $renderer->page->set('title', $pTitle)->set('h1', $pTitle)->set('content', $tpl->apply(['items' => $listItems, 'site_root' => $application->siteRoot]));
     $renderer->loadPage();
     $renderer->output();
 }
コード例 #11
0
ファイル: CourseEditView.php プロジェクト: jne21/WBT
 static function get($data)
 {
     $registry = Registry::getInstance();
     $application = Application::getInstance();
     $locale = $registry->get('locale');
     $locales = LocaleManager::getLocales();
     $tpl = new Template($registry->get('template_path') . 'course_edit.htm');
     $tplTab = new Template($registry->get('template_path') . 'course_edit_tab.htm');
     $tplTabContent = new Template($registry->get('template_path') . 'course_edit_tab_content.htm');
     $tplLessonItem = new Template($registry->get('template_path') . 'lesson_item.htm');
     $course = $data['course'];
     $tabItems = '';
     $tabContentItems = '';
     foreach ($locales as $localeId => $localeData) {
         $tabItems .= $tplTab->apply(['localeId' => $localeId, 'name' => $localeData['name']]);
         $tabContentItems .= $tplTabContent->apply(['name' => htmlspecialchars($course->l10n->get('name', $localeId)), 'meta' => htmlspecialchars($course->l10n->get('meta', $localeId)), 'description' => htmlspecialchars($course->l10n->get('description', $localeId)), 'brief' => htmlspecialchars($course->l10n->get('brief', $localeId)), 'url' => htmlspecialchars($course->l10n->get('url', $localeId)), 'title' => htmlspecialchars($course->l10n->get('title', $localeId)), 'state' => $course->l10n->get('state', $localeId), 'localeId' => $localeId]);
     }
     $lessonItems = '';
     foreach ($data['lessons'] as $lessonId => $lesson) {
         $lessonItems .= $tplLessonItem->apply(['id' => $lessonId, 'order' => $lesson->order, 'name' => $lesson->l10n->get('name', $locale)]);
     }
     return $tpl->apply(['id' => $course->id, 'courseName' => $course->l10n->get('name', $locale), 'state' => $course->state, 'ownerName' => $data['owner']->name ? $data['owner']->name : $_SESSION['admin']['name'], 'tabItems' => $tabItems, 'tabContentItems' => $tabContentItems, 'dateCreate' => $course->dateCreate ? date($localeData['dateFormat'], $course->dateCreate) : '', 'dateUpdate' => $course->dateUpdate ? date($localeData['dateFormat'] . ' H:i', $course->dateUpdate) : '', 'lessonItems' => $lessonItems, 'site_root' => $application->siteRoot]);
 }
コード例 #12
0
ファイル: LessonEditView.php プロジェクト: jne21/WBT
 static function get($data)
 {
     $application = Application::getInstance();
     $registry = Registry::getInstance();
     $tpl = new Template($registry->get('template_path') . 'lesson_edit.htm');
     $tplTab = new Template($registry->get('template_path') . 'lesson_edit_tab.htm');
     $tplTabContent = new Template($registry->get('template_path') . 'lesson_edit_tab_content.htm');
     $tplStageItem = new Template($registry->get('template_path') . 'stage_item.htm');
     $locales = LocaleManager::getLocales();
     $locale = $registry->get('locale');
     $tabItems = '';
     $tabContentItems = '';
     $lesson = $data['lesson'];
     foreach ($locales as $localeId => $localeData) {
         $tabItems .= $tplTab->apply(['localeId' => $localeId, 'name' => $localeData['name']]);
         $tabContentItems .= $tplTabContent->apply(['name' => htmlspecialchars($lesson->l10n->get('name', $localeId)), 'meta' => htmlspecialchars($lesson->l10n->get('meta', $localeId)), 'description' => htmlspecialchars($lesson->l10n->get('description', $localeId)), 'brief' => htmlspecialchars($lesson->l10n->get('brief', $localeId)), 'url' => htmlspecialchars($lesson->l10n->get('url', $localeId)), 'title' => htmlspecialchars($lesson->l10n->get('title', $localeId)), 'localeId' => $localeId]);
     }
     $exercises = $data['exercises'];
     $stageItems = '';
     foreach ($data['stages'] as $stageId => $stage) {
         $stageItems .= $tplStageItem->apply(['id' => $stageId, 'order' => $stage->order, 'name' => $stage->name, 'exerciseName' => $exercises[$stage->exerciseId]->name]);
     }
     return $tpl->apply(['id' => $lesson->id, 'courseId' => $data['courseId'], 'name' => $lesson->l10n->get('name', $locale), 'tabItems' => $tabItems, 'tabContentItems' => $tabContentItems, 'stageItems' => $stageItems, 'site_root' => $application->siteRoot]);
 }
コード例 #13
0
ファイル: MainMenuView.php プロジェクト: jne21/WBT
 static function get($data)
 {
     $registry = Registry::getInstance();
     $tplMainMenu = new TemplateFile($registry->get('template_path') . 'main_menu.htm');
     return $tplMainMenu->apply(['admin' => $data['admin'], 'operator' => $data['operator']]);
 }