예제 #1
0
 public function __construct()
 {
     parent::__construct('formEditEvent', 'Edit Event');
     $event = $this->getEvent();
     $isAdmin = Session::getUser()->hasPriv('MODERATE_EVENTS');
     $isOwner = Session::getUser()->getData('organization') == $event['organizer'];
     if (!$isAdmin && !$isOwner) {
         throw new Exception('You do not have the privs for this.');
     } else {
         if ($isAdmin) {
             $el = FormHelpers::getOrganizerList(true);
             $el->setValue($event['organizer']);
             $this->addElement($el);
         }
     }
     $this->addElement(Element::factory('hidden', 'id', 'event id', $event['id']));
     $this->addElement(Element::factory('text', 'title', 'Title', $event['title']));
     if ($isAdmin) {
         $this->addElement(FormHelpers::getVenueListElement(null, true));
     } else {
         $this->addElement(FormHelpers::getVenueListElement(Session::getUser()->getData('organization'), true));
     }
     $this->getElement('venue')->setValue($event['venue']);
     $this->addElement(Element::factory('text', 'dateStart', 'Start', $event['dateStart']));
     $this->addElement(Element::factory('text', 'dateFinish', 'Finish', $event['dateFinish']));
     $this->addScript('$("#formEditEvent-dateStart").datetime({"firstDay": 1 })');
     $this->addScript('$("#formEditEvent-dateFinish").datetime({"firstDay": 2 })');
     $this->addElement(Element::factory('numeric', 'priceOnDoor', 'Ticket price on the door', $event['priceOnDoor']));
     $this->addElement(Element::factory('numeric', 'priceInAdv', 'Ticket price in advance', $event['priceInAdv']));
     $this->addElement($this->getElementCurrency($event['currency']));
     $this->addElement(Element::factory('text', 'website', 'Event website', $event['website']));
     $this->addElement(Element::factory('checkbox', 'showers', 'Showers', $event['showers']));
     $this->addElement($this->getElementSleeping($event['sleeping']));
     $this->addElement(Element::factory('checkbox', 'alcohol', 'Bring your own alcohol?', $event['alcohol']));
     $this->addElement(Element::factory('checkbox', 'smoking', 'Smoking area?', $event['smoking']));
     $this->addElement(Element::factory('numeric', 'networkMbps', 'Network (mbps)', $event['networkMbps']));
     $this->getElement('networkMbps')->addSuggestedValue('100', 'Old 100 meg network');
     $this->getElement('networkMbps')->addSuggestedValue('1000', 'Shiny Gigabit network');
     $this->addElement(Element::factory('numeric', 'internetMbps', 'Internet (mbps)', $event['internetMbps'], 'If you have an internet connection, what speed is it? Enter 0 for no connection.'));
     $this->getElement('internetMbps')->addSuggestedValue('0', 'No internet!');
     $this->getElement('internetMbps')->addSuggestedValue('2', '2mbps');
     $this->getElement('internetMbps')->addSuggestedValue('8', '8mbps');
     $this->addElement(Element::factory('numeric', 'numberOfSeats', 'Number of seats', $event['numberOfSeats']));
     $this->addElement(Element::factory('textarea', 'blurb', 'Additional blurb', htmlify($event['blurb'])));
     $this->addButtons(Form::BTN_SUBMIT);
 }
예제 #2
0
 public function __construct()
 {
     parent::__construct('formEditVenue', 'Edit Venue');
     $venue = $this->getVenue();
     if (Session::getUser()->getData('organization') != $venue['organizer']) {
         Session::requirePriv('EDIT_VENUE');
     }
     $this->addElement(Element::factory('hidden', 'id', null, $venue['id']));
     $this->addElement(Element::factory('text', 'title', 'Title', $venue['title']));
     $this->addElement(Element::factory('text', 'lat', 'Lat', $venue['lat']));
     $this->getElement('lat')->setMinMaxLengths(1, 10);
     $this->addElement(Element::factory('text', 'lng', 'Lng', $venue['lng']));
     $this->getElement('lng')->setMinMaxLengths(1, 10);
     $this->addElement(FormHelpers::getElementCountry($venue['country']));
     $this->addElement(FormHelpers::getOrganizerList());
     $this->getElement('organizer')->setValue($venue['organizer']);
     $this->addButtons(Form::BTN_SUBMIT);
 }
