public function actionMap() { $this->layout = 'common'; $sql = "SELECT id,title,lat,`long`,comments,favorite,cTime FROM {{posts}} WHERE lat!='' AND `long`!='' AND `status`=1 ORDER BY cTime ASC"; Posts::getAll(array('sql' => $sql, 'pageSize' => 100), $pages, $posts); foreach ($posts as $k => $val) { $posts[$k]['href'] = Yii::app()->createUrl('posts/view', array('id' => $val['id'])); $posts[$k]['cTime'] = zmf::formatTime($val['cTime']); } $posts = !empty($posts) ? $posts : array(); $data = array('postJson' => CJSON::encode($posts), 'loadMap' => empty($posts) ? false : true); $this->pageTitle = '足迹 - ' . zmf::config('sitename'); $this->selectNav = 'map'; $this->render('/index/map', $data); }
<div class="media" id="comment-<?php echo $data['id']; ?> "> <div class="media-body"> <p><b><?php echo CHtml::encode($_uname); ?> </b></p> <p><?php echo nl2br(CHtml::encode($data['content'])); ?> </p> <p class="help-block"> <?php echo zmf::formatTime($data['cTime']); ?> <?php if ($this->uid) { ?> <span class="pull-right"> <?php if ($this->uid != $postInfo['uid']) { echo CHtml::link('回复', 'javascript:;', array('onclick' => "replyOne('" . $data['id'] . "','" . $data['logid'] . "','" . $_uname . "')")); } if ($this->uid == $postInfo['uid'] || $this->userInfo['isAdmin']) { echo CHtml::link('删除', 'javascript:;', array('action' => 'del-content', 'action-type' => 'comment', 'action-data' => $data['id'], 'action-confirm' => 1, 'action-target' => 'comment-' . $data['id'])); } ?> </span>
?> <span style="color: red">[草稿]</span><?php } ?> </td> <td class="text-center"> <?php echo CHtml::encode($data->hits); ?> | <?php echo CHtml::encode($data->favors); ?> </td> <td> <?php echo zmf::formatTime($data->cTime); ?> </td> <td> <?php echo CHtml::link('预览', array('/posts/view', 'id' => $data->id), array('target' => '_blank')); ?> <?php echo CHtml::link('编辑', array('posts/update', 'id' => $data->id), array('target' => '_blank')); ?> <?php echo CHtml::link('删除', 'javascript:;', array('action' => 'del-content', 'action-type' => 'post', 'action-data' => $data->id, 'action-confirm' => 1)); ?> </td> </tr>
foreach ($posts as $row) { ?> <p class="<?php echo $row['new'] ? 'font-bold' : 'help-block'; ?> " id="notice-<?php echo $row['id']; ?> "> <?php echo $row['content']; ?> <span class="pull-right"> <?php echo zmf::formatTime($row['cTime']); ?> <?php echo CHtml::link('<i class="fa fa-remove"></i>', 'javascript:;', array('action' => 'del-content', 'action-type' => 'notice', 'action-data' => $row['id'], 'action-confirm' => 1, 'action-target' => 'notice-' . $row['id'])); ?> </span> </p> <?php } ?> <?php $this->renderPartial('/common/pager', array('pages' => $pages)); ?> <?php }
<?php $a = Yii::app()->getController()->getAction()->id; $this->menu = array('文章列表' => array('link' => array('siteInfo/index'), 'active' => in_array($a, array('index'))), '新增文章' => array('link' => array('siteInfo/create'), 'active' => in_array($a, array('create', 'update'))), '更新文章' => array('link' => array('siteInfo/update', 'id' => $model->id), 'active' => in_array($a, array('create', 'update'))), '文章详情' => array('link' => array('siteInfo/view', 'id' => $model->id), 'active' => in_array($a, array('view'))), '文章预览' => array('link' => array('/site/info', 'code' => $model->code))); ?> <h1><?php echo $model->title; ?> </h1> <p class="help-block"> <?php echo zmf::formatTime($model->cTime); ?> </p> <?php echo zmf::text(array(), $model->content, false);