<div style="width:121.5%; "> <div style="float:left; width:60%; margin-left:2%; "> <?php if (empty($model)) { $this->redirect(array('index')); } $box = $this->beginWidget('bootstrap.widgets.TbBox', array('title' => 'Topic', 'headerIcon' => 'icon-th-list', 'htmlOptions' => array('class' => 'bootstrap-widget-table', 'style' => 'color:black; width:98%; margin-right:2%'))); $this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('topic', 'detail', 'name', 'email'))); $this->endWidget(); $answer = ForumAnswer::model()->findAll(array('condition' => 'a_id = :id', 'params' => array(':id' => $model->id), 'order' => 'a_datetime desc')); foreach ($answer as $value) { $box = $this->beginWidget('bootstrap.widgets.TbBox', array('title' => 'Reply/Comment', 'headerIcon' => 'icon-th-list', 'htmlOptions' => array('class' => 'bootstrap-widget-table', 'style' => 'color:black; width:98%; margin-right:2%'))); date_default_timezone_set("Asia/Manila"); ?> <table style="width:100%;"> <tr style=" border-bottom-style:solid;"> <td style="width:80%;"><?php echo 'Posted By: ' . $value->a_name; ?> </td> <td style="width:20%;"><?php echo $value->a_datetime; ?> </td> </tr> <tr> <td colspan="2"><?php echo $value->a_answer; ?> </td>
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param ForumAnswer $value A ForumAnswer object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(ForumAnswer $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
public function actionview_topic($id) { $modelAnswer = new ForumAnswer(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['ForumAnswer'])) { $modelAnswer->attributes = $_POST['ForumAnswer']; $modelAnswer->a_id = $id; $modelAnswer->a_datetime = date('Y-m-d h:i:sa'); $x = ForumQuestion::model()->findByPK($id); $x->reply = $x->reply + 1; $x->save(); if ($modelAnswer->save()) { $this->redirect(array('view_topic', 'id' => $id)); } } $this->render('view_topic', array('modelAnswer' => $modelAnswer, 'model' => ForumQuestion::model()->findByPK($id))); }