예제 #3
0
 public function __construct()
 {
     parent::__construct('newVenue', 'New Venue');
     $this->addElement(Element::factory('html', 'desc', null, 'A venue is a physical place where an event will be hosted, this may be a convention centre, a hall or just your house. You can specify detail such as sleeping arangements when the event is created.'));
     $this->addElement(Element::factory('text', 'title', 'Title', null, 'eg: Budleigh Salterton town hall, Cheltenham Racecourse, etc.'));
     $this->addElement(FormHelpers::getElementCountry('United Kingdom'));
     $this->addElement(Element::factory('html', 'locationDesc', null, '<br />The geodetic (WGS84) latitude/longitude of your venue. This can be awkward, but it allows us to put a pin on the map. We cannot use post/zip codes because many countries do not have them! <a href = "http://www.getlatlon.com/">http://getlatlong.com</a> will convert an address to a rough lat/lng. '));
     $this->addElement(Element::factory('numeric', 'lat', 'Latitude'))->setAllowNegative(true);
     $this->addElement(Element::factory('numeric', 'lng', 'Longitude'))->setAllowNegative(true);
     if (Session::hasPriv('NEW_VENUE')) {
         $this->addElement(FormHelpers::getOrganizerList());
         if (isset($_REQUEST['formNewVenue-organizer'])) {
             $this->getElement('organizer')->setValue($_REQUEST['formNewVenue-organizer']);
         }
     }
     $this->addButtons(Form::BTN_SUBMIT);
     $this->requireFields(array('title', 'lat', 'lng', 'country'));
 }
예제 #4
0
 public function __construct()
 {
     parent::__construct('formEditUser', 'Edit User');
     $user = $this->getUser();
     $this->addElementReadOnly('Username', $user['username']);
     $this->addElement(Element::factory('text', 'email', 'Email Address', $user['email']));
     $this->getElement('email')->setMinMaxLengths(0, 64);
     $this->addElement(Element::factory('text', 'usernameSteam', 'Steam Username', $user['usernameSteam'], 'Plaese do include your Steam username - its a good way for us to get in contact.'));
     $this->getElement('usernameSteam')->setMinMaxLengths(0, 64);
     $this->addElement(Element::factory('hidden', 'uid', null, $user['id']));
     if (Session::hasPriv('EDIT_USER')) {
         $this->addElement(Element::factory('html', null, null, 'Admin fields'));
         $this->addElement($this->getGroupSelectionElement($user['group']));
         $this->addElement(FormHelpers::getOrganizerList(true));
         $this->getElement('organizer')->setValue($user['organization']);
         $this->addElement(Element::factory('password', 'password', 'New Password'));
         $this->getElement('password')->setOptional(true);
     }
     $this->addButtons(Form::BTN_SUBMIT);
 }
