protected function print_experiment_information($exp, $descr, $res) { ?> <div id="exp-info-header"> <?php echo $this->get_experiment_icon($exp); ?> <span class="exp-title"><?php echo $exp->get_name(); ?> </span> </div> <?php $startDate = NelioABFormatter::format_date($exp->get_start_date()); $end = $exp->get_end_date(); if (empty($end)) { $running = __('Started on', 'nelioab') . ' ' . $startDate; } else { $endDate = NelioABFormatter::format_date($end); $running = $startDate . '—' . $endDate; } if ($res == null && $exp->get_status() == NelioABExperiment::STATUS_FINISHED) { $duration = NelioABFormatter::get_timelapse($exp->get_start_date(), $exp->get_end_date()); } else { if ($res == null) { $duration = __('Not available', 'nelioab'); } else { $duration = NelioABFormatter::get_timelapse($exp->get_start_date(), $res->get_last_update()); } } ?> <div id="exp-info-running-time"> <span class="exp-info-header"><?php _e('Duration', 'nelioab'); ?> </span> <span class="exp-info-duration"><?php echo $duration; ?> </span> <span class="exp-info-running-values"><?php echo $running; ?> </span> </div> <?php $end_mode = __('The experiment can only be stopped manually', 'nelioab'); if ($exp->get_status() == NelioABExperiment::STATUS_RUNNING && NelioABAccountSettings::get_subscription_plan() >= NelioABAccountSettings::ENTERPRISE_SUBSCRIPTION_PLAN) { switch ($exp->get_finalization_mode()) { case NelioABExperiment::FINALIZATION_MANUAL: $end_mode = __('The experiment can only be stopped manually', 'nelioab'); break; case NelioABExperiment::FINALIZATION_AFTER_DATE: $raw_fin_value = $exp->get_finalization_value(); $fin_value = __('24 hours', 'nelioab'); if ($raw_fin_value >= 2) { $fin_value = __('48 hours', 'nelioab'); } if ($raw_fin_value >= 5) { $fin_value = __('5 days', 'nelioab'); } if ($raw_fin_value >= 7) { $fin_value = __('1 week', 'nelioab'); } if ($raw_fin_value >= 14) { $fin_value = __('2 weeks', 'nelioab'); } if ($raw_fin_value >= 30) { $fin_value = __('1 month', 'nelioab'); } if ($raw_fin_value >= 60) { $fin_value = __('2 months', 'nelioab'); } $end_mode = sprintf(__('The experiment will be automatically stopped %s after it was started.', 'nelioab'), $fin_value); break; case NelioABExperiment::FINALIZATION_AFTER_VIEWS: $end_mode = sprintf(__('The experiment will be automatically stopped when the tested page (along with its alternatives) has been seen over %s times.', 'nelioab'), $exp->get_finalization_value()); break; case NelioABExperiment::FINALIZATION_AFTER_CONFIDENCE: $end_mode = sprintf(__('The experiment will be automatically stopped when confidence reaches %s%%.', 'nelioab'), $exp->get_finalization_value()); break; } } ?> <div id="exp-info-end-mode"> <span><?php _e('Finalization Mode', 'nelioab'); ?> </span> <span class="exp-end-mode"><?php echo $end_mode; ?> </span> </div> <?php if (empty($descr)) { $descr = __('No description provided', 'nelioab'); } ?> <div id="exp-info-descr"> <span><?php _e('Description', 'nelioab'); ?> </span> <span><?php echo $descr; ?> </span> </div> <?php }
/** * Returns whether the upgrade notice is visible or not. * * @return boolean whether the upgrade notice is visible or not. * * @since 2.0.11 */ public static function is_upgrade_message_visible() { if (NelioABAccountSettings::get_subscription_plan() != NelioABAccountSettings::BASIC_SUBSCRIPTION_PLAN) { return false; } $result = get_option('nelioab_hide_upgrade_message', false); if (!$result) { return true; } else { return false; } }
/** * PHPDOC * * @param array $field PHPDOC * * @return void * * @since PHPDOC */ protected function make_field($field) { $field_name = $field['label']; $field_id = $field['id']; $callback = $field['callback']; $is_mandatory = false; if (isset($field['mandatory']) && $field['mandatory']) { $is_mandatory = true; } $can_be_used = true; $explanation = false; if (isset($field['min_plan'])) { if (NelioABAccountSettings::get_subscription_plan() < $field['min_plan']) { $can_be_used = false; } switch ($field['min_plan']) { case NelioABAccountSettings::PROFESSIONAL_SUBSCRIPTION_PLAN: $explanation = __('This option is only available for users subscribed to our Professional Plan.', 'nelioab'); break; case NelioABAccountSettings::ENTERPRISE_SUBSCRIPTION_PLAN: $explanation = __('This option is only available for users subscribed to our Enterprise Plan.', 'nelioab'); break; } } $error = ''; if ($this->is_invalid($field_id)) { $error = ' class="error"'; } ?> <table <?php if ($can_be_used) { echo 'class="form-table"'; } else { echo 'class="form-table setting-disabled"'; if ($explanation) { echo ' title="' . $explanation . '"'; } } ?> > <tr valign="top"> <th scope="row"<?php echo $error; ?> > <?php if ($is_mandatory) { ?> <label class="mandatory" for="<?php echo $field_id; ?> "><?php echo $field_name; ?> </label> <?php } else { ?> <label for="<?php echo $field_id; ?> "><?php echo $field_name; ?> </label> <?php } ?> </th> <td class="input_for_<?php echo $field_id; ?> "> <?php call_user_func($callback); ?> </td> <?php if (!$can_be_used) { ?> <script type="text/javascript">(function($) { var selector = "" + "td.input_for_<?php echo $field_id; ?> input,"+ "td.input_for_<?php echo $field_id; ?> select,"+ "td.input_for_<?php echo $field_id; ?> textarea"; $(selector).attr('disabled','disabled'); })(jQuery);</script><?php } ?> </tr> </table> <?php }