/**
 * This is analagous to @a $Subset <= @a $Superset.
 * @param $Subset string Permission level to search for.
 * @param $Superset string Permission level to search in.
 * @return bool Whether all permissions of @a $Subset are permissions of
 *	@a $Superset.
 */
function PermissionsSubset($Subset, $Superset)
{
    // Tree of which subsets of each permission level.
    static $permission_subsets = array('public' => array(), 'student' => array('public' => TRUE), 'organisation' => array('student' => TRUE), 'vip' => array('student' => TRUE), 'office' => array('student' => TRUE), 'pr' => array('office' => TRUE), 'moderator' => array('pr' => TRUE), 'editor' => array('moderator' => TRUE), 'admin' => array('editor' => TRUE));
    // Unknown superset, assume its empty, always fail.
    if (!array_key_exists($Superset, $permission_subsets)) {
        return FALSE;
    }
    // If the superset IS the subset allow.
    if ($Superset === $Subset) {
        return TRUE;
    }
    // If the subset is an explicit subset identifier of superset use it directly.
    if (array_key_exists($Subset, $permission_subsets[$Superset])) {
        return $permission_subsets[$Superset][$Subset];
    }
    // Go through the supersets subsets in a depth first manner to find subset.
    foreach ($permission_subsets[$Superset] as $superset_subset => $enable) {
        $subset_found = PermissionsSubset($Subset, $superset_subset);
        if ($subset_found) {
            // $Subset is a subset of $Superset
            return $enable;
        }
        // Negative: try any other parent permissions before giving up.
    }
    // All explicit subsets checked. Must not be a subset.
    return FALSE;
}
 function information($ContextType, $organisation, $action = 'view', $revision_id = FALSE)
 {
     /// @todo add show all option backend
     if (!CheckPermissions('office')) {
         return;
     }
     $this->pages_model->SetPageCode('office_reviews_information');
     $editor_level = PermissionsSubset('editor', GetUserLevel());
     //Get navigation bar and tell it the current page
     $data = $this->organisations->_GetOrgData($organisation);
     $data['page_information'] = $this->pages_model->GetPropertyWikitext('page_information');
     $data['context_type'] = $ContextType;
     $this->_SetupNavbar($organisation, $ContextType);
     $this->main_frame->SetPage('information');
     //test to allow a person to view deleted revisions
     $show_all_revisions = false;
     if ($action == 'viewall') {
         if ($editor_level) {
             $show_all_revisions = true;
         } else {
             $this->messages->AddMessage('error', 'You do not have permission to view deleted revisions');
         }
         $action = 'view';
     }
     if ($action == 'assign') {
         //There are two types of assignment. Url /assign/ where a user assigns themselfs. And by Posting a form, where an editor can assign anyone.
         $this->load->model('pr_model');
         $content_type_id = $this->pr_model->GetContentTypeId($ContextType);
         if (isset($_POST['assign_reporter'])) {
             //There is form post, so treat and check as an editor
             if ($editor_level) {
                 if ($_POST['assign_reporter'] == 'unassign') {
                     $this->pr_model->AssignReviewVenueToUser($data['organisation']['id'], $content_type_id);
                     $this->messages->AddMessage('success', 'The assigned user has been removed.');
                 } else {
                     $user_id = (int) $_POST['assign_reporter'];
                     //check for post
                     $this->pr_model->AssignReviewVenueToUser($data['organisation']['id'], $content_type_id, $user_id);
                     $this->messages->AddMessage('success', 'The user has been assigned to the venue.');
                 }
             } else {
                 $this->messages->AddMessage('error', 'Only aditors can assign someone else to a venue.');
             }
         } else {
             //there is no form post, so assume its a writer wanting to assign themselfs.
             $user_owns = $this->pr_model->IsUserAssignedToReviewVenue($ContextType, $organisation);
             if ($user_owns) {
                 $this->pr_model->AssignReviewVenueToUser($data['organisation']['id'], $content_type_id, $this->user_auth->entityId);
                 $this->messages->AddMessage('success', 'You have been assigned to this venue.');
             } else {
                 $this->messages->AddMessage('error', 'This venue is already assigned to someone else!');
             }
         }
         $revision_id = FALSE;
         //have used this parameter for user id! Better clear it so other functions dont think i want a revision.
         $action = 'view';
     }
     if ($action == 'unassign') {
         //this action is only used by non editors wanting to unassign themselfs. Editors dont unassign people the reassign something to someone (inculding the null person)
         //Check the user is unassigning themselfs only!
         $this->load->model('pr_model');
         $content_type_id = $this->pr_model->GetContentTypeId($ContextType);
         $user_owns = $this->pr_model->IsUserAssignedToReviewVenue($ContextType, $organisation, $this->user_auth->entityId);
         if ($user_owns) {
             $this->pr_model->AssignReviewVenueToUser($data['organisation']['id'], $content_type_id);
             $this->messages->AddMessage('success', 'You have been unassigned from this venue.');
         } else {
             $this->messages->AddMessage('error', 'You can only unassign yourself from a venue.');
         }
         $revision_id = FALSE;
         $action = 'view';
     }
     if ($action == 'delete') {
         if ($editor_level) {
             if (TRUE) {
                 /// @todo Review context revision removal.
                 $this->messages->AddMessage('error', 'Removal of revisions is not yet available');
             } else {
                 $result = $this->directory_model->FlagEntryRevisionAsDeletedById($organisation, $revision);
                 if ($result == 1) {
                     $this->messages->AddMessage('success', 'Directory revision successfully removed.');
                 } else {
                     $this->messages->AddMessage('error', 'Directory revision was not removed, revision does not exist or is live.');
                 }
             }
         } else {
             $this->messages->AddMessage('error', 'You do not have permission to remove revisions.');
         }
         $action = 'view';
     }
     if ($action == 'restore') {
         //Check Permissions
         if ($editor_level) {
             if (TRUE) {
                 /// @todo Review context revision restoration.
                 $this->messages->AddMessage('error', 'Restoration of revisions is not yet available');
             } else {
                 //Send and get data
                 $result = $this->directory_model->FlagEntryRevisionAsDeletedById($organisation, $revision, false);
                 if ($result == 1) {
                     $this->messages->AddMessage('success', 'Directory revision was restored successfully.');
                 } else {
                     $this->messages->AddMessage('error', 'Directory revision was not restored it does not exist or it is not deleted.');
                 }
             }
         } else {
             $this->messages->AddMessage('error', 'You do not have permission to restore revisions');
         }
         $action = 'view';
     }
     if ($action == 'publish') {
         //Check Permissions
         if ($editor_level) {
             //Send and get data
             $result = $this->review_model->PublishContextContentRevision($organisation, $ContextType, $revision_id);
             if ($result) {
                 $this->messages->AddMessage('success', 'Review page revision was published successfully.');
             } else {
                 $this->messages->AddMessage('error', 'Review page revision was not published as it does not exist or is already live.');
             }
         } else {
             $this->messages->AddMessage('error', 'You do not have permission to publish revisions');
         }
         $action = 'view';
     }
     if ('preview' === $action) {
         $here = site_url('office/reviews/' . $organisation . '/' . $ContextType . '/information');
         $revision = $this->review_model->GetReviewContextContentRevisions($organisation, $ContextType, $revision_id === TRUE ? -1 : $revision_id);
         if (!array_key_exists(0, $revision)) {
             $action = 'view';
         } else {
             //Show a toolbar in a message for the preview.
             $published = $revision[0]['published'];
             $user_level = GetUserLevel();
             $is_deleted = $revision[0]['deleted'];
             if ($published) {
                 $message = 'This is a preview of the current published review page.<br />';
             } else {
                 if ($is_deleted) {
                     $message = 'This is a preview of a <span class="red">deleted</span> review page revision.<br />';
                 } else {
                     $message = 'This is a preview of a review page revision.<br />';
                 }
             }
             $message .= '<a href="' . $here . '/view/' . $revision_id . '">Go Back</a>';
             if ($published == false) {
                 if ($editor_level) {
                     $message .= ' | <a href="' . $here . '/publish/' . $revision_id . '">Publish This Revision</a>';
                 }
                 if ($is_deleted) {
                     if ($editor_level) {
                         $message .= ' | <a href="' . $here . '/restore/' . $revision_id . '">Restore This Revision</a>';
                     }
                 } else {
                     $message .= ' | <a href="' . $here . '/delete/' . $revision_id . '">Delete This Revision</a>';
                 }
             }
             $this->messages->AddMessage('information', $message);
             $this->load->library('Review_views');
             $this->review_views->SetRevision(is_numeric($revision_id) ? $revision_id : -1);
             $this->review_views->DisplayReview($ContextType, $organisation);
         }
     }
     if ('view' === $action) {
         $this->load->model('requests_model');
         $this->load->model('article_model');
         // Insert main text from pages information (sample)
         $data['main_text'] = $this->pages_model->GetPropertyWikitext('main_text');
         // Handle submitted data
         if ($this->input->post('reviewinfo_rating') != false) {
             // Set up validation library
             $this->load->library('validation');
             $this->validation->set_error_delimiters('<li>', '</li>');
             // Specify validation rules
             $rules['reviewinfo_about'] = 'trim|required|xss_clean';
             $rules['reviewinfo_rating'] = 'trim|required|numeric';
             $rules['reviewinfo_js_rating'] = 'trim|required|numeric';
             $rules['reviewinfo_use_js_rating'] = 'trim|required|numeric';
             $rules['reviewinfo_quote'] = 'trim|required|xss_clean';
             $rules['reviewinfo_recommended'] = 'trim|xss_clean';
             $rules['reviewinfo_average_price'] = 'trim|xss_clean';
             $rules['reviewinfo_serving_hours'] = 'trim|xss_clean';
             $this->validation->set_rules($rules);
             // Set field names for displaying in error messages
             $fields['reviewinfo_about'] = 'blurb';
             $fields['reviewinfo_rating'] = 'rating';
             $fields['reviewinfo_js_rating'] = 'js_rating';
             $fields['reviewinfo_use_js_rating'] = 'use_js_rating';
             $fields['reviewinfo_quote'] = 'quote';
             $fields['reviewinfo_recommended'] = 'recommended item';
             $fields['reviewinfo_average_price'] = 'average price';
             $fields['reviewinfo_serving_hours'] = 'serving hours';
             $this->validation->set_fields($fields);
             // Run validation
             $errors = array();
             if ($this->validation->run()) {
                 if ($this->input->post('reviewinfo_deal_expires') != false) {
                     if (!$this->input->post('reviewinfo_deal')) {
                         array_push($errors, 'Please enter deal information or remove the deal expiry date.');
                     }
                     if (strtotime($this->input->post('reviewinfo_deal_expires')) == false) {
                         array_push($errors, 'Please enter the deal expiry date in the format yyyy-mm-dd');
                     }
                 }
                 // If there are no errors, insert data into database
                 if (count($errors) == 0) {
                     //The rating could have come from the nice js or the ugly drop down list, check which was being used.
                     if ($this->input->post('reviewinfo_use_js_rating')) {
                         $rating = $this->input->post('reviewinfo_js_rating');
                     } else {
                         $rating = $this->input->post('reviewinfo_rating');
                     }
                     if ($this->review_model->SetReviewContextContent($organisation, $ContextType, $this->user_auth->entityId, $this->input->post('reviewinfo_about'), $this->input->post('reviewinfo_quote'), $this->input->post('reviewinfo_average_price'), $this->input->post('reviewinfo_recommended'), $rating, $this->input->post('reviewinfo_serving_hours'))) {
                         $this->messages->AddMessage('success', 'Review information updated.');
                     } else {
                         $this->messages->AddMessage('error', 'Review information could not be updated.');
                     }
                 }
             }
             // If there are errors, display them
             if ($this->validation->error_string != '') {
                 $this->messages->AddMessage('error', 'We were unable to process the information you submitted for the following reasons:<ul>' . $this->validation->error_string . '</ul>');
             } elseif (count($errors) > 0) {
                 $temp_msg = '';
                 foreach ($errors as $error) {
                     $temp_msg .= '<li>' . $error . '</li>';
                 }
                 $this->messages->AddMessage('error', 'We were unable to process the information you submitted for the following reasons:<ul>' . $temp_msg . '</ul>');
             }
         }
         // Get revision data from model
         $data['revisions'] = $this->review_model->GetReviewContextContentRevisions($organisation, $ContextType);
         $data['show_all_revisions'] = $show_all_revisions;
         $data['user_is_editor'] = $editor_level;
         //get assigned user stuff
         $data['reviewers'] = $this->requests_model->getReporters();
         $data['assigned_user_you'] = $this->pages_model->GetPropertyWikitext('assigned_user_you');
         $data['assigned_user_none'] = $this->pages_model->GetPropertyWikitext('assigned_user_none');
         $data['assigned_user_editor'] = $this->pages_model->GetPropertyWikitext('assigned_user_editor');
         // Get context contents from model
         $data['main_revision'] = $this->review_model->GetReviewContextContents($organisation, $ContextType, $revision_id);
         if ($data['main_revision'] == FALSE) {
             //Error is not needed, as the blanks make it obvious that no review context exists. Nse500
             //$this->messages->AddMessage('error', 'Review context '.$revision_id.' does not exist');
             $data['main_revision']['content_id'] = 0;
             $data['main_revision']['content_blurb'] = '';
             $data['main_revision']['content_quote'] = '';
             $data['main_revision']['average_price'] = '';
             $data['main_revision']['recommended_item'] = '';
             $data['main_revision']['content_rating'] = 5;
             $data['main_revision']['serving_times'] = '';
             $data['main_revision']['deal'] = '';
             $data['main_revision']['deal_expires'] = '';
         }
         //get reviews for areas for attention
         $temp_reviews = $this->review_model->GetOrgReviews($ContextType, $data['organisation']['id']);
         if (is_array($temp_reviews)) {
             foreach ($temp_reviews as $review) {
                 $temp['writers'] = $this->requests_model->GetWritersForArticle($review['id']);
                 $temp['article'] = $this->article_model->GetArticleHeader($review['id']);
                 $temp['article']['id'] = $review['id'];
                 $data['reviews'][] = $temp;
             }
         }
         // Set up the public frame
         $this->main_frame->SetContentSimple('office/reviews/office_review_information', $data);
     }
     $this->main_frame->SetTitleParameters(array('organisation' => $data['organisation']['name'], 'content_type' => ucfirst($ContextType)));
     // Load the public frame view
     $this->main_frame->Load();
 }
 function contacts($action = "viewgroup", $business_card_group = -1)
 {
     if (!CheckPermissions('vip+pr')) {
         return;
     }
     $organisation = VipOrganisation();
     $this->pages_model->SetPageCode('viparea_directory_contacts');
     $editor_level = PermissionsSubset('pr', GetUserLevel()) || PermissionsSubset('vip', GetUserLevel());
     //The pr and vip has all the powers of the editor in the directory, but not in the calendar
     //Get Data And toolbar
     $data = $this->organisations->_GetOrgData($organisation);
     $data['page_information'] = $this->pages_model->GetPropertyWikitext('page_information');
     //Delete group
     if ($this->input->post('group_deletebutton')) {
         $cards = $this->directory_model->GetDirectoryOrganisationCardsByGroupId($this->input->post('group_id'), true);
         if (empty($cards)) {
             $result = $this->businesscards_model->RemoveOrganisationCardGroupById($this->input->post('group_id'));
             if ($result == 1) {
                 $this->messages->AddMessage('success', 'Group was successfully removed.');
             } else {
                 $this->messages->AddMessage('error', 'Group was not removed, the group does not exist.');
             }
         } else {
             $this->messages->AddMessage('error', 'Group was not removed, you cannot remove groups with cards.');
         }
         //set things back to normal
         redirect(vip_url('directory/contacts/'));
     }
     //rename group
     if ($this->input->post('group_renamebutton')) {
         $result = $this->businesscards_model->RenameOrganisationCardGroup($this->input->post('group_id'), $this->input->post('group_name'));
         if ($result == 1) {
             $this->messages->AddMessage('success', 'Group was successfully renamed.');
         } else {
             $this->messages->AddMessage('error', 'Group was not renamed, the group does not exist.');
         }
         redirect(vip_url('directory/contacts/viewgroup/' . $this->input->post('group_id')));
     }
     if ($action == "deletecard") {
         //business_card_group is actually the card id for this action
         if ($editor_level) {
             $result = $this->businesscards_model->DeleteBusinessCard($business_card_group);
             if ($result) {
                 $this->messages->AddMessage('success', 'The contact card was successfully deleted.');
             } else {
                 $this->messages->AddMessage('error', 'The contact card was not removed, it does not exist.');
             }
             redirect(vip_url('directory/contacts/'));
         } else {
             $this->messages->AddMessage('error', 'You do not have permission to delete contact cards.');
         }
     }
     if ($action == "approvecard") {
         //business_card_group is actually the card id for this action
         if ($editor_level) {
             $result = $this->businesscards_model->ApproveBusinessCard($business_card_group);
             if ($result) {
                 $this->messages->AddMessage('success', 'The contact card was successfully approved.');
             } else {
                 $this->messages->AddMessage('error', 'The contact card was not approved, it does not exist.');
             }
             //set things back to normal
             redirect(vip_url('directory/contacts/'));
         } else {
             $this->messages->AddMessage('error', 'You do not have permission to approve contact cards.');
         }
     }
     //Add Groups
     if ($this->input->post('add_group_button')) {
         if (!empty($_POST["group_name"])) {
             $max_order = $this->businesscards_model->SelectMaxGroupOrderById($data['organisation']['id']);
             $post_data = array('group_name' => $_POST["group_name"], 'organisation_id' => $data['organisation']['id'], 'group_order' => $max_order + 1);
             $this->businesscards_model->AddOrganisationCardGroup($post_data);
             $this->messages->AddMessage('success', 'Group was successfully added.');
             redirect(vip_url('directory/contacts/'));
         }
     }
     if (!empty($_POST["card_addbutton"])) {
         if (empty($_POST["card_name"]) || empty($_POST["card_title"])) {
             $this->messages->AddMessage('error', 'Please include a name and a title for your contact card');
             //add failed send the data back into the form
             $data['card_form'] = $_POST;
         } else {
             //find user id if exist
             if (!empty($_POST["card_username"])) {
                 //find user id from username
                 $user_id = $this->businesscards_model->GetUserIdFromUsername($_POST["card_username"]);
             } else {
                 $user_id = "";
             }
             //Send message if username was given and no id found
             if ($user_id == "" && !empty($_POST["card_username"])) {
                 $this->messages->AddMessage('error', 'The user ' . $_POST["card_username"] . ' was not found, you may have spelt the username incorrectly or the user is not on the yorker. You may wish to leave that field blank.');
                 //add failed send the data back into the form
                 $data['card_form'] = $_POST;
             } else {
                 //add contact card
                 //@note start time, end time, order, and image id are all currently null and not in use.
                 $this->businesscards_model->NewBusinessCard($user_id, $_POST["group_id"], null, $_POST["card_name"], $_POST["card_title"], $_POST["card_about"], $_POST["card_course"], $_POST["email"], $_POST["phone_mobile"], $_POST["phone_internal"], $_POST["phone_external"], $_POST["postal_address"], 0, null, null, 1);
                 //@note the 1 in the last parameter forces the card to be published when it is created. Beta only.
                 $this->messages->AddMessage('success', 'The contact card was successfully added.');
             }
             redirect(vip_url('directory/contacts/viewgroup/' . $_POST["group_id"]));
         }
     }
     if (!empty($data)) {
         $this->_SetupOrganisationNavbar();
         // Business Card Groups
         $groups = $this->directory_model->GetDirectoryOrganisationCardGroups($organisation);
         // translate into nice names for view
         $data['organisation']['groups'] = array();
         foreach ($groups as $group) {
             $data['organisation']['groups'][] = array('name' => $group['business_card_group_name'], 'href' => vip_url('directory/contacts/viewgroup/' . $group['business_card_group_id']), 'id' => $group['business_card_group_id']);
             if ($business_card_group == -1) {
                 $business_card_group = $group['business_card_group_id'];
             }
             $data['current_group']['id'] = $business_card_group;
             if ($group['business_card_group_id'] == $business_card_group) {
                 $data['current_group']['name'] = $group['business_card_group_name'];
             }
         }
         //Make sure there are some groups to prevent view break on none.
         if (empty($groups)) {
             $data['no_groups'] = true;
         } else {
             $data['no_groups'] = false;
         }
         // Members data
         $members = $this->directory_model->GetDirectoryOrganisationCardsByGroupId($business_card_group, true);
         // translate into nice names for view
         $data['organisation']['cards'] = array();
         foreach ($members as $member) {
             $data['organisation']['cards'][] = array('user_id' => $member['business_card_user_entity_id'], 'id' => $member['business_card_id'], 'name' => $member['business_card_name'], 'title' => $member['business_card_title'], 'course' => $member['business_card_course'], 'blurb' => $member['business_card_blurb'], 'email' => $member['business_card_email'], 'image_id' => $member['business_card_image_id'], 'phone_mobile' => $member['business_card_mobile'], 'phone_internal' => $member['business_card_phone_internal'], 'phone_external' => $member['business_card_phone_external'], 'postal_address' => $member['business_card_postal_address'], 'approved' => $member['business_card_approved']);
         }
         //Put the view in edit mode
         $data['organisation']['editmode'] = true;
         // Set up the directory view
         $the_view = $this->frames->view('directory/viparea_directory_view_members', $data);
         // Set up the public frame
         $this->main_frame->SetTitleParameters(array('organisation' => $data['organisation']['name']));
         $this->main_frame->SetPage('contacts');
         $this->main_frame->SetContent($the_view);
     } else {
         $this->load->library('custom_pages');
         $this->main_frame->SetContent(new CustomPageView('directory_notindirectory', 'error'));
     }
     // Load the public frame view
     $this->main_frame->Load();
 }