예제 #5
0
 public function __construct()
 {
     parent::__construct('formNewEvent', 'New Event');
     if (Session::getUser()->hasPriv('CREATE_EVENTS')) {
         $this->addElement(Element::factory('html', 'msg', null, 'Hi superuser.'));
         if (isset($_REQUEST['formNewEvent-organizer'])) {
             $organizerId = intval($_REQUEST['formNewEvent-organizer']);
             $this->addElement(Element::factory('hidden', 'organizer', 'Organizer', $organizerId));
             $this->addElement(FormHelpers::getVenueListElement($organizerId));
         } else {
             $this->addElement(FormHelpers::getOrganizerList(true));
             $this->addElement(FormHelpers::getVenueListElement());
         }
     } else {
         if (Session::getUser()->getData('organization')) {
             $organizer = fetchOrganizer(Session::getUser()->getData('organization'));
             if ($organizer['published']) {
                 $this->addElement(Element::factory('html', 'msg', null, 'You are authorized to create public events for your organization.'));
             } else {
                 $this->addElement(Element::factory('html', 'msg', null, 'Your event will be linked to your organization, but will not be public until your organization has been approved.'));
             }
             try {
                 $this->addElement(FormHelpers::getVenueListElement(Session::getUser()->getData('organization')));
             } catch (Exception $e) {
                 redirect('account.php', 'Create a venue first!');
             }
         } else {
             $this->addElement(Element::factory('html', 'msg', null, 'You can create events, but they will not appear in public lists until approved.'));
         }
     }
     $this->addElement(Element::factory('text', 'title', 'Title', null, 'eg: MyLan 2011'));
     $this->addElement(Element::factory('text', 'eventWebsite', 'Event specific URL', null, 'A URL to the event webpage on the organizer website would be useful.'));
     $this->getElement('eventWebsite')->setMinMaxLengths(0, 256);
     $this->addElement(Element::factory('text', 'dateStart', 'Start date'));
     $this->addElement(Element::factory('text', 'dateFinish', 'Finish date'));
     $this->addElement(Element::factory('html', 'protip', null, '<strong style = "text-decoration: blink; color: red;">Protip:</strong> You can edit this event and add much more detail after you have created it. '));
     $this->addScript('$("#formNewEvent-dateStart").datetime({chainTo: "#formNewEvent-dateFinish", stepMins: 15, first: 3})');
     $this->addButtons(Form::BTN_SUBMIT);
     $this->requireFields(array('title'));
 }
예제 #6
0
FormHelpers::checkError('message', $errors);
?>
</div>
</div>
<div class="form-field">
    <strong>Phone Number:</strong>
    <div class="descr">Phone number, no dashes (e.g. 1234567890).</div>
    <?php 
FormHelpers::createText('number', $channel->getNumber());
?>
    <div class="error"><?php 
FormHelpers::checkError('number', $errors);
?>
</div>
</div>
<div class="form-field">
    <strong>Carrier:</strong>
    <div class="descr">Mobile carrier.</div>
    <?php 
$options = array();
foreach (array_keys(SmsChannel::$carriers) as $c) {
    $options[] = FormHelpers::getOption($c, $c, $channel->getCarrier() == $c ? 'selected="selected"' : null);
}
FormHelpers::createSelect('carrier', $options);
?>
    <div class="error"><?php 
FormHelpers::checkError('number', $errors);
?>
</div>
</div>
예제 #7
0
	<div class="panel-heading">
		<h3 class="panel-title">Edit Site User</h3>
	</div>
	<div class="panel-body">
		<?php 
echo FormHelpers::getReadOnlyTxtInput("Name", $additionalForm['name']);
?>
		<?php 
echo FormHelpers::getReadOnlyTxtInput("First Name", $additionalForm['firstName']);
?>
		<?php 
echo FormHelpers::getReadOnlyTxtInput("Last Name", $additionalForm['lastName']);
?>
		<?php 
echo FormHelpers::getFormCheckInput(1, "Banned", "banned", $form['banned'] === "y", $formErrors);
?>
	</div>
	<div class="panel-footer clearfix">
		<div class="pull-left">
			<?php 
echo FormHelpers::getFormSubmitButton(1, "Update Site User", "", true, "");
?>
		</div>
		<div class="pull-right">
			<a type="button" class="btn btn-default" data-confirm="Are you sure you want to cancel?" href="<?php 
echo e($cancelUri);
?>
">Cancel</a>
		</div>
	</div>
</div>
예제 #8
0
 public static function getButtonGroupInput($formId, $txt, $name, $val, $formErrors, $optionRequired, $buttonsData)
 {
     return self::getFormGroupStart($name, $formErrors) . '<label class="control-label">' . e($txt) . '</label>' . self::getButtonGroupElement($formId, $name, $val, $optionRequired, $buttonsData) . FormHelpers::getErrMsgHTML($formErrors, $name) . '</div>';
 }
예제 #9
0
    }
    ?>
