@@ -27,8 +27,7 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | function validate($value, $options = null) |
| 29 | 29 | { |
| 30 | - if (is_array($value)) |
|
| 31 | - { |
|
| 30 | + if (is_array($value)) { |
|
| 32 | 31 | $value = implode(null, $value); |
| 33 | 32 | } |
| 34 | 33 | if ((string) $value == '') { |
@@ -5,7 +5,8 @@ discard block |
||
| 5 | 5 | * Class Rights |
| 6 | 6 | * @deprecated Don't use this class |
| 7 | 7 | */ |
| 8 | -class Rights { |
|
| 8 | +class Rights |
|
| 9 | +{ |
|
| 9 | 10 | private static $rights_cache = array(); |
| 10 | 11 | private static $rights = array( |
| 11 | 12 | 'show_tabs:reports' => |
@@ -16,32 +17,42 @@ discard block |
||
| 16 | 17 | |
| 17 | 18 | // warning the goal of this function is to enforce rights managment in Chamilo |
| 18 | 19 | // thus default return value is always true |
| 19 | - public static function hasRight($handler) { |
|
| 20 | - if (array_key_exists($handler, self::$rights_cache)) |
|
| 21 | - return self::$rights_cache[$handler]; |
|
| 20 | + public static function hasRight($handler) |
|
| 21 | + { |
|
| 22 | + if (array_key_exists($handler, self::$rights_cache)) { |
|
| 23 | + return self::$rights_cache[$handler]; |
|
| 24 | + } |
|
| 22 | 25 | |
| 23 | - if (!array_key_exists($handler, self::$rights)) |
|
| 24 | - return true; // handler does not exists |
|
| 26 | + if (!array_key_exists($handler, self::$rights)) { |
|
| 27 | + return true; |
|
| 28 | + } |
|
| 29 | + // handler does not exists |
|
| 25 | 30 | |
| 26 | 31 | if (self::$rights[$handler]['type'] == 'sql') { |
| 27 | 32 | $result = Database::query(self::$rights[$handler]['sql']); |
| 28 | - if (Database::num_rows($result) > 0) |
|
| 29 | - $result = true; |
|
| 30 | - else |
|
| 31 | - $result = false; |
|
| 32 | - } else if (self::$rights[$handler]['type'] == 'const') |
|
| 33 | - $result = self::$rights[$handler]['const']; |
|
| 34 | - else if (self::$rights[$handler]['type'] == 'func') |
|
| 35 | - $result = self::$rights[$handler]['func'](); |
|
| 36 | - else // handler type not implemented |
|
| 33 | + if (Database::num_rows($result) > 0) { |
|
| 34 | + $result = true; |
|
| 35 | + } else { |
|
| 36 | + $result = false; |
|
| 37 | + } |
|
| 38 | + } else if (self::$rights[$handler]['type'] == 'const') { |
|
| 39 | + $result = self::$rights[$handler]['const']; |
|
| 40 | + } else if (self::$rights[$handler]['type'] == 'func') { |
|
| 41 | + $result = self::$rights[$handler]['func'](); |
|
| 42 | + } else { |
|
| 43 | + // handler type not implemented |
|
| 37 | 44 | return true; |
| 45 | + } |
|
| 38 | 46 | self::$rights_cache[$handler] = $result; |
| 39 | 47 | return $result; |
| 40 | 48 | } |
| 41 | 49 | |
| 42 | - public static function hasRightClosePageWithError($handler) { |
|
| 43 | - if (hasRight($handler) == false) |
|
| 44 | - die("You are not allowed here"); //FIXME |
|
| 50 | + public static function hasRightClosePageWithError($handler) |
|
| 51 | + { |
|
| 52 | + if (hasRight($handler) == false) { |
|
| 53 | + die("You are not allowed here"); |
|
| 54 | + } |
|
| 55 | + //FIXME |
|
| 45 | 56 | } |
| 46 | 57 | |
| 47 | 58 | } |
@@ -15,7 +15,8 @@ |
||
| 15 | 15 | return isset($_REQUEST[$key]) ? $_REQUEST[$key] : $default; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - public static function has($key) { |
|
| 18 | + public static function has($key) |
|
| 19 | + { |
|
| 19 | 20 | return isset($_REQUEST[$key]); |
| 20 | 21 | } |
| 21 | 22 | |
@@ -18,12 +18,14 @@ discard block |
||
| 18 | 18 | * @param array extra Extra queries to join with. Optional |
| 19 | 19 | * @return array |
| 20 | 20 | */ |
| 21 | -function chamilo_query_query($query_string, $offset = 0, $length = 10, $extra = NULL) { |
|
| 21 | +function chamilo_query_query($query_string, $offset = 0, $length = 10, $extra = NULL) |
|
| 22 | +{ |
|
| 22 | 23 | list($count, $results) = xapian_query($query_string, NULL, $offset, $length, $extra); |
| 23 | 24 | return chamilo_preprocess_results($results); |
| 24 | 25 | } |
| 25 | 26 | |
| 26 | -function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = NULL) { |
|
| 27 | +function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = NULL) |
|
| 28 | +{ |
|
| 27 | 29 | return xapian_query($query_string, NULL, $offset, $length, $extra); |
| 28 | 30 | } |
| 29 | 31 | |
@@ -32,14 +34,16 @@ discard block |
||
| 32 | 34 | * |
| 33 | 35 | * @param string $query_string The term string |
| 34 | 36 | */ |
| 35 | -function chamilo_get_boolean_query($term) { |
|
| 37 | +function chamilo_get_boolean_query($term) |
|
| 38 | +{ |
|
| 36 | 39 | return xapian_get_boolean_query($term); |
| 37 | 40 | } |
| 38 | 41 | |
| 39 | 42 | /** |
| 40 | 43 | * Preprocess all results depending on the toolid |
| 41 | 44 | */ |
| 42 | -function chamilo_preprocess_results($results) { |
|
| 45 | +function chamilo_preprocess_results($results) |
|
| 46 | +{ |
|
| 43 | 47 | // group by toolid |
| 44 | 48 | $results_by_tool = array(); |
| 45 | 49 | if (count($results) > 0) { |
@@ -71,6 +75,7 @@ discard block |
||
| 71 | 75 | * @param string $op |
| 72 | 76 | * @return XapianQuery query joined |
| 73 | 77 | */ |
| 74 | -function chamilo_join_queries($query1, $query2 = NULL, $op = 'or') { |
|
| 78 | +function chamilo_join_queries($query1, $query2 = NULL, $op = 'or') |
|
| 79 | +{ |
|
| 75 | 80 | return xapian_join_queries($query1, $query2, $op); |
| 76 | 81 | } |
@@ -72,7 +72,10 @@ discard block |
||
| 72 | 72 | <div class="form-group"> |
| 73 | 73 | <label class="col-sm-3 control-label"><?php echo get_lang('SessionCategoryName') ?></label> |
| 74 | 74 | <div class="col-sm-6"> |
| 75 | - <input type="text" class="form-control" name="name" placeholder="<?php echo get_lang('Category') ?>" size="50" maxlength="50" value="<?php if ($formSent) echo api_htmlentities($name, ENT_QUOTES, $charset); ?>"> |
|
| 75 | + <input type="text" class="form-control" name="name" placeholder="<?php echo get_lang('Category') ?>" size="50" maxlength="50" value="<?php if ($formSent) { |
|
| 76 | + echo api_htmlentities($name, ENT_QUOTES, $charset); |
|
| 77 | +} |
|
| 78 | +?>"> |
|
| 76 | 79 | </div> |
| 77 | 80 | <div class="col-md-3"></div> |
| 78 | 81 | </div> |
@@ -90,58 +93,184 @@ discard block |
||
| 90 | 93 | <div class="col-sm-6"> |
| 91 | 94 | <select name="day_start"> |
| 92 | 95 | <option value="1">01</option> |
| 93 | - <option value="2" <?php if ((!$formSent && $thisDay == 2) || ($formSent && $day_start == 2)) echo 'selected="selected"'; ?> >02</option> |
|
| 94 | - <option value="3" <?php if ((!$formSent && $thisDay == 3) || ($formSent && $day_start == 3)) echo 'selected="selected"'; ?> >03</option> |
|
| 95 | - <option value="4" <?php if ((!$formSent && $thisDay == 4) || ($formSent && $day_start == 4)) echo 'selected="selected"'; ?> >04</option> |
|
| 96 | - <option value="5" <?php if ((!$formSent && $thisDay == 5) || ($formSent && $day_start == 5)) echo 'selected="selected"'; ?> >05</option> |
|
| 97 | - <option value="6" <?php if ((!$formSent && $thisDay == 6) || ($formSent && $day_start == 6)) echo 'selected="selected"'; ?> >06</option> |
|
| 98 | - <option value="7" <?php if ((!$formSent && $thisDay == 7) || ($formSent && $day_start == 7)) echo 'selected="selected"'; ?> >07</option> |
|
| 99 | - <option value="8" <?php if ((!$formSent && $thisDay == 8) || ($formSent && $day_start == 8)) echo 'selected="selected"'; ?> >08</option> |
|
| 100 | - <option value="9" <?php if ((!$formSent && $thisDay == 9) || ($formSent && $day_start == 9)) echo 'selected="selected"'; ?> >09</option> |
|
| 101 | - <option value="10" <?php if ((!$formSent && $thisDay == 10) || ($formSent && $day_start == 10)) echo 'selected="selected"'; ?> >10</option> |
|
| 102 | - <option value="11" <?php if ((!$formSent && $thisDay == 11) || ($formSent && $day_start == 11)) echo 'selected="selected"'; ?> >11</option> |
|
| 103 | - <option value="12" <?php if ((!$formSent && $thisDay == 12) || ($formSent && $day_start == 12)) echo 'selected="selected"'; ?> >12</option> |
|
| 104 | - <option value="13" <?php if ((!$formSent && $thisDay == 13) || ($formSent && $day_start == 13)) echo 'selected="selected"'; ?> >13</option> |
|
| 105 | - <option value="14" <?php if ((!$formSent && $thisDay == 14) || ($formSent && $day_start == 14)) echo 'selected="selected"'; ?> >14</option> |
|
| 106 | - <option value="15" <?php if ((!$formSent && $thisDay == 15) || ($formSent && $day_start == 15)) echo 'selected="selected"'; ?> >15</option> |
|
| 107 | - <option value="16" <?php if ((!$formSent && $thisDay == 16) || ($formSent && $day_start == 16)) echo 'selected="selected"'; ?> >16</option> |
|
| 108 | - <option value="17" <?php if ((!$formSent && $thisDay == 17) || ($formSent && $day_start == 17)) echo 'selected="selected"'; ?> >17</option> |
|
| 109 | - <option value="18" <?php if ((!$formSent && $thisDay == 18) || ($formSent && $day_start == 18)) echo 'selected="selected"'; ?> >18</option> |
|
| 110 | - <option value="19" <?php if ((!$formSent && $thisDay == 19) || ($formSent && $day_start == 19)) echo 'selected="selected"'; ?> >19</option> |
|
| 111 | - <option value="20" <?php if ((!$formSent && $thisDay == 20) || ($formSent && $day_start == 20)) echo 'selected="selected"'; ?> >20</option> |
|
| 112 | - <option value="21" <?php if ((!$formSent && $thisDay == 21) || ($formSent && $day_start == 21)) echo 'selected="selected"'; ?> >21</option> |
|
| 113 | - <option value="22" <?php if ((!$formSent && $thisDay == 22) || ($formSent && $day_start == 22)) echo 'selected="selected"'; ?> >22</option> |
|
| 114 | - <option value="23" <?php if ((!$formSent && $thisDay == 23) || ($formSent && $day_start == 23)) echo 'selected="selected"'; ?> >23</option> |
|
| 115 | - <option value="24" <?php if ((!$formSent && $thisDay == 24) || ($formSent && $day_start == 24)) echo 'selected="selected"'; ?> >24</option> |
|
| 116 | - <option value="25" <?php if ((!$formSent && $thisDay == 25) || ($formSent && $day_start == 25)) echo 'selected="selected"'; ?> >25</option> |
|
| 117 | - <option value="26" <?php if ((!$formSent && $thisDay == 26) || ($formSent && $day_start == 26)) echo 'selected="selected"'; ?> >26</option> |
|
| 118 | - <option value="27" <?php if ((!$formSent && $thisDay == 27) || ($formSent && $day_start == 27)) echo 'selected="selected"'; ?> >27</option> |
|
| 119 | - <option value="28" <?php if ((!$formSent && $thisDay == 28) || ($formSent && $day_start == 28)) echo 'selected="selected"'; ?> >28</option> |
|
| 120 | - <option value="29" <?php if ((!$formSent && $thisDay == 29) || ($formSent && $day_start == 29)) echo 'selected="selected"'; ?> >29</option> |
|
| 121 | - <option value="30" <?php if ((!$formSent && $thisDay == 30) || ($formSent && $day_start == 30)) echo 'selected="selected"'; ?> >30</option> |
|
| 122 | - <option value="31" <?php if ((!$formSent && $thisDay == 31) || ($formSent && $day_start == 31)) echo 'selected="selected"'; ?> >31</option> |
|
| 96 | + <option value="2" <?php if ((!$formSent && $thisDay == 2) || ($formSent && $day_start == 2)) { |
|
| 97 | + echo 'selected="selected"'; |
|
| 98 | +} |
|
| 99 | +?> >02</option> |
|
| 100 | + <option value="3" <?php if ((!$formSent && $thisDay == 3) || ($formSent && $day_start == 3)) { |
|
| 101 | + echo 'selected="selected"'; |
|
| 102 | +} |
|
| 103 | +?> >03</option> |
|
| 104 | + <option value="4" <?php if ((!$formSent && $thisDay == 4) || ($formSent && $day_start == 4)) { |
|
| 105 | + echo 'selected="selected"'; |
|
| 106 | +} |
|
| 107 | +?> >04</option> |
|
| 108 | + <option value="5" <?php if ((!$formSent && $thisDay == 5) || ($formSent && $day_start == 5)) { |
|
| 109 | + echo 'selected="selected"'; |
|
| 110 | +} |
|
| 111 | +?> >05</option> |
|
| 112 | + <option value="6" <?php if ((!$formSent && $thisDay == 6) || ($formSent && $day_start == 6)) { |
|
| 113 | + echo 'selected="selected"'; |
|
| 114 | +} |
|
| 115 | +?> >06</option> |
|
| 116 | + <option value="7" <?php if ((!$formSent && $thisDay == 7) || ($formSent && $day_start == 7)) { |
|
| 117 | + echo 'selected="selected"'; |
|
| 118 | +} |
|
| 119 | +?> >07</option> |
|
| 120 | + <option value="8" <?php if ((!$formSent && $thisDay == 8) || ($formSent && $day_start == 8)) { |
|
| 121 | + echo 'selected="selected"'; |
|
| 122 | +} |
|
| 123 | +?> >08</option> |
|
| 124 | + <option value="9" <?php if ((!$formSent && $thisDay == 9) || ($formSent && $day_start == 9)) { |
|
| 125 | + echo 'selected="selected"'; |
|
| 126 | +} |
|
| 127 | +?> >09</option> |
|
| 128 | + <option value="10" <?php if ((!$formSent && $thisDay == 10) || ($formSent && $day_start == 10)) { |
|
| 129 | + echo 'selected="selected"'; |
|
| 130 | +} |
|
| 131 | +?> >10</option> |
|
| 132 | + <option value="11" <?php if ((!$formSent && $thisDay == 11) || ($formSent && $day_start == 11)) { |
|
| 133 | + echo 'selected="selected"'; |
|
| 134 | +} |
|
| 135 | +?> >11</option> |
|
| 136 | + <option value="12" <?php if ((!$formSent && $thisDay == 12) || ($formSent && $day_start == 12)) { |
|
| 137 | + echo 'selected="selected"'; |
|
| 138 | +} |
|
| 139 | +?> >12</option> |
|
| 140 | + <option value="13" <?php if ((!$formSent && $thisDay == 13) || ($formSent && $day_start == 13)) { |
|
| 141 | + echo 'selected="selected"'; |
|
| 142 | +} |
|
| 143 | +?> >13</option> |
|
| 144 | + <option value="14" <?php if ((!$formSent && $thisDay == 14) || ($formSent && $day_start == 14)) { |
|
| 145 | + echo 'selected="selected"'; |
|
| 146 | +} |
|
| 147 | +?> >14</option> |
|
| 148 | + <option value="15" <?php if ((!$formSent && $thisDay == 15) || ($formSent && $day_start == 15)) { |
|
| 149 | + echo 'selected="selected"'; |
|
| 150 | +} |
|
| 151 | +?> >15</option> |
|
| 152 | + <option value="16" <?php if ((!$formSent && $thisDay == 16) || ($formSent && $day_start == 16)) { |
|
| 153 | + echo 'selected="selected"'; |
|
| 154 | +} |
|
| 155 | +?> >16</option> |
|
| 156 | + <option value="17" <?php if ((!$formSent && $thisDay == 17) || ($formSent && $day_start == 17)) { |
|
| 157 | + echo 'selected="selected"'; |
|
| 158 | +} |
|
| 159 | +?> >17</option> |
|
| 160 | + <option value="18" <?php if ((!$formSent && $thisDay == 18) || ($formSent && $day_start == 18)) { |
|
| 161 | + echo 'selected="selected"'; |
|
| 162 | +} |
|
| 163 | +?> >18</option> |
|
| 164 | + <option value="19" <?php if ((!$formSent && $thisDay == 19) || ($formSent && $day_start == 19)) { |
|
| 165 | + echo 'selected="selected"'; |
|
| 166 | +} |
|
| 167 | +?> >19</option> |
|
| 168 | + <option value="20" <?php if ((!$formSent && $thisDay == 20) || ($formSent && $day_start == 20)) { |
|
| 169 | + echo 'selected="selected"'; |
|
| 170 | +} |
|
| 171 | +?> >20</option> |
|
| 172 | + <option value="21" <?php if ((!$formSent && $thisDay == 21) || ($formSent && $day_start == 21)) { |
|
| 173 | + echo 'selected="selected"'; |
|
| 174 | +} |
|
| 175 | +?> >21</option> |
|
| 176 | + <option value="22" <?php if ((!$formSent && $thisDay == 22) || ($formSent && $day_start == 22)) { |
|
| 177 | + echo 'selected="selected"'; |
|
| 178 | +} |
|
| 179 | +?> >22</option> |
|
| 180 | + <option value="23" <?php if ((!$formSent && $thisDay == 23) || ($formSent && $day_start == 23)) { |
|
| 181 | + echo 'selected="selected"'; |
|
| 182 | +} |
|
| 183 | +?> >23</option> |
|
| 184 | + <option value="24" <?php if ((!$formSent && $thisDay == 24) || ($formSent && $day_start == 24)) { |
|
| 185 | + echo 'selected="selected"'; |
|
| 186 | +} |
|
| 187 | +?> >24</option> |
|
| 188 | + <option value="25" <?php if ((!$formSent && $thisDay == 25) || ($formSent && $day_start == 25)) { |
|
| 189 | + echo 'selected="selected"'; |
|
| 190 | +} |
|
| 191 | +?> >25</option> |
|
| 192 | + <option value="26" <?php if ((!$formSent && $thisDay == 26) || ($formSent && $day_start == 26)) { |
|
| 193 | + echo 'selected="selected"'; |
|
| 194 | +} |
|
| 195 | +?> >26</option> |
|
| 196 | + <option value="27" <?php if ((!$formSent && $thisDay == 27) || ($formSent && $day_start == 27)) { |
|
| 197 | + echo 'selected="selected"'; |
|
| 198 | +} |
|
| 199 | +?> >27</option> |
|
| 200 | + <option value="28" <?php if ((!$formSent && $thisDay == 28) || ($formSent && $day_start == 28)) { |
|
| 201 | + echo 'selected="selected"'; |
|
| 202 | +} |
|
| 203 | +?> >28</option> |
|
| 204 | + <option value="29" <?php if ((!$formSent && $thisDay == 29) || ($formSent && $day_start == 29)) { |
|
| 205 | + echo 'selected="selected"'; |
|
| 206 | +} |
|
| 207 | +?> >29</option> |
|
| 208 | + <option value="30" <?php if ((!$formSent && $thisDay == 30) || ($formSent && $day_start == 30)) { |
|
| 209 | + echo 'selected="selected"'; |
|
| 210 | +} |
|
| 211 | +?> >30</option> |
|
| 212 | + <option value="31" <?php if ((!$formSent && $thisDay == 31) || ($formSent && $day_start == 31)) { |
|
| 213 | + echo 'selected="selected"'; |
|
| 214 | +} |
|
| 215 | +?> >31</option> |
|
| 123 | 216 | </select> |
| 124 | 217 | / |
| 125 | 218 | <select name="month_start"> |
| 126 | 219 | <option value="1">01</option> |
| 127 | - <option value="2" <?php if ((!$formSent && $thisMonth == 2) || ($formSent && $month_start == 2)) echo 'selected="selected"'; ?> >02</option> |
|
| 128 | - <option value="3" <?php if ((!$formSent && $thisMonth == 3) || ($formSent && $month_start == 3)) echo 'selected="selected"'; ?> >03</option> |
|
| 129 | - <option value="4" <?php if ((!$formSent && $thisMonth == 4) || ($formSent && $month_start == 4)) echo 'selected="selected"'; ?> >04</option> |
|
| 130 | - <option value="5" <?php if ((!$formSent && $thisMonth == 5) || ($formSent && $month_start == 5)) echo 'selected="selected"'; ?> >05</option> |
|
| 131 | - <option value="6" <?php if ((!$formSent && $thisMonth == 6) || ($formSent && $month_start == 6)) echo 'selected="selected"'; ?> >06</option> |
|
| 132 | - <option value="7" <?php if ((!$formSent && $thisMonth == 7) || ($formSent && $month_start == 7)) echo 'selected="selected"'; ?> >07</option> |
|
| 133 | - <option value="8" <?php if ((!$formSent && $thisMonth == 8) || ($formSent && $month_start == 8)) echo 'selected="selected"'; ?> >08</option> |
|
| 134 | - <option value="9" <?php if ((!$formSent && $thisMonth == 9) || ($formSent && $month_start == 9)) echo 'selected="selected"'; ?> >09</option> |
|
| 135 | - <option value="10" <?php if ((!$formSent && $thisMonth == 10) || ($formSent && $month_start == 10)) echo 'selected="selected"'; ?> >10</option> |
|
| 136 | - <option value="11" <?php if ((!$formSent && $thisMonth == 11) || ($formSent && $month_start == 11)) echo 'selected="selected"'; ?> >11</option> |
|
| 137 | - <option value="12" <?php if ((!$formSent && $thisMonth == 12) || ($formSent && $month_start == 12)) echo 'selected="selected"'; ?> >12</option> |
|
| 220 | + <option value="2" <?php if ((!$formSent && $thisMonth == 2) || ($formSent && $month_start == 2)) { |
|
| 221 | + echo 'selected="selected"'; |
|
| 222 | +} |
|
| 223 | +?> >02</option> |
|
| 224 | + <option value="3" <?php if ((!$formSent && $thisMonth == 3) || ($formSent && $month_start == 3)) { |
|
| 225 | + echo 'selected="selected"'; |
|
| 226 | +} |
|
| 227 | +?> >03</option> |
|
| 228 | + <option value="4" <?php if ((!$formSent && $thisMonth == 4) || ($formSent && $month_start == 4)) { |
|
| 229 | + echo 'selected="selected"'; |
|
| 230 | +} |
|
| 231 | +?> >04</option> |
|
| 232 | + <option value="5" <?php if ((!$formSent && $thisMonth == 5) || ($formSent && $month_start == 5)) { |
|
| 233 | + echo 'selected="selected"'; |
|
| 234 | +} |
|
| 235 | +?> >05</option> |
|
| 236 | + <option value="6" <?php if ((!$formSent && $thisMonth == 6) || ($formSent && $month_start == 6)) { |
|
| 237 | + echo 'selected="selected"'; |
|
| 238 | +} |
|
| 239 | +?> >06</option> |
|
| 240 | + <option value="7" <?php if ((!$formSent && $thisMonth == 7) || ($formSent && $month_start == 7)) { |
|
| 241 | + echo 'selected="selected"'; |
|
| 242 | +} |
|
| 243 | +?> >07</option> |
|
| 244 | + <option value="8" <?php if ((!$formSent && $thisMonth == 8) || ($formSent && $month_start == 8)) { |
|
| 245 | + echo 'selected="selected"'; |
|
| 246 | +} |
|
| 247 | +?> >08</option> |
|
| 248 | + <option value="9" <?php if ((!$formSent && $thisMonth == 9) || ($formSent && $month_start == 9)) { |
|
| 249 | + echo 'selected="selected"'; |
|
| 250 | +} |
|
| 251 | +?> >09</option> |
|
| 252 | + <option value="10" <?php if ((!$formSent && $thisMonth == 10) || ($formSent && $month_start == 10)) { |
|
| 253 | + echo 'selected="selected"'; |
|
| 254 | +} |
|
| 255 | +?> >10</option> |
|
| 256 | + <option value="11" <?php if ((!$formSent && $thisMonth == 11) || ($formSent && $month_start == 11)) { |
|
| 257 | + echo 'selected="selected"'; |
|
| 258 | +} |
|
| 259 | +?> >11</option> |
|
| 260 | + <option value="12" <?php if ((!$formSent && $thisMonth == 12) || ($formSent && $month_start == 12)) { |
|
| 261 | + echo 'selected="selected"'; |
|
| 262 | +} |
|
| 263 | +?> >12</option> |
|
| 138 | 264 | </select> |
| 139 | 265 | / |
| 140 | 266 | <select name="year_start"> |
| 141 | 267 | <?php |
| 142 | 268 | for ($i = $thisYear - 5; $i <= ($thisYear + 5); $i++) { |
| 143 | 269 | ?> |
| 144 | - <option value="<?php echo $i; ?>" <?php if ((!$formSent && $thisYear == $i) || ($formSent && $year_start == $i)) echo 'selected="selected"'; ?> ><?php echo $i; ?></option> |
|
| 270 | + <option value="<?php echo $i; ?>" <?php if ((!$formSent && $thisYear == $i) || ($formSent && $year_start == $i)) { |
|
| 271 | + echo 'selected="selected"'; |
|
| 272 | +} |
|
| 273 | +?> ><?php echo $i; ?></option> |
|
| 145 | 274 | <?php |
| 146 | 275 | } |
| 147 | 276 | ?> |
@@ -11,8 +11,9 @@ discard block |
||
| 11 | 11 | /** |
| 12 | 12 | * Security checks |
| 13 | 13 | */ |
| 14 | -if (!isset($_SESSION['conditional_login']['uid'])) |
|
| 14 | +if (!isset($_SESSION['conditional_login']['uid'])) { |
|
| 15 | 15 | die("Not Authorised"); |
| 16 | +} |
|
| 16 | 17 | |
| 17 | 18 | if (isset($_POST['password'])) { |
| 18 | 19 | $u = api_get_user_info($_SESSION['conditional_login']['uid']); |
@@ -20,7 +21,8 @@ discard block |
||
| 20 | 21 | header('Location: '.api_get_self().'?invalid=2'); |
| 21 | 22 | exit(); |
| 22 | 23 | } |
| 23 | - if (empty($_POST['password'])) { //|| !api_check_password($password)) { //Pass must be at least 5 char long with 2 digits and 3 letters |
|
| 24 | + if (empty($_POST['password'])) { |
|
| 25 | +//|| !api_check_password($password)) { //Pass must be at least 5 char long with 2 digits and 3 letters |
|
| 24 | 26 | header('Location: '.api_get_self().'?invalid=1'); |
| 25 | 27 | exit(); |
| 26 | 28 | } |
@@ -13,7 +13,8 @@ |
||
| 13 | 13 | * @param string $current_username |
| 14 | 14 | * @return boolean True if username is available |
| 15 | 15 | */ |
| 16 | - function validate($username, $current_username = null) { |
|
| 16 | + function validate($username, $current_username = null) |
|
| 17 | + { |
|
| 17 | 18 | $user_table = Database::get_main_table(TABLE_MAIN_USER); |
| 18 | 19 | $username = Database::escape_string($username); |
| 19 | 20 | $current_username = Database::escape_string($current_username); |
@@ -253,7 +253,8 @@ |
||
| 253 | 253 | // form title |
| 254 | 254 | $form->addElement('header', $nameTools); |
| 255 | 255 | |
| 256 | -if ($is_certificate_mode) {//added condition for certicate in gradebook |
|
| 256 | +if ($is_certificate_mode) { |
|
| 257 | +//added condition for certicate in gradebook |
|
| 257 | 258 | $form->addElement( |
| 258 | 259 | 'hidden', |
| 259 | 260 | 'certificate', |
@@ -206,8 +206,7 @@ discard block |
||
| 206 | 206 | function display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions = array()) |
| 207 | 207 | { |
| 208 | 208 | $checked = ""; |
| 209 | - if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool])) |
|
| 210 | - { |
|
| 209 | + if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool])) { |
|
| 211 | 210 | $checked = "checked"; |
| 212 | 211 | } |
| 213 | 212 | echo "\t\t\t<input type=\"checkbox\" name=\"permission*$tool*$permission\" $checked>\n"; |
@@ -254,8 +253,7 @@ discard block |
||
| 254 | 253 | echo "</a>"; |
| 255 | 254 | } |
| 256 | 255 | } else { |
| 257 | - if ($editable) |
|
| 258 | - { |
|
| 256 | + if ($editable) { |
|
| 259 | 257 | $url = api_get_self(); |
| 260 | 258 | $urlparameters = ''; |
| 261 | 259 | foreach ($_GET as $key => $value) { |
@@ -273,8 +271,7 @@ discard block |
||
| 273 | 271 | echo "\t\t\t <a href=\"".$url."\">"; |
| 274 | 272 | } |
| 275 | 273 | echo "<img src=\"../img/wrong.gif\" border=\"0\"/>"; |
| 276 | - if ($editable) |
|
| 277 | - { |
|
| 274 | + if ($editable) { |
|
| 278 | 275 | echo "</a>"; |
| 279 | 276 | } |
| 280 | 277 | } |
@@ -306,8 +303,7 @@ discard block |
||
| 306 | 303 | if ($editable) { |
| 307 | 304 | $url = api_get_self(); |
| 308 | 305 | $urlparameters = ''; |
| 309 | - foreach ($_GET as $key => $value) |
|
| 310 | - { |
|
| 306 | + foreach ($_GET as $key => $value) { |
|
| 311 | 307 | $parameter[$key] = $value; |
| 312 | 308 | } |
| 313 | 309 | $parameter['action'] = 'manage_rights'; |
@@ -315,8 +311,7 @@ discard block |
||
| 315 | 311 | $parameter['permission'] = $permission; |
| 316 | 312 | $parameter['tool'] = $tool; |
| 317 | 313 | $parameter['user_id'] = $user_id; |
| 318 | - foreach ($parameter as $key=>$value) |
|
| 319 | - { |
|
| 314 | + foreach ($parameter as $key=>$value) { |
|
| 320 | 315 | $urlparameters .= $key.'='.$value.'&'; |
| 321 | 316 | } |
| 322 | 317 | $url = $url.'?'.$urlparameters; |
@@ -433,16 +428,15 @@ discard block |
||
| 433 | 428 | * @author Patrick Cool <[email protected]>, Ghent University |
| 434 | 429 | * @version 1.0 |
| 435 | 430 | */ |
| 436 | -function get_all_roles($content = 'course') { |
|
| 431 | +function get_all_roles($content = 'course') |
|
| 432 | +{ |
|
| 437 | 433 | $course_id = api_get_course_int_id(); |
| 438 | 434 | $course_id_condition = " WHERE c_id = $course_id "; |
| 439 | 435 | |
| 440 | - if ($content == 'course') |
|
| 441 | - { |
|
| 436 | + if ($content == 'course') { |
|
| 442 | 437 | $table_role = Database::get_course_table(TABLE_ROLE); |
| 443 | 438 | } |
| 444 | - if ($content == 'platform') |
|
| 445 | - { |
|
| 439 | + if ($content == 'platform') { |
|
| 446 | 440 | $table_role = Database::get_main_table(TABLE_ROLE); |
| 447 | 441 | $course_id_condition = ''; |
| 448 | 442 | } |
@@ -450,8 +444,7 @@ discard block |
||
| 450 | 444 | $current_roles = array(); |
| 451 | 445 | $sql = "SELECT * FROM $table_role $course_id_condition "; |
| 452 | 446 | $result = Database::query($sql); |
| 453 | - while ($row = Database::fetch_array($result)) |
|
| 454 | - { |
|
| 447 | + while ($row = Database::fetch_array($result)) { |
|
| 455 | 448 | $roles[] = $row; |
| 456 | 449 | } |
| 457 | 450 | |