/** * Render the full-width notify button section. * * @since 1.0 */ protected function render_notify_button_section() { if ($this->release->get_status() == Release::STATUS_ARCHIVED) { $disabled = ' button-disabled'; $title = __("Update notifications can't be sent for archived releases.", Plugin::SLUG); $title = " title=\"{$title}\""; } else { $disabled = ''; $title = ''; } ?> <div class="spacing-wrapper bottom-border full-notify-button hidden"> <button class="button <?php echo $disabled; ?> " id="notify-button-full"<?php echo $title; ?> > <?php _e("Notify Outdated Customers", Plugin::SLUG); ?> </button> </div> <?php }
/** * Get data to display for a single key. * * @param \ITELIC\Activation|\ITELIC\Release $release * @param bool $raw * * @return array */ protected function get_fields_for_object(\ITELIC\Release $release, $raw = false) { if ($release->get_start_date()) { $started = $release->get_start_date()->format(DateTime::ISO8601); } else { $started = '-'; } return array('ID' => $release->get_ID(), 'product' => $raw ? $release->get_product()->ID : $release->get_product()->post_title, 'version' => $release->get_version(), 'type' => $release->get_type(!$raw), 'status' => $release->get_status(!$raw), 'download' => $raw ? $release->get_download()->ID : $release->get_download()->post_title, 'started' => $started, 'changelog' => $release->get_changelog()); }
/** * Prepare an individual key view. * * @since 1.0 * * @param Release $release * * @return array */ protected function prepare_record(Release $release) { if ($release->get_start_date()) { $start_date = $release->get_start_date()->format(get_option('date_format')); } else { $start_date = '-'; } $updated = $release->get_total_updated(); $total_activations = $release->get_total_active_activations(); $total_activations = max(1, $total_activations); $percent = min(number_format($updated / $total_activations * 100, 0), 100); $data = array('ID' => $release->get_ID(), 'release' => (string) $release, 'status' => $release->get_status(false), 'type' => $release->get_type(true), 'updated' => "{$percent}%", 'start_date' => $start_date); /** * Filter the columns on the releases list table. * * @since 1.0 * * @param array $data * @param Release $release */ $data = apply_filters('itelic_releases_list_table_columns', $data, $release); return $data; }
/** * Get the chart for displaying the previous version being upgrade from. * * @since 1.0 * * @param Release $release * * @return Chart\Base */ private function get_version_chart(Release $release) { if ($release->get_status() == Release::STATUS_DRAFT) { return null; } $results = $release->get_top_5_previous_versions(); $chart = new Chart\Pie(698, 200, array('ibdLoadOn' => 'loadVersionsChart', 'ibdShowLegend' => '#pie-chart-legend', 'tooltipTemplate' => '<%= value %> install<%if (value != 1){%>s<%}%>', 'responsive' => true)); $colors = array(array('color' => '#E94F37', 'highlight' => '#FF6951'), array('color' => '#393E41', 'highlight' => '#53585B'), array('color' => '#3F88C5', 'highlight' => '#59A2DF'), array('color' => '#44BBA4', 'highlight' => '#5ED5BE'), array('color' => '#EDDDD4', 'highlight' => '#D4C4BB')); $i = 0; foreach ($results as $version => $count) { $label = empty($version) ? __("Unknown", Plugin::SLUG) : "v{$version}"; $chart->add_data_set($count, $label, $colors[$i]); $i++; } return $chart; }