Example #1
0
 public function __construct($args = array())
 {
     global $status;
     $validStatuses = DigitalPointBetterAnalytics_Model_Experiments::getStatuses();
     $validStatuses = array_keys($validStatuses);
     $validStatuses = array_map('strtolower', $validStatuses);
     $status = 'all';
     if (isset($_REQUEST['experiment_status']) && in_array($_REQUEST['experiment_status'], $validStatuses)) {
         $status = $_REQUEST['experiment_status'];
         $experiments = array();
         if (!empty($args['experiments']) && is_array($args['experiments'])) {
             foreach ($args['experiments'] as $key => $experiment) {
                 if ($_REQUEST['experiment_status'] == 'active' && $experiment['active']) {
                     $experiments[$key] = $experiment;
                 } elseif ($_REQUEST['experiment_status'] == 'inactive' && !$experiment['active']) {
                     $experiments[$key] = $experiment;
                 }
             }
             $args['experiments'] = $experiments;
         }
     }
     // because this isn't hacky, right?  lol
     if (in_array(@$_GET['action'], $validStatuses) !== false) {
         $_SERVER['REQUEST_URI'] = remove_query_arg(array('id', 'action', '_wpnonce'), $_SERVER['REQUEST_URI']);
     }
     parent::__construct($args);
 }
Example #2
0
 public function __construct($args = array())
 {
     global $status;
     $validStatuses = DigitalPointBetterAnalytics_Model_Experiments::getStatuses();
     $validStatuses = array_keys($validStatuses);
     $validStatuses = array_map('strtolower', $validStatuses);
     $status = 'all';
     if (!empty($args['experiments']['items']) && is_array($args['experiments']['items'])) {
         foreach ($args['experiments']['items'] as $key => $experiment) {
             DigitalPointBetterAnalytics_Model_Experiments::decodeExperimentData($experiment);
             $experiment['sort_type'] = @$experiment['extraData']['type'];
             $args['experiments']['items'][$key] = $experiment;
         }
     }
     if (isset($_REQUEST['experiment_status']) && in_array($_REQUEST['experiment_status'], $validStatuses)) {
         $status = $_REQUEST['experiment_status'];
         $experiments = array();
         if (!empty($args['experiments']['items']) && is_array($args['experiments']['items'])) {
             foreach ($args['experiments']['items'] as $key => $experiment) {
                 if ($_REQUEST['experiment_status'] == 'draft' && $experiment['status'] == 'DRAFT') {
                     $experiments[$key] = $experiment;
                 } elseif ($_REQUEST['experiment_status'] == 'running' && $experiment['status'] == 'RUNNING') {
                     $experiments[$key] = $experiment;
                 } elseif ($_REQUEST['experiment_status'] == 'ended' && $experiment['status'] == 'ENDED') {
                     $experiments[$key] = $experiment;
                 } elseif ($_REQUEST['experiment_status'] == 'ready' && $experiment['status'] == 'READY_TO_RUN') {
                     $experiments[$key] = $experiment;
                 }
             }
             $args['experiments']['items'] = $experiments;
         }
     }
     // because this isn't hacky, right?  lol
     if (in_array(@$_GET['action'], array('start', 'end', 'delete')) !== false) {
         $_SERVER['REQUEST_URI'] = remove_query_arg(array('id', 'action', '_wpnonce'), $_SERVER['REQUEST_URI']);
     }
     parent::__construct($args);
 }
Example #3
0
        }
        wp_nonce_field('create_edit-experiment' . $nOnceSalt);
        ?>

		<table class="form-table">


			<tr valign="top">
				<th scope="row"><?php 
        esc_html_e('Status', 'better-analytics');
        ?>
</th>
				<td>

					<?php 
        $statues = DigitalPointBetterAnalytics_Model_Experiments::getStatuses();
        echo $statues[$experiment['status']];
        echo '<input type="hidden" name="status" value="' . $experiment['status'] . '" />';
        ?>

				</td>
			</tr>

			<?php 
        if ($experiment['status'] == 'RUNNING') {
            if (isset($experiment['variationWinning'])) {
                echo '<tr valign="top">
						<th scope="row">' . esc_html__('Variation Status', 'better-analytics') . '</th>
						<td>';
                if ($experiment['variationWinning'] > 0) {
                    printf(esc_html__('Variation %u is winning', 'better-analytics'), $experiment['variationWinning']);