</td>
				</tr>
			<?php 
}
?>
				<?php 
if ($editEnabled) {
    ?>
				<tr>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td class="action-col"><a type="button" class="btn btn-xs btn-primary" href="<?php 
    echo e($createUri);
    ?>
">Create</a></td>
				</tr>
				<?php 
}
?>
			</tbody>
		</table>
		<?php 
echo FormHelpers::getFormPageSelectionBar($pageNo, $noPages);
?>
	</div>
</div>
예제 #10
0
    echo e($mediaItemId);
    ?>
">
			<?php 
    if (!is_null($vodControlData)) {
        ?>
			<div class="panel panel-default vod-control">
				<div class="panel-heading">
					<h4 class="panel-title">Admin: Video On Demand</h4>
				</div>
				<div class="panel-collapse collapse">
					<div class="panel-body">
						<div class="my-row vod-upload-row">
							<div>Video:</div>
							<?php 
        echo FormHelpers::getFileUploadRawElement("vod-upload-component", $vodControlData['uploadPointId'], $vodControlData['info']['name'], $vodControlData['info']['size'], $vodControlData['fileId'], $vodControlData['info']['processState'], $vodControlData['info']['processPercentage'], $vodControlData['info']['processMsg']);
        ?>
						</div>
					</div>
				</div>
			</div>
			<?php 
    }
    ?>
			<?php 
    if (!is_null($streamControlData)) {
        ?>
			<div class="panel panel-default stream-control" data-beingrecordedforvod="<?php 
        echo $beingRecordedForVod ? "1" : "0";
        ?>
">
예제 #11
0
?>
</div>
    </div>
<div class="form-field">
    <strong>Message Format:</strong>
    <div class="descr">Format of message to send.</div>
    <?php 
if ($channel->getMessageFormat()) {
    $msg = $channel->getMessageFormat();
} else {
    $msg = '%s:%d (%s) is offline.';
}
FormHelpers::createTextArea('message', $msg, 'rows="5" cols="100"');
?>
    <div class="error"><?php 
FormHelpers::checkError('message', $errors);
?>
</div>
</div>
<div class="form-field">
    <strong>Address:</strong>
    <div class="descr">Properly formatted e-mail address.</div>
    <?php 
FormHelpers::createText('address', $channel->getAddress(), 'size="40"');
?>
    <div class="error"><?php 
FormHelpers::checkError('address', $errors);
?>
</div>
</div>
예제 #12
0
echo FormHelpers::getFormTxtAreaInput(1, "Description (Optional)", "description", $form['description'], $formErrors);
?>
		<?php 
echo FormHelpers::getFormUploadInput(1, $coverArtUploadPointId, "Cover Art (Optional) (Should Be 16:9)", "cover-art-id", $form['cover-art-id'], $formErrors, $additionalForm['coverArtFile']['name'], $additionalForm['coverArtFile']['size'], $additionalForm['coverArtFile']['processState'], $additionalForm['coverArtFile']['processPercentage'], $additionalForm['coverArtFile']['processMsg']);
?>
		<?php 
echo FormHelpers::getFormGroupStart("urls", $formErrors);
?>
<label class="control-label">Urls and Qualities</label><div class="form-control form-urls" data-initialdata="<?php 
echo e($additionalForm['urlsInitialData']);
?>
"></div><?php 
echo FormHelpers::getFormHiddenInput(1, "urls", $additionalForm['urlsInput']);
echo FormHelpers::getErrMsgHTML($formErrors, "urls");
?>
</div>
	</div>
	<div class="panel-footer clearfix">
		<div class="pull-left">	
			<?php 
echo FormHelpers::getFormSubmitButton(1, ($editing ? "Update" : "Create") . " Live Stream", "", true, "");
?>
		</div>
		<div class="pull-right">
			<a type="button" class="btn btn-default" data-confirm="Are you sure you want to cancel?" href="<?php 
echo e($cancelUri);
?>
">Cancel</a>
		</div>
	</div>
</div>
예제 #13
0
<div class="form-field">
    <strong>Timeout:</strong>
    <div class="descr">The number of seconds until a connection attempt times out.</div>
    <?php 
FormHelpers::createText('timeout', $monitor->getTimeout(), 'size="3"');
?>
    <div class="error"><?php 
FormHelpers::checkError('timeout', $errors);
?>
</div>
</div>
예제 #14
0
FormHelpers::checkError('message', $errors);
?>
</div>
</div>
<div class="form-field">
    <strong>Phone Number:</strong>
    <div class="descr">Phone number, no dashes (e.g. 1234567890).</div>
    <?php 
FormHelpers::createText('number', $channel->getNumber());
?>
    <div class="error"><?php 
FormHelpers::checkError('number', $errors);
?>
</div>
</div>
<div class="form-field">
    <strong>Carrier:</strong>
    <div class="descr">Mobile carrier.</div>
    <?php 
$options = array();
foreach (array_keys(SmsChannel::$carriers) as $c) {
    $options[] = FormHelpers::getOption($c, urlencode($c), $channel->getCarrier() == $c ? 'selected="selected"' : null);
}
FormHelpers::createSelect('carrier', $options);
?>
    <div class="error"><?php 
FormHelpers::checkError('carrier', $errors);
?>
</div>
</div>
예제 #15
0
		<p>You are logged out.</p>
		<p><a class="btn btn-info" href="<?php 
    echo e(URL::to("/admin/login"));
    ?>
">Click Here To Login</a></p>
		<?php 
}
?>
		<?php 
