本文整理汇总了PHP中Subject::addSubject方法的典型用法代码示例。如果您正苦于以下问题:PHP Subject::addSubject方法的具体用法?PHP Subject::addSubject怎么用?PHP Subject::addSubject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subject
的用法示例。
在下文中一共展示了Subject::addSubject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mkdir
session_start();
//import files
foreach (glob("apps/studyhall/models/*.php") as $filename) {
include_once $filename;
}
$subject = $_POST['subject'];
$class = $_POST['class'];
$name = $_POST['name'];
$snf = $_POST['subject_not_found'];
$cnf = $_POST['class_not_found'];
if ($subject == "Subject Not Listed") {
//for now assume that subject that is input is not a folder
$subject = $snf;
mkdir("apps/studyhall/Documents/" . $subject, 0777);
$add_subject = new Subject();
$add_subject->addSubject($subject);
}
if ($class == "Class Not Listed") {
//same as above
$class = $cnf;
mkdir("apps/studyhall/Documents/" . $subject . "/" . $class, 0777);
$add_class = new Classes();
$add_class->addClass($class, $subject);
}
//this is the path created to place the document in the correct folder
$target_path = "apps/studyhall/Documents/" . $subject . "/" . $class . "/";
//this adds the file name and extension to the end of the path
$target_path = $target_path . basename($_FILES['uploadedfile']['name']);
$ext = pathinfo($target_path, PATHINFO_EXTENSION);
//echo $ext;
//only certain file types can be uploaded (constraint from ViewerJS)
示例2: Subject
$user2->unblock();
$isBlocked2 = $user2->isBlocked();
$bool_str2 = $isBlocked2 ? "true" : "false";
printf("User is blocked: %s\n", $bool_str2);
unset($user);
unset($user2);
////////////////////////////
//Subject UNIT TESTS
////////////////////////////
printf("/////////////////////////////////\n");
printf("STARTING Subject UNIT TESTS\n");
printf("/////////////////////////////////\n");
//construct subject
$subject = new Subject();
//add subject
$subject->addSubject("Math");
//get subject
$subject_string = $subject->getSubject();
printf("Got Subject: %s\n", $subject_string);
//get AZSubjectArray
$orderedArray = $subject->getAZSubjects();
printf("Ordered Subjects: \n");
foreach ($orderedArray as $subject_val) {
printf("%s\n", $subject_val);
}
////////////////////////////
//Classes UNIT TESTS
////////////////////////////
printf("/////////////////////////////////\n");
printf("STARTING Classes UNIT TESTS\n");
printf("/////////////////////////////////\n");
示例3: function
$app->render('admin/addClass.php');
})->name('addClass');
$app->post('/addClass', function () use($app) {
$result = StudentClass::addClass($_POST['className']);
$app->redirect($app->urlFor('gestionClass'));
});
$app->get('/delClass/:classId', function ($classId) use($app) {
$result = StudentClass::delClass($classId);
$app->redirect($app->urlFor('gestionClass'));
});
$app->get('/addSubject', function () use($app) {
$allteacher = User::listTeacher();
$app->render('admin/addSubject.php', array('allteacher' => $allteacher));
})->name('addSubject');
$app->post('/addSubject', function () use($app) {
Subject::addSubject($_POST['subjectName'], $_POST['teacherId']);
$app->redirect($app->urlFor('gestionSubject'));
});
$app->get('/delSubject/:sucjectId', function ($subjectId) use($app) {
$result = Subject::delSubject($subjectId);
$app->redirect($app->urlFor('gestionSubject'));
});
$app->get('/gestionSubject', function () use($app) {
$allsubject = Subject::getAllSubject();
$allteacher = User::listTeacher();
$tab = array();
$i = 0;
$size = sizeof($allteacher);
while ($i < $size) {
$tab[$allteacher[$i]['teacherId']] = $allteacher[$i]['mail'];
$i++;