function printView()
    {
        ?>
		<form method="post" class="form-horizontal">
			<input type="hidden" name="new_note_submitted" value="1" />
			<input type="hidden" name="familyid" value="<?php 
        echo ents($_REQUEST['familyid']);
        ?>
" />
			<h3><?php 
        echo _('New Note Details');
        ?>
</h3>
			<?php 
        $this->_note->printForm();
        ?>
			<div class="controls">
				<button type="submit" class="btn"><?php 
        _('Add Note to Family');
        ?>
</button>
				<a class="btn" href="<?php 
        echo build_url(array('view' => 'families', 'familyid' => $this->_family->id));
        ?>
">Cancel</a>
		</form>
		<?php 
    }
    function printView()
    {
        if ($this->_roster_view) {
            $this->_roster_view->printView(NULL, NULL, FALSE, TRUE);
        } else {
            ?>
			<ul>
			<?php 
            $views = $GLOBALS['system']->getDBObjectData('roster_view', array('is_public' => TRUE), 'AND', 'name');
            foreach ($views as $id => $detail) {
                ?>
				<li><a href="<?php 
                echo build_url(array('roster_view' => $id));
                ?>
"><?php 
                echo ents($detail['name']);
                ?>
</a></li>
				<?php 
            }
            ?>
			</ul>
			<?php 
        }
    }
    function printView()
    {
        $GLOBALS['system']->includeDBClass('person');
        $stats = Person::getStatusStats();
        ?>
		<table class="table table-auto table-striped table-bordered">
		<?php 
        foreach ($stats as $status_name => $count) {
            ?>
			<tr>
				<th><?php 
            echo ents($status_name);
            ?>
</th>
				<td><?php 
            echo (int) $count;
            ?>
</td>
			</tr>
			<?php 
        }
        ?>
		</table>
		<?php 
    }
    function printView()
    {
        if ($this->_roster_view) {
            $end_date = NULL;
            if (!empty($_REQUEST['weeks'])) {
                $end_date = date('Y-m-d', strtotime('+' . ((int) $_REQUEST['weeks'] * 7 + 1) . ' days'));
            }
            $this->_roster_view->printView(NULL, $end_date, FALSE, TRUE);
        } else {
            ?>
			<ul>
			<?php 
            $views = $GLOBALS['system']->getDBObjectData('roster_view', array('is_public' => TRUE), 'AND', 'name');
            foreach ($views as $id => $detail) {
                ?>
				<li><a href="<?php 
                echo build_url(array('roster_view' => $id));
                ?>
"><?php 
                echo ents($detail['name']);
                ?>
</a></li>
				<?php 
            }
            ?>
			</ul>
			<?php 
        }
    }
    function run()
    {
        $results = array();
        if (!empty($_REQUEST['search'])) {
            $name = $_REQUEST['search'];
            $results = $GLOBALS['system']->getDBObjectData('family', array('family_name' => '%' . $_REQUEST['search'] . '%'));
            header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
            // Date in the past
            header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
            // always modified
            header("Cache-Control: no-cache, must-revalidate");
            // HTTP/1.1
            header("Pragma: no-cache");
            // HTTP/1.0
            //header ("Content-Type: application/json");
            echo "{\"results\": [";
            $arr = array();
            $GLOBALS['system']->includeDBClass('family');
            foreach ($results as $i => $details) {
                $arr[] = '
					{
						id: ' . $i . ',
						value: "' . addcslashes(ents($details['family_name']), '"') . '",
						info: "' . addcslashes(ents($details['members']), '"') . '"
					}
				';
            }
            echo implode(", ", $arr);
            echo "]}";
        }
    }
    function printView()
    {
        ?>
		<form method="post" id="add-family">
			<input type="hidden" name="new_person_submitted" value="1" />
			<input type="hidden" name="familyid" value="<?php 
        echo ents($_REQUEST['familyid']);
        ?>
" />
			<h3>New Person Details</h3>
			<?php 
        $this->_person->printForm();
        if ($chooser = Action_Plan::getMultiChooser('execute_plan', 'add_person')) {
            ?>
				<h3>Action Plans</h3>
				<p>Execute the following action plans for the new person:</p>
				<?php 
            echo $chooser;
            ?>
				<p>Reference date for plans: <?php 
            print_widget('plan_reference_date', array('type' => 'date'), NULL);
            ?>
</p>
				<?php 
        }
        ?>
			<button type="submit" class="btn">Add Family Member</button>
			<a href="<?php 
        echo build_url(array('view' => 'families'));
        ?>
" class="btn">Cancel</a>
		</form>
		<?php 
    }
    function printView()
    {
        if ($this->_roster_view) {
            $end_date = NULL;
            if (!empty($_REQUEST['weeks'])) {
                $end_date = date('Y-m-d', strtotime('+' . ((int) $_REQUEST['weeks'] * 7 + 1) . ' days'));
            }
            $this->_roster_view->printView(NULL, $end_date, FALSE, TRUE);
        } else {
            if (defined('PUBLIC_ROSTER_SECRET') && strlen(PUBLIC_ROSTER_SECRET) && array_get($_REQUEST, 'secret') != PUBLIC_ROSTER_SECRET) {
                print_message("Please contact your church administrator to get the private URLs for viewing rosters");
                exit;
            } else {
                ?>
			<ul>
			<?php 
                $views = $GLOBALS['system']->getDBObjectData('roster_view', array('is_public' => TRUE), 'AND', 'name');
                foreach ($views as $id => $detail) {
                    ?>
				<li><a href="<?php 
                    echo build_url(array('roster_view' => $id));
                    ?>
"><?php 
                    echo ents($detail['name']);
                    ?>
</a></li>
				<?php 
                }
                ?>
			</ul>
			<?php 
            }
        }
    }
    function _printResults()
    {
        if (empty($this->_congregations)) {
            return;
        }
        $GLOBALS['system']->includeDBClass('attendance_record_set');
        $stats = Attendance_Record_Set::getCongregationalAttendanceStats($this->_start_date, $this->_end_date, $this->_congregations);
        $GLOBALS['system']->includeDBClass('person');
        $dummy_person = new Person();
        $status_map = $dummy_person->getStatusOptions();
        ?>

		<table class="table table-bordered table-auto-width">

		<?php 
        foreach ($status_map as $k => $v) {
            if (isset($stats[$k])) {
                ?>
				<tr>
					<th><?php 
                echo ents($v);
                ?>
</th>
					<td style="width: 5ex"><?php 
                echo $stats[$k];
                ?>
%</td>
				</tr>
				<?php 
            }
        }
        ?>
		</table>
		<?php 
    }
    /**
     * Execute this call
     *
     * @return void
     * @access public
     */
    function run()
    {
        $service = $GLOBALS['system']->getDBObject('service', (int) $_REQUEST['serviceid']);
        ?>
		<html>
			<head>
				<style media="print">
					html body * {
						color: black;
						text-decoration: none;
					}
				</style>
				<style>
					* {
						font-family: sans-serif;
					}
					td, th {
						padding: 5px 10px;
						vertical-align: top;
					}
					th {
						background-color: #555;
						color: white;
					}
					th * {
						color: white !important;
					}
					table {
						border-collapse: collapse;
					}
					h3 {
						text-transform: uppercase;
						text-align: center;
						color: #888;
					}
					small {
						font-style: italic;
					}
					p, small {
						margin: 10px 0;
					}
					h4 {
						margin: 20px 0 10px 0;
					}
				</style>
			</head>
			<body>
				<h1><?php 
        echo ents($service->toString());
        ?>
</h1>
				<?php 
        $service->printServiceContent();
        ?>
			</body>
		</html>
		<?php 
    }
    function _printCategories($parent = 0, $indent = 0)
    {
        $this_level = array();
        foreach ($this->_all_categories as $id => $details) {
            if ($details['parent_category'] == $parent) {
                $this_level[$id] = $details;
            }
        }
        if (!empty($this_level)) {
            foreach ($this_level as $id => $details) {
                ?>
				<tr>
					<td style="padding-left: <?php 
                echo 10 + $indent * 30;
                ?>
px"><a href="?view=groups__list_all#cat<?php 
                echo $id;
                ?>
"><?php 
                echo ents($details['name']);
                ?>
</a></td>
					<td class="action-cell narrow">
						<form class="min" style="clear: both" method="post" onsubmit="return confirm('<?php 
                echo _('Are you sure you want to delete this category?');
                ?>
')">
							<a href="?view=_edit_group_category&categoryid=<?php 
                echo (int) $id;
                ?>
"><i class="icon-wrench"></i><?php 
                echo _('Edit');
                ?>
</a>
							<input type="hidden" name="delete_category_id" value="<?php 
                echo $id;
                ?>
" />
							<button type="submit" class="btn-link"><i class="icon-trash"></i><?php 
                echo _('Delete');
                ?>
</button>
						</form>
					</td>
				</tr>
				<?php 
                $this->_printCategories($id, $indent + 1);
            }
        }
    }
    function printView()
    {
        if ($this->_role) {
            echo $this->_role->getValue('details');
        } else {
            foreach ($GLOBALS['system']->getDBObjectdata('congregation', array('!meeting_time' => ''), 'AND', 'meeting_time') as $congid => $cong_details) {
                ?>
				<h3><?php 
                echo ents($cong_details['name']);
                ?>
</h3>
				<ul>
				<?php 
                $roles = $GLOBALS['system']->getDBObjectData('roster_role', array('!details' => '', 'congregationid' => $congid), 'AND', 'title');
                foreach ($roles as $id => $detail) {
                    ?>
					<li><a href="<?php 
                    echo build_url(array('role' => $id));
                    ?>
"><?php 
                    echo ents($detail['title']);
                    ?>
</a></li>
					<?php 
                }
                ?>
				</ul>
			<?php 
            }
            ?>
		<h3>Non-Congregational</h3>
                <ul>
                        <?php 
            $roles = $GLOBALS['system']->getDBObjectData('roster_role', array('!details' => '', 'congregationid' => 0), 'AND', 'title');
            foreach ($roles as $id => $detail) {
                ?>
                                <li><a href="<?php 
                echo build_url(array('role' => $id));
                ?>
"><?php 
                echo ents($detail['title']);
                ?>
</a></li>
                                <?php 
            }
            ?>
                </ul>
		<?php 
        }
    }
    function printView()
    {
        ?>
		<div class="container row-fluid margin-bottom">
			<div class="span10">
				<p><i>A roster view is a collection of roster roles, used when setting or displaying roster assignments.<br />You might like to create views such as "morning congregation" or "all preachers".<br />A roster role can belong to several roster views.</i></p>
			</div>
			<div class="span2 align-right">
				<a href="?view=_add_roster_view"><i class="icon-plus-sign"></i>Add View</a>
			</div>
		</div>
		<table class="table">
			<thead>
				<tr>
					<th class="nowrap">View name</th>
					<th>Roles</th>
					<th>&nbsp;</th>
				</tr>
			</thead>
		<?php 
        $views = $GLOBALS['system']->getDBObjectData('roster_view', array(), 'OR', 'name');
        foreach ($views as $id => $details) {
            ?>
			<tr>
				<td class="nowrap"><?php 
            echo ents($details['name']);
            ?>
</td>
				<td><?php 
            echo ents($details['members']);
            ?>
</td>
				<td class="nowrap">
					<a href="?view=_edit_roster_view&roster_viewid=<?php 
            echo $id;
            ?>
"><i class="icon-wrench"></i>Edit</a> &nbsp;
					<a href="<?php 
            echo build_url(array('delete_viewid' => $id));
            ?>
"><i class="icon-trash"></i>Delete</a>
				</td>
			</tr>
			<?php 
        }
        ?>
		</table>
	<?php 
    }
