@@ -293,13 +293,13 @@ discard block |
||
| 293 | 293 | // -------------------------------------------------------------------- |
| 294 | 294 | |
| 295 | 295 | /** |
| 296 | - * Insert ID |
|
| 297 | - * |
|
| 298 | - * Returns the last id created in the Identity column. |
|
| 299 | - * |
|
| 300 | - * @access public |
|
| 301 | - * @return integer |
|
| 302 | - */ |
|
| 296 | + * Insert ID |
|
| 297 | + * |
|
| 298 | + * Returns the last id created in the Identity column. |
|
| 299 | + * |
|
| 300 | + * @access public |
|
| 301 | + * @return integer |
|
| 302 | + */ |
|
| 303 | 303 | function insert_id() |
| 304 | 304 | { |
| 305 | 305 | $ver = self::_parse_major_version($this->version()); |
@@ -312,15 +312,15 @@ discard block |
||
| 312 | 312 | // -------------------------------------------------------------------- |
| 313 | 313 | |
| 314 | 314 | /** |
| 315 | - * Parse major version |
|
| 316 | - * |
|
| 317 | - * Grabs the major version number from the |
|
| 318 | - * database server version string passed in. |
|
| 319 | - * |
|
| 320 | - * @access private |
|
| 321 | - * @param string $version |
|
| 322 | - * @return int16 major version number |
|
| 323 | - */ |
|
| 315 | + * Parse major version |
|
| 316 | + * |
|
| 317 | + * Grabs the major version number from the |
|
| 318 | + * database server version string passed in. |
|
| 319 | + * |
|
| 320 | + * @access private |
|
| 321 | + * @param string $version |
|
| 322 | + * @return int16 major version number |
|
| 323 | + */ |
|
| 324 | 324 | function _parse_major_version($version) |
| 325 | 325 | { |
| 326 | 326 | preg_match('/([0-9]+)\.([0-9]+)\.([0-9]+)/', $version, $ver_info); |
@@ -330,11 +330,11 @@ discard block |
||
| 330 | 330 | // -------------------------------------------------------------------- |
| 331 | 331 | |
| 332 | 332 | /** |
| 333 | - * Version number query string |
|
| 334 | - * |
|
| 335 | - * @access public |
|
| 336 | - * @return string |
|
| 337 | - */ |
|
| 333 | + * Version number query string |
|
| 334 | + * |
|
| 335 | + * @access public |
|
| 336 | + * @return string |
|
| 337 | + */ |
|
| 338 | 338 | function _version() |
| 339 | 339 | { |
| 340 | 340 | return "SELECT @@VERSION AS ver"; |
@@ -277,13 +277,13 @@ discard block |
||
| 277 | 277 | // -------------------------------------------------------------------- |
| 278 | 278 | |
| 279 | 279 | /** |
| 280 | - * Insert ID |
|
| 281 | - * |
|
| 282 | - * Returns the last id created in the Identity column. |
|
| 283 | - * |
|
| 284 | - * @access public |
|
| 285 | - * @return integer |
|
| 286 | - */ |
|
| 280 | + * Insert ID |
|
| 281 | + * |
|
| 282 | + * Returns the last id created in the Identity column. |
|
| 283 | + * |
|
| 284 | + * @access public |
|
| 285 | + * @return integer |
|
| 286 | + */ |
|
| 287 | 287 | function insert_id() |
| 288 | 288 | { |
| 289 | 289 | return $this->query('select @@IDENTITY as insert_id')->row('insert_id'); |
@@ -292,15 +292,15 @@ discard block |
||
| 292 | 292 | // -------------------------------------------------------------------- |
| 293 | 293 | |
| 294 | 294 | /** |
| 295 | - * Parse major version |
|
| 296 | - * |
|
| 297 | - * Grabs the major version number from the |
|
| 298 | - * database server version string passed in. |
|
| 299 | - * |
|
| 300 | - * @access private |
|
| 301 | - * @param string $version |
|
| 302 | - * @return int16 major version number |
|
| 303 | - */ |
|
| 295 | + * Parse major version |
|
| 296 | + * |
|
| 297 | + * Grabs the major version number from the |
|
| 298 | + * database server version string passed in. |
|
| 299 | + * |
|
| 300 | + * @access private |
|
| 301 | + * @param string $version |
|
| 302 | + * @return int16 major version number |
|
| 303 | + */ |
|
| 304 | 304 | function _parse_major_version($version) |
| 305 | 305 | { |
| 306 | 306 | preg_match('/([0-9]+)\.([0-9]+)\.([0-9]+)/', $version, $ver_info); |
@@ -310,11 +310,11 @@ discard block |
||
| 310 | 310 | // -------------------------------------------------------------------- |
| 311 | 311 | |
| 312 | 312 | /** |
| 313 | - * Version number query string |
|
| 314 | - * |
|
| 315 | - * @access public |
|
| 316 | - * @return string |
|
| 317 | - */ |
|
| 313 | + * Version number query string |
|
| 314 | + * |
|
| 315 | + * @access public |
|
| 316 | + * @return string |
|
| 317 | + */ |
|
| 318 | 318 | function _version() |
| 319 | 319 | { |
| 320 | 320 | $info = sqlsrv_server_info($this->conn_id); |
@@ -2016,138 +2016,138 @@ |
||
| 2016 | 2016 | |
| 2017 | 2017 | |
| 2018 | 2018 | /** |
| 2019 | - * Insert__Update_Batch |
|
| 2020 | - * |
|
| 2021 | - * Compiles an on duplicate key update string and runs the query |
|
| 2022 | - * |
|
| 2023 | - * @since 1.6.2 |
|
| 2024 | - * @access public |
|
| 2025 | - * @param string the table to retrieve the results from |
|
| 2026 | - * @param array an associative array of update value |
|
| 2027 | - * @return object */ |
|
| 2028 | - public function insert_update_batch($table = '', $set = NULL) |
|
| 2029 | - { |
|
| 2030 | - if ( ! is_null($set)) |
|
| 2031 | - { |
|
| 2032 | - $this->set($set); |
|
| 2033 | - } |
|
| 2034 | - |
|
| 2035 | - if (count($this->ar_set) == 0) |
|
| 2036 | - { |
|
| 2037 | - if ($this->db_debug) |
|
| 2038 | - { |
|
| 2039 | - return $this->display_error('db_must_use_set'); |
|
| 2040 | - } |
|
| 2041 | - return FALSE; |
|
| 2042 | - } |
|
| 2043 | - |
|
| 2044 | - if ($table == '') |
|
| 2045 | - { |
|
| 2046 | - if ( ! isset($this->ar_from[0])) |
|
| 2047 | - { |
|
| 2048 | - if ($this->db_debug) |
|
| 2049 | - { |
|
| 2050 | - return $this->display_error('db_must_set_table'); |
|
| 2051 | - } |
|
| 2052 | - return FALSE; |
|
| 2053 | - } |
|
| 2019 | + * Insert__Update_Batch |
|
| 2020 | + * |
|
| 2021 | + * Compiles an on duplicate key update string and runs the query |
|
| 2022 | + * |
|
| 2023 | + * @since 1.6.2 |
|
| 2024 | + * @access public |
|
| 2025 | + * @param string the table to retrieve the results from |
|
| 2026 | + * @param array an associative array of update value |
|
| 2027 | + * @return object */ |
|
| 2028 | + public function insert_update_batch($table = '', $set = NULL) |
|
| 2029 | + { |
|
| 2030 | + if ( ! is_null($set)) |
|
| 2031 | + { |
|
| 2032 | + $this->set($set); |
|
| 2033 | + } |
|
| 2034 | + |
|
| 2035 | + if (count($this->ar_set) == 0) |
|
| 2036 | + { |
|
| 2037 | + if ($this->db_debug) |
|
| 2038 | + { |
|
| 2039 | + return $this->display_error('db_must_use_set'); |
|
| 2040 | + } |
|
| 2041 | + return FALSE; |
|
| 2042 | + } |
|
| 2043 | + |
|
| 2044 | + if ($table == '') |
|
| 2045 | + { |
|
| 2046 | + if ( ! isset($this->ar_from[0])) |
|
| 2047 | + { |
|
| 2048 | + if ($this->db_debug) |
|
| 2049 | + { |
|
| 2050 | + return $this->display_error('db_must_set_table'); |
|
| 2051 | + } |
|
| 2052 | + return FALSE; |
|
| 2053 | + } |
|
| 2054 | 2054 | |
| 2055 | - $table = $this->ar_from[0]; |
|
| 2056 | - } |
|
| 2055 | + $table = $this->ar_from[0]; |
|
| 2056 | + } |
|
| 2057 | 2057 | |
| 2058 | 2058 | |
| 2059 | 2059 | // $sql = $this->_insert_update_batch($this->_protect_identifiers($this->dbprefix.$table), $this->ar_set ); |
| 2060 | 2060 | for ($i = 1, $total = count($this->ar_set); $i < $total; $i++) |
| 2061 | 2061 | { |
| 2062 | 2062 | |
| 2063 | - $sql = $this->_insert_update_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), $this->ar_set[$this->_protect_identifiers($i)]); |
|
| 2063 | + $sql = $this->_insert_update_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), $this->ar_set[$this->_protect_identifiers($i)]); |
|
| 2064 | 2064 | |
| 2065 | 2065 | //echo $sql; |
| 2066 | 2066 | |
| 2067 | 2067 | $this->query($sql); |
| 2068 | 2068 | } |
| 2069 | 2069 | |
| 2070 | - $this->_reset_write(); |
|
| 2071 | - return $this->query($sql); |
|
| 2072 | - } |
|
| 2070 | + $this->_reset_write(); |
|
| 2071 | + return $this->query($sql); |
|
| 2072 | + } |
|
| 2073 | 2073 | |
| 2074 | 2074 | |
| 2075 | 2075 | |
| 2076 | 2076 | /** |
| 2077 | - * Insert_On_Duplicate_Update_Batch |
|
| 2078 | - * |
|
| 2079 | - * Compiles batch insert strings and runs the queries |
|
| 2080 | - * MODIFIED to do a MySQL 'ON DUPLICATE KEY UPDATE' |
|
| 2081 | - * |
|
| 2082 | - * @access public |
|
| 2083 | - * @param string the table to retrieve the results from |
|
| 2084 | - * @param array an associative array of insert values |
|
| 2085 | - * @return object |
|
| 2086 | - */ |
|
| 2087 | - function insert_on_duplicate_update_batch($table = '', $set = NULL) |
|
| 2088 | - { |
|
| 2089 | - if ( ! is_null($set)) |
|
| 2090 | - { |
|
| 2091 | - $this->set_insert_batch($set); |
|
| 2092 | - } |
|
| 2077 | + * Insert_On_Duplicate_Update_Batch |
|
| 2078 | + * |
|
| 2079 | + * Compiles batch insert strings and runs the queries |
|
| 2080 | + * MODIFIED to do a MySQL 'ON DUPLICATE KEY UPDATE' |
|
| 2081 | + * |
|
| 2082 | + * @access public |
|
| 2083 | + * @param string the table to retrieve the results from |
|
| 2084 | + * @param array an associative array of insert values |
|
| 2085 | + * @return object |
|
| 2086 | + */ |
|
| 2087 | + function insert_on_duplicate_update_batch($table = '', $set = NULL) |
|
| 2088 | + { |
|
| 2089 | + if ( ! is_null($set)) |
|
| 2090 | + { |
|
| 2091 | + $this->set_insert_batch($set); |
|
| 2092 | + } |
|
| 2093 | 2093 | |
| 2094 | - if (count($this->ar_set) == 0) |
|
| 2095 | - { |
|
| 2096 | - if ($this->db_debug) |
|
| 2097 | - { |
|
| 2098 | - //No valid data array. Folds in cases where keys and values did not match up |
|
| 2099 | - return $this->display_error('db_must_use_set'); |
|
| 2100 | - } |
|
| 2101 | - return FALSE; |
|
| 2102 | - } |
|
| 2103 | - |
|
| 2104 | - if ($table == '') |
|
| 2105 | - { |
|
| 2106 | - if ( ! isset($this->ar_from[0])) |
|
| 2107 | - { |
|
| 2108 | - if ($this->db_debug) |
|
| 2109 | - { |
|
| 2110 | - return $this->display_error('db_must_set_table'); |
|
| 2111 | - } |
|
| 2112 | - return FALSE; |
|
| 2113 | - } |
|
| 2114 | - |
|
| 2115 | - $table = $this->ar_from[0]; |
|
| 2116 | - } |
|
| 2117 | - // Batch this baby |
|
| 2118 | - for ($i = 0, $total = count($this->ar_set); $i < $total; $i = $i + 500) |
|
| 2119 | - { |
|
| 2120 | - $sql = $this->_insert_on_duplicate_update_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), $this->ar_keys, array_slice($this->ar_set, $i, 500)); |
|
| 2121 | - |
|
| 2122 | - // echo $sql; |
|
| 2123 | - $this->query($sql); |
|
| 2124 | - } |
|
| 2125 | - $this->_reset_write(); |
|
| 2126 | - return TRUE; |
|
| 2127 | - } |
|
| 2094 | + if (count($this->ar_set) == 0) |
|
| 2095 | + { |
|
| 2096 | + if ($this->db_debug) |
|
| 2097 | + { |
|
| 2098 | + //No valid data array. Folds in cases where keys and values did not match up |
|
| 2099 | + return $this->display_error('db_must_use_set'); |
|
| 2100 | + } |
|
| 2101 | + return FALSE; |
|
| 2102 | + } |
|
| 2103 | + |
|
| 2104 | + if ($table == '') |
|
| 2105 | + { |
|
| 2106 | + if ( ! isset($this->ar_from[0])) |
|
| 2107 | + { |
|
| 2108 | + if ($this->db_debug) |
|
| 2109 | + { |
|
| 2110 | + return $this->display_error('db_must_set_table'); |
|
| 2111 | + } |
|
| 2112 | + return FALSE; |
|
| 2113 | + } |
|
| 2114 | + |
|
| 2115 | + $table = $this->ar_from[0]; |
|
| 2116 | + } |
|
| 2117 | + // Batch this baby |
|
| 2118 | + for ($i = 0, $total = count($this->ar_set); $i < $total; $i = $i + 500) |
|
| 2119 | + { |
|
| 2120 | + $sql = $this->_insert_on_duplicate_update_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), $this->ar_keys, array_slice($this->ar_set, $i, 500)); |
|
| 2121 | + |
|
| 2122 | + // echo $sql; |
|
| 2123 | + $this->query($sql); |
|
| 2124 | + } |
|
| 2125 | + $this->_reset_write(); |
|
| 2126 | + return TRUE; |
|
| 2127 | + } |
|
| 2128 | 2128 | |
| 2129 | 2129 | |
| 2130 | 2130 | |
| 2131 | 2131 | |
| 2132 | 2132 | /** |
| 2133 | - * Insert_on_duplicate_update_batch statement |
|
| 2134 | - * |
|
| 2135 | - * Generates a platform-specific insert string from the supplied data |
|
| 2136 | - * MODIFIED to include ON DUPLICATE UPDATE |
|
| 2137 | - * |
|
| 2138 | - * @access public |
|
| 2139 | - * @param string the table name |
|
| 2140 | - * @param array the insert keys |
|
| 2141 | - * @param array the insert values |
|
| 2142 | - * @return string |
|
| 2143 | - */ |
|
| 2144 | - function _insert_on_duplicate_update_batch($table, $keys, $values) |
|
| 2145 | - { |
|
| 2146 | - foreach($keys as $key) |
|
| 2147 | - $update_fields[] = $key.'=VALUES('.$key.')'; |
|
| 2133 | + * Insert_on_duplicate_update_batch statement |
|
| 2134 | + * |
|
| 2135 | + * Generates a platform-specific insert string from the supplied data |
|
| 2136 | + * MODIFIED to include ON DUPLICATE UPDATE |
|
| 2137 | + * |
|
| 2138 | + * @access public |
|
| 2139 | + * @param string the table name |
|
| 2140 | + * @param array the insert keys |
|
| 2141 | + * @param array the insert values |
|
| 2142 | + * @return string |
|
| 2143 | + */ |
|
| 2144 | + function _insert_on_duplicate_update_batch($table, $keys, $values) |
|
| 2145 | + { |
|
| 2146 | + foreach($keys as $key) |
|
| 2147 | + $update_fields[] = $key.'=VALUES('.$key.')'; |
|
| 2148 | 2148 | |
| 2149 | - return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values)." ON DUPLICATE KEY UPDATE ".implode(', ', $update_fields); |
|
| 2150 | - } |
|
| 2149 | + return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values)." ON DUPLICATE KEY UPDATE ".implode(', ', $update_fields); |
|
| 2150 | + } |
|
| 2151 | 2151 | |
| 2152 | 2152 | |
| 2153 | 2153 | /** |
@@ -231,7 +231,7 @@ |
||
| 231 | 231 | { |
| 232 | 232 | if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php')) |
| 233 | 233 | { |
| 234 | - include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'); |
|
| 234 | + include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'); |
|
| 235 | 235 | } |
| 236 | 236 | elseif (file_exists(APPPATH.'config/smileys.php')) |
| 237 | 237 | { |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | if(!function_exists('form_breadcrumb')){
|
| 82 | - function form_breadcrumb($info=''){
|
|
| 83 | - $form=false; |
|
| 84 | - if(!empty($info)) |
|
| 82 | + function form_breadcrumb($info=''){
|
|
| 83 | + $form=false; |
|
| 84 | + if(!empty($info)) |
|
| 85 | 85 | $form.="<div class='breadcrumb'> |
| 86 | 86 | <a href='".$info['url']."'>".$info['name']."</a> |
| 87 | 87 | </div>"; |
| 88 | - return $form; |
|
| 89 | - } |
|
| 88 | + return $form; |
|
| 89 | + } |
|
| 90 | 90 | } |
| 91 | 91 | // ------------------------------------------------------------------------ |
| 92 | 92 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | {
|
| 184 | 184 | function form_input($data = '', $value = '', $extra = '') |
| 185 | 185 | {
|
| 186 | - $data["class"] = "col-md-5 form-control"; |
|
| 186 | + $data["class"] = "col-md-5 form-control"; |
|
| 187 | 187 | $defaults = array('type' => 'text', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
|
| 188 | 188 | |
| 189 | 189 | return "<input "._parse_form_attributes($data, $defaults).$extra." />"; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | function form_image($data = '', $value = '', $extra = '') |
| 199 | 199 | {
|
| 200 | 200 | //print_r($data);exit; |
| 201 | - //$data["class"] = "col-md-5 form-control"; |
|
| 201 | + //$data["class"] = "col-md-5 form-control"; |
|
| 202 | 202 | $defaults = array('type' => 'image', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
|
| 203 | 203 | if($data['value'] != ''){
|
| 204 | 204 | return '<div class="col-md-5 no-padding"> |
@@ -212,9 +212,9 @@ discard block |
||
| 212 | 212 | </span> |
| 213 | 213 | </div> |
| 214 | 214 | </div>'; |
| 215 | - }else{
|
|
| 216 | - return "<div class='col-md-5 no-padding'><image "._parse_form_attributes($data, $defaults).$extra." /></div>"; |
|
| 217 | - } |
|
| 215 | + }else{
|
|
| 216 | + return "<div class='col-md-5 no-padding'><image "._parse_form_attributes($data, $defaults).$extra." /></div>"; |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | 219 | } |
| 220 | 220 | } |
@@ -224,9 +224,9 @@ discard block |
||
| 224 | 224 | {
|
| 225 | 225 | function form_img_delete($data = '', $value = '', $extra = '') |
| 226 | 226 | {
|
| 227 | - // echo '<pre>'; print_r($data); exit; |
|
| 228 | - //$data["class"] = "col-md-5 form-control"; |
|
| 229 | - $data['value']='Delete'; |
|
| 227 | + // echo '<pre>'; print_r($data); exit; |
|
| 228 | + //$data["class"] = "col-md-5 form-control"; |
|
| 229 | + $data['value']='Delete'; |
|
| 230 | 230 | $defaults = array('type' => 'button', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => 'Delete');
|
| 231 | 231 | |
| 232 | 232 | return "<div class='col-md-5 no-padding'><input "._parse_form_attributes($data, $defaults).$extra." /></div>"; |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | function form_multiselect($name = '', $options = array(), $selected = array(), $extra = '') |
| 336 | 336 | {
|
| 337 | 337 | |
| 338 | - if ( ! strpos($extra, 'multiple')) |
|
| 338 | + if ( ! strpos($extra, 'multiple')) |
|
| 339 | 339 | {
|
| 340 | 340 | |
| 341 | 341 | $extra .= ' multiple="multiple"'; |
@@ -378,23 +378,23 @@ discard block |
||
| 378 | 378 | |
| 379 | 379 | if ($extra != '') $extra = ' '.$extra; |
| 380 | 380 | $multiple = (count($selected) > 1 && strpos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : ''; |
| 381 | - if(is_array($name)){
|
|
| 382 | - $str=null; |
|
| 383 | - foreach($name as $key=>$value){
|
|
| 384 | - if($key !='class' && $key!='disabled') |
|
| 385 | - $str.=$key."='$value' "; |
|
| 386 | - } |
|
| 387 | - if(isset($name['disabled']) && $name['disabled']== 'disabled'){
|
|
| 388 | - $str.='disabled = "disabled"'; |
|
| 389 | - } |
|
| 390 | - $form = '<select '.$str." class='col-md-5 form-control selectpicker ".$name['class'].$extra."' data-live-search='true'>\n"; |
|
| 391 | - }else{
|
|
| 392 | - if(!empty($extra)){
|
|
| 393 | - $form = '<select name="'.$name.'"' .$multiple." class='col-md-5 form-control selectpicker ".$extra."' data-live-search='true'>\n"; |
|
| 394 | - }else{
|
|
| 395 | - $form = '<select name="'.$name.'"' .$multiple." class='col-md-5 form-control selectpicker' data-live-search='true'>\n"; |
|
| 396 | - } |
|
| 397 | - } |
|
| 381 | + if(is_array($name)){
|
|
| 382 | + $str=null; |
|
| 383 | + foreach($name as $key=>$value){
|
|
| 384 | + if($key !='class' && $key!='disabled') |
|
| 385 | + $str.=$key."='$value' "; |
|
| 386 | + } |
|
| 387 | + if(isset($name['disabled']) && $name['disabled']== 'disabled'){
|
|
| 388 | + $str.='disabled = "disabled"'; |
|
| 389 | + } |
|
| 390 | + $form = '<select '.$str." class='col-md-5 form-control selectpicker ".$name['class'].$extra."' data-live-search='true'>\n"; |
|
| 391 | + }else{
|
|
| 392 | + if(!empty($extra)){
|
|
| 393 | + $form = '<select name="'.$name.'"' .$multiple." class='col-md-5 form-control selectpicker ".$extra."' data-live-search='true'>\n"; |
|
| 394 | + }else{
|
|
| 395 | + $form = '<select name="'.$name.'"' .$multiple." class='col-md-5 form-control selectpicker' data-live-search='true'>\n"; |
|
| 396 | + } |
|
| 397 | + } |
|
| 398 | 398 | // if($extra != '' ){
|
| 399 | 399 | // $form .= '<option value=""></option>'; |
| 400 | 400 | // } |
@@ -423,10 +423,10 @@ discard block |
||
| 423 | 423 | $form .= '<option value="'.$key.'"'.$sel.'>'.(string) $val."</option>\n"; |
| 424 | 424 | } |
| 425 | 425 | } |
| 426 | - if(isset($name['option_value']) && isset($name['option_text'])){
|
|
| 426 | + if(isset($name['option_value']) && isset($name['option_text'])){
|
|
| 427 | 427 | $sel= isset($name['value']) && $name['value']==$name['option_value']?'selected ="selected"':''; |
| 428 | 428 | $form .= '<option value="'.$name['option_value'].'"'.$sel.'>'.(string) $name['option_text']."</option>\n"; |
| 429 | - } |
|
| 429 | + } |
|
| 430 | 430 | $form .= '</select>'; |
| 431 | 431 | //echo $form; exit; |
| 432 | 432 | return $form; |
@@ -451,16 +451,16 @@ discard block |
||
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | 453 | if ($extra != '') $extra = ' '.$extra; |
| 454 | - $class= isset($name['class']) && !empty($name['class']) ? "col-md-5 form-control selectpicker $name[class]" :"col-md-5 form-control selectpicker"; |
|
| 454 | + $class= isset($name['class']) && !empty($name['class']) ? "col-md-5 form-control selectpicker $name[class]" :"col-md-5 form-control selectpicker"; |
|
| 455 | 455 | $multiple = (count($selected) > 1 && strpos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : ''; |
| 456 | 456 | if(is_array($name) && !isset($name["id"])){
|
| 457 | - $form = '<select name="'.$name['name'].'"'." class='$class' data-live-search='true'>\n"; |
|
| 458 | - }else if(is_array($name) && isset($name["id"])){
|
|
| 459 | - $form = '<select name="'.$name['name'].'" id="'.$name['id'].'"'."class='$class' data-live-search='true'>\n"; |
|
| 460 | - } |
|
| 461 | - else{
|
|
| 462 | - $form = '<select name="'.$name.'"' .$multiple." class='$class' data-live-search='true'>\n"; |
|
| 463 | - } |
|
| 457 | + $form = '<select name="'.$name['name'].'"'." class='$class' data-live-search='true'>\n"; |
|
| 458 | + }else if(is_array($name) && isset($name["id"])){
|
|
| 459 | + $form = '<select name="'.$name['name'].'" id="'.$name['id'].'"'."class='$class' data-live-search='true'>\n"; |
|
| 460 | + } |
|
| 461 | + else{
|
|
| 462 | + $form = '<select name="'.$name.'"' .$multiple." class='$class' data-live-search='true'>\n"; |
|
| 463 | + } |
|
| 464 | 464 | |
| 465 | 465 | $form .= '<option value=""> --Select-- </option>'; |
| 466 | 466 | foreach ($options as $key => $val) |
@@ -487,10 +487,10 @@ discard block |
||
| 487 | 487 | $form .= '<option value="'.$key.'"'.$sel.'>'.(string) $val."</option>\n"; |
| 488 | 488 | } |
| 489 | 489 | } |
| 490 | - if(isset($name['option_value']) && isset($name['option_text'])){
|
|
| 490 | + if(isset($name['option_value']) && isset($name['option_text'])){
|
|
| 491 | 491 | $sel= isset($name['value']) && $name['value']==$name['option_value']?'selected ="selected"':''; |
| 492 | 492 | $form .= '<option value="'.$name['option_value'].'"'.$sel.'>'.(string) $name['option_text']."</option>\n"; |
| 493 | - } |
|
| 493 | + } |
|
| 494 | 494 | $form .= '</select>'; |
| 495 | 495 | |
| 496 | 496 | return $form; |
@@ -521,30 +521,30 @@ discard block |
||
| 521 | 521 | ASTPP 3.0 For Search Display In |
| 522 | 522 | */ |
| 523 | 523 | if ($extra != '' && !is_array($extra)) $extra = ' '.$extra; |
| 524 | - /**********************************************************/ |
|
| 524 | + /**********************************************************/ |
|
| 525 | 525 | |
| 526 | - $class= isset($name['class']) && !empty($name['class']) ? "col-md-5 form-control selectpicker $name[class]" :"col-md-5 form-control selectpicker"; |
|
| 526 | + $class= isset($name['class']) && !empty($name['class']) ? "col-md-5 form-control selectpicker $name[class]" :"col-md-5 form-control selectpicker"; |
|
| 527 | 527 | |
| 528 | 528 | $multiple = (count($selected) > 1 && strpos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : ''; |
| 529 | - /* |
|
| 529 | + /* |
|
| 530 | 530 | ASTPP 3.0 For Search Display In |
| 531 | 531 | */ |
| 532 | - if(empty($extra)){
|
|
| 533 | - /*********************************/ |
|
| 532 | + if(empty($extra)){
|
|
| 533 | + /*********************************/ |
|
| 534 | 534 | if(is_array($name) && !isset($name["id"])){
|
| 535 | - $form = '<select name="'.$name['name'].'"'." class='col-md-5 form-control $class' style='margin-left:5px;' data-live-search='true'>\n"; |
|
| 536 | - }else if(is_array($name) && isset($name["id"])){
|
|
| 537 | - $form = '<select name="'.$name['name'].'" id="'.$name['id'].'"'."class='col-md-5 form-control $class' style='margin-left:5px;' data-live-search='true'>\n"; |
|
| 538 | - }else{
|
|
| 539 | - $form = '<select name="'.$name.'"' .$multiple." class='col-md-5 form-control $class' style='margin-left:5px;' data-live-search='true'>\n"; |
|
| 540 | - } |
|
| 535 | + $form = '<select name="'.$name['name'].'"'." class='col-md-5 form-control $class' style='margin-left:5px;' data-live-search='true'>\n"; |
|
| 536 | + }else if(is_array($name) && isset($name["id"])){
|
|
| 537 | + $form = '<select name="'.$name['name'].'" id="'.$name['id'].'"'."class='col-md-5 form-control $class' style='margin-left:5px;' data-live-search='true'>\n"; |
|
| 538 | + }else{
|
|
| 539 | + $form = '<select name="'.$name.'"' .$multiple." class='col-md-5 form-control $class' style='margin-left:5px;' data-live-search='true'>\n"; |
|
| 540 | + } |
|
| 541 | 541 | /* |
| 542 | 542 | ASTPP 3.0 For Search Display In |
| 543 | 543 | */ |
| 544 | - }else{
|
|
| 544 | + }else{
|
|
| 545 | 545 | |
| 546 | - $form = '<select name="'.$name['name'].'" id="'.$name['id'].'"'."class='".$extra['class']." $class' style='".$extra['style']."' data-live-search='true'>\n"; |
|
| 547 | - } |
|
| 546 | + $form = '<select name="'.$name['name'].'" id="'.$name['id'].'"'."class='".$extra['class']." $class' style='".$extra['style']."' data-live-search='true'>\n"; |
|
| 547 | + } |
|
| 548 | 548 | //$form .= '<option value=""> --Select-- </option>'; |
| 549 | 549 | foreach ($options as $key => $val) |
| 550 | 550 | {
|
@@ -693,11 +693,11 @@ discard block |
||
| 693 | 693 | $class=NULL; |
| 694 | 694 | |
| 695 | 695 | //echo "<pre>".$value; print_r($extra); exit; |
| 696 | - if(isset($extra[$value]) && !empty($extra) && $extra[$value] == '0'){
|
|
| 696 | + if(isset($extra[$value]) && !empty($extra) && $extra[$value] == '0'){
|
|
| 697 | 697 | $class='onoffswitch-inner'; |
| 698 | - }else{
|
|
| 698 | + }else{
|
|
| 699 | 699 | $class='onoffswitch-inner'; |
| 700 | - } |
|
| 700 | + } |
|
| 701 | 701 | /* if(isset($extra) && $extra != ''){
|
| 702 | 702 | if(isset($extra[0])){
|
| 703 | 703 | if(strtolower($extra[0]) == 'enable' || $value == "0"){
|
@@ -1413,7 +1413,7 @@ discard block |
||
| 1413 | 1413 | if(strtolower(trim($value)) == strtolower(trim($selected))) |
| 1414 | 1414 | {
|
| 1415 | 1415 | |
| 1416 | - $form .= ' selected="selected" >'; |
|
| 1416 | + $form .= ' selected="selected" >'; |
|
| 1417 | 1417 | |
| 1418 | 1418 | } |
| 1419 | 1419 | else |
@@ -1,40 +1,40 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - /** |
|
| 3 | - * Django - like template inheritance emulation for PHP |
|
| 4 | - * |
|
| 5 | - * @author Daniel Dornhardt <daniel AT dornhardt.com> |
|
| 6 | - * |
|
| 7 | - * I liked djangos template inheritance - system, so I decided to create |
|
| 8 | - * something similar for PHP. |
|
| 9 | - * |
|
| 10 | - * It's not pretty, it's not well tested (yet), but from my intuition it should be |
|
| 11 | - * simple to use and pretty fast. |
|
| 12 | - * |
|
| 13 | - * @copyright Copyright (c) 2008 by Daniel Dornhardt |
|
| 14 | - * @license http://www.opensource.org/licenses/mit-license.php The MIT License |
|
| 15 | - * |
|
| 16 | - * Permission is hereby granted, free of charge, to any person |
|
| 17 | - * obtaining a copy of this software and associated documentation |
|
| 18 | - * files (the "Software"), to deal in the Software without |
|
| 19 | - * restriction, including without limitation the rights to use, |
|
| 20 | - * copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
| 21 | - * copies of the Software, and to permit persons to whom the |
|
| 22 | - * Software is furnished to do so, subject to the following |
|
| 23 | - * conditions: |
|
| 24 | - * |
|
| 25 | - * The above copyright notice and this permission notice shall be |
|
| 26 | - * included in all copies or substantial portions of the Software. |
|
| 27 | - * |
|
| 28 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
| 29 | - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
| 30 | - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
| 31 | - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
| 32 | - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
| 33 | - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
| 34 | - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
| 35 | - * OTHER DEALINGS IN THE SOFTWARE. |
|
| 36 | - * |
|
| 37 | - */ |
|
| 2 | + /** |
|
| 3 | + * Django - like template inheritance emulation for PHP |
|
| 4 | + * |
|
| 5 | + * @author Daniel Dornhardt <daniel AT dornhardt.com> |
|
| 6 | + * |
|
| 7 | + * I liked djangos template inheritance - system, so I decided to create |
|
| 8 | + * something similar for PHP. |
|
| 9 | + * |
|
| 10 | + * It's not pretty, it's not well tested (yet), but from my intuition it should be |
|
| 11 | + * simple to use and pretty fast. |
|
| 12 | + * |
|
| 13 | + * @copyright Copyright (c) 2008 by Daniel Dornhardt |
|
| 14 | + * @license http://www.opensource.org/licenses/mit-license.php The MIT License |
|
| 15 | + * |
|
| 16 | + * Permission is hereby granted, free of charge, to any person |
|
| 17 | + * obtaining a copy of this software and associated documentation |
|
| 18 | + * files (the "Software"), to deal in the Software without |
|
| 19 | + * restriction, including without limitation the rights to use, |
|
| 20 | + * copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
| 21 | + * copies of the Software, and to permit persons to whom the |
|
| 22 | + * Software is furnished to do so, subject to the following |
|
| 23 | + * conditions: |
|
| 24 | + * |
|
| 25 | + * The above copyright notice and this permission notice shall be |
|
| 26 | + * included in all copies or substantial portions of the Software. |
|
| 27 | + * |
|
| 28 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
| 29 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
| 30 | + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
| 31 | + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
| 32 | + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
| 33 | + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
| 34 | + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
| 35 | + * OTHER DEALINGS IN THE SOFTWARE. |
|
| 36 | + * |
|
| 37 | + */ |
|
| 38 | 38 | |
| 39 | 39 | /* |
| 40 | 40 | |
@@ -236,150 +236,150 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | That's it for now. If you have questions, ideas or problems, please write me at daniel AT dornhardt.com. |
| 238 | 238 | */ |
| 239 | - if (! defined('TI_VIEWS_DIR') ) { |
|
| 240 | - if (defined('APPPATH')) { |
|
| 241 | - define('TI_VIEWS_DIR', APPPATH.'views/'); |
|
| 242 | - } else { |
|
| 243 | - define('TI_VIEWS_DIR', ''); |
|
| 244 | - } |
|
| 245 | - } |
|
| 239 | + if (! defined('TI_VIEWS_DIR') ) { |
|
| 240 | + if (defined('APPPATH')) { |
|
| 241 | + define('TI_VIEWS_DIR', APPPATH.'views/'); |
|
| 242 | + } else { |
|
| 243 | + define('TI_VIEWS_DIR', ''); |
|
| 244 | + } |
|
| 245 | + } |
|
| 246 | 246 | // echo TI_VIEWS_DIR; |
| 247 | - define('TI_MARKER_EXTEND_BLOCK_HERE', '{{{[[[{[{[{[INSERT_BASE_DATA_HERE]}]}]}]]]}}}'); |
|
| 248 | - |
|
| 249 | - /** |
|
| 250 | - * Gather output from extended templates |
|
| 251 | - * |
|
| 252 | - * array('blockname' => 'blockContent', ...) |
|
| 253 | - */ |
|
| 254 | - $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'] = array(); |
|
| 255 | - |
|
| 256 | - /** |
|
| 257 | - * keep the name of the last marker |
|
| 258 | - */ |
|
| 259 | - $GLOBALS['TI_CURRENT_BLOCKNAME'] = ''; |
|
| 260 | - |
|
| 261 | - /** |
|
| 262 | - * keep the name of the file we are extending right now |
|
| 263 | - */ |
|
| 264 | - $GLOBALS['TI_CURRENT_BASE_TEMPLATE'] = ''; |
|
| 265 | - |
|
| 266 | - /** |
|
| 267 | - * Called to extend some parts of the base template $filename with content from this file |
|
| 268 | - * |
|
| 269 | - * @param string $filename - filename of the base template |
|
| 270 | - */ |
|
| 271 | - function extend($filename) { |
|
| 247 | + define('TI_MARKER_EXTEND_BLOCK_HERE', '{{{[[[{[{[{[INSERT_BASE_DATA_HERE]}]}]}]]]}}}'); |
|
| 248 | + |
|
| 249 | + /** |
|
| 250 | + * Gather output from extended templates |
|
| 251 | + * |
|
| 252 | + * array('blockname' => 'blockContent', ...) |
|
| 253 | + */ |
|
| 254 | + $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'] = array(); |
|
| 255 | + |
|
| 256 | + /** |
|
| 257 | + * keep the name of the last marker |
|
| 258 | + */ |
|
| 259 | + $GLOBALS['TI_CURRENT_BLOCKNAME'] = ''; |
|
| 260 | + |
|
| 261 | + /** |
|
| 262 | + * keep the name of the file we are extending right now |
|
| 263 | + */ |
|
| 264 | + $GLOBALS['TI_CURRENT_BASE_TEMPLATE'] = ''; |
|
| 265 | + |
|
| 266 | + /** |
|
| 267 | + * Called to extend some parts of the base template $filename with content from this file |
|
| 268 | + * |
|
| 269 | + * @param string $filename - filename of the base template |
|
| 270 | + */ |
|
| 271 | + function extend($filename) { |
|
| 272 | 272 | // echo "externd"; |
| 273 | - $GLOBALS['TI_CURRENT_BASE_TEMPLATE'] = $filename; |
|
| 273 | + $GLOBALS['TI_CURRENT_BASE_TEMPLATE'] = $filename; |
|
| 274 | 274 | // exit(); |
| 275 | - } |
|
| 276 | - |
|
| 277 | - /** |
|
| 278 | - * End the extension process for this file. Needs to be called after all blocks |
|
| 279 | - * have been set. |
|
| 280 | - * |
|
| 281 | - */ |
|
| 282 | - function end_extend() { |
|
| 283 | - //echo 'tttttttttttt'; |
|
| 284 | - if (isset($GLOBALS['CI'])) { |
|
| 285 | - $GLOBALS['CI']->load->view($GLOBALS['TI_CURRENT_BASE_TEMPLATE']); |
|
| 286 | - } |
|
| 287 | - else { |
|
| 288 | - include realpath( TI_VIEWS_DIR . $GLOBALS['TI_CURRENT_BASE_TEMPLATE']); |
|
| 289 | - } |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - /** |
|
| 293 | - * Start a top-level block. Its contents can be replaced from within child templates. |
|
| 294 | - * |
|
| 295 | - * @param string $blockname |
|
| 296 | - */ |
|
| 297 | - function start_block_marker($blockname) { |
|
| 298 | - // remember block name for end_block_marker() |
|
| 299 | - $GLOBALS['TI_CURRENT_BLOCKNAME'] = $blockname; |
|
| 300 | - // start caching this blocks output |
|
| 301 | - ob_start(); |
|
| 302 | - } |
|
| 303 | - |
|
| 304 | - /** |
|
| 305 | - * End a top-level block. Its contents can be replaced from within child templates. |
|
| 306 | - * |
|
| 307 | - */ |
|
| 308 | - function end_block_marker() { |
|
| 309 | - // get block content |
|
| 310 | - $thisBlocksContent = ob_get_clean(); |
|
| 311 | - // check if we got data for this block from child templates |
|
| 312 | - if (array_key_exists($GLOBALS['TI_CURRENT_BLOCKNAME'], $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'])) { |
|
| 313 | - // if yes, use that data instead of what's in this block |
|
| 314 | - // - except we got a marker that the child wants us to include this blocks content |
|
| 315 | - // in some places. If so, place our data into those spots. |
|
| 316 | - $thisBlocksContent = str_replace( |
|
| 317 | - TI_MARKER_EXTEND_BLOCK_HERE, |
|
| 318 | - $thisBlocksContent, |
|
| 319 | - $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'][$GLOBALS['TI_CURRENT_BLOCKNAME']] |
|
| 320 | - ); |
|
| 321 | - } |
|
| 322 | - // output result |
|
| 323 | - echo $thisBlocksContent; |
|
| 324 | - } |
|
| 325 | - |
|
| 326 | - |
|
| 327 | - /** |
|
| 328 | - * Mark the start of a block as content to be embedded into the base template. |
|
| 329 | - * |
|
| 330 | - * @param string $blockname |
|
| 331 | - */ |
|
| 332 | - function startblock($blockname) { |
|
| 333 | - // remember block name for endblock() |
|
| 334 | - $GLOBALS['TI_CURRENT_BLOCKNAME'] = $blockname; |
|
| 335 | - // start caching this blocks output |
|
| 336 | - ob_start(); |
|
| 337 | - } |
|
| 338 | - |
|
| 339 | - /** |
|
| 340 | - * Mark the end of a block as content to be embedded into the base template. |
|
| 341 | - */ |
|
| 342 | - function endblock() { |
|
| 343 | - // get block content |
|
| 344 | - $thisBlocksContent = ob_get_clean(); |
|
| 345 | - // check if we got data for this block from child templates |
|
| 346 | - if (array_key_exists($GLOBALS['TI_CURRENT_BLOCKNAME'], $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'])) { |
|
| 347 | - // check if we got a marker that the child wants us to include this blocks content |
|
| 348 | - // in some places. If so, place our data into those spots. |
|
| 349 | - $thisBlocksContent = str_replace( |
|
| 350 | - TI_MARKER_EXTEND_BLOCK_HERE, |
|
| 351 | - $thisBlocksContent, |
|
| 352 | - $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'][$GLOBALS['TI_CURRENT_BLOCKNAME']] |
|
| 353 | - ); |
|
| 354 | - } |
|
| 355 | - // save this blocks content for use in templates higher up in the hierarchy |
|
| 356 | - $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'][$GLOBALS['TI_CURRENT_BLOCKNAME']] = $thisBlocksContent; |
|
| 357 | - } |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * Insert a marker at this position to add the content from the base templates to this block. |
|
| 361 | - */ |
|
| 362 | - function get_extended_block() { |
|
| 363 | - echo TI_MARKER_EXTEND_BLOCK_HERE; |
|
| 364 | - } |
|
| 365 | - |
|
| 366 | - /** |
|
| 367 | - * Check if this block's contents will be needed. |
|
| 368 | - * True if no child did override this block or a child needs this block's content |
|
| 369 | - * |
|
| 370 | - * @return bool |
|
| 371 | - */ |
|
| 372 | - function block_rendering_neccessary() { |
|
| 373 | - // check if no child did override this block |
|
| 374 | - if (!array_key_exists($GLOBALS['TI_CURRENT_BLOCKNAME'], $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'] )) { |
|
| 375 | - return true; |
|
| 376 | - } |
|
| 377 | - // check if there is an extension marker in the child blocks data. If so, the |
|
| 378 | - // rendering of this block is required |
|
| 379 | - if (false === strpos($GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'][$GLOBALS['TI_CURRENT_BLOCKNAME']], TI_MARKER_EXTEND_BLOCK_HERE)) { |
|
| 380 | - return false; |
|
| 381 | - } else { |
|
| 382 | - return true; |
|
| 383 | - } |
|
| 384 | - } |
|
| 275 | + } |
|
| 276 | + |
|
| 277 | + /** |
|
| 278 | + * End the extension process for this file. Needs to be called after all blocks |
|
| 279 | + * have been set. |
|
| 280 | + * |
|
| 281 | + */ |
|
| 282 | + function end_extend() { |
|
| 283 | + //echo 'tttttttttttt'; |
|
| 284 | + if (isset($GLOBALS['CI'])) { |
|
| 285 | + $GLOBALS['CI']->load->view($GLOBALS['TI_CURRENT_BASE_TEMPLATE']); |
|
| 286 | + } |
|
| 287 | + else { |
|
| 288 | + include realpath( TI_VIEWS_DIR . $GLOBALS['TI_CURRENT_BASE_TEMPLATE']); |
|
| 289 | + } |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + /** |
|
| 293 | + * Start a top-level block. Its contents can be replaced from within child templates. |
|
| 294 | + * |
|
| 295 | + * @param string $blockname |
|
| 296 | + */ |
|
| 297 | + function start_block_marker($blockname) { |
|
| 298 | + // remember block name for end_block_marker() |
|
| 299 | + $GLOBALS['TI_CURRENT_BLOCKNAME'] = $blockname; |
|
| 300 | + // start caching this blocks output |
|
| 301 | + ob_start(); |
|
| 302 | + } |
|
| 303 | + |
|
| 304 | + /** |
|
| 305 | + * End a top-level block. Its contents can be replaced from within child templates. |
|
| 306 | + * |
|
| 307 | + */ |
|
| 308 | + function end_block_marker() { |
|
| 309 | + // get block content |
|
| 310 | + $thisBlocksContent = ob_get_clean(); |
|
| 311 | + // check if we got data for this block from child templates |
|
| 312 | + if (array_key_exists($GLOBALS['TI_CURRENT_BLOCKNAME'], $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'])) { |
|
| 313 | + // if yes, use that data instead of what's in this block |
|
| 314 | + // - except we got a marker that the child wants us to include this blocks content |
|
| 315 | + // in some places. If so, place our data into those spots. |
|
| 316 | + $thisBlocksContent = str_replace( |
|
| 317 | + TI_MARKER_EXTEND_BLOCK_HERE, |
|
| 318 | + $thisBlocksContent, |
|
| 319 | + $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'][$GLOBALS['TI_CURRENT_BLOCKNAME']] |
|
| 320 | + ); |
|
| 321 | + } |
|
| 322 | + // output result |
|
| 323 | + echo $thisBlocksContent; |
|
| 324 | + } |
|
| 325 | + |
|
| 326 | + |
|
| 327 | + /** |
|
| 328 | + * Mark the start of a block as content to be embedded into the base template. |
|
| 329 | + * |
|
| 330 | + * @param string $blockname |
|
| 331 | + */ |
|
| 332 | + function startblock($blockname) { |
|
| 333 | + // remember block name for endblock() |
|
| 334 | + $GLOBALS['TI_CURRENT_BLOCKNAME'] = $blockname; |
|
| 335 | + // start caching this blocks output |
|
| 336 | + ob_start(); |
|
| 337 | + } |
|
| 338 | + |
|
| 339 | + /** |
|
| 340 | + * Mark the end of a block as content to be embedded into the base template. |
|
| 341 | + */ |
|
| 342 | + function endblock() { |
|
| 343 | + // get block content |
|
| 344 | + $thisBlocksContent = ob_get_clean(); |
|
| 345 | + // check if we got data for this block from child templates |
|
| 346 | + if (array_key_exists($GLOBALS['TI_CURRENT_BLOCKNAME'], $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'])) { |
|
| 347 | + // check if we got a marker that the child wants us to include this blocks content |
|
| 348 | + // in some places. If so, place our data into those spots. |
|
| 349 | + $thisBlocksContent = str_replace( |
|
| 350 | + TI_MARKER_EXTEND_BLOCK_HERE, |
|
| 351 | + $thisBlocksContent, |
|
| 352 | + $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'][$GLOBALS['TI_CURRENT_BLOCKNAME']] |
|
| 353 | + ); |
|
| 354 | + } |
|
| 355 | + // save this blocks content for use in templates higher up in the hierarchy |
|
| 356 | + $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'][$GLOBALS['TI_CURRENT_BLOCKNAME']] = $thisBlocksContent; |
|
| 357 | + } |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * Insert a marker at this position to add the content from the base templates to this block. |
|
| 361 | + */ |
|
| 362 | + function get_extended_block() { |
|
| 363 | + echo TI_MARKER_EXTEND_BLOCK_HERE; |
|
| 364 | + } |
|
| 365 | + |
|
| 366 | + /** |
|
| 367 | + * Check if this block's contents will be needed. |
|
| 368 | + * True if no child did override this block or a child needs this block's content |
|
| 369 | + * |
|
| 370 | + * @return bool |
|
| 371 | + */ |
|
| 372 | + function block_rendering_neccessary() { |
|
| 373 | + // check if no child did override this block |
|
| 374 | + if (!array_key_exists($GLOBALS['TI_CURRENT_BLOCKNAME'], $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'] )) { |
|
| 375 | + return true; |
|
| 376 | + } |
|
| 377 | + // check if there is an extension marker in the child blocks data. If so, the |
|
| 378 | + // rendering of this block is required |
|
| 379 | + if (false === strpos($GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'][$GLOBALS['TI_CURRENT_BLOCKNAME']], TI_MARKER_EXTEND_BLOCK_HERE)) { |
|
| 380 | + return false; |
|
| 381 | + } else { |
|
| 382 | + return true; |
|
| 383 | + } |
|
| 384 | + } |
|
| 385 | 385 | ?> |
| 386 | 386 | \ No newline at end of file |
@@ -12,20 +12,20 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | // Set index.php location |
| 14 | 14 | if (isset($config['CRON_CI_INDEX']) && $config['CRON_CI_INDEX']) |
| 15 | - define('CRON_CI_INDEX', $config['CRON_CI_INDEX']); |
|
| 15 | + define('CRON_CI_INDEX', $config['CRON_CI_INDEX']); |
|
| 16 | 16 | else |
| 17 | - define('CRON_CI_INDEX', '../index.php'); |
|
| 17 | + define('CRON_CI_INDEX', '../index.php'); |
|
| 18 | 18 | |
| 19 | 19 | if (count($argv) <= 2) |
| 20 | - if (count($config['argv'])) { |
|
| 21 | - $path = $argv[1]; |
|
| 22 | - unset($argv[1]); |
|
| 20 | + if (count($config['argv'])) { |
|
| 21 | + $path = $argv[1]; |
|
| 22 | + unset($argv[1]); |
|
| 23 | 23 | // $argv = array_merge($argv, $config["argv"][$path]); |
| 24 | - $argv[0] = $argv[0]; |
|
| 25 | - $argv[1] =$config["argv"][$path]; |
|
| 26 | - $_SERVER['argv'] = $argv; |
|
| 27 | - } else |
|
| 28 | - die('Use: php cron.php controller/method'); |
|
| 24 | + $argv[0] = $argv[0]; |
|
| 25 | + $argv[1] =$config["argv"][$path]; |
|
| 26 | + $_SERVER['argv'] = $argv; |
|
| 27 | + } else |
|
| 28 | + die('Use: php cron.php controller/method'); |
|
| 29 | 29 | |
| 30 | 30 | // Simulate an HTTP request |
| 31 | 31 | $_SERVER['PATH_INFO'] = $argv[1]; |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | $output = ob_get_contents(); |
| 46 | 46 | |
| 47 | 47 | if (CRON_FLUSH_BUFFERS === TRUE) |
| 48 | - while (@ob_end_flush()); // display buffer contents |
|
| 49 | - else |
|
| 50 | - ob_end_clean(); |
|
| 48 | + while (@ob_end_flush()); // display buffer contents |
|
| 49 | + else |
|
| 50 | + ob_end_clean(); |
|
| 51 | 51 | |
| 52 | 52 | echo "\n"; |
| 53 | 53 | ?> |
@@ -22,26 +22,26 @@ |
||
| 22 | 22 | ############################################################################### |
| 23 | 23 | |
| 24 | 24 | class Broadcastemail extends CI_Controller { |
| 25 | - function __construct() |
|
| 26 | - { |
|
| 25 | + function __construct() |
|
| 26 | + { |
|
| 27 | 27 | parent::__construct(); |
| 28 | 28 | if(!defined( 'CRON' ) ) |
| 29 | 29 | exit(); |
| 30 | - $this->load->model("db_model"); |
|
| 31 | - $this->load->library("astpp/email_lib"); |
|
| 32 | - } |
|
| 33 | - function broadcast_email(){ |
|
| 30 | + $this->load->model("db_model"); |
|
| 31 | + $this->load->library("astpp/email_lib"); |
|
| 32 | + } |
|
| 33 | + function broadcast_email(){ |
|
| 34 | 34 | |
| 35 | - $where = array("status"=>"1"); |
|
| 36 | - $query = $this->db_model->getSelect("*", "mail_details", $where); |
|
| 37 | - if($query->num_rows >0){ |
|
| 38 | - $account_data = $query->result_array(); |
|
| 39 | - foreach($account_data as $data_key =>$account_value){ |
|
| 40 | - $account_value['history_id']=$account_value['id']; |
|
| 41 | - unset($account_value['id']); |
|
| 42 | - $this->email_lib->send_email('',$account_value,'',$account_value['attachment'],1,0,1); |
|
| 43 | - } |
|
| 44 | - } |
|
| 45 | - } |
|
| 35 | + $where = array("status"=>"1"); |
|
| 36 | + $query = $this->db_model->getSelect("*", "mail_details", $where); |
|
| 37 | + if($query->num_rows >0){ |
|
| 38 | + $account_data = $query->result_array(); |
|
| 39 | + foreach($account_data as $data_key =>$account_value){ |
|
| 40 | + $account_value['history_id']=$account_value['id']; |
|
| 41 | + unset($account_value['id']); |
|
| 42 | + $this->email_lib->send_email('',$account_value,'',$account_value['attachment'],1,0,1); |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | 46 | } |
| 47 | 47 | ?> |
@@ -27,16 +27,16 @@ |
||
| 27 | 27 | { |
| 28 | 28 | parent::__construct(); |
| 29 | 29 | $this->load->model("db_model"); |
| 30 | - $this->load->library("astpp/common"); |
|
| 30 | + $this->load->library("astpp/common"); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | function customer_list_status($id){ |
| 35 | 35 | $post_data = $this->input->post(); |
| 36 | - $post_data['table']=$this->common->decode($post_data['table']); |
|
| 37 | - $data['status']=$post_data['status'] =='true'? 0:1; |
|
| 38 | - $result=$post_data['table'] =='accounts' && $post_data['id'] == 1 ? null:$this->db->update($post_data['table'],$data,array("id"=>$post_data['id'])); |
|
| 39 | - echo TRUE; |
|
| 36 | + $post_data['table']=$this->common->decode($post_data['table']); |
|
| 37 | + $data['status']=$post_data['status'] =='true'? 0:1; |
|
| 38 | + $result=$post_data['table'] =='accounts' && $post_data['id'] == 1 ? null:$this->db->update($post_data['table'],$data,array("id"=>$post_data['id'])); |
|
| 39 | + echo TRUE; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |