public function setNewRelationship($me, $user2) { $db = parent::connect(); $timestamp = time(); $user = new Profil(); $name = $user->getName(); $notice = "<a href='index.php?page=profil&profil={$me}'>Máte novou žádost o přátelstí od {$name}</a>"; $result = $db->prepare("INSERT INTO `relationship`(`user1`, `user2`, `timestamp`, `friends`) VALUES (?, ?, ?, ?)"); $result->execute(array($me, $user2, $timestamp, 0)); $result = $db->prepare("INSERT INTO `notice`(`title`, `timestamp`, `user`) VALUES (?, ?, ?)"); $result->execute(array($notice, $timestamp, $user2)); }
<?php /** * Created by PhpStorm. * User: ununik * Date: 27.08.2015 * Time: 14:33 */ $profil = new Profil(0, $_SESSION['tiary']['login'], $_SESSION['tiary']['password']); $notices = new Notice(); $notices = $notices->getNumNotice($profil->getId()); $headerNotice = ""; if ($notices > 0) { $headerNotice = "!"; if ($notices > 1) { $headerNotice .= '<span class="headerNoticeNum">' . $notices . "</span>"; } } $headerName = "<span class='headerName'>{$profil->getName()}</span>"; $html->addToHeader("<a href='index.php?page=profil'>"); $html->addToHeader($headerName); $html->addToHeader("<img src='images/profile_images/small/{$profil->getProfilImage()}' id='header_profile_image'>"); $html->addToHeader("</a>"); $html->addToHeader("<span class='headerNotice' onclick='getUnseenNotices()'>{$headerNotice}</span>");
<?php /** * Created by PhpStorm. * User: ununik * Date: 26.08.2015 * Time: 14:07 */ $container = "<h1>Kontakty</h1>"; $container .= "<div class='textInput_div'><form action='' method='get'><input type='text' value='contacts' name='page' hidden>\n <input type='text' name='search' value='{$search}'><input type='submit' value='hledat' class='submit'>\n </form></div>\n "; foreach ($users as $user) { $userprofil = new Profil($user['id']); $container .= "<div><a href='index.php?page=profil&profil={$user['id']}'>{$userprofil->getName()}</a></div>"; } return $container;
<?php /** * Created by PhpStorm. * User: ununik * Date: 25.08.2015 * Time: 17:15 */ $commentsBOXES = ""; foreach ($allComments as $allComment) { $authorComments = new Profil($allComment['author']); $dateComments = date('j. n. Y', $allComment['timestamp']); $textComments = $allComment['text']; $commentsBOXES .= "<div><a href='index.php?page=profil&profil={$authorComments->getId()}'>{$authorComments->getName()}</a></div>"; $commentsBOXES .= "<div>{$dateComments}</div>"; $commentsBOXES .= "<div>{$textComments}</div>"; } return $commentsBOXES;