Exemplo n.º 13
0
 public function run()
 {
     if (!empty($_REQUEST['call'])) {
         $call_name = str_replace('/', '', $_REQUEST['call']);
         // Try both the Jethro and system_root calls folders
         $filename = dirname(dirname(__FILE__)) . '/calls/call_' . $call_name . '.class.php';
         if (!file_exists($filename)) {
             $filename = $this->_base_dir . '/calls/call_' . $call_name . '.class.php';
         }
         if (file_exists($filename)) {
             include_once dirname(__FILE__) . '/call.class.php';
             include_once $filename;
             $classname = 'Call_' . $call_name;
             $call_obj = new $classname();
             $call_obj->run();
         } else {
             trigger_error('Unknown call ' . ents($_REQUEST['call']), E_USER_WARNING);
         }
     } else {
         $this->initErrorHandler();
         $raw_view_name = array_get($_REQUEST, 'view', 'home');
         $bits = explode('__', $raw_view_name);
         $view_filename = null;
         if (count($bits) > 1) {
             if (!empty($_SESSION['views'][$this->_base_dir][$bits[0]]['children'][$bits[1]])) {
                 $view_filename = $_SESSION['views'][$this->_base_dir][$bits[0]]['children'][$bits[1]]['filename'];
                 $view_classname = 'View_' . $bits[0] . '__' . $bits[1];
             }
         } else {
             if (isset($_SESSION['views'][$this->_base_dir][$bits[0]])) {
                 $view_filename = $_SESSION['views'][$this->_base_dir][$bits[0]]['filename'];
                 $view_classname = 'View_' . $bits[0];
             }
         }
         if (!is_null($view_filename)) {
             require_once $this->_base_dir . '/views/' . $view_filename;
             $view_perm = call_user_func(array($view_classname, 'getMenuPermissionLevel'));
             if (!empty($view_perm) && !$GLOBALS['user_system']->havePerm($view_perm)) {
                 trigger_error("You don't have permission to access this view", E_USER_ERROR);
                 // exits
             }
             $this->_view = new $view_classname();
             $this->_view->processView();
         }
         require $this->_base_dir . '/templates/main.template.php';
         restore_error_handler();
     }
 }
    function printView()
    {
        $GLOBALS['system']->includeDBClass('person');
        $types = Person::getDateTypes();
        if (empty($types)) {
            ?>
			<p><i>No date types have been set up in the system yet.</i></p>
			<?php 
        }
        $types += array('' => '');
        ?>
		<form method="post">
		<table class="expandable valign-middle">
			<thead>
			</thead>
			<tbody>
			<?php 
        $i = 0;
        foreach ($types as $id => $name) {
            ?>
				<tr>
					<td><?php 
            echo $id;
            ?>
</td>
					<td>
						<input name="datetypename[<?php 
            echo $id ? $id : '_new_][';
            ?>
]" value="<?php 
            echo ents($name);
            ?>
" />
					</td>
					<td>
						<i class="icon-trash clickable delete-row"></i>
					</td>
				</tr>
				<?php 
            $i++;
        }
        ?>
			</tbody>
		</table>
		<input type="submit" class="btn" value="Save" />
		</form>
		<?php 
    }
    function run()
    {
        $GLOBALS['system']->initErrorHandler();
        $template = $GLOBALS['system']->getDBObject('note_template', (int) $_REQUEST['templateid']);
        if ($template) {
            $template->printNoteFieldWidgets();
            ?>
			<script>
				$('input[name=subject]').val("<?php 
            echo ents($template->getValue('subject'));
            ?>
");
			</script>
			<?php 
        }
    }
    function printView()
    {
        $tags = $GLOBALS['system']->getDBObjectData('service_component_tag');
        if (empty($tags)) {
            ?>
			<p><i>No tags have been set up in the system yet.</i></p>
			<?php 
        }
        $tags += array('' => array('tag' => ''));
        ?>
		<form method="post">
		<table class="expandable valign-middle">
			<thead>
			</thead>
			<tbody>
			<?php 
        $i = 0;
        foreach ($tags as $id => $tagdata) {
            ?>
				<tr>
					<td><?php 
            echo $id;
            ?>
</td>
					<td>
						<input name="tagname[<?php 
            echo $id ? $id : '_new_][';
            ?>
]" value="<?php 
            echo ents($tagdata['tag']);
            ?>
" />
					</td>
					<td>
						<i class="icon-trash clickable delete-row"></i>
					</td>
				</tr>
				<?php 
            $i++;
        }
        ?>
			</tbody>
		</table>
		<input type="submit" class="btn" value="Save" />
		</form>
		<?php 
    }
