/**
  * Build form.
  *
  * @param CRM_Core_Form $form
  */
 public static function buildQuickForm(&$form)
 {
     // FIXME: this is using the following as keys rather than the standard numeric keys returned by CRM_Utils_Date
     $dayOfTheWeek = array();
     $dayKeys = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday');
     foreach (CRM_Utils_Date::getAbbrWeekdayNames() as $k => $label) {
         $dayOfTheWeek[$dayKeys[$k]] = $label;
     }
     $form->add('select', 'repetition_frequency_unit', ts('Repeats every'), CRM_Core_SelectValues::getRecurringFrequencyUnits(), FALSE, array('class' => 'required'));
     $numericOptions = CRM_Core_SelectValues::getNumericOptions(1, 30);
     $form->add('select', 'repetition_frequency_interval', NULL, $numericOptions, FALSE, array('class' => 'required'));
     $form->addDateTime('repetition_start_date', ts('Repetition Start Date'), FALSE, array('formatType' => 'activityDateTime'));
     foreach ($dayOfTheWeek as $key => $val) {
         $startActionCondition[] = $form->createElement('checkbox', $key, NULL, $val);
     }
     $form->addGroup($startActionCondition, 'start_action_condition', ts('Repeats on'));
     $roptionTypes = array('1' => ts('day of the month'), '2' => ts('day of the week'));
     $form->addRadio('repeats_by', ts("Repeats by"), $roptionTypes, array('required' => TRUE), NULL);
     $form->add('select', 'limit_to', '', CRM_Core_SelectValues::getNumericOptions(1, 31));
     $dayOfTheWeekNo = array('first' => ts('First'), 'second' => ts('Second'), 'third' => ts('Third'), 'fourth' => ts('Fourth'), 'last' => ts('Last'));
     $form->add('select', 'entity_status_1', '', $dayOfTheWeekNo);
     $form->add('select', 'entity_status_2', '', $dayOfTheWeek);
     $eoptionTypes = array('1' => ts('After'), '2' => ts('On'));
     $form->addRadio('ends', ts("Ends"), $eoptionTypes, array('class' => 'required'), NULL);
     // Offset options gets key=>val pairs like 1=>2 because the BAO wants to know the number of
     // children while it makes more sense to the user to see the total number including the parent.
     $offsetOptions = range(1, 30);
     unset($offsetOptions[0]);
     $form->add('select', 'start_action_offset', NULL, $offsetOptions, FALSE);
     $form->addFormRule(array('CRM_Core_Form_RecurringEntity', 'formRule'));
     $form->addDate('repeat_absolute_date', ts('On'), FALSE, array('formatType' => 'mailing'));
     $form->add('text', 'exclude_date_list', ts('Exclude Dates'), array('class' => 'twenty'));
     $form->addElement('hidden', 'allowRepeatConfigToSubmit', '', array('id' => 'allowRepeatConfigToSubmit'));
     $form->addButtons(array(array('type' => 'submit', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
     // For client-side pluralization
     $form->assign('recurringFrequencyOptions', array('single' => CRM_Utils_Array::makeNonAssociative(CRM_Core_SelectValues::getRecurringFrequencyUnits()), 'plural' => CRM_Utils_Array::makeNonAssociative(CRM_Core_SelectValues::getRecurringFrequencyUnits(2))));
 }
<?php

require_once '../../civicrm.config.php';
require_once 'CRM/Core/Config.php';
require_once 'CRM/Core/I18n.php';
require_once 'CRM/Utils/Date.php';
// assign the weekday and month names
$DN = CRM_Utils_Date::getFullWeekdayNames();
$SDN = CRM_Utils_Date::getAbbrWeekdayNames();
$MN = CRM_Utils_Date::getFullMonthNames();
$SMN = CRM_Utils_Date::getAbbrMonthNames();
// assign the strings hash
$TT['INFO'] = ts('About the calendar');
$TT['ABOUT'] = "DHTML Date/Time Selector\n(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" . ts('For latest version visit: %1', array(1 => 'http://www.dynarch.com/projects/calendar/')) . "\n" . ts('Distributed under GNU LGPL. See %1 for details.', array(1 => 'http://gnu.org/licenses/lgpl.html')) . "\n\n" . ts('Date selection:') . "\n" . ts('- use the \\xab, \\xbb buttons to select year,') . "\n" . ts('- use the \\u2039, \\u203a buttons to select month,') . "\n" . ts('- hold mouse button on any of the above buttons for faster selection.');
$TT['ABOUT_TIME'] = "\n\n" . ts('Time selection:') . "\n" . ts('- click on any of the time parts to increase it') . "\n" . ts('- or Shift-click to decrease it') . "\n" . ts('- or click and drag for faster selection.');
$holdForMenu = ts('hold for menu');
$TT['PREV_YEAR'] = ts('Prev. year') . " ({$holdForMenu})";
$TT['PREV_MONTH'] = ts('Prev. month') . " ({$holdForMenu})";
$TT['GO_TODAY'] = ts('Go Today');
$TT['NEXT_MONTH'] = ts('Next month') . " ({$holdForMenu})";
$TT['NEXT_YEAR'] = ts('Next year') . " ({$holdForMenu})";
$TT['SEL_DATE'] = ts('Select date');
$TT['DRAG_TO_MOVE'] = ts('Drag to move');
$TT['PART_TODAY'] = ' (' . ts('today') . ')';
$TT['DAY_FIRST'] = ts('Display %s first');
$TT['WEEKEND'] = '0,6';
$TT['CLOSE'] = ts('Close');
$TT['TODAY'] = ts('Today');
$TT['TIME_PART'] = ts('(Shift-)Click or drag to change value');
$TT['DEF_DATE_FORMAT'] = '%Y-%m-%d';
$TT['TT_DATE_FORMAT'] = '%a, %b %e';
Example #3
0
 /**
  * Class constructor
  * 
  * @access   public
  * @param    string  Element's name
  * @param    mixed   Label(s) for an element
  * @param    array   Options to control the element's display
  * @param    mixed   Either a typical HTML attribute string or an associative array
  */
 function HTML_QuickForm_date($elementName = null, $elementLabel = null, $options = array(), $attributes = null)
 {
     $this->_locale = array('weekdays_short' => CRM_Utils_Date::getAbbrWeekdayNames(), 'weekdays_long' => CRM_Utils_Date::getFullWeekdayNames(), 'months_short' => CRM_Utils_Date::getAbbrMonthNames(), 'months_long' => CRM_Utils_Date::getFullMonthNames());
     $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
     $this->_persistantFreeze = true;
     $this->_appendName = true;
     $this->_type = 'date';
     // set the options, do not bother setting bogus ones
     if (is_array($options)) {
         foreach ($options as $name => $value) {
             if (isset($this->_options[$name])) {
                 if (is_array($value)) {
                     $this->_options[$name] = @array_merge($this->_options[$name], $value);
                 } else {
                     $this->_options[$name] = $value;
                 }
             }
         }
     }
 }