public function afterDelete($event)
 {
     $log = new RecordOperationLog();
     $log->model = get_class($this->Owner);
     $log->model_id = $this->Owner->getPrimaryKey();
     $log->action = RecordOperationLog::DELETE;
     $log->save();
 }
示例#2
0
文件: view.php 项目: mjrouser/cityapi
        echo CHtml::link(Yii::t('app', 'Message'), array('message/thread', 'recipient' => $user->id), array('class' => 'message'));
    }
    ?>
        </div>
    <?php 
}
$this->endWidget();
?>
<a id="notifications"></a>
<?php 
$this->renderPartial('_notifications', array('userId' => $user->id, 'onlyUnviewed' => true));
$this->beginWidget('application.widgets.OuterBoxWidget', array('class' => 'recent-contributions feed', 'title' => Yii::t('app', 'Recent Contributions')));
?>
    <ul class="posts">
        <?php 
$contributionLogs = RecordOperationLog::model()->findAll(array('condition' => 'user_id = :user_id AND model = :model AND action = :action', 'params' => array(':user_id' => $user->id, ':model' => get_class(Post::model()), ':action' => RecordOperationLog::INSERT), 'order' => 'time DESC', 'limit' => Yii::app()->params['userProfile']['numberOfRecentContributions']));
?>
        <?php 
foreach ($contributionLogs as $contributionLog) {
    ?>
            <?php 
    $post = Post::model()->findByPk($contributionLog->model_id);
    if (!$post) {
        continue;
    } else {
        if ($post->feed->region) {
            $url = array('/resource/list', 'id' => $post->feed->region->id, '#' => 'post-' . $post->id);
            $feedName = $post->feed->region->name;
            $feedUrl = $this->createUrl('/resource/list', array('region' => $post->feed->region->id));
        } else {
            if ($post->feed->location) {