Exemplo n.º 17
0
    /**
     * Execute this call
     *
     * @return void
     * @access public
     */
    function run()
    {
        $service = $GLOBALS['system']->getDBObject('service', (int) $_REQUEST['serviceid']);
        ?>
		<html>
			<head>
				<style media="print">
					html body * {
						color: black;
						text-decoration: none;
					}
				</style>
				<style>
					* {
						font-family: sans-serif;
					}
					td, th {
						padding: 5px 10px;
						vertical-align: top;
					}
					th {
						background-color: #555;
						color: white;
					}
					th * {
						color: white !important;
					}
					table {
						border-collapse: collapse;
					}
				</style>
			</head>
			<body>
				<h1><?php 
        echo ents($service->toString());
        ?>
</h1>
				<?php 
        $service->printServicePlan();
        ?>
			</body>
		</html>
		<?php 
    }
    public function printView()
    {
        $buttons = array('delete' => 'Delete altogether', 'archiveclean' => 'Archive and Clean');
        if ($this->_staff_member) {
            ?>
			<p>This person has a user account and cannot be deleted altogether.</p>
			<p>You can archive and clean this person, which will</p>
			<?php 
            echo self::EXPLANATION;
            unset($buttons['delete']);
        } else {
            if ($this->_person->hasRosterAssignments() || $this->_person->hasAttendance()) {
                ?>
			<p>Deleting this person is not recommended since they have roster assignments and/or attendance records, and deleting them will affect historical statistics.</p>
			<p>It is recommended that you archive and clean the person, which will</p>
			<?php 
                echo self::EXPLANATION;
                $buttons['delete'] = 'Delete anyway';
            }
        }
        ?>
		<form method="post">
			<input type="hidden" name="personid" value="<?php 
        echo (int) $this->_person->id;
        ?>
" />
		<?php 
        foreach ($buttons as $key => $label) {
            ?>
			<input type="button" class="btn" name="confirm_<?php 
            echo $key;
            ?>
" value="<?php 
            echo ents($label);
            ?>
" />
			<?php 
        }
        ?>
		</form>
		<?php 
    }
