public static function value($name, $code) { if (!isset($code)) { return null; } $fv = FieldNames::values($name); return $fv[$code]; }
public function actionIndex($file) { $rfile = preg_replace('/\\.csv$/', '-rej.csv', $file); if (($fh = fopen($file, 'r')) !== FALSE) { $proc = false; $rej = 0; $num = 0; while (($data = fgetcsv($fh, 1000)) !== FALSE) { if ($proc) { ++$num; try { $rec = new MarriageRecord(); $col = 0; $rec->marriage_dt = FormatHelper::dateConv($data[$col++]); $rec->groom_name = $data[$col++]; $rec->groom_dob = FormatHelper::dateConv($data[$col++]); try { $rec->groom_baptism_dt = FormatHelper::dateConv($data[$col++]); } catch (Exception $e) { } $rec->groom_status = FieldNames::find_value('marital_status', $data[$col++]); $rec->groom_rank_prof = $data[$col++]; $rec->groom_fathers_name = $data[$col++]; $rec->groom_mothers_name = $data[$col++]; $rec->groom_residence = $data[$col++]; $rec->bride_name = $data[$col++]; $rec->bride_dob = FormatHelper::dateConv($data[$col++]); try { $rec->bride_baptism_dt = FormatHelper::dateConv($data[$col++]); } catch (Exception $e) { } $rec->bride_status = FieldNames::find_value('marital_status', $data[$col++]); $rec->bride_rank_prof = $data[$col++]; $rec->bride_fathers_name = $data[$col++]; $rec->bride_mothers_name = $data[$col++]; $rec->bride_residence = $data[$col++]; $rec->marriage_type = FieldNames::find_value('marriage_type', $data[$col++]); $rec->banns_licence = $data[$col++]; $rec->minister = $data[$col++]; $rec->witness1 = $data[$col++]; $rec->witness2 = $data[$col++]; $rec->remarks = $data[$col++]; if (!$rec->save()) { throw new Exception("Unable to save record"); } } catch (Exception $e) { if (1 == ++$rej) { if (($rej_fh = fopen($rfile, 'w')) === FALSE) { echo "File {$rfile} cannot be opened in write mode. Do you have write permissions?"; echo "Printing rejected records to STDOUT"; $rej_fh = STDOUT; } fputcsv($rej_fh, $hdr); } echo "Caught exception Record #{$num}: " . $e->getMessage() . ". Saved to rejects file\n"; fputcsv($rej_fh, $data); } } else { $proc = true; $hdr = $data; } } } fclose($fh); echo "Import complete. Total records: {$num}, success: " . ($num - $rej); if (isset($rej_fh)) { fclose($rej_fh); echo ", rejected: {$rej}.\nRejects saved to: {$rfile}"; } echo ".\n"; }
# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # /* @var $this NeedItemsController */ /* @var $dataProvider CActiveDataProvider */ $this->breadcrumbs = array('Admin' => array('site/page', 'view' => 'admin'), 'Need Items'); ?> <table> <?php $needModel = new NeedData(); $needLevels = FieldNames::values('need_level'); ?> <thead> <tr> <th> </th> <?php foreach ($needLevels as $level) { echo '<th>' . $level . '</th>'; } ?> <th> </tr> </thead> <?php
# Alive Parish Software is distributed in the hope that it will # be useful, but WITHOUT ANY WARRANTY; without even the implied warranty # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ?> <table class="cellular"> <thead> <tr> <th rowspan="2">Need Item</th> <th colspan="<?php $fv = FieldNames::values('need_level'); echo count($fv); ?> ">Need Level Percentage (Count)</th> <th rowspan="2">Total</th> </tr> <tr> <?php foreach ($fv as $nv => $val) { echo '<th class="option">' . $val . '</th>'; } ?> </tr> </thead> <?php
<div class="row"> <?php echo $form->label($model, 'language'); ?> <?php echo $form->dropDownList($model, "language", FieldNames::values('languages'), array('prompt' => '-- Select --')); ?> </div> <div class="row"> <?php echo $form->label($model, 'day'); ?> <?php echo $form->dropDownList($model, "day", FieldNames::values('weekdays'), array('prompt' => '-- Select --')); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton('Search'); ?> </div> <?php $this->endWidget(); ?> </div><!-- search-form -->
} ?> </tr> </thead> <?php foreach ($awarenessItems as $data) { ?> <th><?php echo CHtml::encode($data->text); ?> :</th> <?php $sid = $data->id; $fv = FieldNames::values('awareness_level'); foreach ($fv as $fid => $attr) { $chk = isset($awarenessData[$sid]) ? $awarenessData[$sid] == $fid : false; echo '<td>'; echo CHtml::radioButton("AwarenessData[{$sid}]", $chk, array('id' => "AwarenessData_{$sid}_value_{$fid}", 'value' => $fid)); echo "</td>"; } ?> </tr> <?php } ?> </table>
$src = Yii::app()->request->baseUrl . $photo_path; list($width, $height) = getimagesize(".{$photo_path}"); $label = 'Upload Photo'; } $alt = $model->fname . "'s photo"; echo CHtml::image($src, $alt, array('width' => $width, 'height' => $height)); echo "<p>"; echo CHtml::link($label, array('photo', 'id' => $model->id)); echo "</p>"; foreach (array('sex', 'domicile_status', 'education', 'lang_pri', 'lang_lit', 'lang_edu', 'rite') as $field) { if ($model->{$field}) { $key = $field; if (preg_match('/^lang/', $field)) { $key = 'languages'; } $model->{$field} = FieldNames::value($key, $model->{$field}); } } ?> </div> <div class="fields"> <?php if ($model->profession or $model->occupation) { echo "<div>"; if ($model->profession) { echo "<span class='val'>" . $model->profession . "</span>"; if ($model->occupation) { echo " (<span class='val'>" . $model->occupation . "</span>)"; } } else { echo "<span class='val'>" . $model->occupation . "</span>";
<b><?php echo CHtml::encode($data->getAttributeLabel('visit_dt')); ?> :</b> <?php echo CHtml::encode($data->visit_dt); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('purpose')); ?> :</b> <?php echo CHtml::encode(FieldNames::value('visit_purpose', $data->purpose)); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('family_id')); ?> :</b> <?php echo CHtml::encode($data->family_id); ?> <br /> </div>
$sex = $data->sex ? strtolower(FieldNames::value('sex', $data->sex)) : 'generic'; $photo_path = "/images/member-photo-{$sex}.jpg"; } $src = Yii::app()->request->baseUrl . $photo_path; list($width, $height) = getimagesize(".{$photo_path}"); $width = $width * 120 / $height; $height = 120; $alt = $data->fname . "'s photo"; echo CHtml::image($src, $alt, array('width' => $width, 'height' => $height)); foreach (array('sex', 'domicile_status', 'education', 'lang_pri', 'lang_lit', 'lang_edu', 'rite') as $field) { if ($data->{$field}) { $key = $field; if (preg_match('/^lang/', $field)) { $key = 'languages'; } $data->{$field} = FieldNames::value($key, $data->{$field}); } } ?> </div> <div class="fields"> <span class="head"><?php echo CHtml::link($data->fullname() . ': #' . $data->id, array('/person/view', 'id' => $data->id)); ?> </span> <?php if ($data->profession or $data->occupation) { echo "<div>"; if ($data->profession) { $ttxt = $data->occupation ? " title='{$data->profession} ( {$data->occupation} )'" : "";
<div class="row"> <?php echo $form->label($model, 'bride_residence'); ?> <?php echo $form->textField($model, 'bride_residence', array('size' => 25, 'maxlength' => 25)); ?> </div> <div class="row"> <?php echo $form->label($model, 'marriage_type'); ?> <?php echo $form->dropDownList($model, 'marriage_type', FieldNames::values('marriage_type', $model->marriage_type), array('prompt' => '-- Select one --')); ?> </div> <div class="row"> <?php echo $form->label($model, 'banns_licence'); ?> <?php echo $form->dropDownList($model, 'banns_licence', array('banns' => 'Banns', 'licence' => 'Licence'), array('prompt' => '-- Select one --')); ?> </div> <div class="row"> <?php echo $form->label($model, 'minister');
# # Alive Parish - software to manage tomorrow's parish # Copyright (C) 2013 Redemptorist Media Center # # Alive Parish Software is free software: you can redistribute it # and/or modify it under the terms of the GNU General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # Alive Parish Software is distributed in the hope that it will # be useful, but WITHOUT ANY WARRANTY; without even the implied warranty # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # /* @var $this VisitController */ /* @var $model Visits */ $this->breadcrumbs = array('Visits' => array('index'), $model->id); $this->menu = array(array('label' => 'List Visits', 'url' => array('index')), array('label' => 'Create Visits', 'url' => array('create')), array('label' => 'Update Visits', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete Visits', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage Visits', 'url' => array('admin'))); ?> <h1>View Visits #<?php echo $model->id; ?> </h1> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('label' => 'Pastor', 'name' => 'pastor_id', 'value' => Pastors::model()->findByPk($model->pastor_id)->fullname), 'visit_dt', array('label' => 'Purpose', 'name' => 'purpose', 'value' => FieldNames::value('visit_purpose', $model->purpose))))); echo CHtml::link('View Family', array('/family/view', 'id' => $model->family_id));
$pdf->Cell(0, 0.7, sprintf("%-20s: %s", strtoupper($label), strtoupper($value)), 0, 1, 'L'); draw_line($pdf); } show_field($pdf, "Date of Marriage", $marriage->marriage_dt); show_field($pdf, "Name of Bridegroom", $marriage->groom_name); show_field($pdf, "DATE OF BIRTH/AGE", $marriage->groom_dob); show_field($pdf, "Groom Baptism Date", $marriage->groom_baptism_dt); show_field($pdf, "Status", FieldNames::value('marital_status', $marriage->groom_status)); show_field($pdf, "Rank or Profession", $marriage->groom_rank_prof); show_field($pdf, "Name of father", $marriage->groom_fathers_name); show_field($pdf, "name of mother", $marriage->groom_mothers_name); show_field($pdf, "residence", $marriage->groom_residence); show_field($pdf, "Name of Bride", $marriage->bride_name); show_field($pdf, "DATE OF BIRTH/AGE", $marriage->bride_dob); show_field($pdf, "Bride Baptism Date", $marriage->bride_baptism_dt); show_field($pdf, "Status", FieldNames::value('marital_status', $marriage->bride_status)); show_field($pdf, "Rank or Profession", $marriage->bride_rank_prof); show_field($pdf, "Name of father", $marriage->bride_fathers_name); show_field($pdf, "name of mother", $marriage->bride_mothers_name); show_field($pdf, "residence", $marriage->bride_residence); show_field($pdf, "by banns or licence", $marriage->banns_licence); show_field($pdf, "minister", $marriage->minister); show_field($pdf, "Witness 1", $marriage->witness1); show_field($pdf, "Witness 2", $marriage->witness2); show_field($pdf, 'Remarks', $marriage->remarks); draw_line($pdf); $pdf->SetFont("courier", "R", 9); $pdf->Cell(0, 1, '', 0, 1); $pdf->Cell(0, 0, 'I CERTIFY THAT THE ABOVE IS A TRUE COPY OF AN ENTRY IN THE REGISTER', 0, 1, 'C'); $pstr = strtoupper($parish->name . ", " . $parish->city); $pdf->Cell(0, 0, "OF MARRIAGES KEPT AT {$pstr}", 0, 1, 'C');
public function testCreateParishioner() { $this->loginAs('pastor', 'pastor'); $marriages = array(array('groom' => array('groom_name' => 'Luigi', 'groom_status' => 1, 'groom_rank_prof' => 'Engineer', 'groom_residence' => 'Bangalore'), 'bride' => array('bride_name' => 'Nicole', 'bride_status' => 1, 'bride_rank_prof' => 'Housewife', 'bride_residence' => 'Bangalore'), 'marriage_dt' => '15/12/2010', 'marriage_type' => 1, 'banns_licence' => 'banns', 'minister' => 'Fr. Marcion', 'witness1' => 'Sam Lopez', 'witness2' => 'Gregory Peron', 'remarks' => '')); foreach ($marriages as $marriage) { $this->open('marriageRecords/create'); $groom_details = $marriage['groom']; $this->click("css=#groom_search > img"); sleep(2); $this->type("id=key", $groom_details['groom_name']); $this->click('css=#find_match > input[name="yt0"]'); sleep(1); $this->click("id=yw0_c0_0"); sleep(1); $this->click("id=submitMatch"); sleep(1); foreach ($groom_details as $key => $value) { if ('groom_name' === $key) { continue; } if (preg_match('/^groom_status$/', $key)) { $this->select("name=MarriageRecord[{$key}]", "value={$value}"); } else { $this->type("name=MarriageRecord[{$key}]", $value); } } unset($marriage['groom']); $this->click('link=Bride Details'); $bride_details = $marriage['bride']; $this->click("css=#bride_search > img"); sleep(2); $this->type("id=key", $bride_details['bride_name']); $this->click('css=#find_match > input[name="yt0"]'); sleep(1); $this->click("id=yw0_c0_0"); sleep(1); $this->click("id=submitMatch"); sleep(1); foreach ($bride_details as $key => $value) { if ('bride_name' === $key) { continue; } if (preg_match('/^bride_status$/', $key)) { $this->select("name=MarriageRecord[{$key}]", "value={$value}"); } else { $this->type("name=MarriageRecord[{$key}]", $value); } } unset($marriage['bride']); foreach ($marriage as $key => $value) { if (preg_match('/^(?:marriage_type|banns_licence)$/', $key)) { $this->select("name=MarriageRecord[{$key}]", "value={$value}"); } else { $this->type("name=MarriageRecord[{$key}]", $value); } } $this->clickAndWait("//input[@value='Create']"); $this->spouse_test($groom_details); $this->spouse_test($bride_details); foreach ($marriage as $key => $value) { if ('banns_licence' == $key) { $value = ucfirst($value); } if (preg_match('/^(?:marriage_type)$/', $key)) { $this->assertTextPresent(FieldNames::value('marriage_type', $value)); } else { $this->assertTextPresent($value); } } $this->clickAndWait("//input[@value='Create Certificate']"); $this->spouse_test($groom_details); $this->spouse_test($bride_details); foreach ($marriage as $key => $value) { if ('banns_licence' == $key) { $value = ucfirst($value); } if (preg_match('/^(?:marriage_type)$/', $key)) { $this->assertTextPresent(FieldNames::value('marriage_type', $value)); } else { $this->assertTextPresent($value); } } $this->assertTextPresent(date('d/m/Y')); $this->assertElementPresent("link=Download Certificate"); } }
/** * Manages all models. */ public function actionAdmin() { $model = new MarriageRecord('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['MarriageRecord'])) { $model->attributes = $_GET['MarriageRecord']; } if (isset($_GET['export'])) { Yii::trace("MarriageRecords.admin: Export to Excel", 'application.controllers.MarriageRecordsController'); header("Content-Type: application/vnd.ms-excel; charset=utf-8"); header("Content-Disposition: inline; filename=\"marriages-report.xls\""); $dataProvider = $model->search(); $dataProvider->pagination = false; $fields = array('id', 'ref_no', 'groom_name', 'groom_dob', 'groom_baptism_dt', 'groom_status', 'groom_rank_prof', 'groom_fathers_name', 'groom_mothers_name', 'groom_residence', 'bride_name', 'bride_dob', 'bride_baptism_dt', 'bride_status', 'bride_rank_prof', 'bride_fathers_name', 'bride_mothers_name', 'bride_residence', 'marriage_dt', 'marriage_type', 'banns_licence', 'minister', 'witness1', 'witness2', 'groom_id', 'bride_id', 'remarks'); $labels = $model->attributeLabels(); $fval = array(); foreach ($fields as $field) { array_push($fval, $labels[$field]); } echo implode("\t", $fval) . "\n"; foreach ($dataProvider->data as $data) { $fval = array(); foreach ($fields as $field) { $val = 'marriage_type' == $field ? FieldNames::value('marriage_type', $data->{$field}) : $data->{$field}; array_push($fval, $val); } echo implode("\t", $fval) . "\n"; } Yii::app()->end(); } $this->render('admin', array('model' => $model)); }
# Alive Parish Software is distributed in the hope that it will # be useful, but WITHOUT ANY WARRANTY; without even the implied warranty # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ?> <table class="cellular"> <thead> <tr> <th rowspan="2">Satisfaction Item</th> <th colspan="<?php $fv = FieldNames::values('satisfaction_level'); echo count($fv); ?> ">Satisfaction Level Percentage (Count)</th> <th rowspan="2">Total</th> </tr> <tr> <?php foreach ($fv as $nv => $val) { echo '<th class="option">' . $val . '</th>'; } ?> </tr> </thead> <?php
<b><?php echo CHtml::encode($data->getAttributeLabel('ref_no')); ?> :</b> <?php echo CHtml::encode($data->ref_no); ?> , <b><?php echo CHtml::encode($data->getAttributeLabel('sex')); ?> :</b> <?php echo CHtml::encode(isset($data->sex) ? FieldNames::value('sex', $data->sex) : ''); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('name')); ?> :</b> <?php echo CHtml::encode($data->name); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('dob')); ?>
protected function _testMember($role, $member) { $this->assertTextPresent($role); $this->click("link={$role}"); $this->assertTextPresent($member['dob']); $this->assertTextPresent($member['baptism_dt']); if (isset($member['marriage_dt'])) { $this->assertTextPresent($member['marriage_dt']); } $url = $this->getLocation(); $this->clickAndWait("link=" . $member['fname'] . ' ' . $member['lname'] . ': #*'); foreach (array('mobile', 'profession', 'occupation', 'baptism_church', 'baptism_place', 'god_parents', 'cemetery_church') as $fld) { if (isset($member[$fld]) and $member[$fld]) { $this->assertTextPresent($member[$fld]); } } foreach (array('lang_pri', 'lang_lit', 'lang_edu') as $fld) { if (isset($member[$fld])) { $val = FieldNames::value('languages', $member[$fld]); $this->assertTextPresent($val); } } $this->open($url); }
<b><?php echo CHtml::encode($data->getAttributeLabel('bride_residence')); ?> :</b> <?php echo CHtml::encode($data->bride_residence); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('marriage_type')); ?> :</b> <?php echo CHtml::encode(FieldNames::value('marriage_type', $data->marriage_type)); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('banns_licence')); ?> :</b> <?php echo CHtml::encode($data->banns_licence); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('minister')); ?>
function format_mass($dt, $time, $lcode) { $s = date_format(new DateTime($time), 'g:ia'); $s .= ' ' . FieldNames::value('languages', $lcode); return $s; }
/** * 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 FieldNames the loaded model * @throws CHttpException */ public function loadModel($id) { $model = FieldNames::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
$pdf->AddPage(); $pdf->SetFont("times", "IU", 22); $pdf->Cell(0, 6, "", 0, 1); $pdf->Cell(0, 0, "Certificate", 0, 1, 'C'); $pdf->SetFont("times", "R", 16); $pdf->Cell(0, 2, "", 0, 1); $pdf->Cell(2, 0, '', 0, 0); $member = $model->member; function draw_line($pdf, $y = 20, $x1 = 8.5, $x2 = 16.0) { $pdf->Line($x1, $y - 0.2, $x2, $y - 0.2, array('width' => 0.01, 'dash' => 3)); } if ('child' == $member->role) { $rel = 'Male' === FieldNames::value('sex', $member->sex) ? 'son' : 'daughter'; $rel_name = $member->family->head_name; } elseif ('Female' == FieldNames::value('sex', $member->sex)) { $rel = 'wife'; $husband = $member->family->husband; $rel_name = $husband->fullname(); } if (isset($rel)) { $pdf->Cell(0, 1, " This is to certify that " . sprintf("%-40s", $member->fname . " " . $member->lname) . ", {$rel} of", 0, 1, 'L'); $pdf->Cell(2, 0, '', 0, 0); $pdf->Cell(0, 1, " of " . sprintf("%-40s", $rel_name) . " belongs to my Parish and", 0, 1, 'L'); draw_line($pdf, 11); $pdf->Cell(2, 0, '', 0, 0); $pdf->Cell(0, 0, " is regular to Church services.", 0, 1, 'L'); draw_line($pdf, 12, 4.3, 11.6); } else { $pdf->Cell(0, 1, " This is to certify that " . sprintf("%-40s", $member->fname . " " . $member->lname) . "", 0, 1, 'L'); draw_line($pdf, 11);
<?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => "groom_baptism_dt", 'options' => array('dateFormat' => Yii::app()->params['dateFmtDP'], 'yearRange' => '1900:c+10', 'changeYear' => true), 'htmlOptions' => array('size' => '10', 'maxlength' => '10'))); ?> <?php echo $form->error($model, 'groom_baptism_dt'); ?> </span> </div> <div class="row"> <span class="leftHalf"> <?php echo $form->labelEx($model, 'groom_status'); ?> <?php echo $form->dropDownList($model, 'groom_status', FieldNames::values('marital_status'), array('prompt' => '-- Select --')); ?> <?php echo $form->error($model, 'groom_status'); ?> </span> <span class="rightHalf"> <?php echo $form->labelEx($model, 'groom_rank_prof'); ?> <?php echo $form->textField($model, 'groom_rank_prof', array('size' => 25, 'maxlength' => 25)); ?> <?php echo $form->error($model, 'groom_rank_prof');
<?php echo $form->labelEx($model, 'visit_dt'); ?> <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => "visit_dt", 'options' => array('dateFormat' => Yii::app()->params['dateFmtDP'], 'yearRange' => 'c-10:c+10', 'changeYear' => true), 'htmlOptions' => array('size' => '10', 'maxlength' => '10'))); ?> <?php echo $form->error($model, 'visit_dt'); ?> </span> <span class="rightHalf"> <?php echo $form->labelEx($model, 'purpose'); ?> <?php echo $form->dropDownList($model, "purpose", FieldNames::values('visit_purpose'), array('prompt' => '--- Select ---')); ?> <?php echo $form->error($model, 'purpose'); ?> </span> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?> </div> <?php $this->endWidget();
public function actionMassBookings() { $model = new MassBooking(); if (isset($_POST['period'])) { $dt = $_POST['MassBooking']['mass_dt']; $dt = date('Y-m-d', CDateTimeParser::parse($dt, Yii::app()->locale->getDateFormat('short'))); header("Content-Type: application/vnd.ms-excel; charset=utf-8"); header("Content-Disposition: inline; filename=\"mass-bookings-report-{$dt}.xls\""); $period = $_POST['period']; $cond = "mass_dt BETWEEN '{$dt}' AND '{$dt}' + INTERVAL 1 {$period} ORDER BY mass_dt, mass.time, type"; Yii::trace("R.massBookings dt={$dt}, period={$period}, cond={$cond}", 'application.controllers.ReportController'); $crit = new CDbCriteria(); $crit->mergeWith(array('join' => 'INNER JOIN masses mass ON mass.id = t.mass_id', 'condition' => $cond)); $dataProvider = new CActiveDataProvider('MassBooking', array('criteria' => $crit)); $dataProvider->pagination = false; $fields = array('mass_dt', 'mass' => array('time', 'language'), 'type', 'intention', 'booked_by'); $labels = $model->attributeLabels(); $fval = array(); foreach ($fields as $key => $val) { if (!preg_match('/^\\d+$/', $key)) { foreach ($val as $field) { array_push($fval, ucfirst($field)); } } else { array_push($fval, $labels[$val]); } } echo implode("\t", $fval) . "\n"; $last_dt = ''; $last_mass = 0; $last_type = ''; foreach ($dataProvider->data as $data) { $fval = array(); $this_dt = $data->mass_dt; $this_mass = $data->mass_id; $this_type = $data->type; $same_mass = false; $same_type = false; if ($this_dt == $last_dt and $this_mass == $last_mass) { $same_mass = true; if ($this_type == $last_type) { $same_type = true; } } foreach ($fields as $key => $val) { if (!preg_match('/^\\d+$/', $key)) { foreach ($val as $field) { if ($same_mass) { $value = ''; } elseif ('language' == $field) { $value = FieldNames::value('languages', $data->{$key}->{$field}); } else { $value = $data->{$key}->{$field}; } array_push($fval, $value); } } else { if ($this_dt == $last_dt and 'mass_dt' == $val) { $value = ''; } elseif ($same_type and 'type' == $val) { $value = ''; } else { $value = $data->{$val}; } array_push($fval, $value); } } $last_dt = $this_dt; $last_mass = $this_mass; $last_type = $this_type; echo implode("\t", $fval) . "\n"; } Yii::app()->end(); return; } $this->render('mass-bookings', array('model' => $model)); }
if ($data->isRelevantDate) { $masses = $this->getMasses($data->date); $class = ""; $title = ""; if ($feast = $this->isSpecialMass($data->date)) { $class = "special"; $title = "title='{$feast}'"; } echo "<div class='mass {$class}'>"; echo "<div class='left'>"; foreach ($masses as $i => $mass) { if ($i == 5) { echo "</div><div class='right'>"; } $text = date_format(new DateTime($mass->time), 'g:ia') . ' ' . ' '; $lang = FieldNames::value('languages', $mass->language); $bookings = $this->getMassBookings($data->date, $mass->id); $ttip = null; foreach ($bookings as $bkg) { if (isset($ttip)) { $ttip .= ' ' . $bkg->type . ': ' . $bkg->intention; } else { $ttip = ' ' . $bkg->type . ': ' . $bkg->intention; } } if (isset($ttip)) { echo "<a class='mass booked' title='{$lang} {$ttip}' onclick='js:return confirm(" . '"Mass already booked. Still want to book?"' . ")' "; } else { echo "<a class='mass' title='{$lang}' "; } if ($data->date > new DateTime()) {
# Alive Parish - software to manage tomorrow's parish # Copyright (C) 2013 Redemptorist Media Center # # Alive Parish Software is free software: you can redistribute it # and/or modify it under the terms of the GNU General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # Alive Parish Software is distributed in the hope that it will # be useful, but WITHOUT ANY WARRANTY; without even the implied warranty # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # /* @var $this SatisfactionItemController */ /* @var $data SatisfactionItems */ ?> <b><?php echo CHtml::encode($data->text); ?> :</b> <?php $sid = $data->id; echo $form->dropDownList($model, "[SatisfactionData][{$sid}]value", FieldNames::values('satisfaction_level')); ?> <br />
echo $form->labelEx($model, 'marriage_status'); ?> <?php echo $form->dropDownList($model, 'marriage_status', FieldNames::values('marriage_status'), array('prompt' => '--- Select ---')); ?> <?php echo $form->error($model, 'marriage_status'); ?> </span> <span class="rightHalf"> <?php echo $form->labelEx($model, 'monthly_income'); ?> <?php echo $form->dropDownList($model, 'monthly_income', FieldNames::values('monthly_household_income'), array('prompt' => '--- Select ---')); ?> <?php echo $form->error($model, 'monthly_income'); ?> </span> </div> <?php /* if (!$model->isNewRecord): ?> <div class="row"> <span class="leftHalf"> <?php echo $form->labelEx($model,'disabled'); ?> <?php echo $form->dropDownList($model,'disabled',array(0=>'No',1=>'Yes')); ?> </span> <span class="rightHalf">
<div class="row"> <?php echo $form->label($model, 'name'); ?> <?php echo $form->textField($model, 'name', array('size' => 50, 'maxlength' => 50)); ?> </div> <div class="row"> <?php echo $form->label($model, 'sex'); ?> <?php echo $form->dropDownList($model, "sex", FieldNames::values('sex'), array('prompt' => '--- Select ---')); ?> </div> <div class="row"> <?php echo $form->label($model, 'fathers_name'); ?> <?php echo $form->textField($model, 'fathers_name', array('size' => 60, 'maxlength' => 75)); ?> </div> <div class="row"> <?php echo $form->label($model, 'mothers_name');
<?php echo $form->labelEx($model, "[{$person}]lang_edu"); ?> <?php echo $form->dropDownList($model, "[{$person}]lang_edu", FieldNames::values('languages')); ?> <?php echo $form->error($model, "[{$person}]lang_edu"); ?> </span> <span class="rightHalf"> <?php echo $form->labelEx($model, "[{$person}]rite"); ?> <?php echo $form->dropDownList($model, "[{$person}]rite", FieldNames::values('rite'), array('prompt' => '--- Select ---')); ?> <?php echo $form->error($model, "[{$person}]rite"); ?> </span> </div> <div class="row"> <span class="leftHalf"> <?php echo $form->labelEx($model, "[{$person}]baptism_dt"); ?> <?php $pstr = preg_replace('/\\]\\[/', '_', $person); $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => "[{$person}]baptism_dt", 'options' => array('dateFormat' => Yii::app()->params['dateFmtDP'], 'yearRange' => '1900:c+10', 'changeYear' => true, 'maxDate' => 0, 'beforeShowDay' => 'js:function(dt) {
<th>Language</th> <?php if (Yii::app()->user->checkAccess('MassSchedule.Delete')) { ?> <th style="width:30px">Del</th> <?php } ?> </thead> <?php foreach ($day_masses as $day => $masses) { $wday = FieldNames::value('weekdays', $day); $nm = count($masses); echo "<tr><th rowspan='{$nm}'>{$wday}</th>"; foreach ($masses as $i => $mass) { if ($i > 0) { echo "<tr>"; } echo "<td>" . CHtml::encode(date_format(new DateTime($mass['time']), 'g:i a')) . "</td><td>" . CHtml::encode(FieldNames::value('languages', $mass['language'])); if (Yii::app()->user->checkAccess('MassSchedule.Delete')) { echo "</td><td>" . CHtml::link(CHtml::image(Yii::app()->request->baseUrl . '/images/del.png', 'Del'), array('/massSchedule/delete', 'id' => $mass['id']), array('class' => 'del')); } echo "</td></tr>"; } } ?> </table>