public static function printULTree_noAnchors() { $categories = Classroom::model()->findAll(array('order' => 'lft')); $level = 0; foreach ($categories as $n => $category) { if ($category->level == $level) { echo CHtml::closeTag('li') . "\n"; } else { if ($category->level > $level) { echo CHtml::openTag('ul') . "\n"; } else { echo CHtml::closeTag('li') . "\n"; for ($i = $level - $category->level; $i; $i--) { echo CHtml::closeTag('ul') . "\n"; echo CHtml::closeTag('li') . "\n"; } } } echo CHtml::openTag('li'); echo CHtml::encode($category->name); $level = $category->level; } for ($i = $level; $i; $i--) { echo CHtml::closeTag('li') . "\n"; echo CHtml::closeTag('ul') . "\n"; } }
class="client-val-form button"> </div> <!--The tree will be rendered in this div--> <div id="<?php echo Classroom::ADMIN_TREE_CONTAINER_ID; ?> " class="admintree" > </div> <div id='category_info'> <div id='pic'></div> <div id='title'> <h3><?php echo Classroom::model()->findByPK($category_id)->name; ?> </h3> </div> </div> <div id="listview-wrapper" class="left"> <?php $this->widget('zii.widgets.CListView', array('dataProvider' => $prod_dataProvider, 'itemView' => 'application.views.student._frontend_view', 'id' => 'student-listview', 'afterAjaxUpdate' => 'js:function(id,data){$.bind_crud()}', 'pagerCssClass' => 'pager_wrapper clearfix')); ?> </div> </div> <!-- Content-->
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Classroom the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Classroom::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php Yii::app()->clientScript->registerCss('class1', "\n .align_center{text-align:center;}\n .link{text-decoration:none;}\n"); ?> <h1 class = 'align_center'>角色基本信息</h1> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('position_name', 'position_info', 'start_time', array('type' => 'raw', 'name' => 'winner_id', 'value' => $model->winner_id ? '<a class ="link" href=' . $this->createUrl('index/classmate/student_id/' . $model->winner_id) . '>' . Student::model()->findByPk($model->winner_id)->student_name . '</a>' : '暂时为空'), array('name' => 'class_id', 'value' => Classroom::model()->findByPk($model->class_id)->class_name)))); ?> <?php if ($model->winner_id == 0) { ?> <a data-role='button' data-inline = 'true' data-mini='true' href="<?php echo Yii::app()->createUrl('index/compete/position_id/' . $model->position_id); ?> " data-ajax="false" > <!-- <img src="/jq/mobile/images/demo/index/web.png" /> --> <h3>竞选</h3> </a> <a data-role='button' data-inline = 'true' data-mini='true' href="<?php echo Yii::app()->createUrl('index/vote/position_id/' . $model->position_id); ?> " data-ajax="false" > <!-- <img src="/jq/mobile/images/demo/index/web.png" /> --> <h3>投票</h3> </a> <?php }