Exemplo n.º 19
0
    function printView()
    {
        if (!$this->canEdit()) {
            print_message("Sorry, only adults are able to edit this family.", 'error');
            return;
        }
        $ok = $this->family->acquireLock();
        foreach ($this->persons as $p) {
            $ok = $ok && $p->acquireLock();
        }
        if (!$ok) {
            print_message("Your family cannot be edited right now.  Please try later", 'error');
        } else {
            if (defined('MEMBER_REGO_HELP_EMAIL')) {
                ?>
				<p><i>If you need to change names or other details which are not listed in this form, please contact  <a href="mailto:<?php 
                echo ents(MEMBER_REGO_HELP_EMAIL);
                ?>
"><?php 
                echo ents(MEMBER_REGO_HELP_EMAIL);
                ?>
</a>.</i></p>
				<?php 
            }
            ?>
			<form method="post">
			<h3>Family Details</h3>
			<?php 
            $this->family->printForm('family', array('address_street', 'address_suburb', 'address_postcode', 'home_tel'));
            foreach ($this->persons as $person) {
                echo '<h3>' . $person->getValue('first_name') . ' ' . $person->getValue('last_name') . '</h3>';
                $person->printForm('person_' . $person->id, array('gender', 'age_bracket', 'email', 'mobile_tel', 'work_tel'));
            }
            ?>
			<button class="btn" type="submit">Save</button>
			<a class="btn" href="?">Cancel</a>
			</form>
			<?php 
        }
    }
    static function _printChooserOptions($all_cats, $value, $parent = 0, $indent = '')
    {
        foreach ($all_cats as $id => $cat) {
            if ($cat['parent_category'] != $parent) {
                continue;
            }
            $sel = $id == $value ? ' selected="selected"' : '';
            ?>
			<option value="<?php 
            echo $id;
            ?>
"<?php 
            echo $sel;
            ?>
><?php 
            echo $indent . ents($cat['name']);
            ?>
</option>
			<?php 
            self::_printChooserOptions($all_cats, $value, $id, $indent . '&nbsp;&nbsp;&nbsp;&nbsp;');
        }
    }
    function _printCats($parentid = 0)
    {
        foreach ($this->_category_data as $cid => $cat) {
            if ($cat['parent_category'] != $parentid) {
                continue;
            }
            ?>
			<h3><?php 
            echo ents($cat['name']);
            ?>
</h3>
			<?php 
            $this->_printGroupsForCategory($cid);
            ?>
			<div class="indent-left">
			<?php 
            $this->_printCats($cid);
            ?>
			</div>
			<?php 
        }
    }
    function run()
    {
        $results = array();
        if (!empty($_REQUEST['search'])) {
            $name = $_REQUEST['search'];
            $GLOBALS['system']->includeDBClass('person');
            $results = Person::getPersonsByName($name, array_get($_REQUEST, 'include_archived', false));
            header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
            // Date in the past
            header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
            // always modified
            header("Cache-Control: no-cache, must-revalidate");
            // HTTP/1.1
            header("Pragma: no-cache");
            // HTTP/1.0
            header("Content-Type: application/json");
            echo "{\"results\": [";
            $arr = array();
            $GLOBALS['system']->includeDBClass('person');
            $dummy = new Person();
            $count = 0;
            foreach ($results as $i => $details) {
                if ($count++ > 12) {
                    break;
                }
                $dummy->populate($i, $details);
                $arr[] = '
					{
						id: ' . $i . ',
						value: "' . addcslashes(ents($details['first_name'] . ' ' . $details['last_name']), '"') . '",
						info: "' . addcslashes(ents($dummy->getFormattedValue('status') . ', ' . $dummy->getFormattedValue('congregationid')), '"') . '"
					}
				';
            }
            echo implode(", ", $arr);
            echo "]}";
        }
    }
