Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
CommentsFormWidget.php
1 <?php
2 /**
3  * Gentics Portal.Node PHP
4  * Author & Copyright (c) by Gentics Software GmbH
5  * sales@gentics.com
6  * http://www.gentics.com
7  * Licenses can be found in the LICENSE.txt file in the root-folder of this installation
8  * You must not use this software without a valid license agreement.
9  *
10  */
11 
12 ?>
13 <section class="comments-form-widget respond" id="comments-form-<?php echo $this->contentId?>">
14  <h6 class="section-title"><?php echo CommentsModule::t('Leave a Comment')?></h6>
15  <?php echo CHtml::link('', '#', array('name' => $this->contentId, 'class' => 'anchor')) ?>
16  <?php if ($message = Yii::app()->user->getFlash('commentCreateError' . $this->contentId)) { ?>
17  <div class="infobox">
18  <div class="flash-error">
19  <?php echo $message?>
20  </div>
21  </div>
22  <?php } ?>
23 
24  <?php if ($message = Yii::app()->user->getFlash('commentCreateSuccess' . $this->contentId)) { ?>
25  <div class="infobox">
26  <div class="flash-success">
27  <?php echo $message?>
28  </div>
29  </div>
30  <?php }?>
31 
32  <?php $form = $this->beginWidget('CActiveForm', array(
33  'id' => 'comments-form',
34  'action' => Yii::app()->createUrl('/comments/comment/create', array('return_url' => Yii::app()->request->getRequestUri() . '#' . $this->contentId)),
35  'htmlOptions' => array('class' => 'comment-form')
36 ))
37  ?>
38 
39  <?php echo $form->errorSummary($model); ?>
40 
41  <?php echo CHtml::hiddenField('key', $this->hash) ?>
42  <?php echo $form->hiddenField($model, 'parent_id') ?>
43 
44  <div class="input-block comment-form-reply" style="display: none;">
45  <?php echo CHtml::label(CommentsModule::t('Reply to'), 'reply'); ?>
46  <?php echo CHtml::textField('reply', '', array('readonly' => true)) ?>
47 
48  <div class="comment-form-reply-cancel">
49  <?php echo CHtml::link(CommentsModule::t('Cancel'), 'javascript:void(0)')?>
50  </div>
51  </div>
52 
53  <?php if (Yii::app()->user->isGuest): ?>
54  <p class="input-block">
55  <?php echo $form->labelEx($model, 'firstname'); ?>
56  <?php echo $form->textField($model, 'firstname', array('type' => 'text')) ?>
57  <?php echo $form->error($model, 'firstname'); ?>
58  </p>
59 
60  <p class="input-block">
61  <?php echo $form->labelEx($model, 'lastname'); ?>
62  <?php echo $form->textField($model, 'lastname', array('type' => 'text')) ?>
63  <?php echo $form->error($model, 'lastname'); ?>
64  </p>
65 
66  <p class="input-block">
67  <?php echo $form->labelEx($model, 'email'); ?>
68  <?php echo $form->textField($model, 'email', array('type' => 'email')) ?>
69  <?php echo $form->error($model, 'email'); ?>
70  </p>
71  <?php else: ?>
72  <p class="input-block">
73  <span><?php echo CommentsModule::t('Name')?></span>
74  <span><?php echo CHtml::encode($model->firstname) . " " . CHtml::encode($model->lastname)?></span>
75  <?php echo $form->hiddenField($model, 'firstname') ?>
76  <?php echo $form->hiddenField($model, 'lastname') ?>
77  </p>
78  <p class="input-block">
79  <span><?php echo $model->getAttributeLabel('email')?></span>
80  <span><?php echo "{$model->email}"?></span>
81  <?php echo $form->hiddenField($model, 'email') ?>
82  </p>
83  <?php endif?>
84 
85  <p class="input-block">
86  <?php echo $form->labelEx($model, 'subject'); ?>
87  <?php echo $form->textField($model, 'subject') ?>
88  <?php echo $form->error($model, 'subject'); ?>
89  </p>
90 
91  <p class="textarea-block">
92  <?php echo $form->labelEx($model, 'description'); ?>
93  <?php echo $form->textArea($model, 'description', array('cols' => 88, 'rows' => 6)) ?>
94  </p>
95 
96  <p class="input-block">
97  <?php echo $form->labelEx($model, 'notify_user', array('class' => 'email-copy-label')); ?>
98  <?php echo $form->checkBox($model, 'notify_user') ?>
99  <?php echo $form->error($model, 'notify_user'); ?>
100  </p>
101 
102  <?php if (!$this->isPreview): ?>
103  <p class="input-block">
104  <?php $this->widget('CCaptcha', array('captchaAction' => '/comments/comment/captcha')); ?>
105  <?php echo $form->labelEx($model, 'verifyCode'); ?>
106  <?php echo $form->textField($model, 'verifyCode') ?>
107  <?php echo $form->error($model, 'verifyCode'); ?>
108  </p>
109  <?php endif?>
110 
111  <?php echo !$this->isPreview ? CHtml::submitButton(CommentsModule::t('Submit')) : CHtml::button(CommentsModule::t('Submit'))?>
112  <div class="clear"></div>
113  <?php $this->endWidget() ?>
114 
115 </section>