本文整理汇总了PHP中Student::setConnector方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::setConnector方法的具体用法?PHP Student::setConnector怎么用?PHP Student::setConnector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Student
的用法示例。
在下文中一共展示了Student::setConnector方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert
public function insert()
{
if (!$this->title) {
return "Inserire il titolo dell'avviso";
}
if (!$this->text) {
return "Inserire il testo dell'avviso";
}
if (!is_array($this->id_dest)) {
return "Selezionare almeno un destinatario";
}
$tabella = "avvisi";
$campi = array("titolo", "testo", "id_studente", "invio_mail");
$valori = array($this->title, $this->text, implode(";", $this->id_dest), $this->mail_send);
$auth = $this->connector->insert($tabella, $campi, $valori);
if (mysql_errno() == 1062) {
return "Avviso già presente";
} else {
if (mysql_errno() > 0) {
return "Errore interno numero: " . mysql_errno();
}
}
if ($this->mail_send) {
$student = new Student();
$student->setConnector($this->connector);
$lista = array();
if (in_array(0, $this->id_dest)) {
$lista = $student->getList();
} else {
foreach ($this->id_dest as $id_dest) {
$tmp_stud = $student->getById($id_dest);
$lista[] = $tmp_stud;
}
}
$errore = "";
foreach ($lista as $student) {
$student->setConnector($this->connector);
$destinatario = $student->email;
$mittente_mail = "";
$oggetto = "";
$messaggio = "";
$intestazioni = "MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\nFrom: {$mittente_mail}";
//invio la mail
$risultato = mail($destinatario, $oggetto, $messaggio, $intestazioni);
//reindirizzamento
if (!$risultato) {
$errore .= "Problema nell'inoltro dell'email all'indirizzo {$destinatario}. L'avviso è stato comunque registrato sul portale<br>";
}
}
if ($errore != "") {
return $errore;
}
}
}
示例2: getBookedList
public function getBookedList($student_id = null, $order = "data_prenotazione")
{
$order = trim(filter_var($order, FILTER_SANITIZE_STRING));
$id = (int) $student_id;
//interrogazione tabella
if ($id) {
$sql = "SELECT * FROM prenotazioni WHERE id_studente='{$id}' ORDER BY {$order}";
} else {
$sql = "SELECT * FROM prenotazioni ORDER BY {$order}";
}
$auth = $this->connector->query($sql);
$list = array();
$student = new Student();
$student->setConnector($this->connector);
// controllo sul risultato dell'interrogazione
if (mysql_num_rows($auth) > 0) {
while ($res = $this->connector->getObjectResult($auth)) {
$book = $this->getById($res->id_appello);
$book->book_date = $res->data_prenotazione;
$book->student_id = $res->id_studente;
$book->book_id = $res->id_prenotazione;
$book->student = $student->getById($book->student_id);
$list[] = $book;
}
}
return $list;
}
示例3: header
/**
* @author Christian Rizza
* www.crizza.com
* email: christian@crizza.com
*/
session_start();
define('BASE_PATH', "./");
include BASE_PATH . "config.php";
if (!isset($_SESSION['admin'])) {
header("Location: index.php");
}
$conn = new MysqlConnector();
$conn->connect();
$student = new Student();
$student->setConnector($conn);
$lista = $student->getList();
foreach ($lista as $entry) {
echo "Email: " . $entry->email . " ";
$entry->setConnector($conn);
if ($entry->generatePassword()) {
echo "[Errore di invio] <br>";
} else {
echo "[OK] <br>";
}
$counter++;
}
$conn->disconnect();
?>
示例4: homepage
function homepage()
{
global $connector;
global $result;
if (isset($_SESSION['admin'])) {
header("Location: admin/");
}
if (isset($_SESSION['login'])) {
include_once "classes/Student.php";
include_once "classes/Exam.php";
include_once "classes/Plan.php";
include_once "classes/Payment.php";
include_once "classes/Notice.php";
include_once "classes/Booking.php";
include_once "classes/Document.php";
$student = new Student();
$student->setConnector($connector);
$student = $student->getById($_SESSION['id_student']);
$student->setConnector($connector);
$exam = new Exam();
$plan = new Plan();
$payment = new Payment();
$notice = new Notice();
$booking = new Booking();
$document = new Document();
$exam->setConnector($connector);
$plan->setConnector($connector);
$payment->setConnector($connector);
$notice->setConnector($connector);
$booking->setConnector($connector);
$document->setConnector($connector);
if (isset($_POST['operation'])) {
list($operation, $params) = explode("#", $_POST['operation']);
switch ($operation) {
case 'editChanges':
$student->storeFormValues($_POST);
$student->id = $params;
if (isset($_POST['password']) && $_POST['password'] != '') {
$student->generatePassword($_POST['password']);
}
$error_msg = $student->update();
break;
case 'saveBook':
$error_msg = $booking->saveBooking($student->id, $params);
break;
case 'sendMail':
$error_msg = sendMail();
break;
default:
$error_msg = $operation . "#" . $params;
break;
}
if ($error_msg != "") {
$result["errorMessage"] = $error_msg;
} elseif ($operation != 'edit' && $operation != "nextPage") {
$result["statusMessage"] = "Operazione completata!";
}
}
if ($student) {
$result["edit"] = $student;
$result["edit"]->exam = $exam->getList($student);
$result["edit"]->plan = $plan->getById($student->id_plan);
$result['edit']->payment = $payment->getById($student->id);
$result['edit']->notice = $notice->getList();
$result['edit']->booking = $booking->getListForStudent($student);
$result['edit']->booked = $booking->getBookedList($student->id);
$result['edit']->document = $document->getList();
}
$page = "home.php";
include_once BASE_PATH . "/template.php";
} else {
$page = "login.php";
include_once BASE_PATH . "/template.php";
}
}
示例5: showStudent
function showStudent()
{
global $connector;
global $result;
$student = new Student();
$course = new Course();
$plan = new Plan();
$student->setConnector($connector);
$course->setConnector($connector);
$plan->setConnector($connector);
if (isset($_POST['operation'])) {
list($operation, $params) = explode("#", $_POST['operation']);
switch ($operation) {
case 'delete':
$error_msg = $student->delete($params);
break;
case 'edit':
$stud = $student->getById($params);
$result['edit'] = $stud;
$result['edit']->student = $stud;
$exam = new Exam();
$exam->setConnector($connector);
$result['edit']->exam = $exam->getList($result['edit']->student);
break;
case 'editChanges':
$student->storeFormValues($_POST);
$error_msg = $student->update();
break;
case 'saveChanges':
$student->storeFormValues($_POST);
$error_msg = $student->insert();
if ($error_msg) {
$result['edit'] = $student;
}
break;
case 'nextPage':
$student->storeFormValues($_POST);
$result['edit'] = $student;
break;
case 'createPassword':
$stud = $student->getById($params);
$stud->setConnector($connector);
$error_msg = $stud->generatePassword();
$result['edit'] = $stud;
break;
default:
$error_msg = "Operazione non valida";
}
if ($error_msg != "") {
$result["errorMessage"] = $error_msg;
} elseif ($operation != 'edit' && $operation != "nextPage") {
$result["statusMessage"] = "Operazione completata!";
}
}
if (isset($_POST['search'])) {
$result["students"] = $student->search($_POST['search']);
} else {
$result["students"] = $student->getList();
}
$result["plans"] = $plan->getList("id_piano");
$result["courses"] = $course->getList("nome");
$page = "student.php";
include_once BASE_PATH . "template.php";
}