Exemplo n.º 23
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 
            }
        }
    }
    function printView()
    {
        if (!empty($_REQUEST['configure'])) {
            ?>
			<form method="post" action="<?php 
            echo build_url(array('configure' => NULL));
            ?>
">
				<input type="hidden" name="query_submitted" value="1" />
				<?php 
            $this->_query->printForm();
            ?>
				<h3>&nbsp</h3>
				<input type="submit" class="btn" value="Save and view results" />
				<input type="submit" class="btn" name="return" value="Save and return to report list" />
				<a class="btn" href="?view=<?php 
            echo ents($_REQUEST['view']);
            ?>
">Cancel and return to report list</a>

			</form>
			<?php 
        } else {
            if (!empty($this->_query)) {
                $this->_query->printResults();
                ?>
			<hr />
			<div class="row-fluid no-print">
				<div class="span4">
					<a href="?view=<?php 
                echo ents($_REQUEST['view']);
                ?>
"><i class="icon-chevron-left"></i>Back to list of reports</a>
				</div>
				<div class="span4 align-centre">
					<a href="?view=<?php 
                echo ents($_REQUEST['view']);
                ?>
&queryid=<?php 
                echo $this->_query->id;
                ?>
&configure=1"><i class="icon-wrench"></i>Reconfigure this report</a>
				</div>
				<div class="span4 align-right">
					<a href="?call=report_csv&queryid=<?php 
                echo $this->_query->id;
                ?>
"><i class="icon-download-alt"></i>Download CSV</a>
				</div>
			</div>
			<?php 
            } else {
                ?>
			<p>
				<a href="<?php 
                echo build_url(array('*' => NULL, 'view' => $_REQUEST['view'], 'queryid' => 0, 'configure' => 1));
                ?>
"><i class="icon-plus-sign"></i>Create a new report</a>
			</p>

			<?php 
                $saved_reports = $GLOBALS['system']->getDBObjectData('person_query', array('(owner' => array(NULL, $GLOBALS['user_system']->getCurrentUser('id'))), 'OR', 'name');
                if (empty($saved_reports) && empty($_SESSION['saved_query'])) {
                    ?>
				<p><i>There are not yet any reports saved in the system</i></p>
				<?php 
                } else {
                    ?>
				<form method="post">
				<table class="table table-striped table-min-width table-hover">
					<thead>
						<tr>
							<th>ID</th>
							<th>Report Name</th>
							<th>Visible To</th>
							<th>Actions</th>
							<th></th>
						<?php 
                    if (!empty($this->_result_counts)) {
                        ?>
							<th>Results</th>
							<?php 
                    }
                    ?>
						</tr>
					</thead>
					<tbody>

					<?php 
                    if (!empty($_SESSION['saved_query'])) {
                        ?>
						<tr>
							<td>-</td>
							<td><i>Last ad-hoc query</i></td>
							<td class="action-cell">
								<a href="?view=<?php 
                        echo ents($_REQUEST['view']);
                        ?>
&queryid=TEMP&configure=1"><i class="icon-wrench"></i>Configure</a> &nbsp;
								<a href="?view=<?php 
                        echo ents($_REQUEST['view']);
                        ?>
&queryid=TEMP"><i class="icon-list"></i>View Results</a> &nbsp;
							</td>
							<td>&nbsp;</td>
						<?php 
                        if (!empty($this->_result_counts)) {
                            ?>
							<td></td>
							<?php 
                        }
                        ?>
						</tr>
						<?php 
                    }
                    $staff_members = $GLOBALS['system']->getDBObjectData('staff_member');
                    $current_user_id = $GLOBALS['user_system']->getCurrentUser('id');
                    foreach ($saved_reports as $id => $details) {
                        ?>
						<tr>
							<td class="narrow"><?php 
                        echo (int) $id;
                        ?>
</td>
							<td><?php 
                        echo $details['name'];
                        ?>
</td>
							<td><?php 
                        echo $details['owner'] === NULL ? 'Everyone' : 'Only Me';
                        ?>
</td>
							<td class="action-cell narrow">
								<a href="?view=<?php 
                        echo ents($_REQUEST['view']);
                        ?>
&queryid=<?php 
                        echo $id;
                        ?>
&configure=1"><i class="icon-wrench"></i>Configure</a> &nbsp;
								<a href="?view=<?php 
                        echo ents($_REQUEST['view']);
                        ?>
&queryid=<?php 
                        echo $id;
                        ?>
"><i class="icon-list"></i>View</a> &nbsp;
								<a href="?call=email&queryid=<?php 
                        echo $id;
                        ?>
" class="hidden-frame"><i class="icon-email">@</i>Email</a>
							<?php 
                        if ($GLOBALS['user_system']->havePerm(PERM_MANAGEREPORTS)) {
                            ?>
								&nbsp;
								<a href="?view=<?php 
                            echo ents($_REQUEST['view']);
                            ?>
&queryid=<?php 
                            echo $id;
                            ?>
&delete=1" data-method="post" class="double-confirm-title" title="Delete this report"><i class="icon-trash"></i>Delete</a>
								<?php 
                        }
                        ?>
							</td>
							<td class="narrow"><input type="checkbox" name="show_result_count_queryids[]" value="<?php 
                        echo (int) $id;
                        ?>
" <?php 
                        if (isset($this->_result_counts[$id])) {
                            echo 'checked="checked"';
                        }
                        ?>
 /></td>
						<?php 
                        if (!empty($this->_result_counts)) {
                            ?>
							<td class="narrow"><b><?php 
                            if (isset($this->_result_counts[$id])) {
                                echo (int) $this->_result_counts[$id];
                            }
                            ?>
</b></td>
							<?php 
                        }
                        ?>
						</tr>
						<?php 
                    }
                    ?>
					</tbody>
				</table>
				<input type="submit" class="btn-link pull-right" name="show_result_count" value="Show result counts for selected reports" />
				</form>
				<?php 
                }
            }
        }
    }
    private function printFormSequential()
    {
        $cancelURL = build_url(array('*' => NULL, 'view' => 'attendance__record', 'cohortids' => $this->_cohortids, 'attendance_date' => $this->_attendance_date, 'release' => 1));
        $totalPrinted = 0;
        foreach ($this->_record_sets as $i => $set) {
            if ((int) $set->congregationid) {
                $congregation = $GLOBALS['system']->getDBObject('congregation', (int) $set->congregationid);
            } else {
                if ($set->groupid) {
                    $group =& $GLOBALS['system']->getDBObject('person_group', $set->groupid);
                } else {
                    return;
                }
            }
            $title = $set->getCohortName();
            $stats = $abs = array();
            if ($set->statuses) {
                $options = Attendance_Record_Set::getStatusOptions();
                foreach ($set->statuses as $s) {
                    $stats[] = $options[$s];
                }
            }
            if ($set->age_brackets) {
                $GLOBALS['system']->includeDBClass('person');
                $p = new Person();
                foreach ($set->age_brackets as $ab) {
                    $p->setValue('age_bracket', $ab);
                    $abs[] = $p->getFormattedValue('age_bracket');
                }
            }
            $title = implode(', ', $stats) . ' ' . implode(',', $abs) . ' in ' . $title;
            ?>
			<h3><?php 
            echo ents($title);
            ?>
</h3>
			<div class="width-really-auto form-inline">
				<?php 
            $setPrinted = $set->printForm($i);
            if ($setPrinted > 0) {
                $totalPrinted += $setPrinted;
                ?>
					<div class="container row-fluid control-group">
						<p class="span6">
							<?php 
                echo _('Total headcount:');
                ?>
							<?php 
                $set->printHeadcountField();
                ?>
						</p>
						<p class="span6 align-right nowrap">
							<input type="submit" class="btn" value="Save All Attendances" />
							<a href="<?php 
                echo $cancelURL;
                ?>
" class="btn">Cancel</a>
						</p>
					</div>
					<?php 
            } else {
                ?>
					<i><?php 
                echo _('(No persons in this listing)');
                ?>
</i>
					<?php 
            }
            ?>
			</div>
			<?php 
        }
        return $totalPrinted;
    }
