Пример #1
0
 static function addEventType($inputs)
 {
     $eventType = new EventTypes();
     $eventType->name = $inputs['eventTypeName'];
     $eventType->created_by = Session::get('userId');
     $eventType->created_at = date("Y-m-d H:i:s");
     $eventType->save();
     return $eventType;
 }
Пример #2
0
 public function __construct($options = null)
 {
     $staffregions = new StaffRegions();
     $staffregions_options = $staffregions->getOptions();
     $eventtypes = new EventTypes();
     $event_options = $eventtypes->getTypes();
     $orgs = array('PAS' => 'The Portable Antiquities Scheme', 'BM' => 'The British Museum', 'MLA' => 'MLA', 'HLF' => 'Heritage Lottery Fund', 'IFA' => 'Institute of Archaeology', 'CBA' => 'Council for British Archaeology', 'ARCH' => 'Current Archaeology', 'AF' => 'The Art Fund', 'LOC' => 'Local museum', 'NADFAS' => 'NADFAS', 'CASPAR' => 'CASPAR');
     ZendX_JQuery::enableForm($this);
     parent::__construct($options);
     $this->setAttrib('accept-charset', 'UTF-8');
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $this->setName('event');
     $eventTitle = new Zend_Form_Element_Text('eventTitle');
     $eventTitle->setLabel('Event title: ')->setRequired(true)->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 70)->setDecorators($decorators);
     $eventDescription = new Pas_Form_Element_RTE('eventDescription');
     $eventDescription->setLabel('Event description: ')->setRequired(true)->addFilters('StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph')->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds');
     $address = new Zend_Form_Element_Text('eventLocation');
     $address->setLabel('Address: ')->setRequired(true)->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setAttrib('size', 70)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators);
     $eventStartTime = new Zend_Form_Element_Text('eventStartTime');
     $eventStartTime->setLabel('Event start time: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator(new Zend_Validate_Date('H:i:s'))->setDecorators($decorators);
     $eventEndTime = new Zend_Form_Element_Text('eventEndTime');
     $eventEndTime->setLabel('Event end time: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator(new Zend_Validate_Date('H:i:s'))->setDecorators($decorators);
     $eventStartDate = new ZendX_JQuery_Form_Element_DatePicker('eventStartDate');
     $eventStartDate->setLabel('Event start date: ')->setRequired(false)->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Date')->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->removeDecorator('DtDdWrapper');
     $eventEndDate = new ZendX_JQuery_Form_Element_DatePicker('eventEndDate');
     $eventEndDate->setLabel('Event end date: ')->setRequired(false)->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Date')->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->removeDecorator('DtDdWrapper');
     $eventRegion = new Zend_Form_Element_Select('eventRegion');
     $eventRegion->setLabel('Organising section: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('stringLength', false, array(1, 10))->addValidator('inArray', false, array(array_keys($staffregions_options)))->addMultiOptions($staffregions_options)->setDecorators($decorators);
     $eventType = new Zend_Form_Element_Select('eventType');
     $eventType->setLabel('Type of event: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('stringLength', false, array(1, 10))->addValidator('inArray', false, array(array_keys($event_options)))->addMultiOptions($event_options)->setDecorators($decorators);
     $adultsAttend = new Zend_Form_Element_Text('adultsAttend');
     $adultsAttend->setLabel('Adults attending: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->setDecorators($decorators);
     $childrenAttend = new Zend_Form_Element_Text('childrenAttend');
     $childrenAttend->setLabel('Children attending: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->setDecorators($decorators);
     $organisation = new Zend_Form_Element_Select('organisation');
     $organisation->setLabel('Organised by: ')->setRequired(false)->setValue('PAS')->addFilters(array('StripTags', 'StringTrim'))->addMultioptions(array(NULL => 'Choose an organisation', 'Available institutions' => array($orgs)))->addValidator('InArray', false, array(array_keys($orgs)))->setDecorators($decorators);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60);
     $this->addElement($hash);
     $this->addElements(array($eventTitle, $eventDescription, $eventStartTime, $eventEndTime, $eventStartDate, $eventEndDate, $organisation, $childrenAttend, $eventRegion, $adultsAttend, $address, $eventType, $submit));
     $this->addDisplayGroup(array('eventTitle', 'eventDescription', 'eventLocation', 'eventStartTime', 'eventEndTime', 'eventStartDate', 'eventEndDate', 'eventRegion', 'organisation', 'childrenAttend', 'adultsAttend', 'eventType'), 'details')->removeDecorator('HtmlTag');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->removeDecorator('HtmlTag');
     $this->addDisplayGroup(array('submit'), 'submit');
     $this->submit->removeDecorator('DtDdWrapper');
     $this->submit->removeDecorator('HtmlTag');
 }
Пример #3
0
function display_page_content()
{
    ?>

    <div id="edit-header" class="eventtypelist">		
		<div class="nav-left column">
			<h1>Edit Existing Event Types</h1>
		</div>
		<div class="nav-right column">
			<a class="hcd_button" href="<?php 
    echo get_link("admin/add_type");
    ?>
">Add an Event Type</a>
		</div>
		<div class="clearleft"></div>
	</div>
	<p class="announce"><b>Event Colors:</b> Each Event Type is associated with a color that you may customize. We will setup colors that work with the color palette of your website and they will be displayed on the calendar where the event is listed.</p>
	
	<div id="table-header" class="eventlist">
		<strong class="item-link">Click Name to Edit</strong>
		<span class="item-filename">Color Preview</span>
	</div>
	<ul id="listitems" class="managelist">
<?php 
    $types = EventTypes::FindAll();
    foreach ($types as $type) {
        echo "\t\t\t<li><a class=\"item-link\" href=\"" . get_link("/admin/edit_type/{$type->id}") . "\">{$type->name}</a> <span class=\"colorpreview\" style=\"background-color: {$type->color}; color: {$type->text_color};\">{$type->name}</span></li>\n";
    }
    ?>
	
	</ul>

<?php 
}
Пример #4
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $staffregions = new StaffRegions();
     $staffregions_options = $staffregions->getOptions();
     $eventtypes = new EventTypes();
     $event_options = $eventtypes->getTypes();
     $orgs = array('PAS' => 'The Portable Antiquities Scheme', 'BM' => 'The British Museum', 'MLA' => 'MLA', 'HLF' => 'Heritage Lottery Fund', 'IFA' => 'Institute of Archaeology', 'CBA' => 'Council for British Archaeology', 'ARCH' => 'Current Archaeology', 'AF' => 'The Art Fund', 'LOC' => 'Local museum', 'NADFAS' => 'NADFAS', 'CASPAR' => 'CASPAR');
     ZendX_JQuery::enableForm($this);
     parent::__construct($options);
     $this->setName('event');
     $eventTitle = new Zend_Form_Element_Text('eventTitle');
     $eventTitle->setLabel('Event title: ')->setRequired(true)->addErrorMessage('You must enter an event title')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->setAttrib('size', 70);
     $eventDescription = new Pas_Form_Element_CKEditor('eventDescription');
     $eventDescription->setLabel('Event description: ')->setRequired(true)->addFilters(array('StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph'))->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds');
     $address = new Zend_Form_Element_Text('eventLocation');
     $address->setLabel('Address: ')->setRequired(true)->addErrorMessage('You must enter an address')->setAttrib('size', 70)->addFilters(array('StripTags', 'StringTrim', 'Purifier'));
     $eventStartTime = new Zend_Form_Element_Text('eventStartTime');
     $eventStartTime->setLabel('Event start time: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator(new Zend_Validate_Date('H:i:s'))->setDescription('Enter in 24 hour clock format');
     $eventEndTime = new Zend_Form_Element_Text('eventEndTime');
     $eventEndTime->setLabel('Event end time: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator(new Zend_Validate_Date('H:i:s'))->setDescription('Enter in 24 hour clock format');
     $eventStartDate = new ZendX_JQuery_Form_Element_DatePicker('eventStartDate');
     $eventStartDate->setLabel('Event start date: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You need a start date')->setAttrib('size', 20);
     $eventEndDate = new ZendX_JQuery_Form_Element_DatePicker('eventEndDate');
     $eventEndDate->setLabel('Event end date: ')->setRequired(false)->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You need an end date')->setAttrib('size', 20);
     $eventRegion = new Zend_Form_Element_Select('eventRegion');
     $eventRegion->setLabel('Organising section: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('stringLength', false, array(1, 10))->addValidator('inArray', false, array(array_keys($staffregions_options)))->addMultiOptions(array(null => 'Please choose a region', 'Valid regions' => $staffregions_options));
     $eventType = new Zend_Form_Element_Select('eventType');
     $eventType->setLabel('Type of event: ')->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addValidator('stringLength', false, array(1, 10))->addValidator('inArray', false, array(array_keys($event_options)))->addMultiOptions($event_options);
     $adultsAttend = new Zend_Form_Element_Text('adultsAttend');
     $adultsAttend->setLabel('Adults attending: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int');
     $childrenAttend = new Zend_Form_Element_Text('childrenAttend');
     $childrenAttend->setLabel('Children attending: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int');
     $organisation = new Zend_Form_Element_Select('organisation');
     $organisation->setLabel('Organised by: ')->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setValue('PAS')->addFilters(array('StripTags', 'StringTrim'))->addMultioptions(array(null => 'Choose an organisation', 'Available institutions' => $orgs))->addValidator('InArray', false, array(array_keys($orgs)));
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($eventTitle, $eventDescription, $eventStartTime, $eventEndTime, $eventStartDate, $eventEndDate, $organisation, $childrenAttend, $eventRegion, $adultsAttend, $address, $eventType, $submit, $hash));
     $this->addDisplayGroup(array('eventTitle', 'eventDescription', 'eventLocation', 'eventStartTime', 'eventEndTime', 'eventStartDate', 'eventEndDate', 'eventRegion', 'organisation', 'childrenAttend', 'adultsAttend', 'eventType'), 'details');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
Пример #5
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $eventtypes = new EventTypes();
     $event_options = $eventtypes->getTypesWords();
     $event_options['Leave'] = 'Leave';
     $event_options['Celebration'] = 'Celebration';
     $event_options['Demonstration'] = 'Demonstration';
     $event_options['Workshop'] = 'Workshop';
     $event_options['TVC'] = 'TVC';
     $event_options['Project meeting'] = 'Project meeting';
     $event_options['Hack day'] = 'Hack day';
     $event_options['Regional Meeting'] = 'Regional Meeting';
     $event_options['National Meeting'] = 'National Meeting';
     $event_options['Celebration'] = 'Celebration/Party';
     $event_options['Training course'] = 'Training course';
     ZendX_JQuery::enableForm($this);
     parent::__construct($options);
     $this->setName('event');
     $eventTitle = new Zend_Form_Element_Text('title');
     $eventTitle->setLabel('Event title: ')->setRequired(true)->addErrorMessage('You must enter an event title')->addFilters(array('StripTags', 'StringTrim', 'BasicHtml'))->setAttrib('size', 70)->setAttrib('class', 'span8');
     $eventDescription = new Pas_Form_Element_CKEditor('content');
     $eventDescription->setLabel('Event description: ')->setRequired(true)->addFilters(array('StringTrim', 'WordChars'))->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('class', 'span8')->addErrorMessage('You must enter a description');
     $address = new Zend_Form_Element_Text('location');
     $address->setLabel('Address: ')->setRequired(true)->addErrorMessage('You must enter an address/location')->setAttrib('class', 'span8')->addFilters(array('StripTags', 'StringTrim', 'BasicHtml'));
     $eventStartTime = new Zend_Form_Element_Text('startTime');
     $eventStartTime->setLabel('Event start time: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator(new Zend_Validate_Date('H:i:s'))->addErrorMessage('You must enter a time for the start of the event')->setAttribs(array('placeholder' => 'Enter in 24 hour clock format ' . 'eg 11:00 not 1100 or 11.00', 'class' => 'span8'));
     $eventEndTime = new Zend_Form_Element_Text('endTime');
     $eventEndTime->setLabel('Event end time: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator(new Zend_Validate_Date('H:i:s'))->addErrorMessage('You must enter a time for the end of the event')->setAttribs(array('placeholder' => 'Enter in 24 hour clock ' . 'format eg 11:00 not 1100 or 11.00', 'class' => 'span8'));
     $eventStartDate = new ZendX_JQuery_Form_Element_DatePicker('startDate');
     $eventStartDate->setLabel('Event start date: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('placeholder', 'Format of YYYY-mm-dd')->addErrorMessage('You must enter a date')->setAttrib('size', 20);
     $eventEndDate = new ZendX_JQuery_Form_Element_DatePicker('endDate');
     $eventEndDate->setLabel('Event end date: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('placeholder', 'Format of YYYY-mm-dd')->addErrorMessage('You must enter a date')->setAttrib('size', 20);
     $eventType = new Zend_Form_Element_Select('eventType');
     $eventType->setLabel('Type of event: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('stringLength', false, array(1, 50))->addValidator('inArray', false, array(array_keys($event_options)))->addMultiOptions(array(null => 'Choose type of event', 'Available options' => $event_options));
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($eventTitle, $eventDescription, $eventStartTime, $eventEndTime, $eventStartDate, $eventEndDate, $address, $eventType, $submit));
     $this->addDisplayGroup(array('title', 'content', 'location', 'startTime', 'endTime', 'startDate', 'endDate', 'eventType'), 'details');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
Пример #6
0
function display_page_content()
{
    $event_types = EventTypes::FindAll();
    $year = getRequestVarAtIndex(2);
    $month = getRequestVarAtIndex(3);
    $day = getRequestVarAtIndex(4);
    $event_id = getRequestVarAtIndex(5);
    ?>

			<script language="javascript" type="text/javascript">
				//<![CDATA[
				$().ready(function() {
					$("#eventtype").change(function() {
						var selected = $("#eventtype").val();
						if(selected == "All")
						{
							$("table.calendarTable td a").show();
						}
						else
						{
							$("table.calendarTable td a:not(." + selected + ")").hide();
							$("." + selected).show();
						}
					});
				});
				//]]>
			</script>
			
		<?php 
    if ($event_id != "") {
        $event = Events::FindById($event_id);
        $cal = new Calendar();
        echo $cal->getMiniMonthView("events", "calendar", $month, $year, $day, $event_id);
        ?>
			
			<div class="event_details">
				<h1><?php 
        echo $event->title;
        ?>
</h1>
				<h3><?php 
        echo $event->getDateRangeString();
        ?>
</h3>

				<div class="event_description">
					<?php 
        echo $event->getDescription();
        ?>
					
				</div>
			</div>
			
		<?php 
    } else {
        if ($day != "") {
            $event = Events::FindAllForDate($day, $month, $year);
            $cal = new Calendar();
            echo $cal->getMiniMonthView("events", "calendar", $month, $year, $day, $event_id);
            if (substr($day, 0, 1) == "0") {
                $properday = substr($day, 1, 1);
            } else {
                $properday = $day;
            }
            echo "\t\t\t<h2>Events for " . getFullMonthName($month) . " " . $properday . ", " . $year . "</h2>\n";
            foreach ($event as $theevent) {
                ?>
		
			<div class="event_details">
				<h1><?php 
                echo $theevent->title;
                ?>
</h1>
				<h3><?php 
                echo $theevent->getDateRangeString();
                ?>
</h3>
				
				<div class="event_description">
					<?php 
                echo chopText($theevent->getDescription(true), 100);
                ?>
				</div>
				<a href="<?php 
                echo get_link("/events/calendar/{$year}/{$month}/{$day}/{$theevent->id}");
                ?>
">Read More</a>
			</div>
		<?php 
            }
        } else {
            ?>
			
			<p>Below is our Event Calendar engine, which displays all the past and future events for your website. Use the double arrows to go back or forward in time and view previous or upcoming months. Click on any event to find out more about it. Notice how we can handle recurring events &ndash; repetitive events every week, every first day, second, third, or last. </p>
			
			<select name="eventtype" id="eventtype">
				<?php 
            echo "<option value='All' selected>All Events</option>";
            foreach ($event_types as $event_type) {
                echo "<option value='{$event_type->slug()}' ";
                echo ">{$event_type->name}</option>\r\n";
            }
            ?>
			</select>
			<p>&nbsp;</p>

<?php 
            $cal = new Calendar();
            if ($month != "" && $year != "") {
                echo $cal->getMonthView($month, $year);
            } else {
                echo $cal->getCurrentMonthView();
            }
        }
    }
    // end the if statement
}
Пример #7
0
function display_page_content()
{
    $event_id = getRequestVarAtIndex(4);
    $event = Events::FindById($event_id);
    $event_types = EventTypes::FindAll();
    $event_periods = EventPeriods::FindAll();
    $year = getRequestVarAtIndex(2);
    $month = getRequestVarAtIndex(3);
    $recurrences = Recurrence::FindForEvent($event_id);
    $days = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
    $user = Users::GetCurrentUser();
    ?>

<script type="text/javascript">
	//<![CDATA[
	$().ready(function() {
		setupDateFields("<?php 
    echo $event->eventperiod_id;
    ?>
");
		
		$.datepicker.setDefaults({
            showButtonPanel: true,
			showOtherMonths: true,
			selectOtherMonths: true
        });
        
        $( "#date_start" ).datepicker();
		$( "#time_start" ).timepicker({timeFormat: 'hh:mm:ss tt',stepMinute: 5});
		$( "#date_end" ).datepicker();
		$( "#time_end" ).timepicker({timeFormat: 'hh:mm:ss tt',stepMinute: 5});
		$( "#not_date" ).datepicker();
		
		$("a#notdate_add").click(function() {
			var date = $("input[name='not_date']").val();
			if (date != "") {
				$("input[name='not_date']").val('');
				var all_dates_vis = $("span#notdates").html();
				$("span#notdates").html("<label for=\"notdates[]\">"+date+"&nbsp;<a href=\"javascript:;\" onClick=\"$(this).parent().remove();\">X</a><input type=\"hidden\" name=\"notdates[]\" value=\""+date+"\" /></label>"+all_dates_vis);
			}
		});
		
		$("#eventperiod_id").change(function() { 
			var selected = $(this).val();
			setupDateFields(selected);
		});

		$("#edit_event").validate({
			rules: {
				title: "required",
				date_start: "required",
			},
			messages: {
				title: "Please enter a title for this event",
				date_start: "Please at least a start date for this event",
			}
		});
	});
	//]]>
</script>

<div id="edit-header" class="event">
	<h1>Edit Event</h1>
</div>

<div id="calendar_div"></div>

<form method="POST" id="edit_event">
	
	<p class="display_name">
        <label for="title">Title</label>
    	<?php 
    textField("title", $event->title, "required: true");
    ?>
	</p>
    
    <?php 
    if (ALLOW_EVENT_TYPES && count($event_types) > 1) {
        ?>
	<p>
	    <label for="eventtype_id">Event Type</label>
    	<select name="eventtype_id" id="eventtype_id">
		<?php 
        foreach ($event_types as $event_type) {
            echo "<option value='{$event_type->id}' ";
            if ($event_type->id == $event->eventtype_id) {
                echo " selected ";
            }
            echo ">{$event_type->name}</option>\r\n";
        }
        ?>
    	</select>
	</p>
    <?php 
    }
    ?>
    
	<div id="eventdateselects" class="dropslide">
		<p><label for="eventperiod_id">Event Period:</label>
    		<select name="eventperiod_id" id="eventperiod_id">
			<?php 
    foreach ($event_periods as $event_period) {
        echo "<option value='{$event_period->id}' ";
        if ($event_period->id == $event->eventperiod_id) {
            echo " selected ";
        }
        echo ">{$event_period->name}</option>\r\n";
    }
    ?>
    		</select>
		</p>
	
		<p>
		    <label for="date_start">Start Date / Time</label>
    		<input type="text" name="date_start" id="date_start" style="width: 6.5em;" value="<?php 
    echo $event->getDateStart("date");
    ?>
" class="required: true" />&nbsp;
    		<input type="text" name="time_start" id="time_start" style="width: 6.5em;" value="<?php 
    echo $event->getDateStart("time");
    ?>
" />&nbsp;&nbsp; 
		
    		<label for="date_start">End Date / Time</label>
    		<input type="text" name="date_end" id="date_end" style="width: 6.5em;" value="<?php 
    echo $event->getDateEnd("date");
    ?>
" />&nbsp;
    		<input type="text" name="time_end" id="time_end" style="width: 6.5em;" value="<?php 
    echo $event->getDateEnd("time");
    ?>
" />
        </p>
		
		<div id="recurrence_rules" <?php 
    if ($event->eventperiod_id != 3) {
        echo "style=\"display: none; \"";
    }
    ?>
>
			<p><label for="not_date">Exclusion Date(s)</label>
				<input type="text" name="not_date" id="not_date" style="width: 6.5em;"/>&nbsp;<a href="javascript:;" id="notdate_add">Add to list&rarr;</a> 
				<span id="notdates">
				<?php 
    foreach (explode(",", $event->getNotDates()) as $date) {
        if ($date != "") {
            echo "<label for=\"{$date}\">{$date} &nbsp;<a href=\"javascript:;\" onClick=\"\$(this).parent().remove();\">&times;</a><input type=\"hidden\" name=\"notdates[]\" value=\"{$date}\" /></label>";
        }
    }
    ?>
				</span>
			</p>
	
			<label>Recurrence Rules</label>
			<table>
				<tbody>
					<tr>
						<th>&nbsp;</th>
						<th>Sunday</th>
						<th>Monday</th>
						<th>Tuesday</th>
						<th>Wednesday</th>
						<th>Thursday</th>
						<th>Friday</th>
						<th>Saturday</th>
					</tr>
					<tr>
						<td>Every</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag($recurrences, $day, 0);
        echo "</td>";
    }
    ?>
					</tr>
					<tr>
						<td>First</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag($recurrences, $day, 1);
        echo "</td>";
    }
    ?>
					</tr>
					<tr>
						<td>Second</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag($recurrences, $day, 2);
        echo "</td>";
    }
    ?>
					</tr>
					<tr>
						<td>Third</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag($recurrences, $day, 3);
        echo "</td>";
    }
    ?>
					</tr>
					<tr>
						<td>Fourth</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag($recurrences, $day, 4);
        echo "</td>";
    }
    ?>
					</tr>
					<tr>
						<td>Last</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag($recurrences, $day, 5);
        echo "</td>";
    }
    ?>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
	
    <p>
        <label for="name">Event Description</label><br />
        <?php 
    textArea("description", $event->description, 98, EDIT_WINDOW_HEIGHT);
    ?>
    </p>
	
	<?php 
    require_once snippetPath("admin-insert_configs");
    ?>
	
	<div id="edit-footer" class="eventnav clearfix">
		<div class="column half">
			<p>
				<input type="submit" class="submitbutton" name="submit" value="Edit Event" /> <br />
				<input type="submit" class="submitbuttonsmall" name="submit" value="Edit and Return to List" />
			</p>
		</div>
		<div class="column half last">
			
		<?php 
    if ($user->has_role()) {
        ?>
			
			<p><label for="delete">Delete this Event? <input name="delete" id="delete" class="boxes" type="checkbox" value="<?php 
        echo $event->id;
        ?>
"></label>
    		<span class="hint">Check the box and click &ldquo;Save&rdquo; to delete this event from the database</span></p>
		<?php 
    }
    ?>
		
		</div>
	</div>
	
</form>
<?php 
}
Пример #8
0
function display_page_content()
{
    $types = EventTypes::FindAll();
    ?>

<script type="text/javascript">
	$().ready(function() {
		$("#add_color").validate({
			rules : {
				name: "required",
				color: "required"
			},
			messages: {
					name: "Please enter an name for this event type.",
					color: "Please select a color."
				}
		});
		$("#color_picker table td").click(function() {
			var thecolor = $(this).attr('bgcolor');
			$('.colorselected').css("background-color",thecolor);
			$('input.thecolor').val(thecolor);
		});
	});
</script>

<div id="edit-header" class="eventtype">
	<h1>Add Event Type</h1>
</div>
	
<form method="POST" id="add_color">
	
	<div class="column half">
		<p class="display_name">
            <label for="name">Name: </label>
    		<?php 
    textField("name", "", "required: true");
    ?>
		</p>
    </div>
    <div class="column half last">
		<p>
    		<label for="colorselected">Color: </label>
    		<span class="colorselected">&nbsp;</span>
		</p>
	</div>
	<div class="clearleft"></div>
	
	<p><label for="color">Select New Color from Array: </label>
		<input class="thecolor" type="hidden" name="color" value="white" />
		<?php 
    require_once snippetPath("color-picker");
    ?>
	</p>
	
	<p>&nbsp;</p>
	
	<h2>Other Event Types for comparison</h2>
	<div id="table-header" class="eventlist">
		<strong class="item-link">Click Name to Edit</strong>
		<span class="item-filename">Color Preview</span>
	</div>
	<ul id="listitems" class="managelist">
<?php 
    foreach ($types as $thetype) {
        echo "\t\t\t\t\t\t<li><a class=\"item-link\" href=\"" . get_link("/admin/edit_type/{$thetype->id}") . "\">{$thetype->name}</a> <span class=\"colorpreview\" style=\"background-color: {$thetype->color}; color: {$thetype->text_color};\">{$thetype->name}</span></li>\n";
    }
    ?>
	
	</ul>
	
	<div id="edit-footer" class="eventtypenav clearfix">
		<div class="column half">
	
			<p>
				<input type="submit" class="submitbutton" name="submit" value="Add Type" /> <br />
				<input type="submit" class="submitbuttonsmall" name="submit" value="Add and Return to List" />
			</p>
			
		</div>
		<div class="column half last"></div>
	</div>
	
</form>
<?php 
}
Пример #9
0
 function getEventType()
 {
     return EventTypes::FindById($this->eventtype_id);
 }
Пример #10
0
function display_page_content()
{
    $event_types = EventTypes::FindAll();
    $event_periods = EventPeriods::FindAll();
    $days = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
    ?>

<script type="text/javascript">
	//<![CDATA[	
	$().ready(function() {
		setupDateFields("1");
		
		$.datepicker.setDefaults({
            showButtonPanel: true,
			showOtherMonths: true,
			selectOtherMonths: true
        });
        
        $( "#date_start" ).datepicker();
		$( "#time_start" ).timepicker({timeFormat: 'hh:mm:ss tt',stepMinute: 5});
		$( "#date_end" ).datepicker();
		$( "#time_end" ).timepicker({timeFormat: 'hh:mm:ss tt',stepMinute: 5});
		$( "#not_date" ).datepicker();
		
		$("a#notdate_add").click(function() {
			var date = $("input[name='not_date']").val();
			if (date != "") {
				$("input[name='not_date']").val('');
				var all_dates_vis = $("span#notdates").html();
				$("span#notdates").html("<label for=\"notdates[]\">"+date+"&nbsp;<a href=\"javascript:;\" onClick=\"$(this).parent().remove();\">X</a><input type=\"hidden\" name=\"notdates[]\" value=\""+date+"\" /></label>"+all_dates_vis);
			}
		});
		
		$("#eventperiod_id").change(function() {
			var selected = $(this).val();
			setupDateFields(selected);
		});
		
		$("#add_event").validate({
			rules: {
					title: "required",
					date_start: "required",
				},
			messages: {
					title: "Please enter a title for this event",
					date_start: "Please enter at least a start date for this event",
				}
		});	
	});
	//]]>
</script>

<div id="edit-header" class="event">
	<h1>Add Event</h1>
</div>

<div id="calendar_div"></div>

<form method="POST" id="add_event">
	
	<input type="hidden" name="calendar_id" value="1" />
	
	<p class="display_name">
        <label for="title">Title</label>
    	<?php 
    textField('title', '', 'required: true');
    ?>
	</p>
	
	<?php 
    if (ALLOW_EVENT_TYPES && count($event_types) > 1) {
        ?>
	<p>
	    <label for="eventtype_id">Event Type</label>
		<select name="eventtype_id" id="eventtype_id">
		<?php 
        foreach ($event_types as $event_type) {
            echo "<option value=\"{$event_type->id}\">{$event_type->name}</option>\r\n";
        }
        ?>
			
		</select>
	</p>
	<?php 
    }
    ?>
	
	<div id="eventdateselects" class="dropslide">
		<p><label for="eventperiod_id">Event Period:</label>
    		<select name="eventperiod_id" id="eventperiod_id">
			<?php 
    foreach ($event_periods as $event_period) {
        echo "<option value=\"{$event_period->id}\">{$event_period->name}</option>\r\n";
    }
    ?>
    		</select>
		</p>
		
		<p>
		    <label for="date_start">Start Date / Time</label>
    		<input type="text" name="date_start" id="date_start" style="width: 6.5em;" value="" class="required: true" />&nbsp;
    		<input type="text" name="time_start" id="time_start" style="width: 6.5em;" value="" />&nbsp;&nbsp; 
    		
    		<label for="date_start">End Date / Time</label>
    		<input type="text" name="date_end" id="date_end" style="width: 6.5em;" value="" />&nbsp;
    		<input type="text" name="time_end" id="time_end" style="width: 6.5em;" value="" />
		</p>
		
		<div id="recurrence_rules" style="display:none;">
			<p><label for="date_start">Exclusion Date(s)</label>
				<input type="text" name="not_date" id="not_date" style="width: 6.5em;"/>&nbsp;<a href="javascript:;" id="notdate_add">Add to list&rarr;</a> 
				<span id="notdates"></span>
			</p>
			
			<label>Recurrence Rules</label>
			<table>
				<tbody>
					<tr>
						<th>&nbsp;</th>
						<th>Sunday</th>
						<th>Monday</th>
						<th>Tuesday</th>
						<th>Wednesday</th>
						<th>Thursday</th>
						<th>Friday</th>
						<th>Saturday</th>
					</tr>
					<tr>
						<td>Every</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag(null, $day, 0);
        echo "</td>";
    }
    ?>
					</tr>
					<tr>
						<td>First</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag(null, $day, 1);
        echo "</td>";
    }
    ?>
					</tr>
					<tr>
						<td>Second</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag(null, $day, 2);
        echo "</td>";
    }
    ?>
					</tr>
					<tr>
						<td>Third</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag(null, $day, 3);
        echo "</td>";
    }
    ?>
					</tr>
					<tr>
						<td>Fourth</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag(null, $day, 4);
        echo "</td>";
    }
    ?>
					</tr>
					<tr>
						<td>Last</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag(null, $day, 5);
        echo "</td>";
    }
    ?>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
	
	<p><label for="name">Event Description</label><br />
	<?php 
    textArea("description", "", 98, EDIT_WINDOW_HEIGHT);
    ?>
	</p>
	
	<?php 
    require_once snippetPath("admin-insert_configs");
    ?>
	
	<div id="edit-footer" class="eventtypenav clearfix">
		<div class="column half">
			<p>
				<input type="submit" class="submitbutton" name="submit" value="Add Event and add another" /> <br />
				<input type="submit" class="submitbuttonsmall" name="submit" value="Add and Return to List" />
			</p>
		</div>
		<div class="column half last"></div>
	</div>
	
</form>
<?php 
}
Пример #11
0
function display_page_content()
{
    $types = EventTypes::FindAll();
    $type_id = requestIdParam();
    $type = EventTypes::FindById($type_id);
    $user = Users::GetCurrentUser();
    ?>

<script type="text/javascript">
	$().ready(function() {
		$("#edit_type").validate({
			rules : {
				name: "required"
			},
			messages: {
					name: "Please enter an name for this event type.<br/>"
				}
		});
		$("#color_picker table td").click(function() {
			var thecolor = $(this).attr('bgcolor');
			$('.colorselected').css("background-color",thecolor);
			$('input.thecolor').val(thecolor);
		});
	});
</script>

<div id="edit-header" class="eventtype">
	<h1>Edit Event Type</h1>
</div>

<form method="POST" id="edit_type">
	
	<div class="column half">
		<p class="display_name">
            <label for="name">Name: </label>
    		<?php 
    textField("name", $type->name, "required: true");
    ?>
		</p>
    </div>
    <div class="column half last">
		<p>
    		<label for="colorselected">Color: </label>
    		<span class="colorselected" style="background-color:<?php 
    echo $type->color;
    ?>
">&nbsp;</span>
		</p>
	</div>
	<div class="clearleft"></div>
	
	<p><label for="new_color">Select New Color:</label> <span class="hint">Click any color below to select it, then click the Save button below.</span>
		<input class="thecolor" type="hidden" name="color" value="<?php 
    echo $type->color;
    ?>
" />
		<?php 
    require_once snippetPath("color-picker");
    ?>
	</p>
	
	<p>&nbsp;</p>
	
	<h2>Other Event Types for comparison</h2>
	<div id="table-header" class="eventlist">
		<strong class="item-link">Click Name to Edit</strong>
		<span class="item-filename">Color Preview</span>
	</div>
	<ul id="listitems" class="managelist">
<?php 
    foreach ($types as $thetype) {
        echo "\t\t\t\t\t\t<li><a class=\"item-link\" href=\"" . get_link("/admin/edit_type/{$thetype->id}") . "\">{$thetype->name}</a> <span class=\"colorpreview\" style=\"background-color: {$thetype->color}; color: {$thetype->text_color};\">{$thetype->name}</span></li>\n";
    }
    ?>
	
	</ul>
	
	<div id="edit-footer" class="eventtypenav clearfix">
		<div class="column half">
	
			<p>
				<input type="submit" class="submitbutton" name="submit" value="Save Type" /> <br />
				<input type="submit" class="submitbuttonsmall" name="submit" value="Edit and Return to List" />
			</p>
			
		</div>
		<div class="column half last">
			
		<?php 
    if ($user->has_role() && $type->id != 1) {
        ?>
			
			<p><label for="delete">Delete this Event Type?</label>
    		<input name="delete" class="boxes" type="checkbox" value="<?php 
        echo $type->id;
        ?>
" />
    		<span class="hint">Check the box and click &ldquo;Save&rdquo; to delete this type from the database</span></p>
		<?php 
    }
    ?>
		
		</div>
	</div>
	
</form>
<?php 
}
Пример #12
0
 public function saveEventType()
 {
     $inputs = Input::all();
     $id = $inputs['eventTypeIdEdit'];
     $eventTypeName = $inputs['eventTypeNameEdit'];
     $eventType = EventTypes::find($id);
     //dd($eventType);
     $eventType->name = $eventTypeName;
     $eventType->save();
     if ($eventType) {
         return Response::json(array("status" => "success"));
     } else {
         return Response::json(array("status" => "failed"));
     }
 }
 public function postDeleteEventTypes()
 {
     $request = ['event_type_id' => Input::get('event_type_id')];
     $event_type = EventTypes::find($request['event_type_id']);
     if ($event_type->delete()) {
         $response = ApiResponseClass::successResponse($event_type, $request);
     } else {
         $response = ApiResponseClass::errorResponse('Not Deleted', 'Event Type Not Deleted.', $request);
     }
     return $response;
 }