Пример #1
0
 /**
  * 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);
 }
Пример #2
0
 public function actionProfile()
 {
     $fams = Families::model()->findAll();
     $ppl = People::model()->findAll();
     $baptised = People::model()->getBaptised();
     $confirmed = People::model()->getConfirmed();
     $married = People::model()->getMarried();
     $this->render('profile', array('families' => count($fams), 'members' => count($ppl), 'baptised' => count($baptised), 'confirmed' => count($confirmed), 'married' => count($married)));
 }
Пример #3
0
 public function testFindByFid()
 {
     $family = Families::model()->findByAttributes(array('fid' => 'A1'));
     $this->assertTrue($family instanceof Families);
     $this->assertEquals($family->addr_nm, '67, Terroy');
     $this->assertEquals($family->phone, '25805730');
     $this->assertEquals($family->husband_id, 1);
     $this->assertEquals($family->head_name, 'Robert Monteiro');
 }
Пример #4
0
 public function actionParishProfile()
 {
     $fams = Families::model()->findAll();
     $ppl = People::model()->findAll();
     $baptised1 = BaptismRecord::model()->findAll('baptism_dt > NOW() - INTERVAL 1 YEAR AND dob > NOW() - INTERVAL 1 YEAR');
     $baptised7 = BaptismRecord::model()->findAll('baptism_dt > NOW() - INTERVAL 1 YEAR AND dob BETWEEN NOW() - INTERVAL 7 YEAR AND NOW() - INTERVAL 1 YEAR');
     $baptised7p = BaptismRecord::model()->findAll('baptism_dt > NOW() - INTERVAL 1 YEAR AND dob < NOW() - INTERVAL 7 YEAR');
     $baptised = BaptismRecord::model()->findAll();
     $confirmed = ConfirmationRecord::model()->findAll('confirmation_dt > NOW() - INTERVAL 1 YEAR ');
     $firstComm = FirstCommunionRecord::model()->findAll('communion_dt > NOW() - INTERVAL 1 YEAR ');
     $married = MarriageRecord::model()->findAll('marriage_dt > NOW() - INTERVAL 1 YEAR');
     $married_cath = MarriageRecord::model()->findAll('marriage_dt > NOW() - INTERVAL 1 YEAR AND marriage_type <= 2');
     $married_nc = MarriageRecord::model()->findAll('marriage_dt > NOW() - INTERVAL 1 YEAR AND marriage_type > 2');
     $schedule = MassSchedule::model()->findAll(array('order' => 'day, time'));
     $pp = Pastors::model()->find('role = 1');
     $apps = Pastors::model()->findAll('role != 1');
     $this->render('parish-profile', array('families' => count($fams), 'members' => count($ppl), 'baptised' => count($baptised), 'baptised1' => count($baptised1), 'baptised7' => count($baptised7), 'baptised7p' => count($baptised7p), 'confirmed' => count($confirmed), 'firstComm' => count($firstComm), 'married' => count($married), 'married_nc' => count($married_nc), 'married_cath' => count($married_cath), 'pp' => $pp, 'apps' => $apps, 'schedule' => $schedule));
 }
Пример #5
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.
  * @param integer $id the ID of the model to be loaded
  * @return Families the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Families::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Пример #6
0
 public static function getAutoCompleteFields()
 {
     $people = People::model()->findAll();
     $specialSkills = array();
     $professions = array();
     $occupations = array();
     $churches = array();
     $baptism_places = array();
     $cemetery_churches = array();
     foreach ($people as $p) {
         if (!isset($specialSkills[$p->special_skill])) {
             $specialSkills[$p->special_skill] = 1;
         }
         if (!isset($professions[$p->profession])) {
             $professions[$p->profession] = 1;
         }
         if (!isset($occupations[$p->occupation])) {
             $occupations[$p->occupation] = 1;
         }
         if (!isset($baptism_churches[$p->baptism_church])) {
             $churches[$p->baptism_church] = 1;
         }
         if (!isset($baptism_places[$p->baptism_place])) {
             $baptism_places[$p->baptism_place] = 1;
         }
         if (!isset($cemetery_churches[$p->cemetery_church])) {
             $cemetery_churches[$p->cemetery_church] = 1;
         }
     }
     $families = Families::model()->findAll();
     foreach ($families as $fam) {
         if (!isset($churches[$fam->marriage_church])) {
             $churches[$fam->marriage_church] = 1;
         }
     }
     return array('special_skills' => array_keys($specialSkills), 'professions' => array_keys($professions), 'occupations' => array_keys($occupations), 'churches' => array_keys($churches), 'baptism_places' => array_keys($baptism_places), 'cemetery_churches' => array_keys($cemetery_churches));
 }
 /**
  * Manages all models.
  */
 public function actionAdmin($fid = null)
 {
     $model = new Subscription('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($fid)) {
         $family = Families::model()->findByPk($fid);
         $model->family_id = $family->id;
     }
     if (isset($_GET['Subscription'])) {
         $model->attributes = $_GET['Subscription'];
     }
     $this->render('admin', array('model' => $model));
 }
Пример #8
0
 public static function getAreas()
 {
     $families = Families::model()->findAll();
     $areas = array();
     foreach ($families as $fam) {
         if (!isset($areas[$fam->addr_area])) {
             $areas[$fam->addr_area] = 1;
         }
     }
     return $areas;
 }