public static function getAllTemplates() { $models = SmsTemplates::model()->findAll(); if ($models) { return $models; } else { return false; } }
<?php $criteria = new CDbCriteria(); $criteria->condition = '`created_by`=:created_by'; $criteria->params = array(':created_by' => Yii::app()->user->id); $criteria->order = '`created_at` DESC, `id` DESC'; $smstemplates = SmsTemplates::model()->findAll($criteria); ?> <!--tags input--> <link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?> /css/tagsinput/jquery.tagsinput.css" /> <script src="<?php echo Yii::app()->request->baseUrl; ?> /js/tagsinput/jquery.tagsinput.min.js"></script> <style> .sms-block .left{ width:400px; float:left; } .sms-block .right{ width:300px; float:right; height:200px; margin-right:10px; } .sms-templates .sms-template{ background-color:#09F; margin-bottom:10px;
/** * 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 the ID of the model to be loaded */ public function loadModel($id) { $model = SmsTemplates::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }