示例#1
0
 public function actionAdmin()
 {
     $model = new Student('search');
     $model->unsetAttributes();
     if (isset($_GET['Student'])) {
         $model->setAttributes($_GET['Student']);
     }
     $this->render('admin', array('model' => $model));
 }
 public function actionVerifyStudents()
 {
     $model = new Student('search');
     $model->unsetAttributes();
     if (isset($_GET['Student'])) {
         $model->attributes = $_GET['Student'];
     }
     $dataProvider = $model->searchInactive();
     $this->render('verifyStudents', array('model' => $model, 'dataProvider' => $dataProvider));
 }
示例#3
0
 public function actionAdmin()
 {
     $model = new Student('search');
     $model->unsetAttributes();
     // clear any default value
     $class_id = Yii::app()->user->class_id;
     $model->class_id = $class_id;
     $model->is_check = 1;
     $this->render('admin', array('model' => $model));
 }
 /**
  *  Prepares dataproviders for models and jstree open nodes.
  * @return  array  Contains the dataproviders for the models,open nodes for the tree and the model to search for.
  * @since 1.0
  */
 private function prepare_dataproviders()
 {
     //create an array open_nodes with the ids of the nodes that we want to be initially open
     //when the tree is loaded.Modify this to suit your needs.Here,we open all nodes on load.
     $categories = Classroom::model()->findAll(array('order' => 'lft'));
     $identifiers = array();
     foreach ($categories as $n => $category) {
         $identifiers[] = "'" . 'node_' . $category->id . "'";
     }
     $open_nodes = implode(',', $identifiers);
     $cat_dataProvider = new CActiveDataProvider('Classroom');
     $prod_criteria = new CDbCriteria();
     $prod_criteria->with = array('assignments' => array('on' => 'assignments.id=:cat_id', 'together' => true, 'joinType' => 'INNER JOIN', 'params' => array(':cat_id' => $_GET['cat_id'])));
     //for search
     $model = new Student('search');
     $model->unsetAttributes();
     if (isset($_GET['Student'])) {
         //if searching
         $model->setAttributes($_GET['Student']);
         $search_criteria = $model->searchCriteria();
         $prod_criteria->mergeWith($search_criteria);
     }
     $prod_dataProvider = new CActiveDataProvider('Student', array('criteria' => $prod_criteria, 'pagination' => array('pageSize' => self::PAGING_SIZE_CAT)));
     return array('cat_provider' => $cat_dataProvider, 'prod_provider' => $prod_dataProvider, 'open_nodes' => $open_nodes, 'model' => $model);
 }
示例#5
0
 /**
  * Manages all models.
  */
 public function actionIndex()
 {
     if (!isset($_GET['cID'])) {
         $this->redirect(array('classmanager/index'));
     } else {
         $_SESSION['cID'] = $_GET['cID'];
     }
     $model = new Student('search');
     //$model = Student::model()->findAll('ID_Class=:idClass', array('idClass'=>$_SESSION['cID']));
     $model->unsetAttributes();
     // clear any default values
     $model->ID_Class = $_SESSION['cID'];
     if (isset($_GET['Student'])) {
         $model->attributes = $_GET['Student'];
     }
     $this->render('admin', array('model' => $model));
 }
示例#6
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Student('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Student'])) {
         $model->attributes = $_GET['Student'];
     }
     $this->render('admin', array('model' => $model));
 }
示例#7
0
 /**
  * Manages all models.
  */
 public function actionAdmin($assignment = null)
 {
     $model = new Student('search');
     $model->unsetAttributes();
     // clear any default values
     if ($assignment) {
         $dataProvider = new CArrayDataProvider($this->loadStudentsFromAssignment($assignment), array('keyField' => 'id', 'pagination' => array('pageSize' => 1000)));
     } else {
         if (isset($_GET['Student'])) {
             $model->attributes = $_GET['Student'];
         }
         $dataProvider = $model->search();
     }
     $this->render('admin', array('model' => $model, 'dataProvider' => $dataProvider));
 }