summaryrefslogtreecommitdiff
path: root/views/mods/mod_abo/page_abo.phtml
blob: 8f1d06124ca45116248338127320bcd7e877ce2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<?php

	/**
	 * Template für die Übersichtsseite der Abonnements im Frontend
	 */
 
?>

<div class="wpsg_mod_kundenverwaltung_abo wpsg">

	<?php echo $this->writeFrontendMessage(); ?>
	
	<?php if (wpsg_isSizedArray($this->view['arOrder'])) { ?>
		
		<div class="wpsg_mod_abo_order_product_wrap">
		<?php foreach ($this->view['arOrder'] as $oOrder) { ?>

            <?php if ($this->callMod('wpsg_mod_abo', 'isAboOrder', [$oOrder->id]) === 1) {

                $arAbo = $this->callMod('wpsg_mod_abo', 'getAboProductsFromOrder', [$oOrder->id]);

                foreach ($arAbo as $oOrderProduct) {

                    $aboStatus = $this->callMod('wpsg_mod_abo', 'getAboProductStatus', [$oOrder->id, $oOrderProduct->id]); $oAbo = wpsg_abo::getInstance(intval($aboStatus['id']));
                    $state = $oAbo->getState();

                    ?>

                    <div class="wpsg_mod_abo_order_product">

                        <h1 class="entry-title title">
                            <?php echo wpsg_translate(__('Abo "#1#" aus Bestellung #2#', 'wpsg'), $oOrderProduct->getProduct()->getProductName(), $oOrder->getNr()); ?>
                        </h1>

                        <?php $nAttachmentID = $this->imagehandler->getAttachmentID($oOrderProduct->getProductKey()); ?>

                        <?php if (wpsg_isSizedInt($nAttachmentID)) { ?>
                            <div class="image">
                                <?php echo wp_get_attachment_image($nAttachmentID, array(100, 100), false, array()); ?>
                            </div>
                        <?php } ?>

                        <div class="content">

                            <div class="start">
                                <span class="label"><?php echo __('Erstkauf (Startzeitpunkt):', 'wpsg'); ?></span>
                                <span class="value">

                                    <?php echo wpsg_formatTimestamp(strtotime($oOrder->cdate)); ?>

                                </span>
                            </div>
                            <div class="price">
                                <span class="label"><?php echo wpsg_translate(__('Preis (#1# Tage):', 'wpsg'), $oOrderProduct->getProduct()->wpsg_mod_abo_durration); ?></span>
                                <span class="value"><?php echo wpsg_ff($oOrderProduct->getProduct()->wpsg_mod_abo_price, $this->get_option('wpsg_currency')); ?></span>
                            </div>
                            <div class="duration">
                                <span class="label"><?php echo __('Laufzeit (Endzeitpunkt):', 'wpsg'); ?></span>
                                <span class="value">

                                    <?php $exp = $this->callMod('wpsg_mod_abo', 'getOrderAboExpiration', array($oOrder->id, $oOrderProduct->getId())); ?>

                                    <?php if ($oAbo->getState() === wpsg_abo::STATE_RUNNING) { ?>
                                        <span class="duration_running"><?php echo $exp; ?></span>
                                    <?php } else if ($oAbo->getState() === wpsg_abo::STATE_INEXTENSION) { ?>
                                        <span class="duration_inextension"><?php echo $exp; ?></span>
                                    <?php } else if ($oAbo->getState() === wpsg_abo::STATE_EXTEND) { ?>
                                        <span class="duration_expired"><?php echo $exp; ?></span>
                                    <?php }  ?>

                                </span>
                            </div>
                            <div class="status">
                                <span class="label"><?php echo __('automatische Verlängerung:', 'wpsg'); ?></span>
                                <span class="value">

                                    <?php if ($aboStatus['status'] === wpsg_mod_abo::STATUS_ACTIVE) { ?>

                                        <span class="status_activ"><?php echo __('Aktiv'); ?></span>

                                        <?php if (strtotime($aboStatus['mail_admin_stop']) > 0) { ?>

                                            <?php echo __('Kündigung ausstehend', 'wpsg'); ?>

                                        <?php } else { ?>

                                            <?php if (in_array($this->callMod('wpsg_mod_abo', 'getSetting', ['wpsg_mod_abo_autoexpire_customer', $oOrderProduct->getProductId()]), Array(wpsg_mod_abo::CUSTOMER_AUTO_MAIL, wpsg_mod_abo::CUSTOMER_AUTO_DIRECT))) { ?>
                                            <span class="link_wrap"><a href="<?php echo $this->getUrl(wpsg_ShopController::URL_ABO, 'wpsg_mod_abo', 'stoprenewal', Array('order_id' => $oOrder->id, 'product_key' => $oOrderProduct->getProductKey())); ?>"><?php echo __('Deaktivieren'); ?></a></span>
                                            <?php } ?>

                                        <?php } ?>

                                    <?php } else if ($aboStatus['status'] === wpsg_mod_abo::STATUS_STOPPED) { ?>
                                        <span class="status_inactiv"><?php echo __('Inaktiv') ?></span>
                                    <?php } ?>

                                </span>
                            </div>
                        </div>

                        <div class="wpsg_clear"></div>

                    </div>

                    <?php

                }

                ?>

            <?php } ?>
		
			<?php /* foreach ($this->callMod('wpsg_mod_abo', 'getAboProductsFromOrder', Array($oOrder->id)) as $oOrderProduct) {
				
				$product_id = $oOrderProduct->getProductId();
				$aboStatus = $this->callMod('wpsg_mod_abo', 'getAboProductStatus', Array($oOrder->id, $oOrderProduct->getProductKey())); 
				 
				try {
				
					$oAbo = wpsg_abo::getFromOrderAndProduct($oOrder->getId(), $oOrderProduct->getId());
					
				} catch (\Exception $e) {
					
					continue;
					
                }
				
				?>
			
				<div class="wpsg_mod_abo_order_product">

					<h1 class="entry-title title">
						<?php echo wpsg_translate(__('Abo "#1#" aus Bestellung #2#', 'wpsg'), $oOrderProduct->getProduct()->getProductName(), $oOrder->getNr()); ?>
					</h1>
					
					<?php $nAttachmentID = $this->imagehandler->getAttachmentID($oOrderProduct->getProductKey()); ?>
					
					<?php if (wpsg_isSizedInt($nAttachmentID)) { ?>
						<div class="image">
							<?php echo wp_get_attachment_image($nAttachmentID, array(100, 100), false, array()); ?>
						</div>
					<?php } ?>
			
					<div class="content">
					
						<div class="start">
							<span class="label"><?php echo __('Erstkauf (Startzeitpunkt):', 'wpsg'); ?></span>
							<span class="value">
								
								<?php echo wpsg_formatTimestamp(strtotime($oOrder->cdate)); ?>
								
							</span>
						</div>
						<div class="price">
							<span class="label"><?php echo wpsg_translate(__('Preis (#1# Tage):', 'wpsg'), $oOrderProduct->getProduct()->wpsg_mod_abo_durration); ?></span>
							<span class="value"><?php echo wpsg_ff($oOrderProduct->getProduct()->wpsg_mod_abo_price, $this->get_option('wpsg_currency')); ?></span>
						</div>
						<div class="duration">
							<span class="label"><?php echo __('Laufzeit (Endzeitpunkt):', 'wpsg'); ?></span>
							<span class="value">
								
								<?php $exp = $this->callMod('wpsg_mod_abo', 'getOrderAboExpiration', array($oOrder->id, $oOrderProduct->getId())); ?>
								
								<?php if ($oAbo->getState() === wpsg_abo::STATE_RUNNING) { ?>
									<span class="duration_running"><?php echo $exp; ?></span>
                                <?php } else if ($oAbo->getState() === wpsg_abo::STATE_INEXTENSION) { ?>
									<span class="duration_inextension"><?php echo $exp; ?></span>
								<?php } else if ($oAbo->getState() === wpsg_abo::STATE_EXTEND) { ?>
									<span class="duration_expired"><?php echo $exp; ?></span>
								<?php }  ?>
								
							</span>
						</div>					
						<div class="status">
							<span class="label"><?php echo __('automatische Verlängerung:', 'wpsg'); ?></span>
							<span class="value">
													
								<?php if ($aboStatus['status'] === wpsg_mod_abo::STATUS_ACTIVE) { ?>
									
									<span class="status_activ"><?php echo __('Aktiv'); ?></span>
									
									<?php if (strtotime($aboStatus['mail_admin_stop']) > 0) { ?>
	
										<?php echo __('Kündigung ausstehend', 'wpsg'); ?>
										
									<?php } else { ?>
									
										<?php if (in_array($this->callMod('wpsg_mod_abo', 'getSetting', ['wpsg_mod_abo_autoexpire_customer', $product_id]), Array(wpsg_mod_abo::CUSTOMER_AUTO_MAIL, wpsg_mod_abo::CUSTOMER_AUTO_DIRECT))) { ?>
										<span class="link_wrap"><a href="<?php echo $this->getUrl(wpsg_ShopController::URL_ABO, 'wpsg_mod_abo', 'stoprenewal', Array('order_id' => $oOrder->id, 'product_key' => $oOrderProduct->getProductKey())); ?>"><?php echo __('Deaktivieren'); ?></a></span>
										<?php } ?>
							
									<?php } ?>
									
								<?php } else if ($aboStatus['status'] === wpsg_mod_abo::STATUS_STOPPED) { ?>
									<span class="status_inactiv"><?php echo __('Inaktiv') ?></span>
								<?php } ?> 
								
							</span>
						</div>
					</div>
					
					<div class="wpsg_clear"></div>
					
				</div>
				
			<?php } */ ?>
							
		<?php } // foreach Order ?>
		</div>
		
	<?php } else { ?>
	
		<p><?php echo __('Bisher kein(e) Abonnement(s) vorhanden.', 'wpsg'); ?></p>
		
	<?php } ?>
</div>