|
Revision 9806, 3.6 kB
(checked in by ha1t, 5 years ago)
|
|
first import
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | class Event_Form_EventCancelRevert extends Ethna_ActionForm |
|---|
| 18 | { |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | var $form = array( |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | 'id' => array( |
|---|
| 38 | 'name' => 'id', |
|---|
| 39 | 'required' => true, |
|---|
| 40 | 'form_type' => FORM_TYPE_HIDDEN, |
|---|
| 41 | 'type' => VAR_TYPE_INT, |
|---|
| 42 | ), |
|---|
| 43 | 'submit' => array( |
|---|
| 44 | 'name' => 'submit', |
|---|
| 45 | 'required' => false, |
|---|
| 46 | 'form_type' => FORM_TYPE_SUBMIT, |
|---|
| 47 | 'type' => VAR_TYPE_STRING, |
|---|
| 48 | ), |
|---|
| 49 | ); |
|---|
| 50 | } |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | class Event_Action_EventCancelRevert extends Ethna_AuthAdminActionClass |
|---|
| 60 | { |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | function prepare() |
|---|
| 68 | { |
|---|
| 69 | $this->db = $this->backend->getDB(); |
|---|
| 70 | |
|---|
| 71 | $id = Event_Util::getPathInfoArg(); |
|---|
| 72 | if (is_numeric($id)) { |
|---|
| 73 | $this->af->set('id', $id); |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | $this->record = $this->getEventAttendeeFromId($this->af->get('id')); |
|---|
| 77 | |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | if (!$this->af->get('submit')) { |
|---|
| 85 | $record = $this->record; |
|---|
| 86 | unset($record['ip']); |
|---|
| 87 | unset($record['ua']); |
|---|
| 88 | unset($record['event_id']); |
|---|
| 89 | $this->af->setApp('record', $record); |
|---|
| 90 | |
|---|
| 91 | return 'event-cancel-revert-confirm'; |
|---|
| 92 | } |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | |
|---|
| 99 | |
|---|
| 100 | |
|---|
| 101 | function perform() |
|---|
| 102 | { |
|---|
| 103 | if ($this->af->validate() > 0) { |
|---|
| 104 | return 'error'; |
|---|
| 105 | } |
|---|
| 106 | |
|---|
| 107 | $param['canceled'] = 0; |
|---|
| 108 | |
|---|
| 109 | $this->db->autoExecute('event_attendee', |
|---|
| 110 | $param, |
|---|
| 111 | 'UPDATE', |
|---|
| 112 | "id = {$this->record['id']}" |
|---|
| 113 | ); |
|---|
| 114 | |
|---|
| 115 | Event_Util::redirect($this->config->get('base_url') . '/event_show/' . $this->record['event_id'], '1', 'イベントキャンセルを解除しました。'); |
|---|
| 116 | |
|---|
| 117 | return null; |
|---|
| 118 | } |
|---|
| 119 | |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | |
|---|
| 123 | |
|---|
| 124 | function getEventAttendeeFromId($event_id) |
|---|
| 125 | { |
|---|
| 126 | $query = "SELECT * FROM event_attendee"; |
|---|
| 127 | $query.= " WHERE id = ?"; |
|---|
| 128 | |
|---|
| 129 | return $this->db->getRow($query, array((int)$event_id)); |
|---|
| 130 | } |
|---|
| 131 | } |
|---|
| 132 | ?> |
|---|