/** * 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 = Savedsearches::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php echo CHtml::ajaxLink('<span>' . Yii::t('students', 'Save Filter') . '</span>', $this->createUrl('Savedsearches/Create'), array('onclick' => '$("#jobDialog").dialog("open"); return false;', 'update' => '#jobDialog', 'type' => 'GET', 'data' => array('val1' => Yii::app()->request->getUrl(), 'type' => '1'), 'dataType' => 'text'), array('id' => 'showJobDialog', 'class' => 'saveic')); ?> </li> <li><a href="#" class="load_filter" onClick="hide('osload')"><span> <?php echo Yii::t('students', 'Load Filter'); ?> </span></a> <div id="osload" style="display:none; overflow-y:auto; height:auto; background:#fff; left:-40px; top:40px" class="drop"> <div class="droparrow"></div> <ul class="loaddrop"> <li style="text-align:center"> <?php $data = Savedsearches::model()->findAllByAttributes(array('user_id' => Yii::app()->User->id, 'type' => '1')); if ($data != NULL) { foreach ($data as $data1) { echo '<span style="width:150px; float:left; ">'; echo CHtml::link($data1->name, $data1->url, array('class' => 'vtip')); echo '</span>'; echo '<span>'; echo CHtml::link('<img src="images/cross.png" border="0" />', array('/savedsearches/deletestudent', 'user_id' => Yii::app()->User->id, 'sid' => $data1->id), array('confirm' => 'Are you sure you want to delete this?')); echo '</span>'; } } else { echo '<span style="color:#d30707;"><i>' . Yii::t('students', 'No Saved Searches') . '</i></span>'; } ?> </li> </ul>