예제 #1
0
    function printForm($prefix = '', $fields = NULL)
    {
        include_once 'include/size_detector.class.php';
        if ($GLOBALS['system']->featureEnabled('PHOTOS') && (is_null($fields) || in_array('photo', $fields))) {
            $this->fields['photo'] = array('divider_before' => true);
            // fake field for interface purposes
            if ($this->id && !SizeDetector::isNarrow()) {
                ?>
				<div class="person-photo-container">
					<img src="?call=photo&familyid=<?php 
                echo (int) $this->id;
                ?>
" />
				</div>
				<?php 
            }
        }
        parent::printForm($prefix, $fields);
        unset($this->fields['photo']);
    }
예제 #2
0
    function printForm($prefix = '', $fields = NULL)
    {
        include_once 'include/size_detector.class.php';
        if ($GLOBALS['system']->featureEnabled('PHOTOS') && (is_null($fields) || in_array('photo', $fields)) && !SizeDetector::isNarrow()) {
            $this->fields['photo'] = array('divider_before' => true);
            // fake field for interface purposes
            if ($this->id) {
                ?>
				<div class="person-photo-container">
					<img src="?call=photo&personid=<?php 
                echo (int) $this->id;
                ?>
" />
				</div>
				<?php 
            }
        }
        if (!$this->id) {
            unset($this->fields['familyid']);
        }
        parent::printForm($prefix, $fields);
        unset($this->fields['photo']);
        if (empty($fields) || in_array('custom', $fields)) {
            $customFields = $this->getCustomFields();
            $dummyField = new Custom_Field();
            if ($customFields) {
                ?>
				<hr />
				<div class="form-horizontal">
				<?php 
                foreach ($customFields as $fieldid => $fieldDetails) {
                    $dummyField->populate($fieldid, $fieldDetails);
                    $tableClass = $fieldDetails['allow_multiple'] ? 'expandable' : '';
                    $values = isset($this->_custom_values[$fieldid]) ? $this->_custom_values[$fieldid] : array('');
                    if ($fieldDetails['divider_before']) {
                        echo '<hr />';
                    }
                    ?>
					<div class="control-group">
						<?php 
                    if (strlen($fieldDetails['heading_before'])) {
                        ?>
								<h4><?php 
                        echo ents($fieldDetails['heading_before']);
                        ?>
</h4>
							<?php 
                    }
                    ?>

						<label class="control-label" for="custom_<?php 
                    echo $fieldid;
                    ?>
"><?php 
                    echo ents($fieldDetails['name']);
                    ?>
</label>
						<div class="controls">
							<table class="<?php 
                    echo $tableClass;
                    ?>
">
							<?php 
                    foreach ($values as $value) {
                        ?>
								<tr><td>
									<?php 
                        $dummyField->printWidget($value);
                        ?>
								</td></tr>
								<?php 
                    }
                    ?>
							</table>
						</div>
					</div>
					<?php 
                }
                ?>
				</div>
				<?php 
            }
        }
    }
    private function printForm()
    {
        $_SESSION['enter_attendance_token'] = md5(time());
        // STEP 2 - enter attendances
        ob_start();
        ?>
		<form method="post" class="attendance warn-unsaved" action="?view=attendance__record">
			<input type="hidden" name="attendance_date" value="<?php 
        echo $this->_attendance_date;
        ?>
" />
			<input type="hidden" name="show_photos" value="<?php 
        echo $this->_show_photos;
        ?>
" />
			<input type="hidden" name="parallel_mode" value="<?php 
        echo $this->_parallel_mode;
        ?>
" />
			<input type="hidden" name="enter_attendance_token" value="<?php 
        echo $_SESSION['enter_attendance_token'];
        ?>
" />
			<input type="hidden" name="attendances_submitted" value="1" />
			<?php 
        print_hidden_fields(array('cohortids' => $this->_cohortids, 'age_brackets' => $this->_age_brackets, 'statuses' => $this->_statuses));
        ?>

			<p class="visible-desktop smallprint">For greatest speed, press P for present and A for absent.  The cursor will automatically progress to the next person.  To go back, use the arrow keys.</p>

			<?php 
        if ($this->_parallel_mode && count($this->_cohortids) > 1 && !SizeDetector::isNarrow()) {
            $totalPrinted = $this->printFormParallel();
        } else {
            $totalPrinted = $this->printFormSequential();
        }
        ?>
		</form>
		<?php 
        if (ini_get('max_input_vars') && $totalPrinted > ini_get('max_input_vars')) {
            ob_end_clean();
            print_message(_("The parameters you have selected will list more persons ") . _("than your server can process.  Please narrow down your parameters, ") . _("or ask your server administrator to increase the PHP max_input_vars setting") . _(" (currently ") . ini_get('max_input_vars') . ')', 'error');
        } else {
            ob_flush();
        }
    }
