예제 #1
0
 
<p> Choose from roster, and click Import to fill in their info</p>

     
     <?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'rasta-import', 'enableAjaxValidation' => false));
echo CHtml::listBox('rasta', null, CHtml::listData(Roster::model()->findAll(array('order' => 'last_name, first_name')), 'id', 'full_name'), array('size' => 20));
?>

<br />
<br />

<?php 
echo CHtml::button("Import", array('id' => 'importer'));
$this->endWidget();
?>

<?php 
Yii::app()->clientScript->registerCoreScript("jquery");
?>

<script type="text/javascript">
	jQuery(function($) {

            fieldmap = { 
                'last_name' : 'last_name',
                'first_name' : 'first_name',
                'grade' : 'grade',
                'phone' : 'emergency_1',
                'parent_1' : 'contact',
                'cell_parent_1' : 'emergency_2',
예제 #2
0
 /**
  * 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.
  */
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             $this->_model = Roster::model()->findbyPk($_GET['id']);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }