コード例 #1
0
 public function show()
 {
     $form = new PHPWS_Form('waiver');
     $form->addTextArea('usernames');
     $form->setLabel('usernames', 'ASU User names (one per line):');
     $form->setExtra('usernames', 'autofocus');
     $form->addSubmit('submit_btn', 'Create');
     $cmd = CommandFactory::getCommand('CreateWaiver');
     $cmd->initForm($form);
     $tpl = array();
     $form->mergeTemplate($tpl);
     Layout::addPageTitle("Lottery Eligibility Waiver");
     return PHPWS_Template::process($form->getTemplate(), 'hms', 'admin/eligibility_waiver.tpl');
 }
コード例 #2
0
 public function getSearchBox()
 {
     static $id_count = 0;
     if ($id_count) {
         $id = 'search_list_' . $id_count;
     } else {
         $id = 'search_list';
         $id_count++;
     }
     $form = new PHPWS_Form($id);
     $form->setMethod('get');
     $values = $this->getLinkValues();
     unset($values['pager_search']);
     unset($values['go']);
     $form->addHidden($values);
     $form->addText('pager_c_search', $this->search);
     $form->setSize('pager_c_search', 20);
     if ($this->search_label) {
         $form->setLabel('pager_c_search', _('Search'));
     }
     if ($this->clear_button) {
         $form->addButton('clear', _('Clear'));
         $form->setExtra('clear', 'onclick="this.form.search_list_pager_c_search.value=\'\'"');
     }
     if ($this->search_button) {
         $form->addSubmit('go', _('Search'));
     }
     $template = $form->getTemplate();
     if (PHPWS_Error::isError($template)) {
         PHPWS_Error::log($template);
         return null;
     }
     return implode("\n", $template);
 }
コード例 #3
0
ファイル: Admin.php プロジェクト: par-orillonsoft/phpwebsite
 public static function editFeed(RSS_Feed $feed)
 {
     $form = new PHPWS_Form();
     if ($feed->id) {
         $form->addHidden('feed_id', $feed->id);
     }
     $form->addHidden('module', 'rss');
     $form->addHidden('command', 'save_feed');
     $form->addText('address', $feed->address);
     $form->setLabel('address', dgettext('rss', 'Address'));
     $form->setSize('address', '30');
     $form->addText('title', $feed->title);
     $form->setLabel('title', dgettext('rss', 'Title'));
     $form->setSize('title', '30');
     $form->addSubmit('submit', dgettext('rss', 'Save'));
     $form->addButton('cancel', dgettext('rss', 'Cancel'));
     $form->setExtra('cancel', 'onclick="window.close()"');
     $form->addText('item_limit', $feed->item_limit);
     $form->setSize('item_limit', 2);
     $form->setLabel('item_limit', dgettext('rss', 'Item limit'));
     $form->addText('refresh_time', $feed->refresh_time);
     $form->setSize('refresh_time', 5);
     $form->setLabel('refresh_time', dgettext('rss', 'Refresh time'));
     $template = $form->getTemplate();
     $template['TITLE_WARNING'] = dgettext('rss', 'Feed title will be used if left empty');
     $template['REFRESH_WARNING'] = dgettext('rss', 'In seconds');
     $content = PHPWS_Template::process($template, 'rss', 'add_feed.tpl');
     $tpl['TITLE'] = dgettext('rss', 'Add Feed');
     $tpl['CONTENT'] = $content;
     return $tpl;
 }
コード例 #4
0
 public function jsStyleChange()
 {
     $styles = Layout::getExtraStyles();
     if (empty($styles) || !isset($_REQUEST['key_id'])) {
         return false;
     }
     $styles[0] = dgettext('layout', '-- Use default style --');
     ksort($styles, SORT_NUMERIC);
     $key_id = (int) $_REQUEST['key_id'];
     $current_style = Layout::getKeyStyle($key_id);
     if (empty($current_style)) {
         $current_style = 0;
     }
     $form = new PHPWS_Form('change_styles');
     $form->addHidden('module', 'layout');
     $form->addHidden('action', 'admin');
     $form->addHidden('command', 'post_style_change');
     $form->addHidden('key_id', $key_id);
     $form->addSelect('style', $styles);
     $form->setLabel('style', dgettext('layout', 'Style sheet'));
     $form->setMatch('style', $current_style);
     $form->addSubmit(dgettext('layout', 'Save'));
     $form->addButton('cancel', dgettext('layout', 'Cancel'));
     $form->setExtra('cancel', 'onclick="window.close()"');
     $template = $form->getTemplate();
     $template['TITLE'] = dgettext('layout', 'Change CSS');
     return PHPWS_Template::process($template, 'layout', 'style_change.tpl');
 }
コード例 #5
0
 public function getPageDrop()
 {
     if (empty($this->total_pages)) {
         $page_list[1] = 1;
     } else {
         for ($i = 1; $i <= $this->total_pages; $i++) {
             $page_list[$i] = $i;
         }
     }
     $form = new PHPWS_Form('page_list');
     $form->setMethod('get');
     $values = $this->getLinkValues();
     $form->addHidden($values);
     $form->addSelect('change_page', $page_list);
     $form->setExtra('change_page', 'onchange="this.form.submit()"');
     $form->setMatch('change_page', $this->current_page);
     if (!function_exists('javascriptEnabled') || !javascriptEnabled()) {
         $form->addSubmit('go', _('Go'));
     }
     $template = $form->getTemplate();
     if (PHPWS_Error::isError($template)) {
         PHPWS_Error::log($template);
         return null;
     }
     return $template['START_FORM'] . $template['CHANGE_PAGE'] . $template['END_FORM'];
 }
コード例 #6
0
ファイル: Admin.php プロジェクト: par-orillonsoft/phpwebsite
 /**
  * Creates the edit form for an event
  */
 public static function event_form(Calendar_Event $event, $suggest = false)
 {
     Layout::addStyle('calendar');
     javascript('datetimepicker');
     // the form id is linked to the check_date javascript
     $form = new PHPWS_Form('event_form');
     if (isset($_REQUEST['js'])) {
         $form->addHidden('js', 1);
     }
     $form->addHidden('module', 'calendar');
     if ($suggest) {
         $form->addHidden('uop', 'post_suggestion');
     } else {
         $form->addHidden('aop', 'post_event');
     }
     $form->addHidden('event_id', $event->id);
     $form->addHidden('sch_id', $event->_schedule->id);
     $form->addText('summary', $event->summary);
     $form->setLabel('summary', dgettext('calendar', 'Summary'));
     $form->setSize('summary', 60);
     $form->addText('location', $event->location);
     $form->setLabel('location', dgettext('calendar', 'Location'));
     $form->setSize('location', 60);
     $form->addText('loc_link', $event->loc_link);
     $form->setLabel('loc_link', dgettext('calendar', 'Location link'));
     $form->setSize('loc_link', 60);
     $form->addTextArea('description', $event->description);
     if ($suggest) {
         $form->setRows('description', 8);
         $form->setCols('description', 55);
     } else {
         $form->useEditor('description');
     }
     $form->setLabel('description', dgettext('calendar', 'Description'));
     $form->addText('start_date', $event->getStartTime('%Y/%m/%d'));
     $form->setLabel('start_date', dgettext('calendar', 'Start time'));
     $form->setExtra('start_date', 'onblur="check_start_date()"');
     $form->addText('end_date', $event->getEndTime('%Y/%m/%d'));
     $form->setLabel('end_date', dgettext('calendar', 'End time'));
     $form->setExtra('end_date', 'onblur="check_end_date()" onfocus="check_start_date()"');
     $event->timeForm('start_time', $event->start_time, $form);
     $event->timeForm('end_time', $event->end_time, $form);
     $form->setExtra('start_time_hour', 'onchange="check_start_date()"');
     $form->setExtra('end_time_hour', 'onchange="check_end_date()"');
     $form->addCheck('all_day', 1);
     $form->setMatch('all_day', $event->all_day);
     $form->setLabel('all_day', dgettext('calendar', 'All day event'));
     $form->setExtra('all_day', 'onchange="alter_date(this)"');
     if (!$suggest) {
         $form->addCheck('show_busy', 1);
         $form->setMatch('show_busy', $event->show_busy);
         $form->setLabel('show_busy', dgettext('calendar', 'Show busy'));
     }
     if ($suggest) {
         $form->addSubmit('save', dgettext('calendar', 'Suggest event'));
     } else {
         // Suggested events are not allowed repeats
         /**
          * Repeat form elements
          */
         $form->addCheck('repeat_event', 1);
         $form->setLabel('repeat_event', dgettext('calendar', 'Make a repeating event'));
         $form->addText('end_repeat_date', $event->getEndRepeat('%Y/%m/%d'));
         $form->setLabel('end_repeat_date', dgettext('calendar', 'Repeat event until:'));
         $modes = array('daily', 'weekly', 'monthly', 'yearly', 'every');
         $modes_label = array(dgettext('calendar', 'Daily'), dgettext('calendar', 'Weekly'), dgettext('calendar', 'Monthly'), dgettext('calendar', 'Yearly'), dgettext('calendar', 'Every'));
         $form->addRadio('repeat_mode', $modes);
         $form->setLabel('repeat_mode', $modes_label);
         $weekdays = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7);
         $weekday_labels = array(1 => strftime('%A', mktime(0, 0, 0, 1, 5, 1970)), 2 => strftime('%A', mktime(0, 0, 0, 1, 6, 1970)), 3 => strftime('%A', mktime(0, 0, 0, 1, 7, 1970)), 4 => strftime('%A', mktime(0, 0, 0, 1, 8, 1970)), 5 => strftime('%A', mktime(0, 0, 0, 1, 9, 1970)), 6 => strftime('%A', mktime(0, 0, 0, 1, 10, 1970)), 7 => strftime('%A', mktime(0, 0, 0, 1, 11, 1970)));
         $form->addCheck('weekday_repeat', $weekdays);
         $form->setLabel('weekday_repeat', $weekday_labels);
         $monthly = array('begin' => dgettext('calendar', 'Beginning of each month'), 'end' => dgettext('calendar', 'End of each month'), 'start' => dgettext('calendar', 'Every month on start date'));
         $form->addSelect('monthly_repeat', $monthly);
         $every_repeat_week = array(1 => dgettext('calendar', '1st'), 2 => dgettext('calendar', '2nd'), 3 => dgettext('calendar', '3rd'), 4 => dgettext('calendar', '4th'), 5 => dgettext('calendar', 'Last'));
         $frequency = array('every_month' => dgettext('calendar', 'Every month'), 1 => strftime('%B', mktime(0, 0, 0, 1, 1, 1970)), 2 => strftime('%B', mktime(0, 0, 0, 2, 1, 1970)), 3 => strftime('%B', mktime(0, 0, 0, 3, 1, 1970)), 4 => strftime('%B', mktime(0, 0, 0, 4, 1, 1970)), 5 => strftime('%B', mktime(0, 0, 0, 5, 1, 1970)), 6 => strftime('%B', mktime(0, 0, 0, 6, 1, 1970)), 7 => strftime('%B', mktime(0, 0, 0, 7, 1, 1970)), 8 => strftime('%B', mktime(0, 0, 0, 8, 1, 1970)), 9 => strftime('%B', mktime(0, 0, 0, 9, 1, 1970)), 10 => strftime('%B', mktime(0, 0, 0, 10, 1, 1970)), 11 => strftime('%B', mktime(0, 0, 0, 11, 1, 1970)), 12 => strftime('%B', mktime(0, 0, 0, 12, 1, 1970)));
         $form->addSelect('every_repeat_number', $every_repeat_week);
         $form->addSelect('every_repeat_weekday', $weekday_labels);
         $form->addSelect('every_repeat_frequency', $frequency);
         /* set repeat form matches */
         if (!empty($event->repeat_type)) {
             $repeat_info = explode(':', $event->repeat_type);
             $repeat_mode_match = $repeat_info[0];
             if (isset($repeat_info[1])) {
                 $repeat_vars = explode(';', $repeat_info[1]);
             } else {
                 $repeat_vars = null;
             }
             $form->setMatch('repeat_mode', $repeat_mode_match);
             switch ($repeat_mode_match) {
                 case 'weekly':
                     $form->setMatch('weekday_repeat', $repeat_vars);
                     break;
                 case 'monthly':
                     $form->setMatch('monthly_repeat', $repeat_vars[0]);
                     break;
                 case 'every':
                     $form->setMatch('every_repeat_number', $repeat_vars[0]);
                     $form->setMatch('every_repeat_weekday', $repeat_vars[1]);
                     $form->setMatch('every_repeat_frequency', $repeat_vars[2]);
                     break;
             }
             $form->setMatch('repeat_event', 1);
         }
         if ($event->pid) {
             $form->addHidden('pid', $event->pid);
             // This is a repeat copy, if saved it removes it from the copy list
             $form->addSubmit('save', dgettext('calendar', 'Save and remove repeat'));
             $form->setExtra('save', sprintf('onclick="return confirm(\'%s\')"', dgettext('calendar', 'Remove event from repeat list?')));
         } elseif ($event->id && $event->repeat_type) {
             // This is event is a source repeating event
             // Save this
             // Not sure if coding this portion. commenting for now
             // $form->addSubmit('save_source', dgettext('calendar', 'Save this event only'));
             $form->addSubmit('save_copy', dgettext('calendar', 'Save and apply to repeats'));
             $form->setExtra('save_copy', sprintf('onclick="return confirm(\'%s\')"', dgettext('calendar', 'Apply changes to repeats?')));
         } else {
             // this is a non-repeating event
             $form->addSubmit('save', dgettext('calendar', 'Save event'));
         }
     }
     $tpl = $form->getTemplate();
     if (!$suggest) {
         $tpl['EVENT_TAB'] = dgettext('calendar', 'Event');
         $tpl['REPEAT_TAB'] = dgettext('calendar', 'Repeat');
     }
     if (isset($event->_error)) {
         $tpl['ERROR'] = implode('<br />', $event->_error);
     }
     if ($event->pid) {
         $linkvar['aop'] = 'edit_event';
         $linkvar['sch_id'] = $event->_schedule->id;
         $linkvar['event_id'] = $event->pid;
         if (javascriptEnabled()) {
             $linkvar['js'] = 1;
         }
         $source_link = PHPWS_Text::moduleLink(dgettext('calendar', 'Click here if you would prefer to edit the source event.'), 'calendar', $linkvar);
         $tpl['REPEAT_WARNING'] = dgettext('calendar', 'This is a repeat of another event.') . '<br />' . $source_link;
     }
     $tpl['SYNC'] = sprintf('<input type="button" style="display : none" id="sync-dates" onclick="sync_dates(); return false;" name="sync-dates" value="%s" />', dgettext('calendar', 'Sync dates'));
     if (javascriptEnabled()) {
         Layout::addJSHeader('<script src="' . PHPWS_SOURCE_HTTP . 'mod/calendar/javascript/edit_event/head.js"></script>');
         Layout::addJSHeader('<script src="' . PHPWS_SOURCE_HTTP . 'mod/calendar/javascript/check_date/head.js"></script>');
     }
     return PHPWS_Template::process($tpl, 'calendar', 'admin/forms/edit_event.tpl');
 }
コード例 #7
0
 /**
  * Creates the permission menu template
  */
 public static function permissionMenu(Key $key, $popbox = FALSE)
 {
     $edit_groups = Users_Permission::getRestrictedGroups($key, TRUE);
     if (PHPWS_Error::isError($edit_groups)) {
         PHPWS_Error::log($edit_groups);
         $tpl['MESSAGE'] = $edit_groups->getMessage();
         return $tpl;
     }
     $view_groups = User_Form::_getNonUserGroups();
     $view_matches = $key->getViewGroups();
     $edit_matches = $key->getEditGroups();
     if (!empty($edit_groups)) {
         $edit_select = User_Form::_createMultiple($edit_groups['restricted']['all'], 'edit_groups', $edit_matches);
     } else {
         $edit_select = null;
     }
     if (!empty($view_groups)) {
         $view_select = User_Form::_createMultiple($view_groups, 'view_groups', $view_matches);
     } else {
         $view_select = null;
     }
     $form = new PHPWS_Form('choose_permissions');
     $form->addHidden('module', 'users');
     $form->addHidden('action', 'permission');
     $form->addHidden('key_id', $key->id);
     $form->addRadio('view_permission', array(0, 1, 2));
     $form->setExtra('view_permission', 'onclick="hideSelect(this.value)"');
     $form->setLabel('view_permission', array(dgettext('users', 'All visitors'), dgettext('users', 'Logged visitors'), dgettext('users', 'Specific group(s)')));
     $form->setMatch('view_permission', $key->restricted);
     $form->addSubmit(dgettext('users', 'Save permissions'));
     if ($popbox) {
         $form->addHidden('popbox', 1);
     }
     $tpl = $form->getTemplate();
     $tpl['TITLE'] = dgettext('users', 'Permissions');
     $tpl['EDIT_SELECT_LABEL'] = dgettext('users', 'Edit restrictions');
     $tpl['VIEW_SELECT_LABEL'] = dgettext('users', 'View restrictions');
     if ($edit_select) {
         $tpl['EDIT_SELECT'] = $edit_select;
     } else {
         $tpl['EDIT_SELECT'] = dgettext('users', 'No restricted edit groups found.');
     }
     if ($view_select) {
         $tpl['VIEW_SELECT'] = $view_select;
     } else {
         $tpl['VIEW_SELECT'] = dgettext('users', 'No view groups found.');
     }
     if ($popbox) {
         $tpl['CANCEL'] = sprintf('<input type="button" value="%s" onclick="window.close()" />', dgettext('users', 'Cancel'));
     }
     if (isset($_SESSION['Permission_Message'])) {
         $tpl['MESSAGE'] = $_SESSION['Permission_Message'];
         unset($_SESSION['Permission_Message']);
     }
     return $tpl;
 }
コード例 #8
0
ファイル: HMS_Room.php プロジェクト: jlbooker/homestead
 /**
  * DBPager row method for the floor edit pager.
  *
  * @return Array
  */
 public function get_row_edit()
 {
     javascript('jquery');
     $tpl = array();
     $tpl['ID'] = $this->id;
     $tpl['ROOM_NUMBER'] = PHPWS_Text::secureLink($this->room_number, 'hms', array('action' => 'EditRoomView', 'room' => $this->id));
     if (Current_User::allow('hms', 'room_structure') && $this->get_number_of_assignees() == 0) {
         $deleteRoomCmd = CommandFactory::getCommand('DeleteRoom');
         $deleteRoomCmd->setRoomId($this->id);
         $deleteRoomCmd->setFloorId($this->floor_id);
         $confirm = array();
         $confirm['QUESTION'] = 'Are you sure want to delete room ' . $this->room_number . '?';
         $confirm['ADDRESS'] = $deleteRoomCmd->getURI();
         $confirm['LINK'] = 'Delete';
         $tpl['DELETE'] = Layout::getJavascript('confirm', $confirm);
     }
     $form = new PHPWS_Form($this->id);
     $form->addSelect('gender_type', array(FEMALE => FEMALE_DESC, MALE => MALE_DESC, COED => COED_DESC, AUTO => AUTO_DESC));
     $form->setMatch('gender_type', $this->gender_type);
     $form->setExtra('gender_type', 'onChange="submit_form(this, true)"');
     $form->addSelect('default_gender', array(FEMALE => FEMALE_DESC, MALE => MALE_DESC, AUTO => AUTO_DESC));
     $form->setMatch('default_gender', $this->default_gender);
     $form->setExtra('default_gender', 'onChange="submit_form(this, true)"');
     $form->addSelect('rlc_reserved', array('-1' => 'Select RLC') + RlcFactory::getRlcList($this->term));
     $form->setMatch('rlc_reserved', $this->getReservedRlcId());
     $form->setExtra('rlc_reserved', 'onChange="submit_form(this, true)"');
     $form->addCheck('offline', 'yes');
     $form->setMatch('offline', $this->offline == 1 ? 'yes' : 0);
     $form->setExtra('offline', 'onChange="submit_form(this, false)"');
     $form->addCheck('reserved', 'yes');
     $form->setMatch('reserved', $this->reserved == 1 ? 'yes' : 0);
     $form->setExtra('reserved', 'onChange="submit_form(this, false)"');
     $form->addCheck('ra', 'yes');
     $form->setMatch('ra', $this->ra == 1 ? 'yes' : 0);
     $form->setExtra('ra', 'onChange="submit_form(this, false)"');
     $form->addCheck('private', 'yes');
     $form->setMatch('private', $this->private == 1 ? 'yes' : 0);
     $form->setExtra('private', 'onChange="submit_form(this, false)"');
     $form->addCheck('overflow', 'yes');
     $form->setMatch('overflow', $this->overflow == 1 ? 'yes' : 0);
     $form->setExtra('overflow', 'onChange="submit_form(this, false)"');
     $form->addCheck('ada', 'yes');
     $form->setMatch('ada', $this->isAda() ? 'yes' : 0);
     $form->setExtra('ada', 'onChange="submit_form(this, false)"');
     $form->addHidden('action', 'UpdateRoomField');
     $form->addHidden('room', $this->id);
     $form->mergeTemplate($tpl);
     //test($form->getTemplate(),1);
     return $form->getTemplate();
 }
コード例 #9
0
ファイル: Room_Base.php プロジェクト: HaldunA/phpwebsite
 public function getForm($name = null)
 {
     javascript('datepicker');
     \Layout::addStyle('properties', 'forms.css');
     $form = new \PHPWS_Form($name);
     $form->addHidden('module', 'properties');
     $form->addCheck('appalcart', 1);
     $form->setLabel('appalcart', 'On Appalcart route');
     $form->setMatch('appalcart', $this->appalcart);
     $form->addSelect('campus_distance', array(0 => '0 to 5', 5 => '5 to 10', 10 => '10 to 25', 25 => 'More than 25'));
     $form->setLabel('campus_distance', 'Miles from campus');
     $form->setMatch('campus_distance', $this->campus_distance);
     $form->addCheck('clubhouse', 1);
     $form->setLabel('clubhouse', 'Clubhouse');
     $form->setMatch('clubhouse', $this->clubhouse);
     \PHPWS_Core::initModClass('properties', 'User.php');
     $contracts = User::getContracts();
     $form->addSelect('contract_length', $contracts);
     $form->setLabel('contract_length', 'Contract length');
     $form->setMatch('contract_length', $this->contract_length);
     $form->addTextarea('description', $this->description);
     $form->setLabel('description', 'Other property information');
     $form->addCheck('airconditioning', 1);
     $form->setLabel('airconditioning', 'Air Conditioning');
     $form->setMatch('airconditioning', $this->airconditioning);
     $form->addCheck('dishwasher', 1);
     $form->setLabel('dishwasher', 'Dishwasher');
     $form->setMatch('dishwasher', $this->dishwasher);
     $itypes[NET_DIALUP] = 'Dial Up';
     $itypes[NET_CABLE] = 'Cable';
     $itypes[NET_DSL] = 'DSL';
     $itypes[NET_WIRELESS] = 'Wireless';
     $itypes[NET_SATELLITE] = 'Satellite';
     $itypes[NET_FIBER] = 'Fiber';
     $itypes[NET_BOTH] = 'DSL/Cable';
     $form->addSelect('internet_type', $itypes);
     $form->setLabel('internet_type', 'Internet');
     $form->setMatch('internet_type', $this->internet_type);
     $form->addSelect('laundry_type', array(LAUNDRY_NONE => 'No laundry', LAUNDRY_ON_PREMISES => 'Laundry room on premises', LAUNDRY_HOOKUP => 'Washer/Dryer hook ups in unit', LAUNDRY_IN_UNIT => 'Washer/Dryer in unit'));
     $form->setLabel('laundry_type', 'Laundry');
     $form->setMatch('laundry_type', $this->laundry_type);
     $form->addText('monthly_rent', $this->getMonthlyRent());
     $form->setLabel('monthly_rent', 'Monthly rent');
     $form->setSize('monthly_rent', 8, 8);
     $form->setRequired('monthly_rent');
     $form->addText('move_in_date', $this->getMoveInDate());
     $form->setLabel('move_in_date', 'Move-in date');
     $form->setExtra('move_in_date', 'class="datepicker"');
     $form->addText('name', $this->name);
     $form->setLabel('name', 'Name of property');
     $form->setRequired('name');
     $form->setSize('name', 50);
     $form->addCheck('pets_allowed', 1);
     $form->setLabel('pets_allowed', 'Pets allowed');
     $form->setMatch('pets_allowed', $this->pets_allowed);
     $form->addCheck('sublease', 1);
     $form->setMatch('sublease', $this->sublease);
     $form->setLabel('sublease', 'Sublease');
     $toptions[TV_NONE] = 'Antenna';
     $toptions[TV_CABLE] = 'Cable';
     $toptions[TV_SATELLITE] = 'Satellite';
     $toptions[TV_FIBER] = 'Fiber';
     $form->addSelect('tv_type', $toptions);
     $form->setLabel('tv_type', 'Television');
     $form->setMatch('tv_type', $this->tv_type);
     $form->addSelect('trash_type', array(TRASH_ON_YOUR_OWN => 'Trash and recycling receptacles not provided', TRASH_ON_PREMISES_NO_RECYCLE => 'Trash receptacles on site.  Recycling not provided', TRASH_ON_PREMISES_WITH_RECYCLE => 'Trash and recycling receptacles provided on site', TRASH_PICKUP => 'Curbside pickup for trash and recycling'));
     $form->setMatch('trash_type', $this->trash_type);
     $form->setLabel('trash_type', 'Trash removal');
     $form->addCheck('workout_room', 1);
     $form->setMatch('workout_room', $this->workout_room);
     $form->setLabel('workout_room', 'Workout room');
     return $form;
 }
コード例 #10
0
ファイル: Visitors.php プロジェクト: HaldunA/phpwebsite
 public function row($staff_list = null, &$staff)
 {
     static $meeting = 0;
     $form = new PHPWS_Form('form' . $this->id);
     $tpl['NAME'] = sprintf('%s %s', $this->firstname, $this->lastname);
     $tpl['ARRIVED'] = strftime(PHPWS_Settings::get('checkin', 'time_format'), $this->arrival_time);
     $tpl['WAITING'] = Checkin::timeWaiting(time() - $this->arrival_time);
     if ($staff_list && $staff->visitor_id != $this->id) {
         $select = sprintf('visitor_%s', $this->id);
         $form->addSelect($select, $staff_list);
         $form->setExtra($select, sprintf('onchange="reassign(this, %s)"', $this->id));
         $tpl['MOVE'] = $form->get($select);
     }
     if ($this->note) {
         $tpl['NOTE'] = $this->note;
     }
     $tpl['REASON'] = $this->getReason();
     $links[] = $this->noteLink();
     if (Current_User::allow('checkin', 'remove_visitors') && $staff->visitor_id != $this->id) {
         $links[] = $this->removeLink();
     }
     $tpl['ACTION'] = implode(' | ', $links);
     return $tpl;
 }
コード例 #11
0
ファイル: Checkin_Admin.php プロジェクト: HaldunA/phpwebsite
 private function summaryReport()
 {
     javascript('datepicker');
     $form = new PHPWS_Form('report-date');
     $form->setMethod('get');
     $form->addHidden('module', 'checkin');
     $form->addHidden('aop', 'report');
     $form->addHidden('summary_report', 1);
     $form->addText('start_date', $_GET['start_date']);
     $form->setLabel('start_date', 'Start date');
     $form->setSize('start_date', 10);
     $form->setExtra('start_date', 'class="datepicker"');
     $form->addText('end_date', $_GET['end_date']);
     $form->setLabel('end_date', 'End date');
     $form->setSize('end_date', 10);
     $form->setExtra('end_date', 'class="datepicker"');
     if (!empty($_GET['visitor_name'])) {
         $name = trim(strip_tags($_GET['visitor_name']));
     } else {
         $name = null;
     }
     $form->addText('visitor_name', $name);
     $form->setLabel('visitor_name', 'Visitor name');
     $form->addSubmit(dgettext('checkin', 'Summary report'));
     $db = new PHPWS_DB('checkin_staff');
     $db->addColumn('checkin_staff.id');
     $db->addColumn('users.display_name');
     $db->addWhere('checkin_staff.user_id', 'users.id');
     $db->setIndexBy('id');
     $db->addOrder('users.display_name desc');
     $assigned = $db->select('col');
     $assigned[0] = dgettext('checkin', 'Show all');
     $assigned = array_reverse($assigned, true);
     $form->addSelect('assigned', $assigned);
     $form->setLabel('assigned', 'By staff');
     if (isset($_GET['assigned'])) {
         $staff_id = (int) $_GET['assigned'];
         $form->setMatch('assigned', $staff_id);
     } else {
         $staff_id = 0;
     }
     $tpl = $form->getTemplate();
     $start_date = strtotime($_GET['start_date']);
     $end_date = strtotime($_GET['end_date']);
     if (empty($start_date) || empty($end_date) || $start_date > $end_date) {
         $tpl['EMPTY'] = 'Please enter your date range again.';
     } else {
         $this->title = 'Visitors from ' . $_GET['start_date'] . ' to ' . $_GET['end_date'];
         $db = new PHPWS_DB('checkin_visitor');
         $db->addWhere('arrival_time', $start_date, '>=');
         $db->addWhere('arrival_time', $end_date, '<=');
         $db->addColumn('id');
         $db->addColumn('arrival_time');
         $db->addColumn('firstname');
         $db->addColumn('lastname');
         $db->addColumn('start_meeting');
         $db->addColumn('end_meeting');
         if ($staff_id) {
             $db->addWhere('assigned', $staff_id);
         }
         if (!empty($name)) {
             $name = strtolower($name);
             if (strlen($name) == 1) {
                 $db->addWhere('firstname', "{$name}%", 'like', 'and', 'name');
                 $db->addWhere('lastname', "{$name}%", 'like', 'or', 'name');
             } else {
                 $db->addWhere('firstname', "%{$name}%", 'like', 'and', 'name');
                 $db->addWhere('lastname', "%{$name}%", 'like', 'or', 'name');
             }
         }
         $result = $db->select();
         $total_visits = 0;
         $total_wait = 0;
         $total_meeting = 0;
         $total_days = 0;
         $incomplete_visits = 0;
         $current_day = null;
         foreach ($result as $visit) {
             extract($visit);
             $arrival_day = date('MdY', $arrival_time);
             if ($current_day != $arrival_day) {
                 $current_day = $arrival_day;
                 $total_days++;
             }
             $row = array();
             if (!$start_meeting || !$end_meeting) {
                 $incomplete_visits++;
                 continue;
             }
             $total_visits++;
             $twaited = $start_meeting - $arrival_time;
             $waited = Checkin::timeWaiting($twaited);
             if ($end_meeting) {
                 $tmeeting = $end_meeting - $start_meeting;
             }
             $meeting = Checkin::timeWaiting($tmeeting);
             $row['VISIT'] = $total_visits;
             $row['VISITOR'] = "{$firstname} {$lastname}";
             $row['DATE'] = date('g:ia m.d.Y', $arrival_time);
             $row['WAITED'] = $waited;
             $row['MEETING'] = $meeting;
             $tpl['rows'][] = $row;
             $total_wait += $twaited;
             $total_meeting += $tmeeting;
         }
         if ($total_visits) {
             $tpl['TOTAL_DAYS'] = $total_days;
             $tpl['TOTAL_VISITS'] = $total_visits;
             $tpl['AVG_VISITS'] = round($total_visits / $total_days, 1);
             $tpl['TOTAL_WAIT'] = Checkin::timeWaiting($total_wait);
             $tpl['TOTAL_MEETING'] = Checkin::timeWaiting($total_meeting);
             $tpl['AVG_WAIT'] = Checkin::timeWaiting(round($total_wait / $total_visits));
             $tpl['AVG_MEETING'] = Checkin::timeWaiting(round($total_meeting / $total_visits));
             $tpl['INCOMPLETE_MEETINGS'] = $incomplete_visits;
         } else {
             $tpl['EMPTY'] = 'No visits made in this date range.';
         }
     }
     $this->content = PHPWS_Template::process($tpl, 'checkin', 'summary_report.tpl');
 }