if ($showCosignLogoutButton) {
    ?>
		<p>You are <?php 
    echo !$loggedIn ? " still" : "also";
    ?>
 logged into cosign.</p>
		<?php 
    if ($loggedIn) {
        ?>
		<p><em>Logging out of cosign will not log you out of the control panel.</em></p>
		<?php 
    }
    ?>
		<p><?php 
    echo FormHelpers::getFormSubmitButton(2, "Click Here To Log Out Of Cosign", "", true);
    ?>
</p>
		<?php 
}
?>
	</div>
</div>
예제 #16
0
echo FormHelpers::getFormHiddenInput(1, "playlist-content", $additionalForm['playlistContentInput']);
echo FormHelpers::getErrMsgHTML($formErrors, "playlist-content");
?>
</div>
	
		<?php 
echo FormHelpers::getFormGroupStart("related-items", $formErrors);
?>
<label class="control-label">Related Media Items</label><div class="form-control form-related-items" data-initialdata="<?php 
echo e($additionalForm['relatedItemsInitialData']);
?>
"></div><?php 
echo FormHelpers::getFormHiddenInput(1, "related-items", $additionalForm['relatedItemsInput']);
echo FormHelpers::getErrMsgHTML($formErrors, "related-items");
?>
</div>
	</div>
	<div class="panel-footer clearfix">
		<div class="pull-left">
			<?php 
echo FormHelpers::getFormSubmitButton(1, ($editing ? "Update" : "Create") . " Playlist", "", true, "");
?>
		</div>
		<div class="pull-right">
			<a type="button" class="btn btn-default" data-confirm="Are you sure you want to cancel?" href="<?php 
echo e($cancelUri);
?>
">Cancel</a>
		</div>
	</div>
</div>
예제 #17
0
    } else {
        ?>
		<p><button class="btn btn-default" type="button" disabled>Login With Cosign (Currently Unavailable)</button></p>
		<?php 
    }
    ?>
		<h3>Login With Username and Password</h3>
		<p>Login with a username and password assigned to you for this control panel. <strong>This is not your university login.</strong></p>
		<?php 
    echo FormHelpers::getFormTxtInput(1, "Username", "user", $form['user'], $formErrors);
    ?>
		<?php 
    echo FormHelpers::getFormPassInput(1, "Password", "pass", $form['pass'], $formErrors);
    ?>
		<p><?php 
    echo FormHelpers::getFormSubmitButton(1, "Login", "", true);
    ?>
