Ejemplo n.º 1
0
 function printFieldInterface($name, $prefix = '')
 {
     if ($name == 'volunteer_group' && (empty($this->id) || $this->haveLock())) {
         $GLOBALS['system']->includeDBClass('person_group');
         $value = array_get($this->values, $name);
         Person_Group::printChooser($prefix . $name, $value, array(), null, '(None)');
     } else {
         parent::printFieldInterface($name, $prefix);
     }
 }
Ejemplo n.º 2
0
    static function printMultiChooser($name, $value, $exclude_groups = array(), $allow_category_select = FALSE)
    {
        ?>
		<table class="expandable">
		<?php 
        foreach ($value as $id) {
            ?>
			<tr>
				<td>
					<?php 
            Person_Group::printChooser($name . '[]', $id, $exclude_groups, $allow_category_select);
            ?>
				</td>
			</tr>
			<?php 
        }
        ?>
			<tr>
				<td>
					<?php 
        Person_Group::printChooser($name . '[]', 0, $exclude_groups, $allow_category_select);
        ?>
				</td>
			</tr>
		</table>
		<?php 
    }
			<input type="hidden" name="overwrite_membership" value="1" />
			<input type="hidden" name="back_to" value="persons" />

			<div class="modal-header">
				<h4>Add <?php 
    $person->printFieldValue('name');
    ?>
 to a group</h4>
			</div>
			<div class="modal-body">
				<?php 
    $GLOBALS['system']->includeDBClass('person_group');
    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();
    function printView()
    {
        switch ($this->_stage) {
            case 'begin':
                if (!$GLOBALS['system']->getDBObjectData('person_group')) {
                    print_message('You must create a group to import into before you can import persons.  See Groups > Add.');
                    return;
                }
                ?>
				<p>This page allows you to import persons, families and notes from a CSV file.</p>
				<p>The CSV file must be in a format like this <a href="<?php 
                echo BASE_URL;
                ?>
/resources/sample_import.csv">sample file</a>. <br />(The order of columns is flexible but the first row must be a header with these column names).</p>
				<p>A new person record will be created for each row in the file. </p>
				<p>A new family record will be created whenever a new row contains a change in family name or family details.  <br />However, changing to or from a blank value in a field does not create a new family unless the whole row is blank.</p>
				<p>All the imported persons will be added to the group you choose below.</p>
				<form method="post" enctype="multipart/form-data">
				<table>
					<tr>
						<td>Import File:</td>
						<td><input type="file" name="import" /></td>
					</tr>
					<tr>
						<td>Group:</td>
						<td><?php 
                Person_Group::printChooser('groupid', 0);
                ?>
</td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td class="compulsory"><input type="submit" class="btn" value="Go" /></td>
					</tr>
				</table>
				</form>
				<p>(You will be asked to confirm at the next step)</p>
				<?php 
                break;
            case 'confirm':
                $groupname = $GLOBALS['system']->getDBObject('person_group', $_SESSION['import']['groupid'])->toString();
                $GLOBALS['system']->includeDBClass('family');
                $this->_dummy_family = new Family();
                ?>
				<p>Please check the following is correct and click "confirm" at the bottom</p>
				<p><b><?php 
                echo $_SESSION['import']['total_families'];
                ?>
</b> families,<br />
				<b><?php 
                echo $_SESSION['import']['total_persons'];
                ?>
</b> persons and <br />
				<b><?php 
                echo $_SESSION['import']['total_notes'];
                ?>
</b> notes<br />
				will be created</p>
				<p>The new persons will be added to the <b><?php 
                echo $groupname;
                ?>
</b> group</p>

				<?php 
                foreach ($_SESSION['import']['families'] as $family) {
                    foreach ($family['members'] as $k => &$v) {
                        unset($v['note']);
                    }
                    ?>
					<h3><?php 
                    echo ents($family['family_name']);
                    ?>
 family</h3>
					<?php 
                    $this->_dummy_family->populate(0, $family);
                    $this->_dummy_family->printSummary(FALSE, $family['members']);
                }
                ?>
				<form class="stop-js" method="post"><input type="submit" name="confirm_import" value="Proceed with import" class="confirm-title btn" title="Proceed with import" />
				<a href="<?php 
                echo build_url(array());
                ?>
" class="btn">Cancel and start again</a>
				</form>
				<?php 
                break;
            case 'done':
                break;
        }
    }
Ejemplo n.º 5
0
        echo $verb;
        ?>
_group_source" value="existing" checked="checked"
							data-toggle="enable" data-target="#<?php 
        echo $verb;
        ?>
_existing_group *" />
					<b>an existing group:</b>
				</label>
				<div class="indent-left" id="<?php 
        echo $verb;
        ?>
_existing_group">
					<?php 
        $GLOBALS['system']->includeDBClass('person_group');
        Person_Group::printChooser('groupid', NULL);
        if ($verb == 'move') {
            ?>
						<input type="hidden" name="remove_from_groupid" value="<?php 
            echo $groupid;
            ?>
" />
						<?php 
        }
        ?>
					<input type="submit" class="btn " value="Go" data-set-form-action="<?php 
        echo BASE_URL;
        ?>
?view=_edit_group&action=add_members" />
				</div>
				</p>
    function printForm()
    {
        $dummy_person = new Person();
        $dummy_person->fields['congregationid']['allow_multiple'] = true;
        $dummy_person->fields['age_bracket']['allow_multiple'] = true;
        ?>
		<form method="get">
		<input type="hidden" name="view" value="<?php 
        echo ents($_REQUEST['view']);
        ?>
" />
		<table>
			<tr>
				<th>Opt-in group</th>
				<td><?php 
        Person_Group::printChooser('groupid', 0);
        ?>
</td>
			</tr>
			<tr>
				<th>Congregation</th>
				<td>Only include opted-in persons from<br />
				<?php 
        $dummy_person->printFieldInterface('congregationid');
        ?>
</td>
			</tr>
			<tr>
				<th>Age brackets</th>
				<td>Only show contact details for persons who are<br />
				<?php 
        $dummy_person->printFieldInterface('age_bracket');
        ?>
				</td>
			</tr>
			<tr>
				<th>Other family members</th>
				<td>For other members of the families of persons who opted in, show<br />
				<label class="radio">
					<input type="radio" name="all_member_details" value="0" checked="checked" id="all_member_details_0" />
					only their names
				</label>
				<label class="radio">
					<input type="radio" name="all_member_details" value="1" id="all_member_details_1" />
					their contact details, same as for opted-in persons
				</label>
			</tr>
			<tr>
					<th>Addresses</th>
					<td>
						<label class="checkbox">
							<input type="checkbox" name="include_address" />
							Include home addresses in results
						</label>
					</td>
			</tr>
			<tr>
				<th></th>
				<td><input type="submit" name="go" value="Go" /></td>
			</tr>
		</table>
		</form>
		<?php 
    }