Exemplo n.º 26
0
    function _printResultSetHtml($x, $heading)
    {
        if ($heading) {
            echo '<h3>' . $heading . '</h3>';
        }
        if (empty($x)) {
            ?>
			<i>No matching persons were found</i>
			<?php 
            return;
        }
        ?>
		<table class="table table-striped table-condensed table-hover table-min-width clickable-rows query-results">
			<thead>
				<tr>
				<?php 
        foreach (array_keys(reset($x)) as $heading) {
            ?>
					<th<?php 
            echo $this->_getColClasses($heading);
            ?>
>
						<?php 
            switch ($heading) {
                case 'person_groups':
                    echo 'Groups';
                    break;
                case 'notes.subjects':
                    echo 'Notes';
                    break;
                case 'edit_link':
                case 'view_link':
                    break;
                case 'checkbox':
                    echo '<input type="checkbox" class="select-all" title="Select all" />';
                    break;
                default:
                    if (isset($this->_field_details[$heading])) {
                        echo $this->_field_details[$heading]['label'];
                    } else {
                        if (substr($heading, 0, 7) == 'DATE---') {
                            echo ucfirst(substr($heading, 7));
                        } else {
                            echo ucfirst($heading);
                        }
                    }
            }
            ?>
					</th>
					<?php 
        }
        ?>
				</tr>
			</thead>
			<tbody>
			<?php 
        foreach ($x as $row) {
            ?>
				<tr>
				<?php 
            foreach ($row as $label => $val) {
                ?>
					<td<?php 
                echo $this->_getColClasses($label);
                ?>
>
						<?php 
                switch ($label) {
                    case 'edit_link':
                        ?>
								<a class="med-popup no-print" href="?view=_edit_person&personid=<?php 
                        echo $row[$label];
                        ?>
"><i class="icon-wrench"></i>Edit</a>
								<?php 
                        break;
                    case 'view_link':
                        ?>
								<a class="med-popup no-print" href="?view=persons&personid=<?php 
                        echo $row[$label];
                        ?>
"><i class="icon-user"></i>View</a>
								<?php 
                        break;
                    case 'checkbox':
                        ?>
								<input name="personid[]" type="checkbox" value="<?php 
                        echo $row[$label];
                        ?>
" class="no-print" />
								<?php 
                        break;
                    case 'photo':
                        ?>
								<a class="med-popup" href="?view=persons&personid=<?php 
                        echo $row[$label];
                        ?>
">
								<img height="60" src="?call=person_photo&personid=<?php 
                        echo $row[$label];
                        ?>
" />
								</a>
								<?php 
                        break;
                    default:
                        if (isset($this->_field_details[$label])) {
                            $var = $label[0] == 'p' ? '_dummy_person' : '_dummy_family';
                            $fieldname = substr($label, 2);
                            $this->{$var}->setValue($fieldname, $val);
                            $this->{$var}->printFieldValue($fieldname);
                        } else {
                            if (substr($label, 0, 7) == 'DATE---') {
                                echo nl2br($this->_formatDateResult($val));
                            } else {
                                echo nl2br(ents($val));
                            }
                        }
                }
                ?>
					</td>
					<?php 
            }
            ?>
				</tr>
				<?php 
        }
        ?>
			</tbody>
		</table>
		<p><strong><?php 
        echo count($x);
        ?>
 persons listed</strong></p>
		<?php 
    }
    function _printServiceEditCell($congid, $date, $data)
    {
        ?>
		<table class="service-details">
			<tr>
				<th>Topic</th>
				<td class="topic">
					<input type="text" name="topic_title[<?php 
        echo $congid;
        ?>
][<?php 
        echo $date;
        ?>
]" value="<?php 
        echo ents(array_get($data, 'topic_title'));
        ?>
" />
				</td>
			</tr>
			<tr>
				<th>Texts</th>
				<td>
					<table class="expandable table-hover">
					<?php 
        $readings = array_get($data, 'readings');
        if (empty($readings)) {
            $readings = array(array('to_read' => 1));
        }
        foreach ($readings as $reading) {
            ?>
						<tr>
							<td>
								<input type="text" name="bible_refs[<?php 
            echo $congid;
            ?>
][<?php 
            echo $date;
            ?>
][]" class="bible-ref" value="<?php 
            echo ents($this->_formatBible(array_get($reading, 'bible_ref', ''), FALSE));
            ?>
" />
							</td>
							<td class="bible-options">

								<label title="to be read" class="preserve-value">
									R
									<?php 
            /*  because checkboxes themselves don't get don't get submitted if not checked, and
            				we need the "to_read" etc fields to match up with the actual bible refs,
            				we use a hidden field for submission, and rely on JS in tb_lib to adjust
            				the hidden field when the checkbox is clicked */
            ?>
									<input type="checkbox"  class="toggle-next-hidden" />
									<input type="hidden" name="bible_to_read[<?php 
            echo $congid;
            ?>
][<?php 
            echo $date;
            ?>
][]" value="<?php 
            echo (int) array_get($reading, 'to_read');
            ?>
