本文整理汇总了PHP中Classes::addClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Classes::addClass方法的具体用法?PHP Classes::addClass怎么用?PHP Classes::addClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Classes
的用法示例。
在下文中一共展示了Classes::addClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: go
public function go()
{
$this->setViewTemplate('addclass.tpl');
if (isset($_POST['submit'])) {
if ($_POST['classname'] == '') {
$this->addErrorMessage("Name of the class should not be empty");
} else {
// $this->created_by= Session::getLoggedInUser();
$classname = $_POST['classname'];
$date_created = date("Y-m-d H:i:s");
if (Classes::doesClassExist($classname)) {
$this->addErrorMessage(" This Classname already exists");
} else {
Classes::addClass($classname, $date_created);
header('Location: ' . SOURCE_ROOT_PATH . "admin/pages/manageclass.php?source=addclass");
}
}
}
$this->generateView();
}
示例2: printf
//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");
//construct empty class
$class = new Classes();
//add a class
$class->addClass("Calculus I", "Math");
unset($class);
//get class from db
$class2 = new Classes("Calculus I");
//get subject for class
$my_subject = $class2->getSubject();
printf("Calculus I subject is: %s\n", $my_subject);
//get A to Z class list
$orderedArray = $class2->getAZClassList();
printf("Ordered Classes: \n");
foreach ($orderedArray as $class_val) {
printf("%s\n", $class_val);
}
//get A to Z class list for specific subject
$orderedArray = $class2->getClassBySubject("Math");
printf("Ordered Classes by Subject - Math: \n");
示例3: mkdir
$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)
if ($ext == 'pdf' || $ext == 'ods' || $ext == 'odp' || $ext == 'odt') {
//file that is uploaded is a temporary file. Need to copy the temp file to correct location
if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file " . basename($_FILES['uploadedfile']['name']) . " has been uploaded";
} else {
echo "There was an error uploading the file, please try again!";
}