public function actionSent() { Yii::beginProfile('messages_sent'); $total = 0; $criteria = PmbApi::getSentCriteria(Yii::app()->user->id); $total = PmbApi::getSentItems(Yii::app()->user->id); if ($total) { $total = count($total); } $pages = new CPagination($total); $pages->pageSize = Yii::app()->params['resultsPerPage']; $pages->applyLimit($criteria); $messages = PmbMessages::model()->findAll($criteria); //$messages = PmbApi::getInbox(Yii::app()->user->id); $unread = PmbApi::getUnreadInboxCount(Yii::app()->user->id); $this->render('sent', array('messages' => $messages, 'unread' => $unread, 'pages' => $pages)); Yii::endProfile('messages_sent'); }
public static function getMessageById($id) { return PmbMessages::model()->findByPk($id); }