public function executePageMyPosts(sfWebRequest $request) { try { $pageNum = $request->getParameter('pageNum'); $userId = $_SESSION['userId']; $postings = new Postings(); list($posts, $total, $totalPostings) = $postings->getAllPostings($userId, $pageNum); $listBody = ''; foreach ($posts as $v) { // $listBody .= '<a href="#" class="list-group-item" title="Click to Edit or Remove a Post">'; // $listBody .= '<h4 class="list-group-item-heading">'.$v->getPostingTitle().'<span class="text-muted" style="float:right;font-size:13px!important;">Created </span></h4>'; // $listBody .= '<p class="list-group-item-text text-muted" style="font-size: 12px!important;">'.$v->getPostingDesc().'</p>'; // $listBody .= '</a>'; $listBody .= '<div id="postItem" class="list-group-item" style="position:relative;overflow:hidden;">'; $listBody .= '<div class="caption">'; $listBody .= '<p><a href="/index.php/postings/edit?id=' . $v->getId() . '" class="label label-success" rel="tooltip">Edit</a>'; $listBody .= ' <a href="" class="label label-success" rel="tooltip">Delete</a></p>'; $listBody .= '</div>'; $listBody .= '<h4 class="list-group-item-heading">' . $v->getPostingTitle() . '<span class="text-muted" style="float:right;font-size:13px!important;">Created </span></h4>'; $listBody .= '<p class="list-group-item-text text-muted" style="font-size: 12px!important;">' . $v->getPostingDesc() . '</p>'; $listBody .= '</div>'; } die(json_encode(array('success' => true, 'total' => $total, 'body' => $listBody, 'totalPostings' => $totalPostings))); } catch (Exception $e) { die(json_encode(array('success' => false, 'total' => 0, 'error' => $e->getMessage(), 'body' => '', 'totalPostings' => 0))); } }
public function executeGetListOfPostings(sfWebRequest $request) { $postings = new Postings(); $posts = $postings->getAllPostings($_SESSION['userId']); $html = "<ul>"; foreach ($posts as $v) { $html .= '<li> <span style="font-size:12px;"> ' . $v->getPostingTitle() . ' <blockquote>' . $v->getPostingDesc() . '</blockqoute> </span> <br/> <span style="font-weight:bold;"> <a href="/index.php/postings/edit?id=' . $v->getId() . '">Edit</a> | <a id="del-post" name="' . $v->getId() . '" href="#">Delete</a> <span style="color:#FB9601;display:none;" id="del-post-conf-' . $v->getId() . '">Are you sure want to delete the selected post? ( <a id="opt-yes" name="opt-yes-' . $v->getId() . '" href="#">Yes</a> | <a id="opt-no" name="opt-no-' . $v->getId() . '" href="#">No</a> )</span> <br/><span style="color:#FB9601;display:block;" id="resp-msg-' . $v->getId() . '"></span> </span> </li>'; } $html .= "</ul>"; die($html); }