function run()
    {
        if (empty($_REQUEST['uuid'])) {
            header("HTTP/1.0 400 Bad request");
            ?>
<p>UUID not specified</p><?php 
            exit;
        }
        $personid = $this->_getPersonID($_REQUEST['uuid']);
        if (empty($personid)) {
            header("HTTP/1.0 404 Not Found");
            ?>
<p>Not registered</p><?php 
            exit;
        }
        $assignments = Roster_Role_Assignment::getUpcomingAssignments($personid, NULL);
        header('Content-type: text/calendar');
        header('Content-Disposition: inline; filename=roster.ics');
        //header('content-type: text/plain');
        require_once 'templates/roster_ical.template.php';
    }
    function printView()
    {
        ?>
		<div class="member-homepage-box">
			<h3>
				<a class="pull-right" href="?view=_edit_me"><small>Edit</small></a>
				My Family
			</h3>
			<?php 
        $family = $GLOBALS['system']->getDBObject('family', $GLOBALS['member_user_system']->getCurrentMember('familyid'));
        unset($family->fields['status']);
        $family->printCustomSummary(array($this, 'printFamilyMembers'));
        ?>
		</div>

		<?php 
        if ($GLOBALS['system']->featureEnabled('ROSTERS&SERVICES')) {
            ?>
			<div class="member-homepage-box">
			<h3>
				<a class="pull-right" href="?view=_edit_ical"><small>Subscribe</small></a>
				My Roster Allocations &nbsp;
			</h3>
			<?php 
            $GLOBALS['system']->includeDBClass('roster_role_assignment');
            $rallocs = Roster_Role_Assignment::getUpcomingAssignments($GLOBALS['member_user_system']->getCurrentMember('id'), NULL);
            if ($rallocs) {
                ?>
				<table class="table table-auto-width">
				<?php 
                foreach ($rallocs as $date => $allocs) {
                    ?>
					 <tr>
						 <th><?php 
                    echo date('j M', strtotime($date));
                    ?>
</th>
						 <td>
							<?php 
                    foreach ($allocs as $alloc) {
                        echo $alloc['cong'] . ' ' . $alloc['title'] . '<br />';
                    }
                    ?>
						 </td>
					 </tr>
					 <?php 
                }
                ?>
				</table>
				<?php 
            } else {
                ?>
				<p><i>None</i></p>
				<?php 
            }
            ?>
			</div>
			<?php 
        }
        $GLOBALS['system']->includeDBClass('person_group');
        $groups = Person_Group::getGroups($GLOBALS['member_user_system']->getCurrentMember('id'), FALSE, TRUE);
        if (count($groups) > 1) {
            echo '<div  class="member-homepage-box" >';
            echo '<h3>My Groups</h3>';
            echo '<ul>';
            foreach ($groups as $id => $details) {
                echo '<li><a href="?view=_groups&groupid=' . (int) $id . '">' . ents($details['name']) . '</a></li>';
            }
            echo '</ul>';
            echo '</div>';
        }
    }
