Exemplo n.º 1
0
 public function beforeAction($action)
 {
     if (!$this->module->conversationMode) {
         $this->redirect(array('default/index'));
     }
     $this->_userId = Yii::app()->getModule('pm')->getUserId();
     $this->breadcrumbs = array(PmModule::t('Personal messages') => array('/pm'));
     return parent::beforeAction($action);
 }
Exemplo n.º 2
0
<?php

/**
 * @var CActiveDataProvider $dataProvider
 * @var DefaultController $this
 */
$this->breadcrumbs += array(PmModule::t('Outgoing'));
?>
<h2><?php 
echo PmModule::t('Outgoing');
?>
</h2>

<?php 
$this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $dataProvider, 'columns' => array(array('name' => 'recipient_id', 'value' => 'Yii::app()->controller->module->getUserName($data->recipient);'), array('name' => 'created', 'value' => 'Yii::app()->dateFormatter->format("yyy-MM-dd HH:mm:ss", $data->created)'), 'subject', array('class' => 'CButtonColumn', 'template' => '{view}{delete}'))));
?>

Exemplo n.º 3
0
		&nbsp;
		(<?php 
    echo CHtml::link('Написать сообщение', array('create', 'to' => $user->getPrimaryKey()));
    ?>
)
	</li>
	<?php 
}
?>
</ul>

<?php 
$form = $this->beginWidget('CActiveForm', array('action' => $this->createUrl('/pm/default/create'), 'method' => 'get'));
?>
	<?php 
echo PmModule::t('User id');
?>
:
	<?php 
echo CHtml::textField('to');
echo CHtml::submitButton(PmModule::t('Compose message'), array('name' => false));
$this->endWidget();
?>

<br />
	<h2><?php 
echo PmModule::t('Widget example');
?>
</h2>
<?php 
$this->widget('application.modules.pm.components.pmwidget');
Exemplo n.º 4
0
<?php

$this->breadcrumbs += array(PmModule::t('Incoming'));
?>
<h2><?php 
echo PmModule::t('Incoming');
?>
</h2>

<?php 
if (Yii::app()->user->hasFlash('success')) {
    ?>
	<div class="flash-success">
       <?php 
    echo Yii::app()->user->getFlash('success');
    ?>
    </div>
<?php 
}
?>

<?php 
$this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $dataProvider, 'columns' => array(array('name' => 'sender_id', 'type' => 'text', 'value' => '$data->senderName'), 'read:boolean', 'created', 'subject:text', array('class' => 'CButtonColumn', 'template' => '{view}{delete}'))));
Exemplo n.º 5
0
<?php

$this->breadcrumbs += array(PmModule::t('View message'));
?>

<h2><?php 
echo PmModule::t('View message');
?>
</h2>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('name' => 'sender_id', 'type' => 'text', 'value' => $model->senderName), array('name' => 'recipient_id', 'type' => 'text', 'value' => $model->recipientName), 'read:boolean', 'ds:boolean', 'dr:boolean', 'created', 'subject:text', 'text:ntext')));
?>

<?php 
if ($this->_userId != $model->sender_id) {
    echo CHtml::link(PmModule::t('Reply'), array('/pm/default/reply', 'id' => $model->id));
}
?>

<?php 
echo CHtml::link(PmModule::t('Delete'), '#', array('submit' => array('/pm/default/delete', 'id' => $model->id), 'confirm' => PmModule::t('Do you really want to delete this message?')));
?>
	
Exemplo n.º 6
0
<?php

$this->breadcrumbs += array(PmModule::t('Compose message'));
?>
 

<h2><?php 
echo PmModule::t('Compose message');
?>
</h2>

<p>
	<?php 
echo PmModule::t('Compose message for user');
echo ' ' . CHtml::encode($model->recipientName);
?>
</p>

<?php 
$this->renderPartial('_form', array('model' => $model));
?>

Exemplo n.º 7
0
		<?php 
echo $form->textField($model, 'subject', array('size' => 50));
?>
		<?php 
