| 1 | <?php |
| 2 | /** |
| 3 | * search_advanced.tpl |
| 4 | * |
| 5 | * Template to display the advanced (multi-rule) search fields |
| 6 | * |
| 7 | * The following variables are available in this template: |
| 8 | * $allow_advanced_search - boolean TRUE if the advacned search feature is available |
| 9 | * $adv_toggle_link - URL to toggle between basic and advanced searches. |
| 10 | * NULL if advanced search has been disabled. |
| 11 | * $adv_toggle_text - Text to toggle between basic and advanced searches. |
| 12 | * NULL if advanced search has been disabled. |
| 13 | * $mailbox_options - array containing sanitized list of mailboxes to |
| 14 | * sort. Index of each element is the value that |
| 15 | * should be assigned to the HTML input element. |
| 16 | * $logical_options - array containing sanitized list of logical |
| 17 | * operators available, e.g. AND, OR. Index of each |
| 18 | * element is the value that should be assigned |
| 19 | * to the HTML input element. |
| 20 | * $unary_options - array containing sanitized list of unary options, |
| 21 | * e.g. NOT. Index of each element is the value that |
| 22 | * should be assigned to the HTML input element. |
| 23 | * $where_options - array containing sanitized list of fields availble |
| 24 | * to search on. Index of each element is the value |
| 25 | * that should be assigned to the HTML input element. |
| 26 | * $criteria - array containing the current list of search criteria. |
| 27 | * Each element in the array represents a set of criteria |
| 28 | * and contains the following elements: |
| 29 | * $el['MailboxSel'] - the selected mailbox for this rule |
| 30 | * $el['LogicSel'] - the selected logical operator for this rule |
| 31 | * $el['UnarySel'] - the selected unary operator for this rule |
| 32 | * $el['WhereSel'] - the selected field to search in for this rule |
| 33 | * $el['Exclude'] - boolean TRUE if this rule is to be excluded |
| 34 | * $el['IncludeSubfolders'] - boolean TRUE if this rule is to include |
| 35 | * the subfolders of the selected mailbox |
| 36 | * $el['What'] - the value that is to be searched for. |
| 37 | * |
| 38 | * @copyright © 1999-2006 The SquirrelMail Project Team |
| 39 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 40 | * @version $Id$ |
| 41 | * @package squirrelmail |
| 42 | * @subpackage templates |
| 43 | */ |
| 44 | |
| 45 | /** add required includes **/ |
| 46 | |
| 47 | /** extract template variables **/ |
| 48 | extract($t); |
| 49 | |
| 50 | /** Begin template **/ |
| 51 | ?> |
| 52 | <div class="search"> |
| 53 | <table cellspacing="0" class="table2"> |
| 54 | <tr> |
| 55 | <td class="header1" colspan="5"> |
| 56 | <?php echo _("Search"); ?> |
| 57 | <?php |
| 58 | if ($allow_advanced_search) { |
| 59 | ?> |
| 60 | - <small>[<a href="<?php echo $adv_toggle_link; ?>"><?php echo $adv_toggle_text; ?></a>]</small> |
| 61 | <?php |
| 62 | } |
| 63 | ?> |
| 64 | </td> |
| 65 | </tr> |
| 66 | <?php |
| 67 | foreach ($criteria as $row=>$rule) { |
| 68 | $mailbox_sel = strtolower($rule['MailboxSel']); |
| 69 | $logical_sel = $rule['LogicSel']; |
| 70 | $unary_sel = $rule['UnarySel']; |
| 71 | $subfolders = $rule['IncludeSubfolders']; |
| 72 | $where_sel = $rule['WhereSel']; |
| 73 | $what_val = $rule['What']; |
| 74 | $exclude = $rule['Exclude']; |
| 75 | ?> |
| 76 | <tr> |
| 77 | <td class="searchForm"> |
| 78 | <?php |
| 79 | if($row == 0) { |
| 80 | echo _("In"); |
| 81 | } else { |
| 82 | ?> |
| 83 | <select name="biop[<?php echo $row; ?>]"> |
| 84 | <?php |
| 85 | foreach ($logical_options as $value=>$option) { |
| 86 | echo '<option value="'. $value .'"' . ($value==$logical_sel ? ' selected="selected"' : '').'>' . $option .'</option>'."\n"; |
| 87 | } |
| 88 | ?> |
| 89 | </select> |
| 90 | <?php |
| 91 | } |
| 92 | ?> |
| 93 | </td> |
| 94 | <td class="searchForm"> |
| 95 | <select name="mailbox[<?php echo $row; ?>]"> |
| 96 | <?php |
| 97 | foreach ($mailbox_options as $value=>$option) { |
| 98 | echo '<option value="'. $value .'"' . (strtolower($value)==$mailbox_sel ? ' selected="selected"' : '').'>' . $option .'</option>'."\n"; |
| 99 | } |
| 100 | ?> |
| 101 | </select> |
| 102 | <label for="sub_<?php echo $row; ?>"><?php echo _("and subfolders"); ?>:</label> |
| 103 | <input type="checkbox" name="sub[<?php echo $row; ?>]" id="sub_<?php echo $row; ?>" <?php if ($subfolders) echo ' checked="checked"'; ?> /> |
| 104 | </td> |
| 105 | <td class="searchForm"> |
| 106 | <select name="unop[<?php echo $row; ?>]"> |
| 107 | <?php |
| 108 | foreach ($unary_options as $value=>$option) { |
| 109 | echo '<option value="'. $value .'"' . ($value==$unary_sel ? ' selected="selected"' : '').'>' . $option .'</option>'."\n"; |
| 110 | } |
| 111 | ?> |
| 112 | </select> |
| 113 | |
| 114 | <select name="where[<?php echo $row; ?>]"> |
| 115 | <?php |
| 116 | foreach ($where_options as $value=>$option) { |
| 117 | echo '<option value="'. $value .'"' . ($value==$where_sel ? ' selected="selected"' : '').'>' . $option .'</option>'."\n"; |
| 118 | } |
| 119 | ?> |
| 120 | </select> |
| 121 | </td> |
| 122 | <td class="searchForm"> |
| 123 | <input type="text" name="what[<?php echo $row; ?>]" value="<?php echo $what_val; ?>" /> |
| 124 | </td> |
| 125 | <td class="searchForm"> |
| 126 | <label for="exclude_<?php echo $row; ?>"><?php echo _("Exclude"); ?>:</label> |
| 127 | <input type="checkbox" name="exclude[<?php echo $row; ?>]" id="exclude_<?php echo $row; ?>" <?php if ($exclude) echo ' checked="checked"'; ?> /> |
| 128 | </td> |
| 129 | </tr> |
| 130 | <?php |
| 131 | } |
| 132 | ?> |
| 133 | <tr> |
| 134 | <td colspan="5" class="header1"> |
| 135 | <input type="submit" name="submit" value="<?php echo _("Search"); ?>" /> |
| 136 | <input type="submit" name="submit" value="<?php echo _("Add New Criteria"); ?>" /> |
| 137 | <input type="submit" name="submit" value="<?php echo _("Remove All Criteria"); ?>" /> |
| 138 | <input type="submit" name="submit" value="<?php echo _("Remove Excluded Criteria"); ?>" /> |
| 139 | </td> |
| 140 | </tr> |
| 141 | </table> |
| 142 | </div> |