protected function doCreatives($request) { $db = new WPAM_Data_DataAccess(); if (isset($request['action']) && $request['action'] == 'detail') { $response = new WPAM_Pages_TemplateResponse('affiliate_creative_detail'); $affiliate = $db->getAffiliateRepository()->loadByUserId(wp_get_current_user()->ID); $creative = $db->getCreativesRepository()->load((int) $request['creativeId']); if ($creative === NULL) { wp_die(__('Invalid creative.', 'wpam')); } if ($affiliate === NULL) { wp_die(__('Invalid affiliate', 'wpam')); } if (!$creative->isActive()) { wp_die(__('Inactive creative.', 'wpam')); } $response->viewData['affiliate'] = $affiliate; $response->viewData['creative'] = $creative; $linkBuilder = new WPAM_Tracking_TrackingLinkBuilder($affiliate, $creative); $response->viewData['htmlPreview'] = $linkBuilder->getHtmlSnippet(); $response->viewData['htmlSnippet'] = $linkBuilder->getImpressionHtmlSnippet(); return $response; } $response = new WPAM_Pages_TemplateResponse('affiliate_creative_list'); $response->viewData['creatives'] = $db->getCreativesRepository()->loadAllActiveNoDeletes(); return $response; }
</th> <th width="25"><?php _e('Type', 'affiliates-manager'); ?> </th> <th width="200"><?php _e('Link', 'affiliates-manager'); ?> </th> </tr> </thead> <tbody> <?php foreach ($this->viewData['creatives'] as $creative) { $linkBuilder = new WPAM_Tracking_TrackingLinkBuilder($model, $creative); $link = $linkBuilder->getImpressionHtmlSnippet(); ?> <tr class="creative-<?php echo $creative->status; ?> "> <td><?php echo $creative->name; ?> </td> <td><?php echo $creative->type; ?> </td> <td><input type="text" size="50" value='<?php echo htmlentities($link, ENT_QUOTES);