Example #3
0
    function printView()
    {
        $num_cols = 1;
        if ($GLOBALS['user_system']->havePerm(PERM_VIEWNOTE)) {
            $num_cols++;
        }
        if ($GLOBALS['user_system']->havePerm(PERM_VIEWROSTER)) {
            $num_cols++;
        }
        ?>
		<div class="homepage homepage-<?php 
        echo $num_cols;
        ?>
-col">

		<div class="homepage-box search-forms">
			<h3>
				<a class="pull-right hide-phone" 
				   href="javascript:if (sp = prompt('Search <?php 
        echo SYSTEM_NAME;
        ?>
 for: ')) window.location='<?php 
        echo BASE_URL;
        ?>
?view=_mixed_search&search='+sp"
				   onclick="prompt('To create a search-jethro button in your browser, save the following code as a bookmark/favourite: ', this.href); return false"
				>
					<small>Bookmark</small>
				</a>
				<?php 
        echo _('System-Wide Search');
        ?>
</h3>
			<label class="msie-only">Enter a person, family or group name, or phone number or email:</label>
			<form method="get">
				<input type="hidden" name="view" value="_mixed_search" />
				<span class="input-prepend input-append">
					<span class="add-on"><i class="icon-search"></i></span>
					<input type="text" name="search" class="" placeholder=<?php 
        echo _('"Name, Phone or Email"');
        ?>
 /> 
					<button type="submit" class="btn">Go</button>
				</span>
			</form>
		</div>

		<?php 
        if ($GLOBALS['user_system']->havePerm(PERM_VIEWNOTE)) {
            $user =& $GLOBALS['system']->getDBObject('staff_member', $GLOBALS['user_system']->getCurrentUser('id'));
            $tasks = $user->getTasks('now');
            ?>
			<div class="homepage-box my-notes">
				<h3><?php 
            echo _('Notes ');
            ?>
<span><?php 
            echo _('for immediate action');
            ?>
</span></h3>
				<?php 
            if ($tasks) {
                ?>
					<table class="table table-condensed table-striped table-hover clickable-rows" width="100%">
						<thead>
							<tr>
								<th><?php 
                echo _('For');
                ?>
</th>
								<th><?php 
                echo _('Subject');
                ?>
</th>
							</tr>
						</thead>
						<tbody>
							<?php 
                foreach ($tasks as $id => $task) {
                    $icon = $task['type'] == 'person' ? 'user' : 'home';
                    $view = $task['type'] == 'person' ? 'persons' : 'families';
                    $url = ifdef('NOTES_LINK_TO_EDIT') ? '?view=_edit_note&note_type=' . ents($task['type']) . '&noteid=' . (int) $id : '?view=' . $view . '&' . $task['type'] . 'id=' . $task[$task['type'] . 'id'] . '#note_' . $id;
                    ?>
								<tr>
									<td class="narrow"><i class="icon-<?php 
                    echo $icon;
                    ?>
"></i> <?php 
                    echo ents($task['name']);
                    ?>
</td>
									<td><a href="<?php 
                    echo $url;
                    ?>
"><?php 
                    echo ents($task['subject']);
                    ?>
</a></td>
								</tr>
								<?php 
                }
                ?>
						</tbody>
					</table>
					<?php 
            } else {
                ?>
					<p><i>None</i></p>
					<?php 
            }
            $later = $user->getTasks('later');
            $count = count($later);
            if ($count) {
                ?>
					<p class="align-right"><?php 
                echo _('You have ');
                ?>
<a href="<?php 
                echo build_url(array('view' => 'notes__for_future_action', 'assignee' => $user->id));
                ?>
"><?php 
                echo count($later);
                ?>
 note<?php 
                echo $count > 1 ? 's' : '';
                ?>
 <?php 
                echo _('for future action');
                ?>
</a></p>
					<?php 
            }
            ?>
			</div>
			<?php 
        }
        if ($GLOBALS['user_system']->havePerm(PERM_VIEWROSTER)) {
            ?>
			<div class="homepage-box my-roster">
				<h3>
					<a href="?view=_manage_ical" class="pull-right hidden-phone"><small>Subscribe</small></a>
					Upcoming roster<span> allocations</span>
				</h3>
				<?php 
            $GLOBALS['system']->includeDBClass('roster_role_assignment');
            $rallocs = Roster_Role_Assignment::getUpcomingAssignments($GLOBALS['user_system']->getCurrentUser('id'));
            if ($rallocs) {
                foreach ($rallocs as $date => $allocs) {
                    ?>
						 <h5><?php 
                    echo date('j M', strtotime($date));
                    ?>
</h5>
						 <?php 
                    foreach ($allocs as $alloc) {
                        echo $alloc['cong'] . ' ' . $alloc['title'] . '<br />';
                    }
                }
                ?>
					<div class="pull-right"><a href="./?view=persons&personid=<?php 
                echo $GLOBALS['user_system']->getCurrentUser('id');
                ?>
#rosters">See all</a></div>
					<?php 
            } else {
                ?>
					<p><i>None</i></p>
					<?php 
            }
            ?>
			 </div>
			<?php 
        }
        ?>
		</div>
		<?php 
    }
						<?php 
            }
            ?>
					</tr>
				</tbody>
			</table>
			<?php 
        }
    }
    echo $panel_footer;
}
if (isset($tabs['rosters'])) {
    /*************** ROSTERS TAB ****************/
    printf($panel_header, 'rosters', 'Rosters', '');
    $GLOBALS['system']->includeDBClass('roster_role_assignment');
    $assignments = Roster_Role_Assignment::getUpcomingAssignments($person->id, NULL);
    if (empty($assignments)) {
        ?>
		<p><i><?php 
        $person->printFieldValue('name');
        ?>
 has no upcoming roster assignments</i></p>
		<?php 
    } else {
        ?>
		<p><i>Upcoming roster assignments for <?php 
        $person->printFieldValue('name');
        ?>
:</i></p>
		<?php 
        foreach ($assignments as $date => $allocs) {
    function printView()
    {
        $GLOBALS['system']->includeDBClass('member');
        ?>
		<div class="member-homepage-box visible-phone">
			<h3>Search people</h3>
			<form method="get" class="form-inline">
				<input type="hidden" name="view" value="people" />
				<input name="search" type="text" placeholder="Enter name to search" value="<?php 
        echo ents(array_get($_REQUEST, 'search'));
        ?>
">
				<button data-action="search" class="btn" type="submit">Search</button>
			</form>
		</div>

		<div class="member-homepage-box">
			<h3>
				<a class="pull-right" href="?view=_edit_me"><small>Edit</small></a>
				My Family
			</h3>
			<?php 
        $family = $GLOBALS['system']->getDBObject('family', $GLOBALS['member_user_system']->getCurrentMember('familyid'));
        unset($family->fields['status']);
        $family->printCustomSummary(array($this, 'printFamilyMembers'));
        ?>
		</div>

		<?php 
        if ($GLOBALS['system']->featureEnabled('ROSTERS&SERVICES')) {
            ?>
			<div class="member-homepage-box">
			<h3>
				<a class="pull-right" href="?view=_edit_ical"><small>Subscribe</small></a>
				My Roster Allocations &nbsp;
			</h3>
			<?php 
            $GLOBALS['system']->includeDBClass('roster_role_assignment');
            $rallocs = Roster_Role_Assignment::getUpcomingAssignments($GLOBALS['member_user_system']->getCurrentMember('id'), NULL);
            if ($rallocs) {
                ?>
				<table class="table table-auto-width">
				<?php 
                foreach ($rallocs as $date => $allocs) {
                    ?>
					 <tr>
						 <th><?php 
                    echo date('j M', strtotime($date));
                    ?>
</th>
						 <td>
							<?php 
                    foreach ($allocs as $alloc) {
                        echo $alloc['cong'] . ' ' . $alloc['title'] . '<br />';
                    }
                    ?>
						 </td>
					 </tr>
					 <?php 
                }
                ?>
				</table>
				<?php 
            } else {
                ?>
				<p><i>None</i></p>
				<?php 
            }
            ?>
			</div>
			<?php 
        }
        $GLOBALS['system']->includeDBClass('person_group');
        $groups = Person_Group::getGroups($GLOBALS['member_user_system']->getCurrentMember('id'), FALSE, TRUE);
        if (count($groups) > 1) {
            echo '<div  class="member-homepage-box" >';
            echo '<h3>My Groups</h3>';
            echo '<ul>';
            foreach ($groups as $id => $details) {
                echo '<li><a href="?view=_groups&groupid=' . (int) $id . '">' . ents($details['name']) . '</a></li>';
            }
            echo '</ul>';
            echo '</div>';
        }
        ?>
		<div class="member-homepage-box hidden-phone">
			<h3>Search people</h3>
			<form method="get" class="form-inline">
				<input type="hidden" name="view" value="people" />
				<input name="search" type="text" placeholder="Enter name to search" value="<?php 
        echo ents(array_get($_REQUEST, 'search'));
        ?>
">
				<button data-action="search" class="btn" type="submit">Search</button>
			</form>
		</div>
		<?php 
    }