function editComm($id) { $this->load->model('comments'); if ($this->input->post('text') !== false) { $text = $this->input->post('text'); $this->comments->edit($text, $id); echo montexte($text); } else { echo $this->comments->getSource($id); } }
$exists = true; } if (trim($infos['idPSN']) != '' && $exists) { echo '<img style="margin:0;position:absolute;right:-15px;top:35px" src="http://mypsn.eu.playstation.com/psn/profile/' . $infos['idPSN'] . '.png" />'; } ?> <div style="clear:both"></div> <br /> <div class="cadreParam"> <h2>Ma description</h2> <p class="description"><?php echo montexte($infos['description']); ?> </p> </div> <div class="cadreParam"> <h2>Mon profil</h2> <div class="infoProfil"> <div>Pays</div> <?php echo trim($infos['country']) != '' ? $infos['country'] : '-'; ?> </div>
echo $this->pagination->create_links(); foreach ($commentaires as $commentaire) { echo '<div idComm="' . $commentaire['id'] . '" class="commentaire">'; echo '<div class="commAvatar">' . avatar_url($commentaire['user']) . '</div>'; echo '<div class="commPseudo">' . profil_url($commentaire['username'], $commentaire['user'], $commentaire['color']); echo ' <span class="commTime">' . madate($commentaire['date']) . '</span>'; echo '<div class="commActions">'; if ($this->session->userdata('group') >= 2) { echo '<a class="commSuppr" href="' . site_url('commSuppr/' . $commentaire['id']) . '">' . img('mini_delete.png') . ' Supprimer</a>'; } if ($commentaire['user'] == $this->session->userdata('id')) { echo '<a class="commEdit" href="' . site_url('editComm/' . $commentaire['id']) . '">' . img('editComm.png') . ' Edition</a>'; } echo '</div>'; echo '</div>'; echo '<p>' . montexte($commentaire['message']) . '</p>'; echo '</div>'; } echo $this->pagination->create_links(); echo '<script>'; echo 'url="' . $url . '";'; echo 'page=' . $page . ';'; echo 'table="' . $table . '";'; echo 'idData=' . $idData . ';'; echo 'nbMessageParPages=' . $nbMessageParPages . ';'; echo 'nbCommentaires=' . $nbCommentaires . ';'; echo '</script>'; echo '</div>'; if ($this->session->userdata('id') && $isAjaxRequest == false && $blocked == false) { echo '<br /><br /><h1 id="addMsg">Ajouter un message</h1>'; echo '<form id="addComment" method="post" action="' . site_url('addComment') . '">';
public function listMsg($page = null) { $this->load->model('chatboxs'); if ($page == null) { $mgs = $this->chatboxs->getMsg(); $mgs = array_reverse($mgs, true); } else { $mgs = $this->chatboxs->getHistory($page); } $json = array(); $lastUser = false; foreach ($mgs as $msg) { //si c'est un message privé //qu'on la pas envoyé //et qu'on n'est pas le destinataire => continue // if($msg['toUser'] != null && $msg['user'] != $this->session->userdata('id') && $msg['toUser'] != $this->session->userdata('id')) // continue; $json[$msg['id']] = '<div style="display:none" class="message" id="msgTchatbox' . $msg['id'] . '">'; if ($this->session->userdata('group') >= 2 && $page == null) { $json[$msg['id']] .= '<a class="deleteMsg" href="' . site_url('deleteMsg/' . $msg['id']) . '">' . img('mini_delete.png') . '</a>'; } if ($msg['isDeleted'] == 1 && $page == null) { $json[$msg['id']] .= 'removedByAdmin'; } else { $isMp = false; // pseudo du click message privée if ($msg['toUser'] == $this->session->userdata('id')) { $mpUsername = $msg['username']; $isMp = true; } elseif ($msg['toUser'] != null && $msg['user'] == $this->session->userdata('id')) { $mpUsername = $msg['username2']; $isMp = true; } else { $mpUsername = $msg['username']; } if ($isMp) { $testWith = $msg['username'] . '@' . $msg['username2']; } else { $testWith = $msg['username']; } if ($lastUser != $testWith) { $lastUser = $testWith; $json[$msg['id']] .= '<div class="author">'; // bouton MP if ($page == null) { $json[$msg['id']] .= '<a class="mpMsg" username="******" nohref>' . img('mp.png') . '</a>'; } // personne qui a envoyé le message $json[$msg['id']] .= profil_url($msg['username'], $msg['user'], $msg['color']); // si c'est un MP, on affiche a qui if ($isMp) { $json[$msg['id']] .= '@' . profil_url($msg['username2'], $msg['toUser'], $msg['color2']); } //date if ($page == null) { $json[$msg['id']] .= ' <span class="time">' . date('G\\hi', datetime2timestamp($msg['date'])) . '</span></div>'; } else { $json[$msg['id']] .= ' <span class="time">' . madate($msg['date']) . '</span></div>'; } } // on affiche le message if ($isMp) { $style = 'color:#006600'; } else { $style = ''; } $json[$msg['id']] .= '<span style="' . $style . '"">' . montexte($msg['message'], true, false) . '</span>'; } $json[$msg['id']] .= '</div>'; } echo json_encode($json); }