" />
								</label>

								<label title="to be preached on">
									P
									<input type="checkbox" class="toggle-next-hidden bible-to-preach" />
									<input type="hidden" name="bible_to_preach[<?php 
            echo $congid;
            ?>
][<?php 
            echo $date;
            ?>
][]" value="<?php 
            echo (int) array_get($reading, 'to_preach');
            ?>
" />
								</label>

								<img src="<?php 
            echo BASE_URL;
            ?>
/resources/img/arrow_up_thin_black.png" class="icon move-row-up" title="Move up" />
								<img src="<?php 
            echo BASE_URL;
            ?>
/resources/img/arrow_down_thin_black.png" class="icon move-row-down" title="Move down" />
								&nbsp;
							</td>
						</tr>
						<?php 
        }
        ?>
					</table>
				</td>
			</tr>
			<tr>
				<th>Format</th>
				<td class="format">
					<input type="text" name="format_title[<?php 
        echo $congid;
        ?>
][<?php 
        echo $date;
        ?>
]" value="<?php 
        echo array_get($data, 'format_title');
        ?>
" />
					<i class="icon-chevron-down clickable toggle-next-tr <?php 
        if (!empty($data['notes'])) {
            echo 'got-notes';
        }
        ?>
" title="Show notes" ></i>
				</td>
			</tr>
			<tr class="hide">
				<th>Notes</th>
				<td><textarea class="full-width-input" name="notes[<?php 
        echo $congid;
        ?>
][<?php 
        echo $date;
        ?>
]"><?php 
        echo ents(array_get($data, 'notes'));
        ?>
</textarea></td>
			</tr>
		</table>
		<?php 
    }
    function printView()
    {
        if (empty($this->_person_data) && empty($this->_family_data) && empty($this->_group_data)) {
            echo '<p><i>No matching persons or families were found.  Try searching again.</i></p>';
            echo '<form class="form form-horizontal"><input type="hidden" name="view" value="_mixed_search">';
            echo '<input type="text" name="search" placeholder="Name, Phone or Email" />';
            echo '<button type="submit" class="btn">Search</button></form>';
            return;
        }
        ?>
		<table class="table table-hover table-striped table-min-width clickable-rows">
		<?php 
        if (!empty($this->_group_data)) {
            foreach ($this->_group_data as $id => $values) {
                $class = $values['is_archived'] ? 'class="archived"' : '';
                ?>
				<tr <?php 
                echo $class;
                ?>
>
					<td><?php 
                echo ents($values['name']);
                ?>
</td>
					<td class="narrow">
						<a href="?view=groups&groupid=<?php 
                echo $id;
                ?>
"><i class="icon-list"></i>View</a> &nbsp;
						<a href="?view=_edit_group&groupid=<?php 
                echo $id;
                ?>
"><i class="icon-wrench"></i>Edit</a>
					</td>
				</tr>
				<?php 
            }
        }
        if (!empty($this->_person_data)) {
            foreach ($this->_person_data as $id => $values) {
                $class = $values['status'] == 'archived' ? 'class="archived"' : '';
                ?>
				<tr <?php 
                echo $class;
                ?>
>
					<td><?php 
                echo ents($values['first_name']) . ' ' . ents($values['last_name']);
                ?>
</td>
					<td class="narrow">
						<a href="?view=persons&personid=<?php 
                echo $id;
                ?>
"><i class="icon-user"></i>View</a> &nbsp;
						<a href="?view=_edit_person&personid=<?php 
                echo $id;
                ?>
"><i class="icon-wrench"></i>Edit</a>
					</td>
				</tr>
				<?php 
            }
        }
        if (!empty($this->_family_data)) {
            foreach ($this->_family_data as $id => $values) {
                $class = $values['status'] == 'archived' ? 'class="archived"' : '';
                ?>
				<tr <?php 
                echo $class;
                ?>
>
					<td><?php 
                echo ents($values['family_name']);
                ?>
 Family</td>
					<td class="narrow">
						<a href="?view=families&familyid=<?php 
                echo $id;
                ?>
"><i class="icon-home"></i>View</a> &nbsp;
						<a href="?view=_edit_family&familyid=<?php 
                echo $id;
                ?>
"><i class="icon-wrench"></i>Edit</a>
					</td>
				</tr>
				<?php 
            }
        }
        ?>
		</table>
		<?php 
    }
Exemplo n.º 29
0
    function _printRoleHeaders($editing, $public)
    {
        // print role/field headings
        $dummy_service = new Service();
        $last_congid = NULL;
        foreach ($this->_members as $id => $details) {
            $th_class = '';
            if ($details['congregationid'] != $last_congid) {
                $th_class = 'thick-left-border';
                $last_congid = $details['congregationid'];
            }
            ?>
			<th class="<?php 
            echo $th_class;
            ?>
">
				<?php 
            if ($details['role_id']) {
                if ($editing) {
                    if (!empty($details['volunteer_group'])) {
                        echo '<a title="Click to edit volunteer group" href="' . BASE_URL . '?view=groups&groupid=' . (int) $details['volunteer_group'] . '">' . ents($details['role_title']) . '</a>';
                    } else {
                        echo ents($details['role_title']);
                    }
                    if (!empty($details['readonly'])) {
                        echo '<br /><b>[LOCKED]</b>';
                    }
                } else {
                    echo '<a class="med-popup" title="Click for role description" href="' . BASE_URL . '/public/?view=display_role_description&role=' . $details['role_id'] . '">' . ents($details['role_title']) . '</a>';
                }
            } else {
                echo ents($dummy_service->getFieldLabel($details['service_field'], true));
            }
            ?>
			</th>
			<?php 
        }
    }
