/** * Echo a content list as tag-list. * * @since 1.0.0 * * @param array $contents List of content items to display. */ protected function content_box($rule) { static $row_items = 0; $rule_titles = MS_Model_Rule::get_rule_type_titles(); $title = $rule_titles[$rule->rule_type]; $contents = (array) $rule->get_contents(null, true); $membership_id = $this->data['membership']->id; $row_items += 1; $new_row = $row_items % 4 === 0; $show_sep = ($row_items - 1) % 4 === 0; if ($show_sep && $row_items > 1) { MS_Helper_Html::html_separator(); } ?> <div class="ms-part-4 ms-min-height"> <?php if (!$new_row) { MS_Helper_Html::html_separator('vertical'); } ?> <div class="ms-bold"> <?php printf('%s (%s):', $title, $rule->count_rules()); ?> </div> <div class="inside"> <ul class="ms-content-tag-list ms-group"> <?php foreach ($contents as $content) { if ($content->access) { MS_Helper_Html::content_tag($content); } } ?> </ul> <div class="ms-protection-edit-wrapper"> <?php $edit_url = MS_Controller_Plugin::get_admin_url('protection', array('tab' => $rule->rule_type, 'membership_id' => $membership_id)); MS_Helper_Html::html_element(array('id' => 'edit_' . $rule->rule_type, 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'title' => $title, 'value' => sprintf(__('Edit %s Access', 'membership2'), $title), 'url' => $edit_url, 'class' => 'wpmui-field-button button')); ?> </div> </div> </div> <?php if ($new_row) { echo '</div><div class="ms-group">'; } }
/** * Echo a content list as 2-column table that show Content-Title and the * Available date. * Used by Dripped-Content view. * * @since 1.0.0 * * @param array $contents List of content items to display. */ protected function content_box($contents) { $row_class = ''; ksort($contents); $rule_titles = MS_Model_Rule::get_rule_type_titles(); $edit_url = MS_Controller_Plugin::get_admin_url('protection', array('tab' => $rule->rule_type)); $edit_link = array('id' => 'edit_dripped', 'type' => MS_Helper_Html::TYPE_HTML_LINK); ?> <table class="ms-list-table ms-list-date widefat"> <thead> <tr> <th class="col-icon"> </th> <th class="col-text"><?php _e('Rule', MS_TEXT_DOMAIN); ?> </th> <th class="col-text"><?php _e('Protected Item', MS_TEXT_DOMAIN); ?> </th> <th class="col-date"><?php _e('Access', MS_TEXT_DOMAIN); ?> </th> </tr> </thead> <tbody> <?php foreach ($contents as $id => $content) { $row_class = $row_class == 'alternate' ? '' : 'alternate'; ?> <tr class="<?php echo esc_attr($row_class . ' ' . $content->icon); ?> "> <td class="col-icon"> <i class="dashicons dashicons-<?php echo esc_attr($content->icon); ?> "></i> </td> <td class="col-text col-type"> <?php $edit_link['url'] = esc_url_raw(add_query_arg('tab', $content->type, $edit_url)); $edit_link['value'] = $rule_titles[$content->type]; MS_Helper_Html::html_element($edit_link); ?> </td> <td class="col-text"> <?php MS_Helper_Html::content_tag($content, 'span'); ?> </td> <td class="col-date"> <?php echo '' . $content->date; ?> </td> </tr> <?php } ?> </tbody> </table> <?php }