smart-block-criteria.phtml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <form id="smart-block-form" method="post" action="">
  2. <fieldset class='toggle <?php echo $this->openOption ? "" : "closed"?> sb-criteria-fieldset' id='smart_block_options'>
  3. <legend style='cursor: pointer;'><span class='ui-icon ui-icon-triangle-2-n-s'></span><?php echo _("Smart Block Options") ?></legend>
  4. <dl class='zend_form search-criteria'>
  5. <div class='btn-toolbar clearfix'>
  6. <div class='btn-group sp-button'>
  7. <?php echo $this->element->getElement('generate_button') ?>
  8. </div>
  9. <div class='btn-group sp-button'>
  10. <?php echo $this->element->getElement('shuffle_button') ?>
  11. </div>
  12. </div>
  13. <div id='sp-success' class='success' style='display:none'></div>
  14. <dd id='sp_type-element'>
  15. <label class='sp-label'>
  16. <?php echo $this->element->getElement('sp_type')->getLabel() ?>
  17. <span class='playlist_type_help_icon'></span>
  18. </label>
  19. <?php $i=0;
  20. $value = $this->element->getElement('sp_type')->getValue();
  21. foreach ($this->element->getElement('sp_type')->getMultiOptions() as $radio) : ?>
  22. <label class='sp-label' for='sp_type-<?php echo $i?>'>
  23. <input type="radio" value="<?php echo $i ?>" id="sp_type-<?php echo $i ?>" name="sp_type" <?php if($i == $value){echo 'checked="checked"';}?> ><?php echo $radio ?>
  24. </label>
  25. <?php $i = $i + 1; ?>
  26. <?php endforeach; ?>
  27. </dd>
  28. <dd id='sp_criteria-element' class='criteria-element'>
  29. <?php for ($i = 0; $i < $this->criteriasLength; $i++) {
  30. // modRowMap holds the number of modifier rows for each criteria element
  31. // i.e. if we have 'Album contains 1' and 'Album contains 2' the modRowMap
  32. // for Album is 2
  33. ?>
  34. <?php for ($j = 0; $j < $this->modRowMap[$i]; $j++) {
  35. // determine if logic label should be 'and' or 'or'
  36. if ($this->modRowMap[$i] > 1 && $j != $this->modRowMap[$i]-1) $logicLabel = _('or');
  37. else $logicLabel = _('and');
  38. $disabled = $this->element->getElement("sp_criteria_field_".$i."_".$j)->getAttrib('disabled') == 'disabled'?true:false;
  39. // determine if the next row is disabled and only display the logic label if it isn't
  40. if ($j == $this->modRowMap[$i]-1 && $i < 25) {
  41. $n = $i+1;
  42. $nextIndex = $n."_0";
  43. } elseif ($j+1 <= $this->modRowMap[$i]-1) {
  44. $n = $j+1;
  45. $nextIndex = $i."_".$n;
  46. }
  47. $nextDisabled = $this->element->getElement("sp_criteria_field_".$nextIndex)->getAttrib('disabled') == 'disabled'?true:false;
  48. ?>
  49. <div <?php if (($i > 0) && $disabled) {
  50. echo 'style=display:none';
  51. } ?>>
  52. <?php echo $this->element->getElement("sp_criteria_field_".$i."_".$j) ?>
  53. <a class='btn btn-small' id='modifier_add_<?php echo $i ?>'>
  54. <i class='icon-white icon-plus'></i>
  55. </a>
  56. <?php echo $this->element->getElement("sp_criteria_modifier_".$i."_".$j) ?>
  57. <?php echo $this->element->getElement("sp_criteria_value_".$i."_".$j) ?>
  58. <span class='sp_text_font' id="extra_criteria" <?php echo $this->element->getElement("sp_criteria_extra_".$i."_".$j)->getAttrib("disabled") == "disabled"?'style="display:none;"':""?>><?php echo _(" to "); ?><?php echo $this->element->getElement('sp_criteria_extra_'.$i."_".$j) ?></span>
  59. <a style='margin-right:3px' class='btn btn-small btn-danger' id='criteria_remove_<?php echo $i ?>'>
  60. <i class='icon-white icon-remove'></i>
  61. </a>
  62. <span class='db-logic-label' <?php if ($nextDisabled) echo "style='display:none'"?>>
  63. <?php echo $logicLabel;?>
  64. </span>
  65. <?php if($this->element->getElement("sp_criteria_field_".$i."_".$j)->hasErrors()) : ?>
  66. <?php foreach($this->element->getElement("sp_criteria_field_".$i."_".$j)->getMessages() as $error): ?>
  67. <span class='errors sp-errors'>
  68. <?php echo $error; ?>
  69. </span>
  70. <?php endforeach; ?>
  71. <?php endif; ?>
  72. </div>
  73. <?php } ?>
  74. <?php } ?>
  75. <br />
  76. </dd>
  77. <dd id='sp_repeate_tracks-element'>
  78. <span class='sp_text_font'><?php echo $this->element->getElement('sp_repeat_tracks')->getLabel() ?></span>
  79. <span class='repeat_tracks_help_icon'></span>
  80. <?php echo $this->element->getElement('sp_repeat_tracks')?>
  81. <?php if($this->element->getElement("sp_repeat_tracks")->hasErrors()) : ?>
  82. <?php foreach($this->element->getElement("sp_repeat_tracks")->getMessages() as $error): ?>
  83. <span class='errors sp-errors'>
  84. <?php echo $error; ?>
  85. </span>
  86. <?php endforeach; ?>
  87. <?php endif; ?>
  88. <br />
  89. </dd>
  90. <dd id='sp_sort-element'>
  91. <span class='sp_text_font'>Sort tracks by</span>
  92. <?php echo $this->element->getElement('sp_sort_options') ?>
  93. <?php if($this->element->getElement("sp_sort_options")->hasErrors()) : ?>
  94. <?php foreach($this->element->getElement("sp_sort_options")->getMessages() as $error): ?>
  95. <span class='errors sp-errors'>
  96. <?php echo $error; ?>
  97. </span>
  98. <?php endforeach; ?>
  99. <?php endif; ?>
  100. <br />
  101. </dd>
  102. <dd id='sp_limit-element'>
  103. <span class='sp_text_font'><?php echo $this->element->getElement('sp_limit_value')->getLabel() ?></span>
  104. <?php echo $this->element->getElement('sp_limit_value')?>
  105. <?php echo $this->element->getElement('sp_limit_options') ?>
  106. <?php if($this->element->getElement("sp_limit_value")->hasErrors()) : ?>
  107. <?php foreach($this->element->getElement("sp_limit_value")->getMessages() as $error): ?>
  108. <span class='errors sp-errors'>
  109. <?php echo $error; ?>
  110. </span>
  111. <?php endforeach; ?>
  112. <?php endif; ?>
  113. <br />
  114. </dd>
  115. <?php if ($this->showPoolCount) { ?>
  116. <div class='sp_text_font sp_text_font_bold'>
  117. <span id='sp_pool_count' class='sp_text_font sp_text_font_bold'>
  118. <?php
  119. if ($this->poolCount > 1) {
  120. echo $this->poolCount;
  121. ?>
  122. <?php echo _("files meet the criteria")?>
  123. </span>
  124. <span class='checked-icon sp-checked-icon' id='sp_pool_count_icon'></span>
  125. <?php
  126. } else if ($this->poolCount == 1) {
  127. echo $this->poolCount;
  128. ?>
  129. <?php echo _("file meet the criteria")?>
  130. </span>
  131. <span class='checked-icon sp-checked-icon' id='sp_pool_count_icon'></span>
  132. <?php
  133. } else {
  134. ?>
  135. 0 <?php echo " "._("files meet the criteria")?>
  136. </span>
  137. <span class='sp-warning-icon' id='sp_pool_count_icon'></span>
  138. <?php
  139. }
  140. ?>
  141. </div>
  142. <?php } ?>
  143. </dl>
  144. </fieldset>
  145. </form>