Exemplo n.º 30
0
    function printView()
    {
        if ($this->_group) {
            ?>
			<h3>Group Details</h3>
			<table class="table-full-width">
				<tr>
					<th class="narrow" style="padding-bottom: 10px">Category</th>
					<td><?php 
            $this->_group->printFieldValue('categoryid');
            ?>
&nbsp;&nbsp;</td>
					<th class="narrow hidden-phone">Record Attendance?</th>
					<td class="hidden-phone"><?php 
            $this->_group->printFieldValue('attendance_recording_days');
            ?>
</td>
					<td class="align-right">
						<a class="link-collapse" href="?view=_edit_group&groupid=<?php 
            echo $this->_group->id;
            ?>
"><i class="icon-wrench"></i>Edit group details</a>
					</td>
				</tr>
				<tr>
					<th class="narrow">Status</th>
					<td><?php 
            $this->_group->printFieldValue('is_archived');
            ?>
</td>
					<th class="narrow hidden-phone">Share Member Details?</th>
					<td class="hidden-phone"><?php 
            $this->_group->printFieldValue('share_member_details');
            ?>
</td>
					<td class="align-right">
						<form class="min" method="post" action="?view=_edit_group&groupid=<?php 
            echo $this->_group->id;
            ?>
">
							<input type="hidden" name="action" value="delete" />
							<button class="btn-link double-confirm-title link-collapse" type="submit" title="Delete this group">
								<i class="icon-trash"></i>Delete group
							</button>
						</form>
					</td>
				</tr>
			</table>

			<div class="modal hide fade" id="action-plan-modal" role="dialog" aria-hidden="true">
				<form method="post" action="?view=_edit_group&action=add_member&groupid=<?php 
            echo $this->_group->id;
            ?>
">
					<div class="modal-header">
						<h4>Add Members by Name Search</h4>
					</div>
					<div class="modal-body">
						<table>
							<tr>
								<td>Select persons:</td>
								<td>
									<?php 
            $GLOBALS['system']->includeDBClass('person');
            Person::printMultipleFinder('personid');
            ?>
								</td>
							</tr>
							<tr>
								<td>Membership status:</td>
								<td>
									<?php 
            $GLOBALS['system']->includeDBClass('person_group');
            Person_Group::printMembershipStatusChooser('membership_status');
            ?>
								</td>
							</tr>
						</table>
					</div>
					<div class="modal-footer">
						<input class="btn" type="submit" value="Add Members" id="add-member-button" />
						<input class="btn" type="button" value="Cancel" data-dismiss="modal" aria-hidden="true" />
					</div>
				</form>
			</div>

			<div class="modal hide fade autosize" id="email-modal" role="dialog" aria-hidden="true">
				<div class="modal-header">
					<h4>Email members of <?php 
            echo ents($this->_group->getValue('name'));
            ?>
</h4>
				</div>
				<div class="modal-body">
					<!-- to be populated with ajax -->
				</div>
				<div class="modal-footer">
					<input class="btn" type="button" value="Cancel" data-dismiss="modal" aria-hidden="true" />
				</div>
			</div>


			<?php 
            $persons = $this->_group->getMembers(!empty($_SESSION['show_archived_group_members']));
            list($status_options, $default_status) = Person_Group::getMembershipStatusOptionsAndDefault();
            ?>
			<h3>Group Members (<?php 
            echo count($persons);
            ?>
)</h3>

			<?php 
            if (empty($_REQUEST['edit_statuses'])) {
                ?>
				<div class="group-members-links">
					<div class="archived-link">
						<?php 
                if (empty($_SESSION['show_archived_group_members'])) {
                    ?>
							<a class="hidden-phone" href="<?php 
                    echo build_url(array('show_archived' => 1));
                    ?>
"><i class="icon-eye-open"></i>Show archived members</a>
							<?php 
                } else {
                    ?>
							<a class="hidden-phone" href="<?php 
                    echo build_url(array('show_archived' => 0));
                    ?>
"><i class="icon-eye-close"></i>Hide archived members</a>
							<?php 
                }
                ?>
					</div>
				<?php 
                if (!empty($persons)) {
                    ?>
					<div class="email-link">
						<a href="<?php 
                    echo build_url(array('view' => NULL, 'call' => 'email', 'groupid' => $this->_group->id, 'show_modal' => 1));
                    ?>
" data-target="#email-modal" data-toggle="modal"><i class="icon-email">@</i>Email members</a>
					</div>
					<?php 
                }
                if (!empty($persons) && $GLOBALS['user_system']->havePerm(PERM_EDITPERSON)) {
                    if (count($status_options) > 1) {
                        ?>
						<div class="edit-status-link">
							<a href="<?php 
                        echo build_url(array('edit_statuses' => 1));
                        ?>
"><i class="icon-wrench"></i>Edit membership statuses</a>
						</div>
						<?php 
                    }
                }
                ?>
					<div class="add-link">
						<a href="#action-plan-modal" data-toggle="modal"><i class="icon-plus-sign"></i>Add members</a>
					</div>
				</div>
				<?php 
            }
            if (!empty($persons)) {
                $special_fields = array('joined_group', 'congregation');
                if (count($status_options) > 1) {
                    array_unshift($special_fields, 'membership_status');
                }
                if (!empty($_REQUEST['edit_statuses'])) {
                    ?>
					<form method="post" action="<?php 
                    echo build_url(array('edit_statuses' => NULL));
                    ?>
">
					<?php 
                    $callbacks = array('membership_status' => array($this, 'printMembershipStatusChooser'));
                    $show_actions = FALSE;
                    // This is a bit ugly, but the 'membership status' column needs to show the membership status chooser,
                    // which needs the ID rather than the label
                    foreach ($persons as &$person) {
                        $person['membership_status'] = $person['membership_status_id'];
                    }
                }
                include_once 'templates/person_list.template.php';
                if (!empty($_REQUEST['edit_statuses'])) {
                    ?>
					<div class="align-right">
						<input type="submit" class="btn" value="Save membership statuses" />
						<a class="btn" href="<?php 
                    echo build_url(array('edit_statuses' => NULL));
                    ?>
">Cancel</a>
					</div>
					</form>
					<?php 
                }
            } else {
                ?>
				<p><em>This group does not currently have any members</em></p>
				<?php 
            }
        }
    }