</p>
		<?php 
} else {
    ?>
		<?php 
    if ($accountDisabled) {
        ?>
		<p>You are logged in but your account is currently disabled. Please contact an admin.</p>
		<?php 
    } else {
        ?>
		<p>You are logged in!</p>
		<p><a href="<?php 
        echo e(URL::to("/admin/dashboard"));
예제 #18
0
?>
		<?php 
echo FormHelpers::getFormTxtInput(1, "Key", "key", $form['key'], $formErrors);
?>
		<?php 
echo FormHelpers::getFormTxtAreaInput(1, "Information (Optional)", "information", $form['information'], $formErrors);
?>
		<?php 
echo FormHelpers::getFormCheckInput(1, "Can View VOD Uris", "can-view-vod-uris", $form['can-view-vod-uris'] === "y", $formErrors);
?>
		<?php 
echo FormHelpers::getFormCheckInput(1, "Can View Stream Uris", "can-view-stream-uris", $form['can-view-stream-uris'] === "y", $formErrors);
?>
		<?php 
echo FormHelpers::getFormCheckInput(1, "Can Use Webhooks", "can-use-webhooks", $form['can-use-webhooks'] === "y", $formErrors);
?>
	</div>
	<div class="panel-footer clearfix">
		<div class="pull-left">
			<?php 
echo FormHelpers::getFormSubmitButton(1, ($editing ? "Update" : "Create") . " API User", "", true, "");
?>
		</div>
		<div class="pull-right">
			<a type="button" class="btn btn-default" data-confirm="Are you sure you want to cancel?" href="<?php 
echo e($cancelUri);
?>
">Cancel</a>
		</div>
	</div>
</div>
예제 #19
0
 public static function createButton($value, $attribs = null)
 {
     p('<input type="button" value="' . $value . '"' . FormHelpers::optional($attribs) . ' />');
 }
예제 #20
0
<?php

$monitor = Monitor::fetch(intval($_GET['id']));
if (FormHelpers::donePOST()) {
    $monitor->processDelete($_GET);
    ?>
<div class="message">
    The monitor has been deleted. <br />
    <a href="?page=monitors">Return to monitors</a>
</div>
        <?
    }
    else
    {
?>
<div class="form-field">
</div>
<?php 
    FormHelpers::startForm('POST', '?page=monitor-delete&id=' . $monitor->getId());
    FormHelpers::createHidden('confirmed', '1');
    ?>
<center>
    Are you sure you want to delete this monitor?<br />
    <?php 
    FormHelpers::createSubmit('Yes');
    ?>
</center>
<?php 
    FormHelpers::endForm();
}
FormHelpers::createRadio('match_method', HttpValidationMonitor::$MATCH_REGEX, $monitor->getMatchMethod() == HttpValidationMonitor::$MATCH_REGEX ? 'checked="checked"' : '');
?>
 Use regular expressions (Will error if
    invalid pattern.  See <a href="http://www.php.net/manual/en/pcre.pattern.php" target="_new">Reference</a>)</li>
    </ul>
    <div class="error"><?php 
FormHelpers::checkError('match_method', $errors);
?>
</div>
</div
><div class="form-field">
    <strong>Condition:</strong>
    <div class="descr">What condition must be met for the monitor to be considered online?</div>
    <ul class="options">
    <li><?php 
FormHelpers::createRadio('mode', HttpValidationMonitor::$MODE_DOES_CONTAIN, $monitor->getMode() == HttpValidationMonitor::$MODE_DOES_CONTAIN ? 'checked="checked"' : '');
?>
 The monitor <strong>must</strong> contain
    the pattern.</li>
    <li><?php 
FormHelpers::createRadio('mode', HttpValidationMonitor::$MODE_DOESNT_CONTAIN, $monitor->getMode() == HttpValidationMonitor::$MODE_DOESNT_CONTAIN ? 'checked="checked"' : '');
?>
 The monitor must <strong>not</strong>
    contain the pattern.</li>
    </ul>
    <div class="error"><?php 
FormHelpers::checkError('mode', $errors);
?>
</div>
</div>