" method="post">
	<div class="BlueBox">
		<h2>about</h2>
		<div id="name_details">
		<p>
			Organisation name : <strong><?php 
echo xml_escape($organisation['name']);
?>
</strong><br />
			Organisation type : <strong><?php 
echo xml_escape($organisation['type']);
?>
</strong><br />
		</p>
<?php 
if (PermissionsSubset('pr', GetUserLevel())) {
    ?>
		<form>
			<fieldset>
				<input name="name_edit_button" type="button" onclick="document.getElementById('name_details').style.display = 'none'; document.getElementById('name_details_form').style.display = 'block';" value="Edit" class="button" />
			</fieldset>
		</form>
		</div>
		<div id="name_details_form" style="display: none;">
			<form id="org_name" action="<?php 
    echo vip_url('directory/information/changename');
    ?>
" method="post">
				<fieldset>
					<label for="organisation_name">Name:</label>
						<input type="text" name="organisation_name" id="organisation_name" value="<?php 
 function edit($game_id = -1)
 {
     if ($game_id == -1) {
         redirect('office/games');
     }
     if (!CheckPermissions('office')) {
         return;
     }
     $data['is_editor'] = PermissionsSubset('editor', GetUserLevel());
     $this->pages_model->SetPageCode('office_games_edit');
     $this->load->library('image');
     $data['section_games_edit_page_info_title'] = $this->pages_model->GetPropertyText('section_games_edit_page_info_title');
     $data['section_games_edit_page_info_text'] = $this->pages_model->GetPropertyWikiText('section_games_edit_page_info_text');
     if (isset($_POST['game_title_field']) && isset($_POST['game_width_field']) && isset($_POST['game_height_field'])) {
         if ($this->games_model->Edit_Game_Update($game_id, $_POST['game_title_field'], $_POST['game_width_field'], $_POST['game_height_field'], PermissionsSubset('editor', GetUserLevel()) and isset($_POST['game_activated_field']))) {
             $this->main_frame->AddMessage('success', 'Changes saved!', FALSE);
         } else {
             $this->main_frame->AddMessage('error', 'Update failed!', FALSE);
         }
     }
     $data['game'] = $this->games_model->Edit_Game_Get($game_id);
     $data['game']['pathname'] = $this->config->item('static_web_address') . '/games/' . $data['game']['filename'];
     $data['game']['image'] = $this->image->getImage($data['game']['image_id'], 'gamethumb', array('title' => $data['game']['title']));
     $data['game_id'] = $game_id;
     $this->main_frame->SetContentSimple('office/games/edit', $data);
     $this->main_frame->Load();
 }
 function editinfo($campaign_id)
 {
     if (!CheckPermissions('office')) {
         return;
     }
     //set the page code and load the required models
     $this->pages_model->SetPageCode('office_campaign_edit');
     $this->load->model('campaign_model', 'campaign_model');
     //Get navigation bar and tell it the current page
     $this->_SetupNavbar($campaign_id);
     $this->main_frame->SetPage('info');
     //get charity from given id
     $data['campaign']['name'] = $this->campaign_model->GetCampaignNameID($campaign_id);
     $data['campaign']['id'] = $campaign_id;
     //get the current users id and office access
     $data['user']['id'] = $this->user_auth->entityId;
     $data['user']['is_editor'] = PermissionsSubset('editor', GetUserLevel());
     // Set up the view
     $the_view = $this->frames->view('office/campaign/info', $data);
     // Set up the public frame
     $this->main_frame->SetTitleParameters(array('name' => $data['campaign']['name']));
     $this->main_frame->SetContent($the_view);
     // Load the public frame view
     $this->main_frame->Load();
 }
            unset($links[$i]);
        }
    }
    if (count($links) == 0) {
        return;
    }
    echo '				<ul' . ($firstMenu ? ' class="first"' : '') . '>' . "\n";
    echo '					<li class="first">' . $title . '</li>' . "\n";
    foreach ($links as $link) {
        echo '					<li><a href="' . $link[1] . '">' . $link[0] . '</a></li>' . "\n";
    }
    echo '				</ul>' . "\n";
}
printMenu($this, 'Office', array(array('Office Home', '/office', ''), array('Office Chat', '/office/irc', 'IRC_CHAT'), array('My Bylines', '/office/bylines', 'BYLINES_VIEW')), true);
// Editor and Admins only
if (PermissionsSubset('editor', GetUserLevel())) {
    printMenu($this, 'Admin', array(array('Announcements', '/office/announcements', 'ANNOUNCEMENT_VIEW'), array('Permissions', '/admin/permissions', 'PERMISSIONS_VIEW'), array('Manage Team', '/office/manage/members', 'MANAGE'), array('Manage VIPs', '/office/vipmanager', 'VIPMANAGER_VIEW'), array('Content Schedule', '/office/news/contentschedule', 'ARTICLE_VIEW'), array('Change Live Article', '/office/news/scheduledlive', 'ARTICLE_VIEW'), array('Comment Moderation', '/office/moderator', 'COMMENT_MODERATE'), array('Page Properties', '/admin/pages', 'PAGES_VIEW'), array('Statistics', '/office/stats', 'STATS_VIEW'), array('Feedback', '/admin/feedback', 'FEEDBACK_VIEW'), array('Article Types', '/office/articletypes', 'ARTICLETYPES_VIEW'), array('Special Articles', '/office/specials', 'ARTICLE_VIEW'), array('Facebook Articles', '/office/ticker', 'ARTICLE_VIEW'), array('Advertising', '/office/advertising', 'ADVERTISING_VIEW'), array('Polls', '/office/polls', 'POLLS_VIEW')));
}
printMenu($this, 'Sections', array(array('Uni News', '/office/news/uninews', 'ARTICLE_VIEW'), array('Features', '/office/news/features', 'ARTICLE_VIEW'), array('Lifestyle', '/office/news/lifestyle', 'ARTICLE_VIEW'), array('Arts', '/office/news/arts', 'ARTICLE_VIEW'), array('Sport', '/office/news/sport', 'ARTICLE_VIEW'), array('Blogs', '/office/news/blogs', 'ARTICLE_VIEW'), array('Food', '/office/news/food', 'ARTICLE_VIEW'), array('Videocasts', '/office/news/videocasts', 'ARTICLE_VIEW'), array('News Comment', '/office/news/comment', 'ARTICLE_VIEW'), array('Podcasts', '/office/podcasts', 'ARTICLE_VIEW')));
printMenu($this, 'Info + Reviews', array(array('Directory', '/office/prlist', ''), array('Food', '/office/reviewlist/foodreviews', ''), array('Drink', '/office/reviewlist/drinkreviews', ''), array('Review Tags', '/office/reviewtags', ''), array('Leagues', '/office/leagues', ''), array('PR System', '/office/pr/summary', ''), array('Campaigns', '/office/campaign', 'CAMPAIGN_VIEW'), array('Charities', '/office/charity', 'CHARITY_VIEW'), array('How Do I', '/office/howdoi', 'HOWDOI_VIEW'), array('Game Zone', '/office/games', 'GAMEZONE_VIEW')));
printMenu($this, 'Photos', array(array('Photo Requests', '/office/photos', 'GALLERY_VIEW'), array('Gallery', '/office/gallery', 'GALLERY_VIEW'), array('Homepage Banners', '/office/banners', 'BANNERS_VIEW')));
printMenu($this, 'Homepage', array(array('Quotes', '/office/quotes', 'QUOTES_VIEW'), array('Links', '/office/links', 'LINKS_VIEW'), array('Style Guide', '/office/guide', 'ARTICLE_VIEW')));
?>
					<?php 
if (isset($extra_menu_buttons) && !empty($extra_menu_buttons)) {
    echo '<ul>';
    foreach ($extra_menu_buttons as $key => $button) {
        echo '<li' . (!$key ? ' class="first"' : '') . '>';
        if (is_string($button)) {
            echo $button;
        } else {
 function __construct()
 {
     parent::__construct('templates/list');
     $config = get_instance()->config->item('comments');
     $this->SetData('Mode', $config['edit']['moderator'] && PermissionsSubset('moderator', GetUserLevel()) ? 'mod' : null);
     $this->SetData('Threaded', true);
     $this->mMaxPerPage = $config['max_per_page'];
 }