예제 #4
0
function print_widget($name, $params, $value)
{
    $classes = array_get($params, 'class', '');
    if (!array_get($params, 'allow_empty', 1)) {
        $classes .= ' compulsory';
    }
    $attrs = array();
    foreach (array_get($params, 'attrs', array()) as $attr => $val) {
        $attrs[] = $attr . '="' . ents($val) . '"';
    }
    $attrs = implode(' ', $attrs);
    switch ($params['type']) {
        case 'phone':
            $lengths = get_valid_phone_number_lengths($params['formats']);
            $width = max(get_phone_format_lengths($params['formats']));
            ?>
			<input name="<?php 
            echo $name;
            ?>
" type="tel" size="<?php 
            echo $width;
            ?>
" value="<?php 
            echo format_phone_number($value, $params['formats']);
            ?>
" class="phone-number" validlengths="<?php 
            echo implode(',', $lengths);
            ?>
" <?php 
            echo $attrs;
            ?>
 />
			<?php 
            break;
        case 'bibleref':
            require_once 'bible_ref.class.php';
            $br = new bible_ref($value);
            $value = $br->toShortString();
            $params['class'] = 'bible-ref';
            // fall through
        // fall through
        case 'text':
        case 'email':
            $maxlength_exp = empty($params['maxlength']) ? '' : 'maxlength="' . $params['maxlength'] . '"';
            if (array_get($params, 'height', 1) > 1) {
                $cols_exp = empty($params['width']) ? '' : 'cols="' . $params['width'] . '"';
                ?>
				<textarea name="<?php 
                echo $name;
                ?>
" rows="<?php 
                echo $params['height'];
                ?>
" <?php 
                echo $cols_exp;
                ?>
 class="<?php 
                echo trim($classes);
                ?>
" <?php 
                echo $maxlength_exp;
                ?>
><?php 
                echo ents($value);
                ?>
</textarea>
				<?php 
            } else {
                $width_exp = empty($params['width']) ? '' : 'size="' . $params['width'] . '"';
                $regex_exp = empty($params['regex']) ? '' : 'regex="' . trim($params['regex'], '/ ') . '"';
                $autocomplete_exp = isset($params['autocomplete']) ? 'autocomplete=' . ($params['autocomplete'] ? 'on' : 'off') . '"' : '';
                ?>
				<input type="<?php 
                echo $params['type'];
                ?>
" name="<?php 
                echo $name;
                ?>
" value="<?php 
                echo ents($value);
                ?>
" class="<?php 
                echo trim($classes);
                ?>
" <?php 
                echo implode(' ', array($maxlength_exp, $width_exp, $regex_exp, $autocomplete_exp));
                ?>
 <?php 
                echo $attrs;
                ?>
 />
				<?php 
            }
            break;
        case 'html':
            static $includedCK = false;
            if (!$includedCK) {
                ?>
				<script src="<?php 
                echo BASE_URL . 'resources/ckeditor/ckeditor.js';
                ?>
"></script>
				<?php 
            }
            ?>
			<textarea class="ckeditor" name="<?php 
            echo $name;
            ?>
" <?php 
            echo $attrs;
            ?>
><?php 
            echo $value;
            ?>
</textarea>
			<?php 
            break;
        case 'int':
            $classes .= ' int-box';
            $width_exp = '';
            if (!empty($params['width'])) {
                $width_exp = 'size="' . $params['width'] . '" ';
            } else {
                $width_exp = 'size="3" ';
            }
            ?>
			<input type="text" name="<?php 
            echo $name;
            ?>
" value="<?php 
            echo $value;
            ?>
" class="<?php 
            echo trim($classes);
            ?>
" <?php 
            echo $width_exp;
            ?>
 <?php 
            echo $attrs;
            ?>
 />
			<?php 
            break;
        case 'select':
            $our_val = is_array($value) ? $value : ($value === '' ? array() : array("{$value}"));
            foreach ($our_val as $k => $v) {
                $our_val[$k] = "{$v}";
            }
            if (array_get($params, 'style', 'dropbox') == 'colour-buttons') {
                ?>
				<div class="radio-button-group <?php 
                echo array_get($params, 'class', '');
                ?>
" 
					 <?php 
                if (!SizeDetector::isNarrow()) {
                    echo ' tabindex="1"';
                }
                ?>
				>
				<input type="hidden" name="<?php 
                echo $name;
                ?>
" value="<?php 
                echo reset($our_val);
                ?>
" />
				<?php 
                foreach ($params['options'] as $k => $v) {
                    $classes = 'btn value-' . $k;
                    if (in_array("{$k}", $our_val, true)) {
                        $classes .= ' active';
                    }
                    ?>
					<div 
						class="<?php 
                    echo $classes;
                    ?>
" 
						title="<?php 
                    echo $v;
                    ?>
"
						data-val="<?php 
                    echo $k;
                    ?>
"
					>
						<?php 
                    echo strtoupper($v[0]);
                    ?>
					</div>
					<?php 
                }
                ?>
				</div>
				<?php 
            } else {
                if (array_get($params, 'allow_multiple')) {
                    $height = array_get($params, 'height', min(count($params['options']), 4));
                    if (substr($name, -2) != '[]') {
                        $name .= '[]';
                    }
                    $style = 'height: ' . $height * 1.8 . 'em';
                    $classes .= ' multi-select';
                    // the empty onclick below is to make labels work on iOS
                    // see http://stackoverflow.com/questions/5421659/html-label-command-doesnt-work-in-iphone-browser
                    ?>
				<div class="<?php 
                    echo $classes;
                    ?>
" style="<?php 
                    echo $style;
                    ?>
" tabindex="0" onclick="" <?php 
                    echo $attrs;
                    ?>
 >
					<?php 
                    foreach ($params['options'] as $k => $v) {
                        $checked_exp = in_array("{$k}", $our_val, true) ? ' checked="checked"' : '';
                        $disabled_exp = !empty($params['disabled_prefix']) && strpos($k, $params['disabled_prefix']) === 0 ? ' disabled="disabled" ' : '';
                        ?>
						<label class="checkbox" title="<?php 
                        echo ents($v);
                        ?>
">
							<input type="checkbox" name="<?php 
                        echo $name;
                        ?>
" value="<?php 
                        echo $k;
                        ?>
" <?php 
                        echo $checked_exp . $disabled_exp;
                        ?>
>
							<?php 
                        echo ents($v);
                        ?>
						</label>
						<?php 
                    }
                    ?>
				</div>
				<?php 
                } else {
                    ?>
				<select name="<?php 
                    echo $name;
                    ?>
" class="<?php 
                    echo $classes;
                    ?>
" <?php 
                    echo $attrs;
                    ?>
 >
					<?php 
                    if (array_get($params, 'allow_empty') && !array_get($params, 'allow_multiple')) {
                        ?>
						<option value=""><?php 
                        echo array_get($params, 'empty_text', '(None)');
                        ?>
</option>
						<?php 
                    }
                    foreach (array_get($params, 'options', array()) as $k => $v) {
                        $selected_exp = in_array("{$k}", $our_val, true) ? ' selected="selected"' : '';
                        $disabled_exp = !empty($params['disabled_prefix']) && strpos($k, $params['disabled_prefix']) === 0 ? ' disabled="disabled" ' : '';
                        ?>
						<option value="<?php 
                        echo $k;
                        ?>
"<?php 
                        echo $selected_exp . $disabled_exp;
                        ?>
><?php 
                        echo ents($v);
                        ?>
</option>
						<?php 
                    }
                    ?>
				</select>
				<?php 
                }
            }
            break;
        case 'date':
            $day_year_classes = trim($classes . ' int-box');
            if (FALSE === strpos($name, '[')) {
                $name_template = $name . '%s';
            } else {
                $name_template = substr($name, 0, strpos($name, '[')) . '%s' . substr($name, strpos($name, '['));
            }
            $months = array();
            if (array_get($params, 'allow_empty', false)) {
                $months[''] = '(Month)';
            }
            for ($i = 1; $i < 13; $i++) {
                $months[$i] = date(array_get($params, 'month_format', 'F'), strtotime("2007-{$i}-01"));
            }
            if (empty($value)) {
                $value = date('Y-m-d');
            }
            // blank dates not allowed
            list($year_val, $month_val, $day_val) = explode('-', substr($value, 0, 10));
            ?>
			<span class="nowrap" <?php 
            echo $attrs;
            ?>
 >
			<input type="text" name="<?php 
            printf($name_template, '_d');
            ?>
" class="day-box <?php 
            echo $day_year_classes;
            ?>
" size="2" maxlength="2" value="<?php 
            echo $day_val;
            ?>
" placeholder="DD" /><select name="<?php 
            printf($name_template, '_m');
            ?>
" class="month-box <?php 
            echo $classes;
            ?>
">
				<?php 
            foreach ($months as $i => $month_name) {
                $selected = $i == $month_val ? ' selected="selected"' : '';
                ?>
					<option value="<?php 
                echo $i;
                ?>
"<?php 
                echo $selected;
                ?>
><?php 
                echo $month_name;
                ?>
</option>
					<?php 
            }
            ?>
			</select><input type="text" name="<?php 
            printf($name_template, '_y');
            ?>
" class="year-box <?php 
            echo $day_year_classes;
            ?>
" size="4" maxlength="4" value="<?php 
            echo $year_val;
            ?>
" placeholder="YYYY"/>
			</span>
			<?php 
            break;
        case 'reference':
            if (!empty($params['references'])) {
                $where = array();
                if (!empty($params['filter']) && is_array($params['filter'])) {
                    $where = $params['filter'];
                }
                $where_logic = array_get($params, 'filter_logic', 'AND');
                $options = $GLOBALS['system']->getDBObjectData($params['references'], $where, $where_logic, array_get($params, 'order_by'));
                $dummy = new $params['references']();
                $our_val = is_array($value) ? $value : (empty($value) ? array() : array($value));
                if (!empty($params['filter']) && is_callable($params['filter'])) {
                    foreach ($options as $i => $o) {
                        $dummy->populate($i, $o);
                        if (!in_array($i, $our_val) && !$params['filter']($dummy)) {
                            unset($options[$i]);
                        }
                    }
                }
                $params['options'] = array();
                foreach ($options as $k => $details) {
                    $dummy->populate($k, $details);
                    $params['options'][$k] = $dummy->toString();
                }
                $params['type'] = 'select';
                print_widget($name, $params, $value);
            }
            break;
        case 'bitmask':
            $value = (int) $value;
            ?>
			<div class="bitmask-boxes">
			<?php 
            $percol = false;
            $cols = 3;
            require_once 'include/size_detector.class.php';
            if (SizeDetector::getWidth()) {
                if (SizeDetector::isNarrow()) {
                    $cols = 1;
                } else {
                    if (SizeDetector::isMedium()) {
                        $cols = 2;
                    }
                }
            }
            if ($cols > 1) {
                $percol = ceil(count($params['options']) / $cols);
                ?>
				<div class="bitmask-column" <?php 
                echo $attrs;
                ?>
 >
				<?php 
            }
            $i = 0;
            foreach ($params['options'] as $k => $v) {
                $checked_exp = ($value & (int) $k) == $k ? 'checked="checked"' : '';
                // the empty onclick below is to make labels work on iOS
                // see http://stackoverflow.com/questions/5421659/html-label-command-doesnt-work-in-iphone-browser
                ?>
				<label class="checkbox" onclick="">
					<input type="checkbox" name="<?php 
                echo ents($name);
                ?>
[]" value="<?php 
                echo ents($k);
                ?>
" <?php 
                echo $checked_exp;
                ?>
>
					<?php 
                echo nbsp(ents($v));
                ?>
				</label>
				<?php 
                if ($percol && ++$i % $percol == 0) {
                    ?>
					</div>
					<div>
					<?php 
                }
            }
            if ($percol) {
                ?>
				</div>
				<?php 
            }
            ?>
			</div>
			<?php 
            break;
    }
}
    public function printForm($prefix = 0)
    {
        if (empty($this->_persons)) {
            return 0;
        }
        $GLOBALS['system']->includeDBClass('person');
        $dummy = new Person();
        ?>
		<table class="table table-condensed table-auto-width valign-middle">
		<?php 
        $is_first = TRUE;
        foreach ($this->_persons as $personid => $details) {
            $dummy->populate($personid, $details);
            ?>
			<tr>
			<?php 
            if (!SizeDetector::isNarrow()) {
                ?>
				<td><?php 
                echo $personid;
                ?>
</td>
				<?php 
            }
            if ($this->show_photos) {
                ?>
				<td>
					<a class="med-popup" tabindex="-1" href="?view=persons&personid=<?php 
                echo $personid;
                ?>
">
						<img style="width: 50px; max-width: 50px" src="?call=photo&personid=<?php 
                echo (int) $personid;
                ?>
" />
					</a>
				</td>
				<?php 
            }
            ?>
				<td>
					<?php 
            echo ents($details['first_name'] . ' ' . $details['last_name']);
            ?>
				</td>
			<?php 
            if (!SizeDetector::isNarrow()) {
                ?>
				<td>
					<?php 
                if ($this->groupid) {
                    echo ents($details['membership_status']);
                } else {
                    $dummy->printFieldValue('status');
                }
                ?>
				</td>
				<?php 
            }
            ?>
				<td class="narrow">
					<?php 
            $this->printWidget($prefix, $personid);
            ?>
				</td>
			<?php 
            if (!SizeDetector::isNarrow()) {
                ?>
				<td class="action-cell narrow">
					<a class="med-popup" tabindex="-1" href="?view=persons&personid=<?php 
                echo $personid;
                ?>
"><i class="icon-user"></i>View</a> &nbsp;
					<a class="med-popup" tabindex="-1" href="?view=_edit_person&personid=<?php 
                echo $personid;
                ?>
"><i class="icon-wrench"></i>Edit</a> &nbsp;
					<a class="med-popup" tabindex="-1" href="?view=_add_note_to_person&personid=<?php 
                echo $personid;
                ?>
"><i class="icon-pencil"></i>Add Note</a>
				</td>
				<?php 
            }
            ?>
			</tr>
			<?php 
            $is_first = FALSE;
        }
        ?>
		</table>
		<?php 
        return count($this->_persons);
    }
    function printForm()
    {
        $GLOBALS['system']->includeDBClass('person');
        $person = new Person();
        $person->fields['first_name']['width'] = 11;
        $person->fields['last_name']['width'] = 11;
        $person->fields['email']['width'] = 25;
        ?>
		<form method="post" id="add-family" class="form-horizontal">
			<input type="hidden" name="new_family_submitted" value="1" />
			<div class="">

			<label>Family Name:</label>
			<?php 
        $this->_family->printFieldInterface('family_name');
        ?>
			
			</div>

			<div>
			<h3>Family Members</h3>
			<table class="expandable">
			<?php 
        include_once 'include/size_detector.class.php';
        if (SizeDetector::isNarrow()) {
            ?>
				<tr>
					<td>
						<div class="compact-2col family-member-box">
							<label>First Name</label>
							<label>Last Name</label>
							<div><?php 
            $person->printFieldInterface('first_name', 'members_0_');
            ?>
</div>
							<div class="last_name preserve-value"><?php 
            $person->printFieldInterface('last_name', 'members_0_');
            ?>
</div>

							<label>Gender</label>
							<label>Age</label>
							<div><?php 
            $person->printFieldInterface('gender', 'members_0_');
            ?>
</div>
							<div><?php 
            $person->printFieldInterface('age_bracket', 'members_0_');
            ?>
</div>

							<label>Status</label>
							<label>Congregation</label>
							<div class="person-status preserve-value"><?php 
            $person->printFieldInterface('status', 'members_0_');
            ?>
</div>
							<div class="congregation"><?php 
            $person->printFieldInterface('congregationid', 'members_0_');
            ?>
</div>

							<label>Mobile</label>
							<label>Email</label>
							<div><?php 
            $person->printFieldInterface('mobile_tel', 'members_0_');
            ?>
</div>
							<div><?php 
            $person->printFieldInterface('email', 'members_0_');
            ?>
</div>

						</div>



					</td>
				</tr>
				<?php 
        } else {
            ?>
				<thead>
					<tr>
						<td>First Name</td>
						<td>Last Name</td>
						<td>Gender</td>
						<td>Age</td>
						<td>Status</td>
						<td>Cong.</td>
						<td>Mobile Tel</td>
						<td>Email</td>
					</tr>
				<thead>
				<tbody>
					<tr>
						<td><?php 
            $person->printFieldInterface('first_name', 'members_0_');
            ?>
</td>
						<td class="last_name preserve-value"><?php 
            $person->printFieldInterface('last_name', 'members_0_');
            ?>
</td>
						<td><?php 
            $person->printFieldInterface('gender', 'members_0_');
            ?>
</td>
						<td><?php 
            $person->printFieldInterface('age_bracket', 'members_0_');
            ?>
</td>
						<td class="person-status preserve-value"><?php 
            $person->printFieldInterface('status', 'members_0_');
            ?>
</td>
						<td class="congregation preserve-value"><?php 
            $person->printFieldInterface('congregationid', 'members_0_');
            ?>
</td>
						<td><?php 
            $person->printFieldInterface('mobile_tel', 'members_0_');
            ?>
</td>
						<td><?php 
            $person->printFieldInterface('email', 'members_0_');
            ?>
</td>
					</tr>
				</tbody>
				<?php 
        }
        ?>
			</table>
			</div>

			<h3>Family Details <small>(optional)</small></h3>
			<?php 
        $this->_family->fields['family_name']['readonly'] = 1;
        $this->_family->printForm();
        $this->_family->fields['family_name']['readonly'] = 0;
        ?>

		<?php 
        if ($GLOBALS['user_system']->havePerm(PERM_EDITNOTE)) {
            ?>
			<div <?php 
            echo REQUIRE_INITIAL_NOTE ? '' : 'class="optional"';
            ?>
>
			<h3>Initial Note <small>(<?php 
            echo REQUIRE_INITIAL_NOTE ? 'required' : 'optional';
            ?>
)</small></h3>
			<?php 
            $GLOBALS['system']->includeDBClass('family_note');
            $note = new Family_Note();
            $note->printForm('initial_note_');
            ?>
			</div>
			<?php 
        }
        if ($plan_chooser = Action_Plan::getMultiChooser('execute_plan', 'create_family')) {
            ?>
			<h3>Action plans <small>(optional)</small></h3>
			<p>Execute the following action plans for the new family: </p>
			<div class="indent-left">
				<?php 
            echo $plan_chooser;
            ?>
				<p>Reference date for plans: <?php 
            print_widget('plan_reference_date', array('type' => 'date'), NULL);
            ?>
</p>
			</div>
			<?php 
        }
        ?>
		<h3>Create</h3>
			<div class="align-right">
				<input type="submit" class="btn" value="Create Family" />
				<input type="button" class="back btn" value="Cancel" />
			</div>
		</form>
		<?php 
    }
