/**
	 * Creates a new model.
	 * If creation is successful, the browser will be redirected to the 'view' page.
	 */
	public function actionCreate()
	{
		$model=new Visits;
		if(isset($_GET['solicitor'])){
			$model->solicitor_id = $_GET['solicitor'];
		}
		$lists = BaseModel::getAll('Solicitor');
		$solicitors = array();
		foreach($lists as $list){
			$solicitors[$list->id] = $list->first_name.' '.$list->last_name.'('.$list->solicitor_code.')';
		}
		// Uncomment the following line if AJAX validation is needed
		// $this->performAjaxValidation($model);

		if(isset($_POST['Visits']))
		{
			$model->attributes=$_POST['Visits'];
			if($model->save())
				$this->redirect(array('view','id'=>$model->id));
		}

		$this->render('create',array(
			'model'=>$model,
			'solicitors' => $solicitors
		));
	}
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($fid = null)
 {
     $model = new Visits();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Visits'])) {
         $model->attributes = $_POST['Visits'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $params = array('model' => $model, 'pastors' => $this->getPastors());
     if (isset($fid)) {
         $params['fid'] = $fid;
     } else {
         $families = Families::model()->findAll();
         $fData = array();
         foreach ($families as $f) {
             $head = $f->head();
             $fname = $head ? $head->fullname() . ' #' . $f->id : 'Family #' . $f->id;
             $fData[$f->id] = $fname;
         }
         $params['famData'] = $fData;
     }
     $this->render('create', $params);
 }