本文整理汇总了PHP中Home::repPost方法的典型用法代码示例。如果您正苦于以下问题:PHP Home::repPost方法的具体用法?PHP Home::repPost怎么用?PHP Home::repPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Home
的用法示例。
在下文中一共展示了Home::repPost方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendRep
public function sendRep($smarty, $tpl, $params, $DB)
{
$this->Test_session();
$rep = new Home($DB);
$id = $_GET['id'];
// Vérif champs
if (isset($_POST['repSend'])) {
if (isset($_POST['repPost']) && $_POST['repPost'] != '') {
$texte = trim(htmlentities($_POST['repPost'], ENT_QUOTES));
$today = getdate();
$jour = $today['mday'];
$annee = $today['year'];
$heures = $today['hours'];
$minutes = $today['minutes'];
if (strlen($minutes) == 1) {
$minutes = "0" . $today['minutes'];
}
switch ($today['month']) {
case "January":
$mois = "Janvier";
break;
case "February":
$mois = "Février";
break;
case "March":
$mois = "Mars";
break;
case "April":
$mois = "Avril";
break;
case "May":
$mois = "Mai";
break;
case "June":
$mois = "Juin";
break;
case "July":
$mois = "Juillet";
break;
case "August":
$mois = "Août";
break;
case "September":
$mois = "Septembre";
break;
case "October":
$mois = "Octobre";
break;
case "November":
$mois = "Novembre";
break;
case "December":
$mois = "Décembre";
break;
}
$date = $jour . " " . $mois . " " . $annee . " à " . $heures . "h" . $minutes;
$auteur = trim(htmlentities($_SESSION['pseudoMbr']));
// Ajout dans la BDD
$send = $rep->addRep($texte, $date, $auteur, $id);
// Lecture du post
$post = new Home($DB);
$read = $post->readPost($id);
// Récupération des infos du post
$smarty->assign('idd', $read['idPosts']);
$smarty->assign('titre', $read['titrePosts']);
$smarty->assign('date', $read['datePosts']);
$smarty->assign('texte', $read['textePosts']);
$smarty->assign('etat', $read['etatPosts']);
$smarty->assign('auteur', $read['membres_pseudoMbr']);
$smarty->assign('categorie', $read['catPosts_nomCatPosts']);
// (Ré)affichage du post
$rep = new Home($DB);
$reps = $rep->repPost($id);
$tabReps = array();
if ($reps) {
foreach ($reps as $key => $value) {
if (!isset($tabReps[$reps[$key]['idMsg']])) {
$tabReps[$reps[$key]['idMsg']] = array();
}
array_push($tabReps[$reps[$key]['idMsg']], html_entity_decode($reps[$key]['texteMsg']), $reps[$key]['dateMsg'], $reps[$key]['membres_pseudoMbr']);
}
}
$smarty->assign('reps', $tabReps);
$this->Test_admin($smarty, $tpl, $params, $DB);
$this->init($smarty, $tpl, $params, $DB);
header('Location:index.php?c=home&f=readPost&id=' . $read['idPosts']);
} else {
$post = new Home($DB);
$read = $post->readPost($id);
// Récupération des infos du post
$smarty->assign('idd', $read['idPosts']);
$smarty->assign('titre', $read['titrePosts']);
$smarty->assign('date', $read['datePosts']);
$smarty->assign('texte', $read['textePosts']);
$smarty->assign('etat', $read['etatPosts']);
$smarty->assign('auteur', $read['membres_pseudoMbr']);
$smarty->assign('categorie', $read['catPosts_nomCatPosts']);
$smarty->assign('errRep', "Veuillez saisir une réponse.");
$rep = new Home($DB);
$reps = $rep->repPost($id);
//.........这里部分代码省略.........