/** Reply to a stored message
  * @access public
  * @return void
  */
 public function replyAction()
 {
     if ($this->getParam('id', false)) {
         $form = new MessageReplyForm();
         $form->submit->setLabel('Send reply');
         $this->view->form = $form;
         if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) {
             if ($form->isValid($form->getValues())) {
                 $reply = array();
                 $reply['messagetext'] = $form->getValue('messagetext');
                 $reply['messageID'] = $this->getParam('id');
                 $data['replied'] = 1;
                 $where = $this->_messages->getAdapter()->quoteInto('id= ?', $this->getParam('id'));
                 $update = $this->_messages->update($data, $where);
                 $this->_replies->add($reply);
                 $contact = array(array('email' => $form->getValue('comment_author_email'), 'name' => $form->getValue('comment_author')));
                 $this->_helper->mailer($form->getValues(), 'messageResponse', $contact, $contact);
                 $this->getFlash()->addMessage('Message replied to.');
                 $this->redirect('/admin/messages/');
             } else {
                 $this->getFlash()->addMessage('There is a problem with ' . 'the form, please check and resubmit');
                 $form->populate($form->getValues());
             }
         } else {
             // find id is expected in $params['id']
             $id = (int) $this->_request->getParam('id', 0);
             if ($id > 0) {
                 $message = $this->_messages->fetchRow('id =' . $id);
                 if ($message) {
                     $form->populate($message->toArray());
                 } else {
                     throw new Pas_Exception_Param($this->_nothingFound);
                 }
             }
         }
     } else {
         throw new Pas_Exception_Param($this->_missingParameter, 500);
     }
 }
Exemple #2
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Replies::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #3
0
<?php

/**
 * Created by PhpStorm.
 * User: dan
 * Date: 7/13/15
 * Time: 11:23 AM
 */
include 'config/config.php';
include 'classes/Comments.php';
include 'classes/Replies.php';
$obj1 = new Comments();
$obj2 = new Replies();
$data1 = $obj1->getComments();
$data2 = $obj2->getReplies();
?>

<div class="post-comments">
    <h1>Comments</h1>
    <div class="comments-listing">
        <ul>
            <?php 
if (isset($data1) && !empty($data1)) {
    foreach ($data1 as $comm) {
        ?>
            <li id="">
                <div class="comment hidden-wrap">
                    <div class="avatar-container">
                        <div class="bordered-image">
                            <a href="">
                                <img alt="aaa" src="<?php 
Exemple #4
0
<?php

include_once 'config/config.php';
include_once 'classes/comments.php';
include_once 'classes/replies.php';
$title = 'Comments';
$comm = new Comments();
$q = $comm->getComments();
$reply = new Replies();
$s = $reply->getReplies();
?>
<!DOCTYPE html>
<html>
<head>
    <?php 
include 'includes/head.php';
?>
</head>
<body>
<?php 
include 'includes/header.php';
include 'includes/sub_header.php';
?>
<div class="site-wrap">
    <div class="main-content">
        <?php 
include 'includes/comm_page.php';
?>
    </div>
    <?php 
include 'includes/footer.php';
 /** List message replies
  * @access public
  */
 public function messagereplyAction()
 {
     $replies = new Replies();
     $this->view->replies = $replies->fetchRow('messageID=' . $this->getParam('id'));
     $this->_helper->viewRenderer->setNoRender(false);
 }
<?php

$obj = new Comments();
$data = $obj->getAll();
$obj1 = new Replies();
$data1 = $obj1->getAllReplies();
?>
	<div class="comments_wrap">
        <h1 class="titlu_comments">Comments</h1>

        <div class="comments_list">
            <ul>
                <?php 
if (isset($data) && !empty($data)) {
    foreach ($data as $row) {
        ?>
                <li>
                    <div class="comments">
                        <div class="img_wrap"><img src="assets/img/<?php 
        echo $row->img;
        ?>
"/></div>
						<div class="comments_author"><a href="#" ><?php 
        echo $row->name;
        ?>
</a></div>
						<div class="comments_date"><span><?php 
        echo $row->date;
        ?>
</span></div>
						<div class="reply_link"><a href="#"><img src="assets/img/reply_icon.png" /><span>Reply</span></a></div>