本文整理汇总了PHP中Template::WithTemplateFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::WithTemplateFile方法的具体用法?PHP Template::WithTemplateFile怎么用?PHP Template::WithTemplateFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::WithTemplateFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
Language::loadLanguageFile('de', $langTemplate, 'json', dirname(__FILE__) . '/');
// load user data from the database
$databaseURI = $databaseURI . "/user/user/{$uid}";
$user = http_get($databaseURI, false);
$user = json_decode($user, true);
if (is_null($user)) {
$user = array();
}
$menu = MakeNavigationElement($user, PRIVILEGE_LEVEL::STUDENT, true, true);
// construct a new header
$h = Template::WithTemplateFile('include/Header/Header.template.html');
$h->bind($user);
$h->bind(array("name" => Language::Get('main', 'title', $langTemplate), "hideBackLink" => "true", "notificationElements" => $notifications, "navigationElement" => $menu));
// sort courses by semester
if (isset($user['courses']) && is_array($user['courses'])) {
foreach ($user['courses'] as &$course) {
$course['semesterInt'] = substr($course['course']['semester'], -4) * 2;
if (substr($course['course']['semester'], 0, 2) == 'WS') {
$course['semesterInt']--;
}
}
$user['courses'] = LArraySorter::orderBy($user['courses'], 'semesterInt', SORT_DESC, 'name', SORT_ASC);
}
$pageData = array('uid' => isset($user['id']) ? $user['id'] : null, 'courses' => isset($user['courses']) ? $user['courses'] : null, 'sites' => PRIVILEGE_LEVEL::$SITES, 'statusName' => PRIVILEGE_LEVEL::$NAMES);
// construct a login element
$courseSelect = Template::WithTemplateFile('include/CourseSelect/CourseSelect.template.html');
$courseSelect->bind($pageData);
// wrap all the elements in some HTML and show them on the page
$w = new HTMLWrapper($h, $courseSelect);
$w->set_config_file('include/configs/config_default.json');
$w->show();
示例2: foreach
foreach ($upload_data['exercises'] as &$key) {
if ($value->getExerciseId() == $key['id']) {
$key['form'] = $value;
break;
}
}
}
$upload_data['hasStarted'] = $hasStarted;
$upload_data['isExpired'] = $isExpired;
$user_course_data = $upload_data['user'];
$menu = MakeNavigationElement($user_course_data, PRIVILEGE_LEVEL::STUDENT);
// construct a new header
$h = Template::WithTemplateFile('include/Header/Header.template.html');
$h->bind($user_course_data);
$h->bind(array("name" => $user_course_data['courses'][0]['course']['name'], "backTitle" => Language::Get('main', 'backToCourse', $langTemplate), "backURL" => "Student.php?cid={$cid}", "notificationElements" => $notifications, "navigationElement" => $menu));
/**
* @todo detect when the form was changed by the user, this could be done by
* hashing the form elements before handing them to the user:
* - hash the form (simple hash/hmac?)
* - save the calculated has in a hidden form input
* - when the form is posted recalculate the hash and compare to the previous one
* - log the user id?
*
* @see http://www.php.net/manual/de/function.hash-hmac.php
* @see http://php.net/manual/de/function.hash.php
*/
$t = Template::WithTemplateFile('include/Upload/Upload.template.html');
$t->bind($upload_data);
$w = new HTMLWrapper($h, $t);
$w->set_config_file('include/configs/config_upload_exercise.json');
$w->show();
示例3: HTMLWrapper
$revokeRights = Template::WithTemplateFile('include/CourseManagement/RevokeRights.template.html');
$revokeRights->bind($courseManagement_data);
if (isset($revokeRightsNotifications)) {
$revokeRights->bind(array("RevokeRightsNotificationElements" => $revokeRightsNotifications));
}
$editExternalId = Template::WithTemplateFile('include/CourseManagement/EditExternalId.template.html');
$editExternalId->bind($externalid_data);
if (isset($editExternalIdNotifications)) {
$editExternalId->bind(array("EditExternalIdNotificationElements" => $editExternalIdNotifications));
}
$addExternalId = Template::WithTemplateFile('include/CourseManagement/AddExternalId.template.html');
if (isset($addExternalIdNotifications)) {
$addExternalId->bind(array("AddExternalIdNotificationElements" => $addExternalIdNotifications));
}
// construct a content element for adding users
$addUser = Template::WithTemplateFile('include/CourseManagement/AddUser.template.html');
if (isset($addUserNotifications)) {
$addUser->bind(array("AddUserNotificationElements" => $addUserNotifications));
}
/**
* @todo combine the templates into a single file
*/
// wrap all the elements in some HTML and show them on the page
$w = new HTMLWrapper($h, $courseSettings, $plugins, $addExerciseType, $editExerciseType, $grantRights, $revokeRights, $addUser, $editExternalId, $addExternalId);
$w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $courseSettings);
$w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $plugins);
$w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $addExerciseType);
$w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $editExerciseType);
$w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $grantRights);
$w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $revokeRights);
$w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $addUser);
示例4: elseif
$file = File::encodeFile($file);
} elseif (isset($_GET['downloadConditionCsv'])) {
$csv = Csv::createCsv($rows);
$file = http_post_data($filesystemURI . '/csv', Csv::encodeCsv($csv), true);
$file = File::decodeFile($file);
$file->setDisplayName('conditions.csv');
$file = File::encodeFile($file);
}
echo $file;
exit(0);
}
if (isset($_GET['sortby'])) {
$condition_data['sortby'] = $_GET['sortby'];
}
if (isset($_GET['sortId'])) {
$condition_data['sortId'] = $_GET['sortId'];
}
// construct a new header
$h = Template::WithTemplateFile('include/Header/Header.template.html');
$h->bind($user_course_data);
$h->bind(array("name" => $user_course_data['courses'][0]['course']['name'], "notificationElements" => $notifications, "navigationElement" => $menu));
// construct a content element for setting exam paper conditions
$setCondition = Template::WithTemplateFile('include/Condition/SetCondition.template.html');
$setCondition->bind($condition_data);
$userList = Template::WithTemplateFile('include/Condition/UserList.template.html');
$userList->bind($condition_data);
// wrap all the elements in some HTML and show them on the page
$w = new HTMLWrapper($h, $setCondition, $userList);
$w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $setCondition);
$w->set_config_file('include/configs/config_condition.json');
$w->show();
示例5: HTMLWrapper
// construct a content element for group information
$groupMembers = Template::WithTemplateFile('include/Group/GroupMembers.template.html');
$groupMembers->bind($group_data);
// construct a content element for managing groups
if ($isInGroup) {
$groupManagement = Template::WithTemplateFile('include/Group/GroupManagement.template.html');
$groupManagement->bind($group_data);
}
// construct a content element for creating groups
if ($isLeader) {
$invitationsFromGroup = Template::WithTemplateFile('include/Group/InvitationsFromGroup.template.html');
$invitationsFromGroup->bind($group_data);
}
// construct a content element for joining groups
if ($hasInvitations) {
$invitationsToGroup = Template::WithTemplateFile('include/Group/InvitationsToGroup.template.html');
$invitationsToGroup->bind($group_data);
}
// wrap all the elements in some HTML and show them on the page
$w = new HTMLWrapper($h, $groupMembers, isset($invitationsToGroup) ? $invitationsToGroup : null, isset($groupManagement) ? $groupManagement : null, isset($invitationsFromGroup) ? $invitationsFromGroup : null);
$w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $groupMembers);
if (isset($groupManagement)) {
$w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $groupManagement);
}
if (isset($invitationsFromGroup)) {
$w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $invitationsFromGroup);
}
if (isset($invitationsToGroup)) {
$w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $invitationsToGroup);
}
$w->set_config_file('include/configs/config_group.json');
示例6: isset
?>
:</label>
<!--ckeditor--><textarea name="exercises[0][subexercises][0][task]"
class="reset form-field task-field"
rows="5"
style="width:100%;"
maxlength="2500">
<?php
echo isset($form['task']) ? $form['task'] : '';
?>
</textarea>
<?php
if (isset($form['choices'])) {
foreach ($form['choices'] as $choice) {
$radio = Template::WithTemplateFile('include/CreateSheet/Form/FormAddRadio.template.php');
if (isset($cid)) {
$radio->bind(array('cid' => $cid));
}
if (isset($uid)) {
$radio->bind(array('uid' => $uid));
}
if (isset($sid)) {
$radio->bind(array('sid' => $sid));
}
$radio->bind(array('choice' => $choice));
$radio->show();
}
}
?>
示例7: MakeNotification
if ($signed !== false) {
$notifications[] = $signed;
} else {
$notifications[] = MakeNotification("error", Language::Get('main', 'errorLogin', $langTemplate));
}
}
} else {
$notifications = array();
}
// check if already logged in
if (Authentication::checkLogin()) {
header('Location: index.php');
exit;
}
// construct a new header
$h = Template::WithTemplateFile('include/Header/Header.template.html');
$h->bind(array("backTitle" => Language::Get('main', 'changeCourse', $langTemplate), "name" => Language::Get('main', 'title', $langTemplate), "hideBackLink" => "true", "hideLogoutLink" => "true", "notificationElements" => $notifications));
// construct a login element
$userLogin = Template::WithTemplateFile('include/Login/Login.template.html');
// if back Parameter is given bind it to the userLogin to create hidden input
if (isset($_GET['back'])) {
$backparameter = cleanInput($_GET['back']);
$backdata = array("backURL" => $backparameter);
} else {
$backdata = array();
}
$userLogin->bind($backdata);
// wrap all the elements in some HTML and show them on the page
$w = new HTMLWrapper($h, $userLogin);
$w->set_config_file('include/configs/config_default.json');
$w->show();
示例8: dirname
* Constructs the page that is displayed to a tutor.
*
* @author Felix Schmidt
* @author Florian Lücke
* @author Ralf Busch
*/
include_once dirname(__FILE__) . '/include/Boilerplate.php';
include_once dirname(__FILE__) . '/../Assistants/Structures.php';
global $globalUserData;
Authentication::checkRights(PRIVILEGE_LEVEL::TUTOR, $cid, $uid, $globalUserData);
$langTemplate = 'Tutor_Controller';
Language::loadLanguageFile('de', $langTemplate, 'json', dirname(__FILE__) . '/');
// load tutor data from GetSite
$URI = $getSiteURI . "/tutor/user/{$uid}/course/{$cid}";
$tutor_data = http_get($URI, true);
$tutor_data = json_decode($tutor_data, true);
$tutor_data['filesystemURI'] = $filesystemURI;
$tutor_data['cid'] = $cid;
// check userrights for course
$user_course_data = $tutor_data['user'];
$menu = MakeNavigationElement($user_course_data, PRIVILEGE_LEVEL::TUTOR);
// construct a new header
$h = Template::WithTemplateFile('include/Header/Header.template.html');
$h->bind($user_course_data);
$h->bind(array("name" => $user_course_data['courses'][0]['course']['name'], "backTitle" => Language::Get('main', 'changeCourse', $langTemplate), "backURL" => "index.php", "notificationElements" => $notifications, "navigationElement" => $menu));
$t = Template::WithTemplateFile('include/ExerciseSheet/ExerciseSheetTutor.template.html');
$t->bind($tutor_data);
$w = new HTMLWrapper($h, $t);
$w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $t);
$w->set_config_file('include/configs/config_student_tutor.json');
$w->show();
示例9: unset
$markingElement = Template::WithTemplateFile('include/MarkingTool/MarkingTool.template.html');
$markingElement->bind($markingTool_data);
$markingElement->bind(array('selectedSheet' => $selectedSheet));
$markingElement->bind(array('group' => $group));
if (isset($GroupNotificationElements[$group['leader']['id']])) {
$markingElement->bind(array('GroupNotificationElements' => $GroupNotificationElements[$group['leader']['id']]));
unset($GroupNotificationElements[$group['leader']['id']]);
}
$w->insert($markingElement);
$w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $markingElement);
}
if ($allOutputs == 0) {
$markingElement = Template::WithTemplateFile('include/MarkingTool/MarkingToolEmpty.template.html');
$markingElement->bind($markingTool_data);
$w->insert($markingElement);
}
} else {
$markingElement = Template::WithTemplateFile('include/MarkingTool/MarkingToolEmpty.template.html');
$markingElement->bind($markingTool_data);
$w->insert($markingElement);
}
if (!empty($GroupNotificationElements)) {
foreach ($GroupNotificationElements as $key => $notifs) {
$notifications = array_merge($notifications, $notifs);
}
}
$h->bind(array("notificationElements" => $notifications));
$searchSettings->bind(array('allOutputs' => $allOutputs));
$w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $searchSettings);
$w->set_config_file('include/configs/config_marking_tool.json');
$w->show();
示例10: HTMLWrapper
// construct a content element for assigning tutors automatically
$assignAutomatically = Template::WithTemplateFile('include/TutorAssign/AssignAutomatically.template.html');
$assignAutomatically->bind($tutorAssign_data);
if (isset($assignAutomaticallyNotifications)) {
$assignAutomatically->bind(array("AssignAutomaticallyNotificationElements" => $assignAutomaticallyNotifications));
}
// construct a content element for assigning tutors manually
$assignManually = Template::WithTemplateFile('include/TutorAssign/AssignManually.template.html');
$assignManually->bind($tutorAssign_data);
if (isset($assignManuallyNotifications)) {
$assignManually->bind(array("AssignManuallyNotificationElements" => $assignManuallyNotifications));
}
// construct a content element for removing assignments from tutors
$assignRemove = Template::WithTemplateFile('include/TutorAssign/AssignRemove.template.html');
if (isset($assignRemoveNotifications)) {
$assignRemove->bind(array("AssignRemoveNotificationElements" => $assignRemoveNotifications));
}
// construct a content element for creating submissions for unsubmitted users
$assignMake = Template::WithTemplateFile('include/TutorAssign/AssignMake.template.html');
if (isset($assignMakeNotifications)) {
$assignMake->bind(array("AssignMakeNotificationElements" => $assignMakeNotifications));
}
// wrap all the elements in some HTML and show them on the page
$w = new HTMLWrapper($h, $assignAutomatically, $assignManually, $assignMake, $assignRemove);
$w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $assignAutomatically);
$w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $assignManually);
$w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $assignMake);
$w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $assignRemove);
$w->set_config_file('include/configs/config_tutor_assign.json');
//$w->set_config_file('include/configs/config_default.json');
$w->show();
示例11: http_put_data
http_put_data($URI, Submission::encodeSubmission($submissionUpdate), true, $message2);
if ($message == "201" && $message2 == 201) {
$notifications[] = MakeNotification("success", Language::Get('main', 'successDeleteSubmission', $langTemplate));
} else {
$notifications[] = MakeNotification("error", Language::Get('main', 'errorDeleteSubmission', $langTemplate));
}
}
} elseif (isset($_POST['downloadMarkings'])) {
downloadMarkingsForSheet($uid, $_POST['downloadMarkings']);
}
// load tutor data from GetSite
$URI = $getSiteURI . "/student/user/{$uid}/course/{$cid}";
$student_data = http_get($URI, true);
$student_data = json_decode($student_data, true);
$student_data['filesystemURI'] = $filesystemURI;
$student_data['cid'] = $cid;
$student_data['uid'] = $uid;
$user_course_data = $student_data['user'];
$menu = MakeNavigationElement($user_course_data, PRIVILEGE_LEVEL::STUDENT);
// construct a new header
$h = Template::WithTemplateFile('include/Header/Header.template.html');
$h->bind($user_course_data);
$h->bind(array("name" => $user_course_data['courses'][0]['course']['name'], "backTitle" => Language::Get('main', 'changeCourse', $langTemplate), "backURL" => "index.php", "notificationElements" => $notifications, "navigationElement" => $menu));
$h->bind($student_data);
$t = Template::WithTemplateFile('include/ExerciseSheet/ExerciseSheetStudent.template.html');
$t->bind($student_data);
$t->bind(array('uid' => $uid));
$w = new HTMLWrapper($h, $t);
$w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $t);
$w->set_config_file('include/configs/config_student_tutor.json');
$w->show();
示例12: array_merge
} else {
$notifications = array_merge($notifications, $f->notifications);
}
}
if (isset($sid)) {
$URL = $databaseURI . "/exercisesheet/exercisesheet/{$sid}/exercise";
$sheet_data = http_get($URL, true);
$sheet_data = json_decode($sheet_data, true);
}
$menu = MakeNavigationElement($createsheetData['user'], PRIVILEGE_LEVEL::LECTURER, true);
// construct a new header
$h = Template::WithTemplateFile('include/Header/Header.template.html');
$h->bind($createsheetData['user']);
$h->bind(array("name" => $createsheetData['user']['courses'][0]['course']['name'], "notificationElements" => $notifications, "navigationElement" => $menu));
$sheetSettings = Template::WithTemplateFile('include/CreateSheet/SheetSettings.template.html');
$createExercise = Template::WithTemplateFile('include/CreateSheet/CreateExercise.template.html');
$sheetSettings->bind($createsheetData['user']);
if (isset($cid)) {
$sheetSettings->bind(array('cid' => $cid));
}
if (isset($uid)) {
$sheetSettings->bind(array('uid' => $uid));
}
if (isset($sid)) {
$sheetSettings->bind(array('sid' => $sid));
// if (!isset($_POST['action']) || $_POST['action']=='new'){
$result = http_get($serverURI . "/DB/DBForm/form/exercisesheet/{$sid}", true);
$forms = json_decode($result, true);
$result = http_get($serverURI . "/DB/DBProcess/process/exercisesheet/{$sid}", true);
$processes = json_decode($result, true);
// }
示例13:
><?php
echo $link->getName();
?>
</option>
<?php
if ($selectedComponent === NULL || isset($process['target']['id']) && $process['target']['id'] == $link->getId()) {
$selectedComponent = $link;
}
}
?>
</select>
<br><br>
<?php
if (isset($process) && isset($selectedComponent)) {
$pro = Template::WithTemplateFile('include/CreateSheet/Processor/' . $selectedComponent->getName() . '.template.php');
if (isset($cid)) {
$pro->bind(array('cid' => $cid));
}
if (isset($uid)) {
$pro->bind(array('uid' => $uid));
}
if (isset($sid)) {
$pro->bind(array('sid' => $sid));
}
$pro->bind(array('process' => $process));
$pro->bind(array('component' => $selectedComponent));
$pro->show();
}
?>
<div class="form-field processor-parameter-area" style="width:100%"></div>
示例14: HTMLWrapper
// construct a new header
$h = Template::WithTemplateFile('include/Header/Header.template.html');
$h->bind($user_course_data);
$h->bind(array("name" => Language::Get('main', 'settings', $langTemplate), "backTitle" => Language::Get('main', 'courses', $langTemplate), "backURL" => "index.php", "notificationElements" => $notifications, "navigationElement" => $menu));
// construct a content element for creating new courses
$createCourse = Template::WithTemplateFile('include/MainSettings/CreateCourse.template.html');
$createCourse->bind($mainSettings_data);
if (count($notifications) != 0) {
$createCourse->bind($_POST);
}
// construct a content element for setting admins
$setAdmin = Template::WithTemplateFile('include/MainSettings/SetAdmin.template.html');
$setAdmin->bind($mainSettings_data);
// construct a content element for creating new users
$createUser = Template::WithTemplateFile('include/MainSettings/CreateUser.template.html');
if (count($notifications) != 0) {
$createUser->bind($_POST);
}
// construct a content element for deleting users
$deleteUser = Template::WithTemplateFile('include/MainSettings/DeleteUser.template.html');
/**
* @todo combine the templates into a single file
*/
// wrap all the elements in some HTML and show them on the page
$w = new HTMLWrapper($h, $createCourse, $setAdmin, $createUser, $deleteUser);
$w->defineForm(basename(__FILE__), false, $createCourse);
$w->defineForm(basename(__FILE__), false, $setAdmin);
$w->defineForm(basename(__FILE__), false, $createUser);
$w->defineForm(basename(__FILE__), false, $deleteUser);
$w->set_config_file('include/configs/config_default.json');
$w->show();
示例15: MakeNotification
}
} else {
$errormsg = Language::Get('main', 'unknownError', $langTemplate);
$notifications[] = MakeNotification('error', $errormsg);
}
}
} else {
$errormsg = Language::Get('main', 'invalidFileType', $langTemplate);
$notifications[] = MakeNotification('error', $errormsg);
}
}
}
}
// load tutorUpload data from GetSite
$URL = $getSiteURI . "/tutorupload/user/{$uid}/course/{$cid}";
$tutorUpload_data = http_get($URL, true);
$tutorUpload_data = json_decode($tutorUpload_data, true);
$tutorUpload_data['filesystemURI'] = $filesystemURI;
$tutorUpload_data['cid'] = $cid;
$user_course_data = $tutorUpload_data['user'];
$menu = MakeNavigationElement($user_course_data, PRIVILEGE_LEVEL::TUTOR, true);
// construct a new header
$h = Template::WithTemplateFile('include/Header/Header.template.html');
$h->bind($user_course_data);
$h->bind(array("name" => isset($user_course_data['courses'][0]['course']['name']) ? $user_course_data['courses'][0]['course']['name'] : null, "notificationElements" => $notifications, "navigationElement" => $menu));
// construct a content element for uploading markings
$tutorUpload = Template::WithTemplateFile('include/TutorUpload/TutorUpload.template.html');
$tutorUpload->bind($tutorUpload_data);
$w = new HTMLWrapper($h, $tutorUpload);
$w->set_config_file('include/configs/config_upload_exercise.json');
$w->show();