echo $form->error($model, 'subject');
?>
	
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'text');
?>
		<?php 
echo $form->textArea($model, 'text', array('rows' => 10, 'cols' => 60));
?>
		<?php 
echo $form->error($model, 'text');
?>
	</div>

	<div class="row buttons">
		<?php 
echo CHtml::submitButton(PmModule::t('Send'));
?>
	</div>
<?php 
$this->endWidget();
?>
</div>
Exemplo n.º 8
0
<?php

$this->breadcrumbs += array(PmModule::t('View conversation'));
?>
<h2><?php 
echo PmModule::t('View conversation with {user}', array('{user}' => $message->recipientName));
?>
</h2>

<?php 
$data = array_reverse($dataProvider->getData());
$dataProvider->setData($data);
$this->widget('zii.widgets.CListView', array('dataProvider' => $dataProvider, 'itemView' => '_message', 'template' => '{items}'));
?>

<?php 
$this->renderPartial('_form', array('model' => $message));
?>
	
Exemplo n.º 9
0
<?php

$this->breadcrumbs += array(PmModule::t('New conversations'));
?>

<h2><?php 
echo PmModule::t('New conversations');
?>
</h2>
<?php 
if (Yii::app()->user->hasFlash('success')) {
    ?>
	<div class="flash-success">
		<?php 
    echo Yii::app()->user->getFlash('success');
    ?>
	</div>
<?php 
} elseif (Yii::app()->user->hasFlash('error')) {
    ?>
	<div class="flash-error">
		<?php 
    echo Yii::app()->user->getFlash('error');
    ?>
	</div>
<?php 
}
?>

<?php 
$this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $dataProvider, 'columns' => array(array('name' => 'interlocutorId', 'type' => 'text', 'value' => '$data->getInterlocutorName()'), 'created', 'read:boolean', 'id', 'subject:text', array('class' => 'CButtonColumn', 'template' => '{view}', 'viewButtonUrl' => 'array("view", "id" => $data->interlocutorId)')), 'template' => '{items}'));
Exemplo n.º 10
0
 /**
  * Delete message
  *
  * @param int $id message ID
  */
 public function actionDelete($id)
 {
     if (Yii::app()->request->isPostRequest) {
         $model = PersonalMessage::model()->haveAccess($this->_userId)->findByPk($id);
         if ($model !== null) {
             $this->_userId == $model->sender_id ? $model->ds = 1 : ($model->dr = 1);
             if (Yii::app()->getModule('pm')->reallyDelete && $model->ds && $model->dr) {
                 $model->delete();
             } else {
                 $model->save(false, array('dr', 'ds'));
             }
             if (!isset($_GET['ajax'])) {
                 Yii::app()->user->setFlash('success', PmModule::t('Message has been succsefully deleted.'));
                 $this->redirect(array('/pm/default/listincoming'));
             }
         }
     } else {
         throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
     }
 }
Exemplo n.º 11
0
 /**
  * @return array customized attribute labels (name=>label)
  */
 public function attributeLabels()
 {
     return array('id' => 'ID', 'sender_id' => PmModule::t('Sender'), 'recipient_id' => PmModule::t('Recipient'), 'read' => PmModule::t('Read'), 'created' => PmModule::t('Created'), 'subject' => PmModule::t('Subject'), 'text' => PmModule::t('Text'), 'interlocutorId' => PmModule::t('Interlocutor'));
 }
Exemplo n.º 12
0
<?php

$this->breadcrumbs += array(PmModule::t('Reply to message'));
?>
<h2><?php 
echo PmModule::t('Reply to message');
?>
</h2>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('subject:text', 'created', 'senderName:text', 'text:ntext')));
?>

<?php 
$this->renderPartial('_form', array('model' => $modelNew));
?>

Exemplo n.º 13
0
<?php

if ($unread) {
    echo CHtml::link(PmModule::t('Messages({unread})', array('{unread}' => $unread)), $this->url);
} else {
    echo CHtml::link(PmModule::t('Messages'), $this->url);
}