/** * 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 SystemSetting the loaded model * @throws CHttpException */ public function loadModel($id) { $model = SystemSetting::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
protected function save($settings) { $result = true; foreach ($settings as $key => $value) { $item = SystemSetting::model()->findByAttributes(array('name' => $key)); if (!$item) { $item = new SystemSetting(); $item->name = $key; } $item->value = json_encode($value); if (!$item->save()) { $result = false; } } if (($cache = Yii::app()->cache) !== null) { $cache->delete($this->_key); } return $result; }
?> <!-- EduWind 主要内容 --> <?php echo $content; ?> <!-- EduWind 底部 --> <div class="clearfix"></div> <div class="light-green-background"> <div class="container"> <div class="row"> <?php $footer = SystemSetting::model()->find('name="footer"'); if (isset($footer->value)) { $footer = json_decode($footer->value, true); echo $footer['html']; } ?> </div> </div> </div> <div class="green-background"> <div class="container"> <div class="row"> <div class="col-sm-11 col-sm-offset-1"> <div style="padding:15px 0;color:white;"> Powered by