protected function update(News $news) { $requete = $this->db->prepare('UPDATE news SET auteur = :auteur, titre = :titre, contenu = :contenu, dateModif = NOW() WHERE id = :id'); $requete->bindValue(':titre', $news->titre()); $requete->bindValue(':auteur', $news->auteur()); $requete->bindValue(':contenu', $news->contenu()); $requete->bindValue(':id', $news->id(), PDO::PARAM_INT); $requete->execute(); }
public function commit() { if ($this->valid_origin) { $nv = new NewsValidate(array('writer' => $this->writer, 'target' => $this->target, 'image' => $this->image, 'origin' => $this->origin, 'title' => $this->title, 'content' => $this->content, 'begin' => $this->begin, 'end' => $this->end, 'comment' => $this->comment)); $v = new Validate(array('writer' => $this->writer, 'group' => $this->target->group(), 'item' => $nv, 'type' => 'news')); $v->insert(); } else { $n = new News(); $n->insert(); $n->writer($this->writer); $n->target($this->target); $n->image($this->image); $n->origin($this->origin); $n->title($this->title); $n->content($this->content); $n->begin($this->begin); $n->end($this->end); $n->comment($this->comment); $this->idIfValid = $n->id(); // This code is used to post news on a newsgroup server //if ($this->target->rights()->isMe(Rights::everybody())) { // $this->sendnewsgroupmail(); //} } return true; }
/** * @see NewsManager::update() */ protected function update(News $news) { $requete = $this->db->prepare('UPDATE news SET auteur = ?, titre = ?, contenu = ?, dateModif = NOW() WHERE id = ?'); $requete->bind_param('sssi', $news->auteur(), $news->titre(), $news->contenu(), $news->id()); $requete->execute(); }
function viewTable($data, $count) { $news = new News(); $paginations = new Paginations(); $paginations->setLimit(10); $paginations->setPage($_REQUEST['page']); $paginations->setJSCallback("viewNews"); $paginations->setTotalPages($count); $paginations->makePagination(); ?> <div class="mws-panel-header"> <span class="mws-i-24 i-table-1">View News</span> </div> <div class="mws-panel-body"> <table cellpadding="0" cellspacing="0" border="0" class="mws-datatable-fn mws-table"> <colgroup> <col class="con0"/> <col class="con1"/> </colgroup> <thead> <tr> <th class="head1">News Title</th> <th class="head0"> </th> <th class="head0"> </th> <th class="head1"> </th> </tr> </thead> <tbody> <?php if (count($data) > 0) { ?> <?php for ($i = 0; $i < count($data); $i++) { $news->extractor($data, $i); ?> <tr id="row_<?php echo $news->id(); ?> "> <td class="con1"><?php echo $news->title(); ?> </td> <td class="con0"><?php //echo $news->image(); ?> </td> <td class="con0"><?php //echo $admins->username(); ?> </td> <td class="center"><a onclick="loadGUIContent('news','edit','<?php echo $news->id(); ?> ')">Edit</a> <a onclick="deleteNews(<?php echo $news->id(); ?> )" class="toggle">Delete</a></td> </tr> <?php } ?> <?php } ?> </tbody> </table> <?php $paginations->drawPagination(); }