public function run()
 {
     $church = new Church();
     $church->name = 'Victory Church';
     $church->email = '*****@*****.**';
     $church->password = $_ENV['USER_PASS'];
     $church->address = '112 Main Street,';
     $church->city = 'San Antonio';
     $church->zipcode = '12345';
     $church->phone_number = '123456789';
     $church->denomination = 'Catholic';
     $church->save();
     $church1 = new Church();
     $church1->name = 'Faithful';
     $church1->email = '*****@*****.**';
     $church1->password = $_ENV['USER_PASS'];
     $church1->address = '112 Navarro Street,';
     $church1->city = 'San Antonio';
     $church1->zipcode = '23456';
     $church1->phone_number = '123456789';
     $church->denomination = 'Baptist';
     $church1->save();
     $church2 = new Church();
     $church2->name = 'Joyful';
     $church2->email = '*****@*****.**';
     $church2->password = $_ENV['USER_PASS'];
     $church2->address = '112 Commerce Street,';
     $church2->city = 'San Antonio';
     $church2->zipcode = '34567';
     $church2->phone_number = '123456789';
     $church->denomination = 'Methodist';
     $church2->save();
     $church3 = new Church();
     $church3->name = 'Peaceful';
     $church3->email = '*****@*****.**';
     $church3->password = $_ENV['USER_PASS'];
     $church3->address = '112 Presa Street,';
     $church3->city = 'San Antonio';
     $church3->zipcode = '45678';
     $church3->phone_number = '123456789';
     $church->denomination = 'Protestant';
     $church3->save();
 }
예제 #2
0
 public function getUser($attrib = "")
 {
     //        echo $attrib;exit;
     $model = Users::model()->findByPk(Yii::app()->user->getId());
     switch ($attrib) {
         case 'churchId':
             if (Yii::app()->session['church_id']) {
                 return Yii::app()->session['church_id'];
             } else {
                 return $model->church_id;
             }
             break;
         case 'fullname':
             return $model->user_fullname;
             break;
         case 'userId':
             return $model->user_id;
             break;
         case 'churchName':
             $church = Church::model()->findByPk($model->church_id);
             return $church->church_name;
             break;
         case 'churchCountry':
             $church = Church::model()->findByPk($model->church_id);
             return $church->address->country;
             break;
         case 'churchCity':
             $church = Church::model()->findByPk($model->church_id);
             return $church->address->city;
             break;
         case 'churchAddress':
             $church = Church::model()->findByPk($model->church_id);
             return $church->address->address_det;
             break;
         case 'latlng':
             $church = Church::model()->findByPk($model->church_id);
             return $church->latlng;
             break;
         case 'status':
             $church = Church::model()->findByPk($model->church_id);
             return $church->status;
             break;
         case 'userStatus':
             return $model->user_status;
             break;
         default:
             return $model->attributes;
             break;
     }
 }
예제 #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $response = new stdClass();
     $statusCode = 201;
     $in = Input::only('name', 'lat', 'lng', 'cid');
     $rules = array('name' => 'required | alpha_spaces | unique:churches', 'lat' => 'numeric', 'lng' => 'numeric', 'cid' => 'integer');
     $vd = Validator::make($in, $rules);
     if ($vd->fails()) {
         $errs = $vd->messages();
         $statusCode = 400;
         $response = $errs->all();
         if ($errs->has('name')) {
             // 教會已有建檔,嘗試建立教會與使用者之間的關係
             $cid = Church::where('name', $in['name'])->pluck('id');
             $statusCode = 201;
             // 先檢查是否已經加入教會
             $uc = UserChurch::where('uid', Auth::user()->id)->first();
             if ($uc && $uc->uid === Auth::user()->id) {
                 $uc->cid = $cid;
                 $uc->save();
             } else {
                 $relation = array('cid' => $cid, 'uid' => Auth::user()->id);
                 UserChurch::firstOrCreate($relation);
             }
             $response = new stdClass();
             return Response::json($response, $statusCode);
         }
     } else {
         $in['qlink'] = XUtil::makeQlink($in['name']);
         $church = Church::create($in);
         // 先檢查是否已經加入教會
         $uc = UserChurch::where('uid', Auth::user()->id)->first();
         if ($uc && $uc->uid === Auth::user()->id) {
             $uc->cid = $church->id;
             $uc->save();
         } else {
             // 建立教會與使用者之間的關係
             $relation = array('cid' => $church->id, 'uid' => Auth::user()->id);
             UserChurch::firstOrCreate($relation);
         }
         $response = new stdClass();
     }
     return Response::json($response, $statusCode);
 }
<?php

require_once __DIR__ . "/../../../Backend/SessionManager.php";
require_once __DIR__ . "/../../../Backend/RectorManager.php";
require_once __DIR__ . "/../../../Backend/ChurchManager.php";
if (!isset($_GET) || $_GET["nameChuch"] === NULL) {
    echo "KO";
    die;
}
if ($_GET["status"] === 'insert' && ChurchManager::getSingleChurch('name', $_GET["nameChuch"]) !== NULL) {
    echo "KO";
} else {
    $status = $_GET["status"];
    $church = new Church();
    $church->setId(0);
    $church->setName($_GET["nameChuch"]);
    $church->setType($_GET["typeChurch"]);
    $church->setCode($_GET["codeChurch"]);
    $church->setAddress($_GET["addressChurch"]);
    $church->setColony($_GET["colonyChurch"]);
    $church->setPostalCode($_GET["postalCodeChurch"]);
    $church->setPhoneNumber($_GET["phoneNumberChurch"]);
    $church->setIdVicar(ChurchManager::getSingleVicar('name', $_GET["vicar"])->getId());
    $church->setIdDean(ChurchManager::getSingleDean('name', $_GET["dean"])->getId());
    $church->setIdCity(CityManager::getSingleCity('name', $_GET["city"])->getId());
    $niches = $_GET["niche"];
    if ($niches == 'true') {
        $niche = new Niche();
        $niche->setMaxCol($_GET["maxCol"]);
        $niche->setMaxRow($_GET["maxRow"]);
        $niche->setSize($_GET["size"]);
 public function run()
 {
     $group = new Group();
     $group->group_name = 'Men Flag Football';
     $group->address = '500 Devine Rd';
     $group->city = 'San Antonio';
     $group->zipcode = '78209';
     $group->latitude = 29.476664;
     $group->longitude = -98.4773;
     $group->state = 'TX';
     $group->meeting_day = 'Monday';
     $group->meeting_time = '12:00';
     $group->children = true;
     $group->description = 'Come play football with us. We play play fair and fun';
     $group->user_id = User::findorFail(1)->id;
     $group->church_id = Church::findorFail(1)->id;
     $group->part_of_day = 'PM';
     $group->save();
     $group->categories()->attach(9);
     $group1 = new Group();
     $group1->group_name = 'Women Bible Study';
     $group1->address = '550 Fredericksburg Rd';
     $group1->city = 'San Antonio';
     $group1->zipcode = '78209';
     $group1->latitude = 29.492532;
     $group1->longitude = -98.553601;
     $group1->state = 'TX';
     $group1->meeting_day = 'Tuesday';
     $group1->meeting_time = '02:00';
     $group1->children = false;
     $group1->description = 'Come study the Bible and enrich your faith in God.';
     $group1->user_id = User::findorFail(2)->id;
     $group1->church_id = Church::findorFail(2)->id;
     $group1->part_of_day = 'AM';
     $group1->save();
     $group1->categories()->attach(8);
     //the '1' is an id
     $group2 = new Group();
     $group2->group_name = 'Women Volleyball';
     $group2->address = '500 Bandera Rd';
     $group2->city = 'San Antonio';
     $group2->zipcode = '78209';
     $group2->latitude = 29.45175;
     $group2->longitude = -98.54776699999999;
     $group2->state = 'TX';
     $group2->meeting_day = 'Wednesday';
     $group2->meeting_time = '01:00';
     $group2->children = false;
     $group2->description = 'Come play volleyball with us. We play play fair and fun';
     $group2->user_id = User::findorFail(3)->id;
     $group2->church_id = Church::findorFail(2)->id;
     $group2->part_of_day = 'AM';
     $group2->save();
     $group2->categories()->attach(8);
     $group3 = new Group();
     $group3->group_name = 'Youth Choir';
     $group3->address = '500 Castle Hills Rd';
     $group3->city = 'San Antonio';
     $group3->zipcode = '78209';
     $group3->latitude = 29.496472;
     $group3->longitude = -98.47953099999999;
     $group3->state = 'TX';
     $group3->meeting_day = 'Thursday';
     $group3->meeting_time = '05:00';
     $group3->children = true;
     $group3->description = 'In need of guitar players. Come practice with us regardless of all experiences.';
     $group3->user_id = User::findorFail(4)->id;
     $group3->church_id = Church::findorFail(4)->id;
     $group3->part_of_day = 'PM';
     $group3->save();
     $group3->categories()->attach(11);
     $group4 = new Group();
     $group4->group_name = 'Couple Counseling';
     $group4->address = '500 Castle Hills Rd';
     $group4->city = 'San Antonio';
     $group4->zipcode = '78209';
     $group4->latitude = 29.551683;
     $group4->longitude = -98.495223;
     $group4->state = 'TX';
     $group4->meeting_day = 'Thursday';
     $group4->meeting_time = '05:00';
     $group4->children = true;
     $group4->description = 'Every Sunday we have couples counselors who will be willing to pray with couples and help them facilitate communication.';
     $group4->user_id = User::findorFail(1)->id;
     $group4->church_id = Church::findorFail(1)->id;
     $group4->part_of_day = 'PM';
     $group4->save();
     $group4->categories()->attach(7);
     $group5 = new Group();
     $group5->group_name = 'Singles Bible Study';
     $group5->address = '2605 Juniper Springs Rd';
     $group5->city = 'San Antonio';
     $group5->zipcode = '78250';
     $group5->latitude = 29.500374;
     $group5->longitude = -98.665559;
     $group5->state = 'TX';
     $group5->meeting_day = 'Friday';
     $group5->meeting_time = '07:00';
     $group5->children = true;
     $group5->description = 'Come strengthen your knowledge of your individual story and how that intersects with the story of God. Our group meets every Friday at 7 PM.';
     $group5->user_id = User::findorFail(2)->id;
     $group5->church_id = Church::findorFail(2)->id;
     $group5->part_of_day = 'PM';
     $group5->save();
     $group5->categories()->attach(6);
     $group6 = new Group();
     $group6->group_name = 'Men Bible Study';
     $group6->address = '2603 Potranco Rd';
     $group6->city = 'San Antonio';
     $group6->zipcode = '78210';
     $group6->latitude = 29.397958;
     $group6->longitude = -98.46778500000001;
     $group6->state = 'TX';
     $group6->meeting_day = 'Tuesday';
     $group6->meeting_time = '06:00';
     $group6->children = true;
     $group6->description = 'Come share your story and how that intersects with the story of God.';
     $group6->user_id = User::findorFail(3)->id;
     $group6->church_id = Church::findorFail(3)->id;
     $group6->part_of_day = 'PM';
     $group6->save();
     $group6->categories()->attach(9);
     $group7 = new Group();
     $group7->group_name = 'Spanish Bible Reading';
     $group7->address = '2603 Huisache Rd';
     $group7->city = 'San Antonio';
     $group7->zipcode = '78237';
     $group7->latitude = 29.414671;
     $group7->longitude = -98.566608;
     $group7->state = 'TX';
     $group7->meeting_day = 'Wednesday';
     $group7->meeting_time = '06:00';
     $group7->children = true;
     $group7->description = 'Every Wednesday we read passages from the Bible and decipher their meanings in everday life.';
     $group7->user_id = User::findorFail(4)->id;
     $group7->church_id = Church::findorFail(4)->id;
     $group7->part_of_day = 'PM';
     $group7->save();
     $group7->categories()->attach(10);
     $group8 = new Group();
     $group8->group_name = 'Youth Bible Readings';
     $group8->address = 'W Military Drive';
     $group8->city = 'San Antonio';
     $group8->zipcode = '78227';
     $group8->latitude = 29.410404;
     $group8->longitude = -98.632561;
     $group8->state = 'TX';
     $group8->meeting_day = 'Thursday';
     $group8->meeting_time = '06:00';
     $group8->children = true;
     $group8->description = 'Every Thursday we read passages from the bible and how it relates to teenagers and their lives.';
     $group8->user_id = User::findorFail(1)->id;
     $group8->church_id = Church::findorFail(1)->id;
     $group8->part_of_day = 'PM';
     $group8->save();
     $group8->categories()->attach(10);
     $group9 = new Group();
     $group9->group_name = 'Women Sewing Group';
     $group9->address = 'Westover Hills Blvd';
     $group9->city = 'San Antonio';
     $group9->zipcode = '78251';
     $group9->latitude = 29.465118;
     $group9->longitude = -98.676562;
     $group9->state = 'TX';
     $group9->meeting_day = 'Monday';
     $group9->meeting_time = '06:00';
     $group9->children = true;
     $group9->description = 'Bring your sewing materials and ideas! We meet everday at 6 PM to 8PM. Snacks will be provided.';
     $group9->user_id = User::findorFail(2)->id;
     $group9->church_id = Church::findorFail(2)->id;
     $group9->part_of_day = 'PM';
     $group9->save();
     $group9->categories()->attach(8);
 }
예제 #6
0
    $churchRegistries = ChurchManager::simpleSearchChurch($simpleKeyword, $sortType, $numberPage);
} else {
    if ($kid !== NULL) {
        $churchSearch = new Church();
        $kid = $_GET["kid"];
        $kName = $_GET["kName"];
        $kType = $_GET["kType"];
        $kCode = $_GET["kCode"];
        $kAddress = $_GET["kAddress"];
        $kColony = $_GET["kColony"];
        $kPostalCode = $_GET["kPostalCode"];
        $kPhonenumber = $_GET["kPhonenumber"];
        $kDean = $_GET["kDean"];
        $kVicar = $_GET["kVicar"];
        $kCity = $_GET["kCity"];
        $church = new Church();
        $church->setId($kid);
        $church->setName($kName);
        $church->setType($kType);
        $church->setCode($kCode);
        $church->setAddress($kAddress);
        $church->setColony($kColony);
        $church->setPostalCode($kPostalCode);
        $church->setPhoneNumber($kPhonenumber);
        $church->setIdDean($kDean);
        $church->setIdVicar($kVicar);
        $church->setIdCity($kCity);
        $churchRegistries = ChurchManager::advancedSearchChurch($church, $sortType, $numberPage, 'AND');
    } else {
        $churchRegistries = ChurchManager::getAllChurchs($sortType, $numberPage);
    }
예제 #7
0
 public function getChurchall($per = 20)
 {
     $in = Input::only('apikey');
     $out = array();
     $rules = array('apikey' => 'required | alpha_num');
     $vd = Validator::make($in, $rules);
     if ($vd->fails()) {
         return;
     }
     if ($in['apikey'] != 'ccea77120806') {
         return;
     }
     $rdata = array();
     foreach (Church::orderBy('created_at', 'DESC')->get() as $church) {
         if ($church->status == 0) {
             $user_count = $church->users()->count();
             $target_count = $church->targets()->count();
             $church->user_count = $user_count;
             $church->target_count = $target_count;
             $church->setHidden(['id', 'lat', 'lng', 'updated_at', 'deleted_at', 'status', 'cid']);
             $rdata[] = $church;
         }
     }
     $current = Input::get('page') - 1;
     $data = array_slice($rdata, $current * $per, $per);
     $out = Paginator::make($data, count($rdata), $per);
     return Response::json($out);
 }
예제 #8
0
function church_validate($data)
{
    $church = new Church();
    if (strpos($data['fn'], "edit")) {
        $type = "edit";
    }
    if (strpos($data['fn'], "delete")) {
        $type = "delete";
    }
    if (strpos($data['fn'], "create")) {
        $type = "create";
    }
    return $church->_validate($data, $type, false);
}
예제 #9
0
<?php

if ($_SESSION['login']['role'] < 2) {
    echo '<h2 style="text-align: center; vertical-align: middle">Página Restrita</h2>';
} else {
    include_once 'class/Church.php';
    $id = filter_input(INPUT_GET, 'cod', FILTER_SANITIZE_NUMBER_INT);
    if (Church::getChurch("WHERE id_church = {$id}")) {
        $church = Church::getChurch("WHERE id_church = {$id}");
    } else {
        echo '<script>window.location = "index.php"</script>';
    }
    ?>
<div class="row">
    <div class="col-lg-12">
        <h1 class="page-header">Alterar Igreja</h1>
    </div>
</div>
<div class="row">
    <div class="col-lg-12">
        <div class="col-md-6 col-md-offset-3">
            <ul class="nav nav-wizard">
                <li class="active" id="1"><a href="#">Dados da Igreja</a></li>
                <li class="disabled" id="2"><a href="#">Endereço</a></li>
                <li class="disabled" id="3"><a href="#">Finalizar</a></li>
            </ul>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-lg-12">
 /**
  * Search one church by one similar name
  * 
  * @author Jonathan Sandoval <*****@*****.**>
  * @param  Church        $church      Pseudo-church with the data to search
  * @param  string        $order       The type of sort of the Church
  * @param  integer       $begin       The number of page to display the registry
  * @param  string        $operator    To search with 'or' or 'and'
  * @return Array[Church] $churchs     Church objects with the similar name or null
  */
 static function advancedSearchChurch($church = null, $order = 'id', $begin = -1, $operator = 'AND')
 {
     if ($church === null) {
         return null;
     }
     $tableChurch = DatabaseManager::getNameTable('TABLE_CHURCH');
     $tableVicar = DatabaseManager::getNameTable('TABLE_VICAR');
     $tableDean = DatabaseManager::getNameTable('TABLE_DEAN');
     $tableCity = DatabaseManager::getNameTable('TABLE_CITY');
     $church->getId() <= 0 ? $id = '' : ($id = $church->getId());
     $name = $church->getName();
     $type = $church->getType();
     $church->getCode() <= 0 ? $code = '' : ($code = $church->getCode());
     $address = $church->getAddress();
     $colony = $church->getColony();
     $church->getPostalCode() <= 0 ? $postalCode = '' : ($postalCode = $church->getPostalCode());
     $phoneNumber = $church->getPhoneNumber();
     $vicar = $church->getIdVicar();
     $dean = $church->getIdDean();
     $city = $church->getIdCity();
     $query = "SELECT {$tableChurch}.*\r\n                          FROM {$tableChurch} \r\n                                LEFT JOIN {$tableDean}  ON {$tableChurch}.idDean  = {$tableDean}.id\r\n                                LEFT JOIN {$tableVicar} ON {$tableChurch}.idVicar = {$tableVicar}.id\r\n                                LEFT JOIN {$tableCity}  ON {$tableChurch}.idCity  = {$tableCity}.id\r\n                          WHERE {$tableChurch}.id          LIKE '%{$id}%'          {$operator}\r\n                                {$tableChurch}.name        LIKE '%{$name}%'        {$operator}\r\n                                {$tableChurch}.type        LIKE '%{$type}%'        {$operator}\r\n                                {$tableChurch}.code        LIKE '%{$code}%'        {$operator}\r\n                                {$tableChurch}.address     LIKE '%{$address}%'     {$operator}\r\n                                {$tableChurch}.colony      LIKE '%{$colony}%'      {$operator}\r\n                                {$tableChurch}.postalCode  LIKE '%{$postalCode}%'  {$operator}\r\n                                {$tableChurch}.phoneNumber LIKE '%{$phoneNumber}%' {$operator}\r\n                                ({$tableDean}.id           LIKE '%{$dean}%'        OR\r\n                                 {$tableDean}.name         LIKE '%{$dean}%'      ) {$operator}\r\n                                ({$tableVicar}.id          LIKE '%{$vicar}%'       OR\r\n                                 {$tableVicar}.name        LIKE '%{$vicar}%'     ) {$operator}\r\n                                ({$tableCity}.id           LIKE '%{$city}%'        OR\r\n                                 {$tableCity}.name         LIKE '%{$city}%'      )\r\n                                ORDER BY {$order}";
     $query = $query . " LIMIT " . strval($begin * 10) . ", 11 ";
     $arrayChurchs = DatabaseManager::multiFetchAssoc($query);
     if ($arrayChurchs === null) {
         return null;
     } else {
         $i = 0;
         foreach ($arrayChurchs as $church) {
             if ($i == 10) {
                 continue;
             }
             $churchs[] = self::ArrayToChurch($church);
             $i++;
         }
         return $churchs;
     }
 }
 public function run()
 {
     $event = new CalendarEvent();
     $event->title = 'Youth Concert';
     $event->address = 'P Sherman 42 Wallaby Way';
     $event->city = 'San Antonio';
     $event->zipcode = '89203';
     $event->date = '2016-09-02';
     $event->time = '5:00';
     $event->time_of_day = 'PM';
     $event->cost = '$20.00';
     $event->description = 'A youth concert at the Alamo Coliseum that runs from 5PM to 8PM';
     $this->getImage($event);
     $event->category_id = Category::findorFail(1)->id;
     $event->user_id = User::findorFail(1)->id;
     $event->church_id = Church::findorFail(1)->id;
     $event->save();
     // $event->users()->attach(1);
     $event1 = new CalendarEvent();
     $event1->title = 'Adult Retreat';
     $event1->address = 'P Allen 42 Wallaby Way';
     $event1->city = 'San Antonio';
     $event1->zipcode = '78201';
     $event1->date = '2016-02-02';
     $event1->time = '5:00';
     $event1->time_of_day = 'PM';
     $event1->cost = '$20.00';
     $event1->description = 'An adult retreat at the Antonian that runs from Friday to Sunday';
     $this->getImage($event1);
     $event1->category_id = Category::findorFail(2)->id;
     $event1->user_id = User::findorFail(2)->id;
     $event1->church_id = Church::findorFail(2)->id;
     $event1->save();
     // $event->users()->attach(2);
     $event2 = new CalendarEvent();
     $event2->title = 'Church Cook-out';
     $event2->address = 'Loma Linda Express Way';
     $event2->city = 'San Antonio';
     $event2->zipcode = '78209';
     $event2->date = '2016-03-02';
     $event2->time = '3:00';
     $event2->time_of_day = 'PM';
     $event2->cost = '$20.00';
     $event2->description = 'Come join the church for our yearly spring cookout';
     $this->getImage($event2);
     $event2->category_id = Category::findorFail(11)->id;
     $event2->user_id = User::findorFail(3)->id;
     $event2->church_id = Church::findorFail(3)->id;
     $event2->save();
     // $event->users()->attach(3);
     $event3 = new CalendarEvent();
     $event3->title = 'Youth Choir Tryouts';
     $event3->address = '204 Bandera Road';
     $event3->city = 'San Antonio';
     $event3->zipcode = '78228';
     $event3->date = '2016-02-02';
     $event->time = '2:00';
     $event->time_of_day = 'PM';
     $event3->cost = 'Free';
     $event3->description = 'Play an instrument sing? Come tryout for the youth choir!';
     $this->getImage($event3);
     $event3->category_id = Category::findorFail(1)->id;
     $event3->user_id = User::findorFail(4)->id;
     $event3->church_id = Church::findorFail(4)->id;
     $event3->save();
     $event4 = new CalendarEvent();
     $event4->title = 'Women Adult Retreat';
     $event4->address = '265 W Military Road';
     $event4->city = 'San Antonio';
     $event4->zipcode = '78202';
     $event4->date = '2016-04-02';
     $event4->time = '5:00';
     $event4->time_of_day = 'PM';
     $event4->cost = 'Free';
     $event4->description = 'Our church is having a women retreat up soon in April. Come by the pavillion after church on Sunday for more info!';
     $this->getImage($event4);
     $event4->category_id = Category::findorFail(2)->id;
     $event4->user_id = User::findorFail(1)->id;
     $event4->church_id = Church::findorFail(1)->id;
     $event4->save();
     $event5 = new CalendarEvent();
     $event5->title = 'Spanish Mass';
     $event5->address = '354 Bobcat Drive';
     $event5->city = 'San Antonio';
     $event5->zipcode = '78218';
     $event5->date = '2015-05-02';
     $event5->time = '2:00';
     $event5->time_of_day = 'PM';
     $event5->cost = 'Free';
     $event5->description = 'Our church has decided to incorporate a Spanish mass at 2 PM every Sunday. Come and join us!';
     $this->getImage($event5);
     $event5->category_id = Category::findorFail(10)->id;
     $event5->user_id = User::findorFail(2)->id;
     $event5->church_id = Church::findorFail(2)->id;
     $event5->save();
     $event6 = new CalendarEvent();
     $event6->title = 'Financial Classes';
     $event6->address = '103 Bandera Road';
     $event6->city = 'San Antonio';
     $event6->zipcode = '78240';
     $event6->date = '2016-08-02';
     $event6->time = '5:00';
     $event6->time_of_day = 'PM';
     $event6->cost = 'Free';
     $event6->description = 'Gordon Ramsey will be offering classes at Joyful Church regarding finances. Come our church pavillion for more info!';
     $this->getImage($event6);
     $event6->category_id = Category::findorFail(7)->id;
     $event6->user_id = User::findorFail(3)->id;
     $event6->church_id = Church::findorFail(3)->id;
     $event6->save();
     $event7 = new CalendarEvent();
     $event7->title = 'Guitar Performance';
     $event7->address = '105 Bandera Road';
     $event7->city = 'San Antonio';
     $event7->zipcode = '78202';
     $event7->date = '2016-07-02';
     $event7->time = '2:00';
     $event7->time_of_day = 'PM';
     $event7->cost = 'Free';
     $event7->description = 'Watch the advanced and intermediate guitar ensemble perform renditions of Christmas tunes!';
     $this->getImage($event7);
     $event7->category_id = Category::findorFail(1)->id;
     $event7->user_id = User::findorFail(4)->id;
     $event7->church_id = Church::findorFail(4)->id;
     $event7->save();
     // $event->users()->attach(1);
     $event8 = new CalendarEvent();
     $event8->title = 'Vacation Bible Study';
     $event8->address = '3405 Bandera Road';
     $event8->city = 'San Antonio';
     $event8->zipcode = '78217';
     $event8->date = '2016-06-02';
     $event8->time = '6:00';
     $event8->time_of_day = 'PM';
     $event8->cost = 'Free';
     $event8->description = 'Vacation Bible Study will be offered to kids ages 7-14 on Sunday at 6-8 PM for kids ages 7-11 and on Monday 6-8 PM for ages 12-14!';
     $this->getImage($event8);
     $event8->category_id = Category::findorFail(4)->id;
     $event8->user_id = User::findorFail(1)->id;
     $event8->church_id = Church::findorFail(1)->id;
     $event8->save();
     $event9 = new CalendarEvent();
     $event9->title = 'Youth Sports';
     $event9->address = '352 Fredericksburg Road';
     $event9->city = 'San Antonio';
     $event9->zipcode = '78254';
     $event9->date = '2015-03-12';
     $event9->time = '2:00';
     $event9->time_of_day = 'PM';
     $event9->cost = 'Free';
     $event9->description = 'Youth intramural sports will begin in !';
     $this->getImage($event9);
     $event9->category_id = Category::findorFail(3)->id;
     $event9->user_id = User::findorFail(2)->id;
     $event9->church_id = Church::findorFail(2)->id;
     $event9->save();
     $event10 = new CalendarEvent();
     $event10->title = 'Choir Concert';
     $event10->address = '153 Bandera Road';
     $event10->city = 'San Antonio';
     $event10->zipcode = '78202';
     $event10->date = '2015-05-02';
     $event10->time = '7:00';
     $event10->time_of_day = 'PM';
     $event10->cost = 'Free';
     $event10->description = 'Watch the girls and boys choir concert at 7 PM. They have been working hard on rehearsals for the past few months so come and support!';
     $this->getImage($event10);
     $event10->category_id = Category::findorFail(1)->id;
     $event10->user_id = User::findorFail(3)->id;
     $event10->church_id = Church::findorFail(3)->id;
     $event10->save();
 }
예제 #12
0
 public static function getMissions($where = null)
 {
     $dados = Database::ReadAll("mission", "*", $where);
     if (!$dados) {
         return '';
     }
     foreach ($dados as $dado) {
         $mission = new Mission();
         $mission->setId($dado['ID_MISSION']);
         $mission->setName($dado['NAME_MISSION']);
         $mission->setDateBegin($dado['DATE_INICIAL']);
         $mission->setDateEnd($dado['DATE_END']);
         $mission->setStatus($dado['STATUS']);
         $team = Team::getTeam("WHERE id_team = " . $dado['ID_TEAM']);
         $mission->setTeam($team);
         if (!empty($dado['ID_ADDRESS'])) {
             $address = Address::getAddress("AND id_address = " . $dado['ID_ADDRESS']);
             $mission->setAddress($address);
         }
         if (!empty($dado['ID_CHURCH'])) {
             $church = Church::getChurch("WHERE id_church = " . $dado['ID_CHURCH']);
             $mission->setChurch($church);
         }
         $missions[] = $mission;
     }
     return $missions;
 }
예제 #13
0
                        </div>
                    </form>
                </div>
                <!-- FIM PRIMEIRO PASSO - DADOS PESSOAIS -->

                <div class="step2Ig" style="display: none;">
                    <form id="formMissaoIgreja" class="form-horizontal">
                        <div class="form-group">
                            <label for="pass1" class="control-label col-lg-4">Igreja</label>

                            <div class="col-lg-5">
                                <select name="ID_CHURCH" class="form-control" required>
                                    <option>Selecione a Igreja</option>
                                    <?php 
    if (Church::getChurches()) {
        foreach (Church::getChurches() as $rel) {
            echo '<option value="' . $rel->getId() . '">' . $rel->getName() . '</option>';
        }
    }
    ?>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-4 col-lg-offset-4">
                                <button type="button" data-back="1" class="btn btn-primary back">Voltar</button>
                            </div>
                            <div class="col-md-4">
                                <button type="submit" class="btn btn-primary">Continue</button>
                            </div>
                        </div>
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $group = Group::with('user')->where('id', '=', $id)->first();
     if (Auth::check() && Auth::user()->id != $id) {
         Session::flash('errorMessage', 'Unauthorized to edit this group.');
         return Redirect::action('HomeController@showHome');
     }
     $categories = Category::where('type', '=', 'group')->lists('name', 'id');
     $churches = Church::lists('name', 'id');
     $meetingHour = substr($group->meeting_time, 0, 1) == '0' ? substr($group->meeting_time, 1, 1) : substr($group->meeting_time, 0, 2);
     $meetingMinutes = substr($group->meeting_time, -2, 2);
     return View::make('groups.edit')->with(array('group' => $group, 'categories' => $categories, 'churches' => $churches, 'meetingHour' => $meetingHour, 'meetingMinutes' => $meetingMinutes));
 }
예제 #15
0
<?php

Event::listen('cron.collectJobs', function () {
    Cron::add('daily new churches notification', $_ENV['CRON_DAILY'], function () {
        $churches = Church::yesterday();
        if ($churches && $churches->count() > 0) {
            $data['churches'] = $churches;
            Mail::send('emails.dailynewchurches', $data, function ($message) {
                // michhsin@ccea.org.tw
                $message->to('*****@*****.**', '一領一禱告認領同工')->subject('一領一禱告認領:新加入教會通知 ' . date('Y/m/d'))->bcc('*****@*****.**', 'lancetw');
            });
        }
    }, true);
});
/*
|--------------------------------------------------------------------------
| Register The Laravel Class Loader
|--------------------------------------------------------------------------
|
| In addition to using Composer, you may use the Laravel class loader to
| load your controllers and models. This is useful for keeping all of
| your classes in the "global" namespace without Composer updating.
|
*/
ClassLoader::addDirectories(array(app_path() . '/commands', app_path() . '/controllers', app_path() . '/models', app_path() . '/database/seeds'));
/*
|--------------------------------------------------------------------------
| Application Error Logger
|--------------------------------------------------------------------------
|
| Here we will configure the error logger setup for the application which
예제 #16
0
<?php

session_cache_expire(25);
session_start();
require_once 'bootstrap.php';
require_once 'modules/dashboard_widgets/dashboard_widgets.controller.php';
require_once 'modules/dashboard_widgets/dashboard_widgets_blocks.php';
$username = $_SESSION['log_username'];
$version = NATURAL_VERSION;
$_SESSION['dash_type'] = 2;
$church = new Church();
$church->byID($_SESSION['log_church_id']);
$user_full_name = $_SESSION['log_first_name'] . ' ' . $_SESSION['log_last_name'] . ' (' . $church->name . ')';
$db = DataConnection::readOnly();
$q = $db->files[$_SESSION['log_file_id']];
if (count($q) > 0) {
    $avatar = $q['uri'];
} else {
    $avatar = "files/images/avatar/user.png";
}
$menu = new Menu();
$menu_html = $twig->render('menu.html', array('links' => $menu->byLevel('church', $_SESSION['log_access_level']), 'first' => TRUE));
$template = $twig->loadTemplate('base.html');
$template->display(array('project_title' => TITLE, 'path_to_theme' => THEME_PATH, 'company' => NATURAL_COMPANY, 'version' => $version, 'page' => 'dashboard-main', 'menu' => $menu_html, 'avatar' => $avatar, 'admin' => true, 'skin' => 'skin-light-blue', 'show_profile_button' => true, 'admin_profile_button' => false, 'user_header' => 'user-header-company', 'skin_profile' => 'bg-light-blue', 'user_full_name' => $user_full_name, 'username' => $username, 'actual_date' => date('F jS, Y'), 'page_title' => 'Dashboard', 'page_subtitle' => 'Widgets', 'content' => dashboard_content()));
예제 #17
0
 public static function getHistorys($where = null)
 {
     $dados = Database::ReadAll('history', '*', $where);
     if (!$dados) {
         return false;
     }
     foreach ($dados as $dado) {
         $history = new HistoryChurch();
         $history->setId($dado['ID_HISTORY']);
         $history->setNamePastor($dado['NAME_PASTOR']);
         $church = Church::getChurch("WHERE id_church = " . $dado['ID_CHURCH']);
         $history->setChurch($church);
         $history->setDateInicial($dado['DATE_INICIAL']);
         $history->setDateFinal($dado['DATE_FINAL']);
         $historys[] = $history;
     }
     return $historys;
 }
예제 #18
0
                         <div class="table-responsive">
                             <table class="table table-striped table-bordered table-hover dataTables-example">
                                 <thead>
                                 <tr>
                                     <th>ID</th>
                                     <th>Nome</th>
                                     <th>Pastor</th>
                                     <th>Endereço</th>
                                     <th>Status</th>
                                     <th>Ação</th>
                                 </tr>
                                 </thead>
                                 <tbody>
                                 <?php 
 if (Church::getChurches() != '') {
     foreach (Church::getChurches() as $chur) {
         echo '<tr>';
         echo '<td>' . $chur->getId() . '</td>';
         echo '<td>' . '<a class="modalChurch" data-id="' . $chur->getId() . '" >' . $chur->getName() . '</a>' . '</td>';
         echo '<td>' . $chur->getPastor() . '</td>';
         echo '<td>' . $chur->getAddress()->getStreet() . ', ' . $chur->getAddress()->getNumber() . ' ' . $chur->getAddress()->getComplement() . ', ' . $chur->getAddress()->getDistrict() . ', ' . $chur->getAddress()->getCity() . '/' . $chur->getAddress()->getState() . '</td>';
         echo '<td>' . $chur->getStatus() . '</td>';
         if ($chur->getStatus() != 'Banido') {
             echo '<td>' . '<a href="forms.php?p=altIgreja&cod=' . $chur->getId() . '">' . '<i class="icon icon-pencil"></i> Editar' . '</a>' . '</td>';
         } else {
             echo '<td></td>';
         }
         echo '</tr>';
     }
 }
 ?>
예제 #19
0
 public function actionStatistics()
 {
     $churchcnt = Church::model()->count();
     $rschcnt = ChurchSupplies::model()->count();
     $usercnt = AppUsers::model()->count();
     $this->render('statistics', array('churchcnt' => $churchcnt, 'rsccnt' => $rschcnt, 'usercnt' => $usercnt));
 }
예제 #20
0
function getChurch($tid)
{
    //TODO: delete getChurch();
    try {
        $church = new Church($tid);
        $church->allowOldStructure();
        return (array) $church;
    } catch (Exception $e) {
        //If there is no such church, we return an empty array();
        //echo $e->getMessage();
        return array();
    }
}
예제 #21
0
 public static function getChurches()
 {
     $dados = Database::ReadAll("church", "*");
     if (!$dados) {
         return '';
     }
     foreach ($dados as $dado) {
         $church = new Church();
         $church->setId($dado['ID_CHURCH']);
         $church->setName($dado['NAME_CHURCH']);
         $church->setPastor($dado['NAME_PASTOR']);
         $church->setStatus($dado['STATUS']);
         $address = Address::getAddress('AND a.id_address = ' . $dado['ID_ADDRESS']);
         $church->setAddress($address);
         $churches[] = $church;
     }
     return $churches;
 }
예제 #22
0
        <p><label>Status</label>: <?php 
        echo $team->getStatus();
        ?>

        <p><label>Integrantes</label>:<br/>
            <?php 
        foreach ($team->getMembers() as $member) {
            echo $member->getId() . ' - ' . $member->getName() . '<br />';
        }
        ?>
</p>
        <?php 
        break;
    case 'church':
        $cod = filter_input(INPUT_POST, 'cod', FILTER_SANITIZE_NUMBER_INT);
        $chur = Church::getChurch('WHERE id_church = ' . $cod);
        ?>
        <p><label>Nome</label>: <?php 
        echo $chur->getName();
        ?>
</p>
        <p><label>Pastor</label>: <?php 
        echo $chur->getPastor();
        ?>
</p>
        <p><label>Status</label>: <?php 
        echo $chur->getStatus();
        ?>

        <h4>Endereço</h4>
        <p><label>CEP</label>:  <?php