本文整理汇总了PHP中Agenda::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Agenda::add方法的具体用法?PHP Agenda::add怎么用?PHP Agenda::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agenda
的用法示例。
在下文中一共展示了Agenda::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_calendar
public function add_calendar()
{
switch ($_SERVER['REQUEST_METHOD']) {
case 'GET':
//si l'utilisateur est connecté on affiche la page de création d'une note
if (isset($_SESSION['user'])) {
include 'views/createAgenda.php';
} else {
$_SESSION['message']['type'] = 'error';
$_SESSION['message']['text'] = "Vous n'êtes pas connecté";
include 'views/connexion.php';
}
break;
case 'POST':
if (isset($_SESSION['user'])) {
$u = Utilisateur::get_by_login($_SESSION['user']);
if (isset($_POST['title']) && isset($_POST['content'])) {
if (isset($_POST['intersection'])) {
$intersection = 1;
} else {
$intersection = 0;
}
if (isset($_POST['prive'])) {
$prive = 0;
} else {
$prive = 1;
}
$n = new Agenda(1, $u->idUtilisateur(), $_POST['title'], $_POST['content'], '0', '0', $intersection, $prive);
$n->add();
$_SESSION['message']['type'] = 'success';
$_SESSION['message']['text'] = "L'agenda " . $_POST['title'] . " a bien été créé.";
include 'views/home.php';
} else {
$_SESSION['message']['type'] = 'error';
$_SESSION['message']['text'] = 'Données postées incomplètes';
include 'views/home.php';
}
} else {
$_SESSION['message']['type'] = 'error';
$_SESSION['message']['text'] = "Vous n'êtes pas connecté";
include 'views/connexion.php';
}
break;
}
}
示例2: switch
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/posproject/models/Agenda.php';
if (isset($_POST['acao'])) {
switch ($_POST['acao']) {
case 'Adicionar':
$agenda = new Agenda();
$evento = $_POST['evento'];
$data = $_POST['data'];
$hora = $_POST['hora'];
$obs = $_POST['obs'];
$agenda->setEvento($evento);
$agenda->setData($data);
$agenda->setHora($hora);
$agenda->setObs($obs);
if ($agenda->add()) {
$url = BASE_URL . '/views/agenda/';
header('Location: ' . $url);
die;
} else {
echo "Deu ruim!";
die;
}
break;
case 'Atualizar':
$agenda = new Agenda();
$evento = $_POST['evento'];
$data = $_POST['data'];
$hora = $_POST['hora'];
$obs = $_POST['obs'];
$id = $_POST['id'];