예제 #7
0
    function _printSummaryRows()
    {
        parent::_printSummaryRows();
        include_once 'include/size_detector.class.php';
        if (SizeDetector::isNarrow()) {
            ?>
			<tr class="divider-before">
				<td colspan="2" id="family-members-container">
				<h4>&nbsp;Members:</h4>
			<?php 
        } else {
            ?>
			<tr class="divider-before">
				<th>Members</th>
				<td id="family-members-container">
			<?php 
        }
        $persons = $this->getMemberData();
        $show_actions = !empty($this->id);
        // hide actions if this is a "draft" family
        if (isset($this->_tmp['show_member_callback'])) {
            call_user_func($this->_tmp['show_member_callback'], $persons);
        } else {
            if (empty($this->_tmp['abbreviate_member_list'])) {
                ?>
					<div style="float: left" id="member-details-container">
					<?php 
                // full blown version
                $special_fields = array('congregation');
                if (!empty($this->_tmp['member_list_special_fields'])) {
                    $special_fields = $this->_tmp['member_list_special_fields'];
                }
                include 'templates/person_list.template.php';
                ?>
					</div>
					<?php 
                if ($GLOBALS['system']->featureEnabled('PHOTOS') && $this->id) {
                    ?>
						<div style="float: left; " id="family-photos-container">
						<?php 
                    foreach ($persons as $personid => $details) {
                        ?>
							<a href="?view=persons&personid=<?php 
                        echo (int) $personid;
                        ?>
"><img title="<?php 
                        echo ents($details['first_name'] . ' ' . $details['last_name']);
                        ?>
" src="?call=person_photo&personid=<?php 
                        echo (int) $personid;
                        ?>
" /></a>
							<?php 
                    }
                    ?>
						</div>
						<?php 
                }
            } else {
                // abbreviated version
                $GLOBALS['system']->includeDBClass('person');
                $dummy_person = new Person();
                ?>
					<table>
					<?php 
                foreach ($persons as $id => $person) {
                    $dummy_person->populate($id, $person);
                    $tr_class = $person['status'] == 'archived' ? ' class="archived"' : '';
                    ?>
						<tr<?php 
                    echo $tr_class;
                    ?>
>
							<td class="nowrap"><a href="?view=persons&personid=<?php 
                    echo $id;
                    ?>
"><?php 
                    echo ents($dummy_person->toString());
                    ?>
</a></td>
							<td><?php 
                    $dummy_person->printFieldValue('gender');
                    ?>
</td>
							<td><?php 
                    $dummy_person->printFieldValue('age_bracket');
                    ?>
</td>
						</tr>
						<?php 
                }
                ?>
					</table>
					<?php 
            }
        }
        ?>
			</td>
		</tr>
		<?php 
    }
    echo 'Add as a ';
    Person_Group::printMembershipStatusChooser('membership_status');
    echo ' of ';
    $can_add_group = Person_Group::printChooser('groupid', 0, array_keys($groups));
    ?>
			</div>
			<div class="modal-footer">
				<input type="submit" class="btn" value="Go" accesskey="s" onclick="if (!$('[name=groupid]').val()) { alert('Choose a group first'); return false; }" />
				<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
			</div>
		</form>
	</div>
	<?php 
}
// -------- CHECK PERMISSIONS AND ASSEMBLE DATA ------------- //
$accordion = SizeDetector::getWidth() && SizeDetector::isNarrow();
$tabs = array('basic' => 'Basic Details');
if ($GLOBALS['user_system']->havePerm(PERM_VIEWNOTE)) {
    $notes = $person->getNotesHistory();
    $tabs['notes'] = 'Notes (' . count($notes) . ')';
}
if ($can_add_group || count($groups) > 1) {
    $tabs['groups'] = 'Groups (' . count($groups) . ')';
}
if ($GLOBALS['user_system']->havePerm(PERM_VIEWATTENDANCE)) {
    $tabs['attendance'] = 'Attendance';
}
if ($GLOBALS['user_system']->havePerm(PERM_VIEWROSTER)) {
    $tabs['rosters'] = 'Rosters';
}
if (!$accordion && ($GLOBALS['user_system']->havePerm(PERM_VIEWNOTE) || !$GLOBALS['system']->featureEnabled('NOTES'))) {
예제 #9
0
    ?>
>
		<td><?php 
    echo (int) $id;
    ?>
</td>
		<td><?php 
    echo ents($details['family_name']);
    ?>
</td>
		<td><?php 
    echo ents($details['members']);
    ?>
</td>
	<?php 
    if (!SizeDetector::isNarrow()) {
        ?>
		<td><?php 
        echo ents($details['home_tel']);
        ?>
</td>
		<?php 
    }
    ?>
		<td class="action-cell narrow">
			<a href="?view=families&familyid=<?php 
    echo $id;
    ?>
"><i class="icon-user"></i>View</a> &nbsp;
		<?php 
    if ($GLOBALS['user_system']->havePerm(PERM_EDITPERSON)) {
    function printForm($prefix = 0)
    {
        require_once 'include/size_detector.class.php';
        $order = defined('ATTENDANCE_LIST_ORDER') ? constant('ATTENDANCE_LIST_ORDER') : self::LIST_ORDER_DEFAULT;
        if ($this->congregationid) {
            $conds = array('congregationid' => $this->congregationid, '!status' => 'archived');
            if (strlen($this->age_bracket)) {
                $conds['age_bracket'] = $this->age_bracket;
            }
            $members = $GLOBALS['system']->getDBObjectData('person', $conds, 'AND', $order);
        } else {
            $group =& $GLOBALS['system']->getDBObject('person_group', $this->groupid);
            $members =& $group->getMembers(FALSE, $order);
            if (strlen($this->age_bracket)) {
                // Not the most efficient but it's a problem when it's a problem
                foreach ($members as $i => $person) {
                    if ($person['age_bracket'] != $this->age_bracket) {
                        unset($members[$i]);
                    }
                }
            }
        }
        $GLOBALS['system']->includeDBClass('person');
        $dummy = new Person();
        ?>
		<table class="table table-condensed table-auto-width valign-middle">
		<?php 
        $is_first = TRUE;
        foreach ($members as $personid => $details) {
            $v = isset($this->_attendance_records[$personid]) ? $this->_attendance_records[$personid] ? 'present' : 'absent' : (empty($this->_attendance_records) ? '' : 'unknown');
            $dummy->populate($personid, $details);
            ?>
			<tr>
			<?php 
            if (!SizeDetector::isNarrow()) {
                ?>
				<td><?php 
                echo $personid;
                ?>
</td>
				<?php 
            }
            if ($this->show_photos) {
                ?>
				<td>
					<img style="width: 50px; max-width: 50px" src="?call=person_photo&personid=<?php 
                echo (int) $personid;
                ?>
" />
				</td>
				<?php 
            }
            ?>
				<td><?php 
            echo ents($details['last_name']);
            ?>
</td>
				<td><?php 
            echo ents($details['first_name']);
            ?>
</td>
			<?php 
            if (!SizeDetector::isNarrow()) {
                ?>
				<td>
					<?php 
                if ($this->groupid) {
                    echo ents($details['membership_status']);
                } else {
                    $dummy->printFieldValue('status');
                }
                ?>
				</td>
				<?php 
            }
            ?>
				<td class="narrow">
					<?php 
            print_widget('attendances[' . $prefix . '][' . $personid . ']', array('options' => array('unknown' => '?', 'present' => 'Present', 'absent' => 'Absent'), 'type' => 'select', 'style' => 'colour-buttons', 'class' => $is_first ? 'autofocus' : ''), $v);
            ?>
				</td>
			<?php 
            if (!SizeDetector::isNarrow()) {
                ?>
				<td class="action-cell narrow">
					<a class="med-popup" tabindex="-1" href="?view=persons&personid=<?php 
                echo $personid;
                ?>
"><i class="icon-user"></i>View</a> &nbsp;
					<a class="med-popup" tabindex="-1" href="?view=_edit_person&personid=<?php 
                echo $personid;
                ?>
"><i class="icon-wrench"></i>Edit</a> &nbsp;
					<a class="med-popup" tabindex="-1" href="?view=_add_note_to_person&personid=<?php 
                echo $personid;
                ?>
"><i class="icon-pencil"></i>Add Note</a>
				</td>
				<?php 
            }
            ?>
			</tr>
			<?php 
            $is_first = FALSE;
        }
        ?>
		</table>
		<?php 
        return count($members);
    }