You are here

popup_maker_display_rule.tpl.php in Popup Maker - All popup types 7

File

popup_maker_display_rule.tpl.php
View source
<div class="sgpm-popup-rule" data-rule-id="<?php

echo $index;
?>">
	<div>
		<label class="sgpm-label">Select Target</label>
		<select name="sgpm_rules[<?php

echo $index;
?>][param]" class="sgpm-select sgpm-rule-param">
			<?php

foreach ($displayRules as $type => $nodes) {
  if (!empty($nodes)) {
    ?>
					<optgroup label="<?php

    echo $type;
    ?>">
						<option data-sgpm-rule-param="<?php

    echo $type;
    ?>_all"
						        value="<?php

    echo $type . '_all';
    ?>" <?php

    if (isset($rule['param']) && $rule['param'] === $type . '_all') {
      ?>selected="selected" <?php

    }
    ?> >
						All <?php

    echo $type;
    ?>s
						</option>
						<option data-sgpm-rule-param="<?php

    echo $type;
    ?>_selected"
						        value="<?php

    echo $type . '_selected';
    ?>" <?php

    if (isset($rule['param']) && $rule['param'] === $type . '_selected') {
      ?>selected="selected" <?php

    }
    ?> >
						Selected <?php

    echo $type;
    ?>s
						</option>
					</optgroup>
				<?php

  }
}
?>
		</select>
	</div>

	<div>
		<label class="sgpm-label">Operator</label>
		<select name="sgpm_rules[<?php

echo $index;
?>][operator]" class="sgpm-select">
			<option value="==" <?php

if (isset($rule['operator']) && $rule['operator'] === '==') {
  ?>selected="selected"<?php

}
?> >Is</option>
			<option value="!=" <?php

if (isset($rule['operator']) && $rule['operator'] === '!=') {
  ?>selected="selected"<?php

}
?> >Is not</option>
		</select>
	</div>

	<?php

foreach ($displayRules as $type => $nodes) {
  ?>
		<div data-sgpm-rule-param="<?php

  echo $type;
  ?>_selected" class="sgpm-rule-value <?php

  if (!isset($rule['param']) || $rule['param'] != $type . '_selected') {
    ?>sgpm-hide<?php

  }
  ?>">
			<label class="sgpm-label">Selected <?php

  echo $type;
  ?>s</label>
			<select <?php

  if ($last || isset($rule['param']) && $rule['param'] === $type . '_selected') {
    ?>name="sgpm_rules[<?php

    echo $index;
    ?>][value][]"<?php

  }
  else {
    ?>data-name="sgpm_rules[<?php

    echo $index;
    ?>][value][]"<?php

  }
  ?> class="sgpm-select sgpm-popup-rule-value" multiple="multiple">
			<?php

  foreach ($nodes as $nodeId => $nodeTitle) {
    ?>
				<option value="<?php

    echo $nodeId;
    ?>" <?php

    if (isset($rule['param']) && $rule['param'] === $type . '_selected' && in_array($nodeId, $rule['value'])) {
      ?>selected="selected" <?php

    }
    ?> ><?php

    echo $nodeTitle;
    ?></option>
			<?php

  }
  ?>
			</select>
		</div>
	<?php

}
?>

	<a href="#" class="sgpm-fab-btn sgpm-remove-rule">
		<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
			<path d="M19 13H5v-2h14v2z"/>
			<path d="M0 0h24v24H0z" fill="none"/>
		</svg>
	</a>

	<a href="#" class="sgpm-fab-btn sgpm-add-rule <?php

if (!$last) {
  ?>sgpm-hide<?php

}
?>">
		<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
			<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
			<path d="M0 0h24v24H0z" fill="none"/>
		</svg>
	</a>

</div>