/**
  * Returns the static model of the specified AR class.
  * Please note that you should have this exact method in all your CActiveRecord descendants!
  * @param string $className active record class name.
  * @return MsgMessageCopiesView the static model class
  */
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
Exemple #2
0
<?php

$total_unread = MsgMessageCopies::model()->getTotals('user_id=:t1 and `read`=:t2', array(':t1' => Yii::app()->user->id, ':t2' => 0));
$grid_id = 'inbox-listview';
$model_class_name = $model->getClassName();
?>
<div class="message-container">
        <div id="id-message-list-navbar" class="message-navbar align-center clearfix">
                <div class="message-bar">
                        <div class="message-infobar" id="id-message-infobar">
                                <span class="blue bigger-150"><?php 
echo Lang::t('Inbox');
?>
</span>
                                <span class="grey bigger-110">(<?php 
echo number_format($total_unread);
?>
 <?php 
echo Lang::t('unread messages');
?>
)</span>
                        </div>
                        <div class="message-toolbar hide">
                                <div class="inline position-relative align-left">
                                        <a href="#" class="btn-message btn btn-xs dropdown-toggle" data-toggle="dropdown">
                                                <i class="icon-ok-circle bigger-110"></i>
                                                <span class="bigger-110"><?php 
echo Lang::t('Mark as');
?>
</span>
                                                <i class="icon-caret-down icon-on-right"></i>
 public function actionMarkInboxAs($id, $key, $val)
 {
     $model = MsgMessageCopies::model()->loadModel($id);
     if ($model->user_id !== Yii::app()->user->id) {
         throw new CHttpException(403, Lang::t('403_error'));
     }
     $model->markAs($key, $val);
 }
Exemple #4
0
 protected function addMessageCopies()
 {
     if ($this->message_type === self::TYPE_PRIVATE) {
         $to_user_ids = explode(',', $this->to_ids);
         foreach ($to_user_ids as $to_user_id) {
             MsgMessageCopies::model()->addRecord(array('message_id' => $this->id, 'user_id' => $to_user_id, 'owner' => MsgMessageCopies::OWNER_RECIPIENT));
         }
         //add sender's copy
         MsgMessageCopies::model()->addRecord(array('message_id' => $this->id, 'user_id' => $this->from_user_id, 'owner' => MsgMessageCopies::OWNER_SENDER, 'notified' => 1, 'read' => 1));
     }
 }