@@ -21,23 +21,23 @@ discard block |
||
| 21 | 21 | // You should have received a copy of the GNU Affero General Public License |
| 22 | 22 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 23 | 23 | // ############################################################################## |
| 24 | -if (! defined ( 'BASEPATH' )) |
|
| 25 | - exit ( 'No direct script access allowed' ); |
|
| 24 | +if ( ! defined('BASEPATH')) |
|
| 25 | + exit ('No direct script access allowed'); |
|
| 26 | 26 | class Package_form { |
| 27 | 27 | function get_package_form_fields($id = '') { |
| 28 | - $form ['forms'] = array ( |
|
| 29 | - base_url () . 'package/package_save/' . $id . "/", |
|
| 30 | - array ( |
|
| 28 | + $form ['forms'] = array( |
|
| 29 | + base_url().'package/package_save/'.$id."/", |
|
| 30 | + array( |
|
| 31 | 31 | 'id' => 'packeage_form', |
| 32 | 32 | 'method' => 'POST', |
| 33 | 33 | 'name' => 'packeage_form' |
| 34 | 34 | ) |
| 35 | 35 | ); |
| 36 | - $form [gettext ( 'Package Information' )] = array ( |
|
| 37 | - array ( |
|
| 36 | + $form [gettext('Package Information')] = array( |
|
| 37 | + array( |
|
| 38 | 38 | '', |
| 39 | 39 | 'HIDDEN', |
| 40 | - array ( |
|
| 40 | + array( |
|
| 41 | 41 | 'name' => 'id' |
| 42 | 42 | ), |
| 43 | 43 | '', |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | '', |
| 46 | 46 | '' |
| 47 | 47 | ), |
| 48 | - array ( |
|
| 48 | + array( |
|
| 49 | 49 | '', |
| 50 | 50 | 'HIDDEN', |
| 51 | - array ( |
|
| 51 | + array( |
|
| 52 | 52 | 'name' => 'status', |
| 53 | 53 | 'value' => '1' |
| 54 | 54 | ), |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | '', |
| 57 | 57 | '' |
| 58 | 58 | ), |
| 59 | - array ( |
|
| 60 | - gettext ( 'Name' ), |
|
| 59 | + array( |
|
| 60 | + gettext('Name'), |
|
| 61 | 61 | 'INPUT', |
| 62 | - array ( |
|
| 62 | + array( |
|
| 63 | 63 | 'name' => 'package_name', |
| 64 | 64 | 'size' => '20', |
| 65 | 65 | 'class' => "text field medium" |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | 'tOOL TIP', |
| 69 | 69 | '' |
| 70 | 70 | ), |
| 71 | - array ( |
|
| 72 | - gettext ( 'Rate Group' ), |
|
| 71 | + array( |
|
| 72 | + gettext('Rate Group'), |
|
| 73 | 73 | 'pricelist_id', |
| 74 | 74 | 'SELECT', |
| 75 | 75 | '', |
@@ -81,15 +81,15 @@ discard block |
||
| 81 | 81 | 'pricelists', |
| 82 | 82 | 'build_dropdown', |
| 83 | 83 | 'where_arr', |
| 84 | - array ( |
|
| 84 | + array( |
|
| 85 | 85 | "status" => "0", |
| 86 | 86 | "reseller_id" => "0" |
| 87 | 87 | ) |
| 88 | 88 | ), |
| 89 | - array ( |
|
| 90 | - gettext ( 'Included Seconds' ), |
|
| 89 | + array( |
|
| 90 | + gettext('Included Seconds'), |
|
| 91 | 91 | 'INPUT', |
| 92 | - array ( |
|
| 92 | + array( |
|
| 93 | 93 | 'name' => 'includedseconds', |
| 94 | 94 | 'size' => '20', |
| 95 | 95 | 'class' => "text field medium" |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * Add For Package Inbound or Outbound or both? |
| 104 | 104 | * * |
| 105 | 105 | */ |
| 106 | - array ( |
|
| 106 | + array( |
|
| 107 | 107 | 'Applicable For?', |
| 108 | 108 | 'applicable_for', |
| 109 | 109 | 'SELECT', |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | /** |
| 121 | 121 | * ****************************************** |
| 122 | 122 | */ |
| 123 | - array ( |
|
| 123 | + array( |
|
| 124 | 124 | 'Status', |
| 125 | 125 | 'status', |
| 126 | 126 | 'SELECT', |
@@ -134,17 +134,17 @@ discard block |
||
| 134 | 134 | 'set_status' |
| 135 | 135 | ) |
| 136 | 136 | ); |
| 137 | - $form ['button_cancel'] = array ( |
|
| 137 | + $form ['button_cancel'] = array( |
|
| 138 | 138 | 'name' => 'action', |
| 139 | - 'content' => gettext ( 'Cancel' ), |
|
| 139 | + 'content' => gettext('Cancel'), |
|
| 140 | 140 | 'value' => 'cancel', |
| 141 | 141 | 'type' => 'button', |
| 142 | 142 | 'class' => 'btn btn-line-sky margin-x-10', |
| 143 | 143 | 'onclick' => 'return redirect_page(\'/package/package_list/\')' |
| 144 | 144 | ); |
| 145 | - $form ['button_save'] = array ( |
|
| 145 | + $form ['button_save'] = array( |
|
| 146 | 146 | 'name' => 'action', |
| 147 | - 'content' => gettext ( 'Save' ), |
|
| 147 | + 'content' => gettext('Save'), |
|
| 148 | 148 | 'value' => 'save', |
| 149 | 149 | 'type' => 'submit', |
| 150 | 150 | 'class' => 'btn btn-line-parrot' |
@@ -153,17 +153,17 @@ discard block |
||
| 153 | 153 | return $form; |
| 154 | 154 | } |
| 155 | 155 | function get_package_search_form() { |
| 156 | - $form ['forms'] = array ( |
|
| 156 | + $form ['forms'] = array( |
|
| 157 | 157 | "", |
| 158 | - array ( |
|
| 158 | + array( |
|
| 159 | 159 | 'id' => "package_search" |
| 160 | 160 | ) |
| 161 | 161 | ); |
| 162 | - $form [gettext ( 'Search' )] = array ( |
|
| 163 | - array ( |
|
| 164 | - gettext ( 'Name' ), |
|
| 162 | + $form [gettext('Search')] = array( |
|
| 163 | + array( |
|
| 164 | + gettext('Name'), |
|
| 165 | 165 | 'INPUT', |
| 166 | - array ( |
|
| 166 | + array( |
|
| 167 | 167 | 'name' => 'package_name[package_name]', |
| 168 | 168 | '', |
| 169 | 169 | 'size' => '20', |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | 'search_string_type', |
| 180 | 180 | '' |
| 181 | 181 | ), |
| 182 | - array ( |
|
| 183 | - gettext ( 'Rate Group' ), |
|
| 182 | + array( |
|
| 183 | + gettext('Rate Group'), |
|
| 184 | 184 | 'pricelist_id', |
| 185 | 185 | 'SELECT', |
| 186 | 186 | '', |
@@ -192,15 +192,15 @@ discard block |
||
| 192 | 192 | 'pricelists', |
| 193 | 193 | 'build_dropdown', |
| 194 | 194 | 'where_arr', |
| 195 | - array ( |
|
| 195 | + array( |
|
| 196 | 196 | "status" => "0", |
| 197 | 197 | "reseller_id" => "0" |
| 198 | 198 | ) |
| 199 | 199 | ), |
| 200 | - array ( |
|
| 201 | - gettext ( 'Included Seconds' ), |
|
| 200 | + array( |
|
| 201 | + gettext('Included Seconds'), |
|
| 202 | 202 | 'INPUT', |
| 203 | - array ( |
|
| 203 | + array( |
|
| 204 | 204 | 'name' => 'includedseconds[includedseconds]', |
| 205 | 205 | 'value' => '', |
| 206 | 206 | 'size' => '20', |
@@ -221,8 +221,8 @@ discard block |
||
| 221 | 221 | * Add For Package Inbound or Outbound or both? |
| 222 | 222 | * * |
| 223 | 223 | */ |
| 224 | - array ( |
|
| 225 | - gettext ( 'Applicable For?' ), |
|
| 224 | + array( |
|
| 225 | + gettext('Applicable For?'), |
|
| 226 | 226 | 'applicable_for', |
| 227 | 227 | 'SELECT', |
| 228 | 228 | '', |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | /** |
| 240 | 240 | * ****************************************** |
| 241 | 241 | */ |
| 242 | - array ( |
|
| 243 | - gettext ( 'Status' ), |
|
| 242 | + array( |
|
| 243 | + gettext('Status'), |
|
| 244 | 244 | 'status', |
| 245 | 245 | 'SELECT', |
| 246 | 246 | '', |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | '' |
| 256 | 256 | ), |
| 257 | 257 | |
| 258 | - array ( |
|
| 258 | + array( |
|
| 259 | 259 | '', |
| 260 | 260 | 'HIDDEN', |
| 261 | 261 | 'ajax_search', |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | '', |
| 265 | 265 | '' |
| 266 | 266 | ), |
| 267 | - array ( |
|
| 267 | + array( |
|
| 268 | 268 | '', |
| 269 | 269 | 'HIDDEN', |
| 270 | 270 | 'advance_search', |
@@ -275,18 +275,18 @@ discard block |
||
| 275 | 275 | ) |
| 276 | 276 | ) |
| 277 | 277 | ; |
| 278 | - $form ['button_search'] = array ( |
|
| 278 | + $form ['button_search'] = array( |
|
| 279 | 279 | 'name' => 'action', |
| 280 | 280 | 'id' => "package_search_btn", |
| 281 | - 'content' => gettext ( 'Search' ), |
|
| 281 | + 'content' => gettext('Search'), |
|
| 282 | 282 | 'value' => 'save', |
| 283 | 283 | 'type' => 'button', |
| 284 | 284 | 'class' => 'btn btn-line-parrot pull-right' |
| 285 | 285 | ); |
| 286 | - $form ['button_reset'] = array ( |
|
| 286 | + $form ['button_reset'] = array( |
|
| 287 | 287 | 'name' => 'action', |
| 288 | 288 | 'id' => "id_reset", |
| 289 | - 'content' => gettext ( 'Clear' ), |
|
| 289 | + 'content' => gettext('Clear'), |
|
| 290 | 290 | 'value' => 'cancel', |
| 291 | 291 | 'type' => 'reset', |
| 292 | 292 | 'class' => 'btn btn-line-sky pull-right margin-x-10' |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | } |
| 297 | 297 | function build_package_list_for_admin() { |
| 298 | 298 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
| 299 | - $grid_field_arr = json_encode ( array ( |
|
| 300 | - array ( |
|
| 299 | + $grid_field_arr = json_encode(array( |
|
| 300 | + array( |
|
| 301 | 301 | "<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", |
| 302 | 302 | "30", |
| 303 | 303 | "", |
@@ -313,8 +313,8 @@ discard block |
||
| 313 | 313 | * For Package edit on Name |
| 314 | 314 | * * |
| 315 | 315 | */ |
| 316 | - array ( |
|
| 317 | - gettext ( "Name" ), |
|
| 316 | + array( |
|
| 317 | + gettext("Name"), |
|
| 318 | 318 | "170", |
| 319 | 319 | "package_name", |
| 320 | 320 | "", |
@@ -327,8 +327,8 @@ discard block |
||
| 327 | 327 | /** |
| 328 | 328 | * ******************************** |
| 329 | 329 | */ |
| 330 | - array ( |
|
| 331 | - gettext ( "Rate Group" ), |
|
| 330 | + array( |
|
| 331 | + gettext("Rate Group"), |
|
| 332 | 332 | "150", |
| 333 | 333 | "pricelist_id", |
| 334 | 334 | "name", |
@@ -338,8 +338,8 @@ discard block |
||
| 338 | 338 | "true", |
| 339 | 339 | "center" |
| 340 | 340 | ), |
| 341 | - array ( |
|
| 342 | - gettext ( "Included Seconds" ), |
|
| 341 | + array( |
|
| 342 | + gettext("Included Seconds"), |
|
| 343 | 343 | "160", |
| 344 | 344 | "includedseconds", |
| 345 | 345 | "", |
@@ -354,8 +354,8 @@ discard block |
||
| 354 | 354 | * Add For Package Inbound or Outbound or both? |
| 355 | 355 | * * |
| 356 | 356 | */ |
| 357 | - array ( |
|
| 358 | - gettext ( "Applicable For?" ), |
|
| 357 | + array( |
|
| 358 | + gettext("Applicable For?"), |
|
| 359 | 359 | "200", |
| 360 | 360 | "applicable_for", |
| 361 | 361 | "applicable_for", |
@@ -372,8 +372,8 @@ discard block |
||
| 372 | 372 | * ASTPP 3.0 |
| 373 | 373 | * Creation date,last modified date show in grid |
| 374 | 374 | */ |
| 375 | - array ( |
|
| 376 | - gettext ( "Status" ), |
|
| 375 | + array( |
|
| 376 | + gettext("Status"), |
|
| 377 | 377 | "140", |
| 378 | 378 | "status", |
| 379 | 379 | "status", |
@@ -383,8 +383,8 @@ discard block |
||
| 383 | 383 | "true", |
| 384 | 384 | "center" |
| 385 | 385 | ), |
| 386 | - array ( |
|
| 387 | - gettext ( "Created Date" ), |
|
| 386 | + array( |
|
| 387 | + gettext("Created Date"), |
|
| 388 | 388 | "120", |
| 389 | 389 | "creation_date", |
| 390 | 390 | "creation_date", |
@@ -394,8 +394,8 @@ discard block |
||
| 394 | 394 | "true", |
| 395 | 395 | "center" |
| 396 | 396 | ), |
| 397 | - array ( |
|
| 398 | - gettext ( "Modified Date" ), |
|
| 397 | + array( |
|
| 398 | + gettext("Modified Date"), |
|
| 399 | 399 | "140", |
| 400 | 400 | "last_modified_date", |
| 401 | 401 | "last_modified_date", |
@@ -416,50 +416,50 @@ discard block |
||
| 416 | 416 | /** |
| 417 | 417 | * ***************************************** |
| 418 | 418 | */ |
| 419 | - array ( |
|
| 420 | - gettext ( "Action" ), |
|
| 419 | + array( |
|
| 420 | + gettext("Action"), |
|
| 421 | 421 | "160", |
| 422 | 422 | "", |
| 423 | 423 | "", |
| 424 | 424 | "", |
| 425 | - array ( |
|
| 426 | - "EDIT" => array ( |
|
| 425 | + array( |
|
| 426 | + "EDIT" => array( |
|
| 427 | 427 | "url" => "package/package_edit/", |
| 428 | 428 | "mode" => "single" |
| 429 | 429 | ), |
| 430 | - "DELETE" => array ( |
|
| 430 | + "DELETE" => array( |
|
| 431 | 431 | "url" => "package/package_delete/", |
| 432 | 432 | "mode" => "single" |
| 433 | 433 | ) |
| 434 | 434 | ) |
| 435 | 435 | ) |
| 436 | - ) ); |
|
| 436 | + )); |
|
| 437 | 437 | return $grid_field_arr; |
| 438 | 438 | } |
| 439 | 439 | function build_grid_buttons() { |
| 440 | - $buttons_json = json_encode ( array ( |
|
| 441 | - array ( |
|
| 442 | - gettext ( "Create" ), |
|
| 440 | + $buttons_json = json_encode(array( |
|
| 441 | + array( |
|
| 442 | + gettext("Create"), |
|
| 443 | 443 | "btn btn-line-warning btn", |
| 444 | 444 | "fa fa-plus-circle fa-lg", |
| 445 | 445 | "button_action", |
| 446 | 446 | "/package/package_add/" |
| 447 | 447 | ), |
| 448 | - array ( |
|
| 449 | - gettext ( "Delete" ), |
|
| 448 | + array( |
|
| 449 | + gettext("Delete"), |
|
| 450 | 450 | "btn btn-line-danger", |
| 451 | 451 | "fa fa-times-circle fa-lg", |
| 452 | 452 | "button_action", |
| 453 | 453 | "/package/package_delete_multiple/" |
| 454 | 454 | ) |
| 455 | - ) ); |
|
| 455 | + )); |
|
| 456 | 456 | return $buttons_json; |
| 457 | 457 | } |
| 458 | 458 | function build_package_counter_list_for_admin() { |
| 459 | 459 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
| 460 | - $grid_field_arr = json_encode ( array ( |
|
| 461 | - array ( |
|
| 462 | - gettext ( "Package Name" ), |
|
| 460 | + $grid_field_arr = json_encode(array( |
|
| 461 | + array( |
|
| 462 | + gettext("Package Name"), |
|
| 463 | 463 | "430", |
| 464 | 464 | "package_id", |
| 465 | 465 | "package_name", |
@@ -469,8 +469,8 @@ discard block |
||
| 469 | 469 | "true", |
| 470 | 470 | "center" |
| 471 | 471 | ), |
| 472 | - array ( |
|
| 473 | - gettext ( "Account" ), |
|
| 472 | + array( |
|
| 473 | + gettext("Account"), |
|
| 474 | 474 | "420", |
| 475 | 475 | "accountid", |
| 476 | 476 | "first_name,last_name,number", |
@@ -480,8 +480,8 @@ discard block |
||
| 480 | 480 | "true", |
| 481 | 481 | "center" |
| 482 | 482 | ), |
| 483 | - array ( |
|
| 484 | - gettext ( "Used Seconds" ), |
|
| 483 | + array( |
|
| 484 | + gettext("Used Seconds"), |
|
| 485 | 485 | "420", |
| 486 | 486 | "seconds", |
| 487 | 487 | "", |
@@ -491,12 +491,12 @@ discard block |
||
| 491 | 491 | "true", |
| 492 | 492 | "center" |
| 493 | 493 | ) |
| 494 | - ) ); |
|
| 494 | + )); |
|
| 495 | 495 | return $grid_field_arr; |
| 496 | 496 | } |
| 497 | 497 | function build_pattern_list_for_customer($packageid) { |
| 498 | - $grid_field_arr = json_encode ( array ( |
|
| 499 | - array ( |
|
| 498 | + $grid_field_arr = json_encode(array( |
|
| 499 | + array( |
|
| 500 | 500 | "<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", |
| 501 | 501 | "30", |
| 502 | 502 | "", |
@@ -507,55 +507,55 @@ discard block |
||
| 507 | 507 | "false", |
| 508 | 508 | "center" |
| 509 | 509 | ), |
| 510 | - array ( |
|
| 511 | - gettext ( "Code" ), |
|
| 510 | + array( |
|
| 511 | + gettext("Code"), |
|
| 512 | 512 | "450", |
| 513 | 513 | "patterns", |
| 514 | 514 | "patterns", |
| 515 | 515 | "", |
| 516 | 516 | "get_only_numeric_val" |
| 517 | 517 | ), |
| 518 | - array ( |
|
| 519 | - gettext ( "Destination" ), |
|
| 518 | + array( |
|
| 519 | + gettext("Destination"), |
|
| 520 | 520 | "450", |
| 521 | 521 | "destination", |
| 522 | 522 | "", |
| 523 | 523 | "", |
| 524 | 524 | "" |
| 525 | 525 | ), |
| 526 | - array ( |
|
| 527 | - gettext ( "Action" ), |
|
| 526 | + array( |
|
| 527 | + gettext("Action"), |
|
| 528 | 528 | "100", |
| 529 | 529 | "", |
| 530 | 530 | "", |
| 531 | 531 | "", |
| 532 | - array ( |
|
| 533 | - "DELETE" => array ( |
|
| 532 | + array( |
|
| 533 | + "DELETE" => array( |
|
| 534 | 534 | "url" => "package/package_patterns_delete/$packageid/", |
| 535 | 535 | "mode" => "single" |
| 536 | 536 | ) |
| 537 | 537 | ) |
| 538 | 538 | ) |
| 539 | - ) ); |
|
| 539 | + )); |
|
| 540 | 540 | return $grid_field_arr; |
| 541 | 541 | } |
| 542 | 542 | function set_pattern_grid_buttons($packageid) { |
| 543 | - $buttons_json = json_encode ( array ( |
|
| 544 | - array ( |
|
| 545 | - gettext ( "Create" ), |
|
| 543 | + $buttons_json = json_encode(array( |
|
| 544 | + array( |
|
| 545 | + gettext("Create"), |
|
| 546 | 546 | "btn btn-line-warning btn", |
| 547 | 547 | "fa fa-plus-circle fa-lg", |
| 548 | 548 | "button_action", |
| 549 | 549 | "/package/customer_add_patterns/$packageid", |
| 550 | 550 | "popup" |
| 551 | 551 | ) |
| 552 | - ) ); |
|
| 552 | + )); |
|
| 553 | 553 | return $buttons_json; |
| 554 | 554 | } |
| 555 | 555 | function build_package_counter_report() { |
| 556 | - $buttons_json = json_encode ( array ( |
|
| 557 | - array ( |
|
| 558 | - gettext ( "Export" ), |
|
| 556 | + $buttons_json = json_encode(array( |
|
| 557 | + array( |
|
| 558 | + gettext("Export"), |
|
| 559 | 559 | "btn btn-xing", |
| 560 | 560 | " fa fa-download fa-lg", |
| 561 | 561 | "button_action", |
@@ -567,9 +567,9 @@ discard block |
||
| 567 | 567 | return $buttons_json; |
| 568 | 568 | } |
| 569 | 569 | function build_package_list_for_reseller() { |
| 570 | - $grid_field_arr = json_encode ( array ( |
|
| 571 | - array ( |
|
| 572 | - gettext ( "Name" ), |
|
| 570 | + $grid_field_arr = json_encode(array( |
|
| 571 | + array( |
|
| 572 | + gettext("Name"), |
|
| 573 | 573 | "310", |
| 574 | 574 | "package_name", |
| 575 | 575 | "", |
@@ -579,8 +579,8 @@ discard block |
||
| 579 | 579 | "true", |
| 580 | 580 | "center" |
| 581 | 581 | ), |
| 582 | - array ( |
|
| 583 | - gettext ( "Rate Group" ), |
|
| 582 | + array( |
|
| 583 | + gettext("Rate Group"), |
|
| 584 | 584 | "250", |
| 585 | 585 | "pricelist_id", |
| 586 | 586 | "name", |
@@ -590,8 +590,8 @@ discard block |
||
| 590 | 590 | "true", |
| 591 | 591 | "center" |
| 592 | 592 | ), |
| 593 | - array ( |
|
| 594 | - gettext ( "Included Seconds" ), |
|
| 593 | + array( |
|
| 594 | + gettext("Included Seconds"), |
|
| 595 | 595 | "260", |
| 596 | 596 | "includedseconds", |
| 597 | 597 | "", |
@@ -601,8 +601,8 @@ discard block |
||
| 601 | 601 | "true", |
| 602 | 602 | "center" |
| 603 | 603 | ), |
| 604 | - array ( |
|
| 605 | - gettext ( "Status" ), |
|
| 604 | + array( |
|
| 605 | + gettext("Status"), |
|
| 606 | 606 | "160", |
| 607 | 607 | "status", |
| 608 | 608 | "status", |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | "true", |
| 613 | 613 | "center" |
| 614 | 614 | ) |
| 615 | - ) ); |
|
| 615 | + )); |
|
| 616 | 616 | return $grid_field_arr; |
| 617 | 617 | } |
| 618 | 618 | } |
@@ -23,37 +23,37 @@ discard block |
||
| 23 | 23 | // ############################################################################## |
| 24 | 24 | class ANIMAP_model extends CI_Model { |
| 25 | 25 | function ANIMAP_model() { |
| 26 | - parent::__construct (); |
|
| 26 | + parent::__construct(); |
|
| 27 | 27 | } |
| 28 | 28 | function animap_list($flag, $start = 0, $limit = 0) { |
| 29 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 29 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 30 | 30 | |
| 31 | - if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) { |
|
| 32 | - $qry = $this->db_model->getselect ( 'id', 'accounts', array ( |
|
| 31 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
| 32 | + $qry = $this->db_model->getselect('id', 'accounts', array( |
|
| 33 | 33 | 'reseller_id' => $accountinfo ['id'] |
| 34 | - ) ); |
|
| 35 | - $result = $qry->result_array (); |
|
| 34 | + )); |
|
| 35 | + $result = $qry->result_array(); |
|
| 36 | 36 | |
| 37 | - foreach ( $result as $value1 ) { |
|
| 37 | + foreach ($result as $value1) { |
|
| 38 | 38 | $value [] = $value1 ['id']; |
| 39 | 39 | } |
| 40 | - $this->db->where_in ( 'accountid', $value ); |
|
| 40 | + $this->db->where_in('accountid', $value); |
|
| 41 | 41 | } else { |
| 42 | - $qry = $this->db_model->getselect ( 'id', 'accounts', array ( |
|
| 42 | + $qry = $this->db_model->getselect('id', 'accounts', array( |
|
| 43 | 43 | 'reseller_id' => 0 |
| 44 | - ) ); |
|
| 45 | - $result = $qry->result_array (); |
|
| 44 | + )); |
|
| 45 | + $result = $qry->result_array(); |
|
| 46 | 46 | |
| 47 | - foreach ( $result as $value1 ) { |
|
| 47 | + foreach ($result as $value1) { |
|
| 48 | 48 | $value [] = $value1 ['id']; |
| 49 | 49 | } |
| 50 | - $this->db->where_in ( 'accountid', $value ); |
|
| 50 | + $this->db->where_in('accountid', $value); |
|
| 51 | 51 | } |
| 52 | - $this->db_model->build_search ( 'animap_list_search' ); |
|
| 52 | + $this->db_model->build_search('animap_list_search'); |
|
| 53 | 53 | if ($flag) { |
| 54 | - $query = $this->db_model->select ( "*", "ani_map", "", "id", "ASC", $limit, $start ); |
|
| 54 | + $query = $this->db_model->select("*", "ani_map", "", "id", "ASC", $limit, $start); |
|
| 55 | 55 | } else { |
| 56 | - $query = $this->db_model->countQuery ( "*", "ani_map", "" ); |
|
| 56 | + $query = $this->db_model->countQuery("*", "ani_map", ""); |
|
| 57 | 57 | } |
| 58 | 58 | return $query; |
| 59 | 59 | } |
@@ -62,23 +62,23 @@ discard block |
||
| 62 | 62 | * ASTPP 3.0 |
| 63 | 63 | * Add creation date |
| 64 | 64 | */ |
| 65 | - $data = array ( |
|
| 66 | - 'creation_date' => gmdate ( 'Y-m-d H:i:s' ), |
|
| 65 | + $data = array( |
|
| 66 | + 'creation_date' => gmdate('Y-m-d H:i:s'), |
|
| 67 | 67 | 'number' => $add_array ['number'], |
| 68 | 68 | 'accountid' => $add_array ['accountid'], |
| 69 | 69 | 'status' => $add_array ['status'], |
| 70 | 70 | 'context' => 'default' |
| 71 | 71 | ); |
| 72 | - $this->db->insert ( "ani_map", $data ); |
|
| 73 | - return $this->db->insert_id (); |
|
| 72 | + $this->db->insert("ani_map", $data); |
|
| 73 | + return $this->db->insert_id(); |
|
| 74 | 74 | } |
| 75 | 75 | function edit_animap($add_array, $id) { |
| 76 | 76 | /* |
| 77 | 77 | * ASTPP 3.0 |
| 78 | 78 | * last modify date update |
| 79 | 79 | */ |
| 80 | - $data = array ( |
|
| 81 | - 'last_modified_date' => gmdate ( 'Y-m-d H:i:s' ), |
|
| 80 | + $data = array( |
|
| 81 | + 'last_modified_date' => gmdate('Y-m-d H:i:s'), |
|
| 82 | 82 | 'number' => $add_array ['number'], |
| 83 | 83 | 'accountid' => $add_array ['accountid'], |
| 84 | 84 | 'status' => $add_array ['status'], |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | /** |
| 88 | 88 | * ****************************************************** |
| 89 | 89 | */ |
| 90 | - $this->db->where ( "id", $id ); |
|
| 91 | - return $this->db->update ( "ani_map", $data ); |
|
| 90 | + $this->db->where("id", $id); |
|
| 91 | + return $this->db->update("ani_map", $data); |
|
| 92 | 92 | } |
| 93 | 93 | function remove_animap($id) { |
| 94 | - $this->db->where ( "id", $id ); |
|
| 95 | - $this->db->delete ( "ani_map" ); |
|
| 94 | + $this->db->where("id", $id); |
|
| 95 | + $this->db->delete("ani_map"); |
|
| 96 | 96 | return true; |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -22,125 +22,125 @@ |
||
| 22 | 22 | // ############################################################################## |
| 23 | 23 | class Animap extends MX_Controller { |
| 24 | 24 | function Animap() { |
| 25 | - parent::__construct (); |
|
| 25 | + parent::__construct(); |
|
| 26 | 26 | |
| 27 | - $this->load->helper ( 'template_inheritance' ); |
|
| 27 | + $this->load->helper('template_inheritance'); |
|
| 28 | 28 | |
| 29 | - $this->load->library ( 'session' ); |
|
| 30 | - $this->load->library ( "animap_form" ); |
|
| 31 | - $this->load->library ( 'astpp/form' ); |
|
| 32 | - $this->load->model ( 'animap_model' ); |
|
| 29 | + $this->load->library('session'); |
|
| 30 | + $this->load->library("animap_form"); |
|
| 31 | + $this->load->library('astpp/form'); |
|
| 32 | + $this->load->model('animap_model'); |
|
| 33 | 33 | |
| 34 | - if ($this->session->userdata ( 'user_login' ) == FALSE) |
|
| 35 | - redirect ( base_url () . '/astpp/login' ); |
|
| 34 | + if ($this->session->userdata('user_login') == FALSE) |
|
| 35 | + redirect(base_url().'/astpp/login'); |
|
| 36 | 36 | } |
| 37 | 37 | function animap_add() { |
| 38 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
| 38 | + $data ['username'] = $this->session->userdata('user_name'); |
|
| 39 | 39 | $data ['flag'] = 'create'; |
| 40 | - $data ['page_title'] = gettext ( 'Add Caller ID' ); |
|
| 40 | + $data ['page_title'] = gettext('Add Caller ID'); |
|
| 41 | 41 | $edit_id = ''; |
| 42 | - $data ['form'] = $this->form->build_form ( $this->animap_form->get_animap_form_fields ( $edit_id ), '' ); |
|
| 42 | + $data ['form'] = $this->form->build_form($this->animap_form->get_animap_form_fields($edit_id), ''); |
|
| 43 | 43 | |
| 44 | - $this->load->view ( 'animap_add_edit', $data ); |
|
| 44 | + $this->load->view('animap_add_edit', $data); |
|
| 45 | 45 | } |
| 46 | 46 | function animap_edit($edit_id = '') { |
| 47 | - $data ['page_title'] = gettext ( 'Edit Caller ID' ); |
|
| 48 | - $where = array ( |
|
| 47 | + $data ['page_title'] = gettext('Edit Caller ID'); |
|
| 48 | + $where = array( |
|
| 49 | 49 | 'id' => $edit_id |
| 50 | 50 | ); |
| 51 | - $account = $this->db_model->getSelect ( "*", "ani_map", $where ); |
|
| 52 | - foreach ( $account->result_array () as $key => $value ) { |
|
| 51 | + $account = $this->db_model->getSelect("*", "ani_map", $where); |
|
| 52 | + foreach ($account->result_array() as $key => $value) { |
|
| 53 | 53 | $edit_data = $value; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - $data ['form'] = $this->form->build_form ( $this->animap_form->get_animap_form_fields ( $edit_id ), $edit_data ); |
|
| 57 | - $this->load->view ( 'animap_add_edit', $data ); |
|
| 56 | + $data ['form'] = $this->form->build_form($this->animap_form->get_animap_form_fields($edit_id), $edit_data); |
|
| 57 | + $this->load->view('animap_add_edit', $data); |
|
| 58 | 58 | } |
| 59 | 59 | function animap_save() { |
| 60 | - $add_array = $this->input->post (); |
|
| 60 | + $add_array = $this->input->post(); |
|
| 61 | 61 | |
| 62 | 62 | $edit_id = $add_array ['id']; |
| 63 | - $data ['form'] = $this->form->build_form ( $this->animap_form->get_animap_form_fields ( $edit_id ), $add_array ); |
|
| 63 | + $data ['form'] = $this->form->build_form($this->animap_form->get_animap_form_fields($edit_id), $add_array); |
|
| 64 | 64 | if ($add_array ['id'] != '') { |
| 65 | - $data ['page_title'] = gettext ( 'Add Caller ID' ); |
|
| 66 | - if ($this->form_validation->run () == FALSE) { |
|
| 67 | - $data ['validation_errors'] = validation_errors (); |
|
| 65 | + $data ['page_title'] = gettext('Add Caller ID'); |
|
| 66 | + if ($this->form_validation->run() == FALSE) { |
|
| 67 | + $data ['validation_errors'] = validation_errors(); |
|
| 68 | 68 | echo $data ['validation_errors']; |
| 69 | 69 | exit (); |
| 70 | 70 | } else { |
| 71 | 71 | |
| 72 | - $this->animap_model->edit_animap ( $add_array, $add_array ['id'] ); |
|
| 73 | - echo json_encode ( array ( |
|
| 72 | + $this->animap_model->edit_animap($add_array, $add_array ['id']); |
|
| 73 | + echo json_encode(array( |
|
| 74 | 74 | "SUCCESS" => " Caller ID updated successfully!" |
| 75 | - ) ); |
|
| 75 | + )); |
|
| 76 | 76 | exit (); |
| 77 | 77 | } |
| 78 | 78 | } else { |
| 79 | 79 | |
| 80 | - if ($this->form_validation->run () == FALSE) { |
|
| 81 | - $data ['validation_errors'] = validation_errors (); |
|
| 80 | + if ($this->form_validation->run() == FALSE) { |
|
| 81 | + $data ['validation_errors'] = validation_errors(); |
|
| 82 | 82 | echo $data ['validation_errors']; |
| 83 | 83 | exit (); |
| 84 | 84 | } else { |
| 85 | 85 | |
| 86 | - $ip_id = $this->animap_model->add_animap ( $add_array ); |
|
| 86 | + $ip_id = $this->animap_model->add_animap($add_array); |
|
| 87 | 87 | |
| 88 | - echo json_encode ( array ( |
|
| 88 | + echo json_encode(array( |
|
| 89 | 89 | "SUCCESS" => " Caller ID added successfully!" |
| 90 | - ) ); |
|
| 90 | + )); |
|
| 91 | 91 | exit (); |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | function animap_delete($id) { |
| 96 | - $this->animap_model->remove_animap ( $id ); |
|
| 97 | - $this->session->set_flashdata ( 'astpp_notification', 'Caller ID removed successfully!' ); |
|
| 98 | - redirect ( base_url () . 'animap/animap_detail/' ); |
|
| 96 | + $this->animap_model->remove_animap($id); |
|
| 97 | + $this->session->set_flashdata('astpp_notification', 'Caller ID removed successfully!'); |
|
| 98 | + redirect(base_url().'animap/animap_detail/'); |
|
| 99 | 99 | } |
| 100 | 100 | function animap_detail_search() { |
| 101 | - $ajax_search = $this->input->post ( 'ajax_search', 0 ); |
|
| 102 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
| 103 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
| 104 | - $action = $this->input->post (); |
|
| 105 | - unset ( $action ['action'] ); |
|
| 106 | - unset ( $action ['advance_search'] ); |
|
| 107 | - $this->session->set_userdata ( 'animap_list_search', $action ); |
|
| 101 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
| 102 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
| 103 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
| 104 | + $action = $this->input->post(); |
|
| 105 | + unset ($action ['action']); |
|
| 106 | + unset ($action ['advance_search']); |
|
| 107 | + $this->session->set_userdata('animap_list_search', $action); |
|
| 108 | 108 | } |
| 109 | 109 | if (@$ajax_search != 1) { |
| 110 | - redirect ( base_url () . 'animap/animap_list/' ); |
|
| 110 | + redirect(base_url().'animap/animap_list/'); |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | function animap_detail_clearsearchfilter() { |
| 114 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
| 115 | - $this->session->set_userdata ( 'animap_list_search', "" ); |
|
| 114 | + $this->session->set_userdata('advance_search', 0); |
|
| 115 | + $this->session->set_userdata('animap_list_search', ""); |
|
| 116 | 116 | } |
| 117 | 117 | function animap_detail() { |
| 118 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
| 119 | - $data ['page_title'] = gettext ( 'Caller ID' ); |
|
| 118 | + $data ['username'] = $this->session->userdata('user_name'); |
|
| 119 | + $data ['page_title'] = gettext('Caller ID'); |
|
| 120 | 120 | $data ['search_flag'] = true; |
| 121 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
| 122 | - $data ['grid_fields'] = $this->animap_form->build_animap_list_for_admin (); |
|
| 123 | - $data ["grid_buttons"] = $this->animap_form->build_grid_buttons (); |
|
| 124 | - $data ['form_search'] = $this->form->build_serach_form ( $this->animap_form->get_animap_search_form () ); |
|
| 121 | + $this->session->set_userdata('advance_search', 0); |
|
| 122 | + $data ['grid_fields'] = $this->animap_form->build_animap_list_for_admin(); |
|
| 123 | + $data ["grid_buttons"] = $this->animap_form->build_grid_buttons(); |
|
| 124 | + $data ['form_search'] = $this->form->build_serach_form($this->animap_form->get_animap_search_form()); |
|
| 125 | 125 | |
| 126 | - $this->load->view ( 'animap_view', $data ); |
|
| 126 | + $this->load->view('animap_view', $data); |
|
| 127 | 127 | } |
| 128 | 128 | function animap_detail_json() { |
| 129 | - $json_data = array (); |
|
| 130 | - $count_all = $this->animap_model->animap_list ( false ); |
|
| 131 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
| 129 | + $json_data = array(); |
|
| 130 | + $count_all = $this->animap_model->animap_list(false); |
|
| 131 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
| 132 | 132 | $json_data = $paging_data ["json_paging"]; |
| 133 | - $query = $this->animap_model->animap_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] ); |
|
| 134 | - $grid_fields = json_decode ( $this->animap_form->build_animap_list_for_admin () ); |
|
| 135 | - $json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields ); |
|
| 133 | + $query = $this->animap_model->animap_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]); |
|
| 134 | + $grid_fields = json_decode($this->animap_form->build_animap_list_for_admin()); |
|
| 135 | + $json_data ['rows'] = $this->form->build_grid($query, $grid_fields); |
|
| 136 | 136 | |
| 137 | - echo json_encode ( $json_data ); |
|
| 137 | + echo json_encode($json_data); |
|
| 138 | 138 | } |
| 139 | 139 | function animap_delete_multiple() { |
| 140 | - $ids = $this->input->post ( "selected_ids", true ); |
|
| 140 | + $ids = $this->input->post("selected_ids", true); |
|
| 141 | 141 | $where = "id IN ($ids)"; |
| 142 | - $this->db->where ( $where ); |
|
| 143 | - echo $this->db->delete ( "ani_map" ); |
|
| 142 | + $this->db->where($where); |
|
| 143 | + echo $this->db->delete("ani_map"); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
@@ -21,28 +21,28 @@ discard block |
||
| 21 | 21 | // You should have received a copy of the GNU Affero General Public License |
| 22 | 22 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 23 | 23 | // ############################################################################## |
| 24 | -if (! defined ( 'BASEPATH' )) |
|
| 25 | - exit ( 'No direct script access allowed' ); |
|
| 24 | +if ( ! defined('BASEPATH')) |
|
| 25 | + exit ('No direct script access allowed'); |
|
| 26 | 26 | class Animap_form { |
| 27 | 27 | function __construct($library_name = '') { |
| 28 | - $this->CI = & get_instance (); |
|
| 28 | + $this->CI = & get_instance(); |
|
| 29 | 29 | } |
| 30 | 30 | function get_animap_form_fields($edit_id) { |
| 31 | 31 | $id = $edit_id; |
| 32 | - $form ['forms'] = array ( |
|
| 33 | - base_url () . 'animap/animap_save/', |
|
| 34 | - array ( |
|
| 32 | + $form ['forms'] = array( |
|
| 33 | + base_url().'animap/animap_save/', |
|
| 34 | + array( |
|
| 35 | 35 | 'id' => 'animap_form', |
| 36 | 36 | 'method' => 'POST', |
| 37 | 37 | 'name' => 'animap_form' |
| 38 | 38 | ) |
| 39 | 39 | ); |
| 40 | - $val = $id > 0 ? 'ani_map.number.' . $id : 'ani_map.number'; |
|
| 41 | - $form [gettext ( 'Caller ID' )] = array ( |
|
| 42 | - array ( |
|
| 40 | + $val = $id > 0 ? 'ani_map.number.'.$id : 'ani_map.number'; |
|
| 41 | + $form [gettext('Caller ID')] = array( |
|
| 42 | + array( |
|
| 43 | 43 | '', |
| 44 | 44 | 'HIDDEN', |
| 45 | - array ( |
|
| 45 | + array( |
|
| 46 | 46 | 'name' => 'id' |
| 47 | 47 | ), |
| 48 | 48 | '', |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | '', |
| 51 | 51 | '' |
| 52 | 52 | ), |
| 53 | - array ( |
|
| 54 | - gettext ( 'Account' ), |
|
| 53 | + array( |
|
| 54 | + gettext('Account'), |
|
| 55 | 55 | 'accountid', |
| 56 | 56 | 'SELECT', |
| 57 | 57 | '', |
@@ -63,27 +63,27 @@ discard block |
||
| 63 | 63 | 'accounts', |
| 64 | 64 | 'build_concat_dropdown', |
| 65 | 65 | 'where_arr', |
| 66 | - array ( |
|
| 66 | + array( |
|
| 67 | 67 | "reseller_id" => "0", |
| 68 | 68 | "type" => "0,3", |
| 69 | 69 | "deleted" => "0", |
| 70 | 70 | "status" => "0" |
| 71 | 71 | ) |
| 72 | 72 | ), |
| 73 | - array ( |
|
| 74 | - gettext ( 'Caller ID' ), |
|
| 73 | + array( |
|
| 74 | + gettext('Caller ID'), |
|
| 75 | 75 | 'INPUT', |
| 76 | - array ( |
|
| 76 | + array( |
|
| 77 | 77 | 'name' => 'number', |
| 78 | 78 | 'size' => '20', |
| 79 | 79 | 'class' => "text field medium" |
| 80 | 80 | ), |
| 81 | - 'trim|required|is_unique[' . $val . ']|numeric|xss_clean', |
|
| 81 | + 'trim|required|is_unique['.$val.']|numeric|xss_clean', |
|
| 82 | 82 | 'tOOL TIP', |
| 83 | 83 | 'Please Enter ANI number' |
| 84 | 84 | ), |
| 85 | - array ( |
|
| 86 | - gettext ( 'Status' ), |
|
| 85 | + array( |
|
| 86 | + gettext('Status'), |
|
| 87 | 87 | 'status', |
| 88 | 88 | 'SELECT', |
| 89 | 89 | '', |
@@ -97,17 +97,17 @@ discard block |
||
| 97 | 97 | ) |
| 98 | 98 | ) |
| 99 | 99 | ; |
| 100 | - $form ['button_cancel'] = array ( |
|
| 100 | + $form ['button_cancel'] = array( |
|
| 101 | 101 | 'name' => 'action', |
| 102 | - 'content' => gettext ( 'Close' ), |
|
| 102 | + 'content' => gettext('Close'), |
|
| 103 | 103 | 'value' => 'cancel', |
| 104 | 104 | 'type' => 'button', |
| 105 | 105 | 'class' => 'btn btn-line-sky margin-x-10', |
| 106 | 106 | 'onclick' => 'return redirect_page(\'NULL\')' |
| 107 | 107 | ); |
| 108 | - $form ['button_save'] = array ( |
|
| 108 | + $form ['button_save'] = array( |
|
| 109 | 109 | 'name' => 'action', |
| 110 | - 'content' => gettext ( 'Save' ), |
|
| 110 | + 'content' => gettext('Save'), |
|
| 111 | 111 | 'value' => 'save', |
| 112 | 112 | 'id' => 'submit', |
| 113 | 113 | 'type' => 'button', |
@@ -116,17 +116,17 @@ discard block |
||
| 116 | 116 | return $form; |
| 117 | 117 | } |
| 118 | 118 | function get_animap_search_form() { |
| 119 | - $logintype = $this->CI->session->userdata ( 'logintype' ); |
|
| 119 | + $logintype = $this->CI->session->userdata('logintype'); |
|
| 120 | 120 | |
| 121 | - $form ['forms'] = array ( |
|
| 121 | + $form ['forms'] = array( |
|
| 122 | 122 | "", |
| 123 | - array ( |
|
| 123 | + array( |
|
| 124 | 124 | 'id' => "animap_search" |
| 125 | 125 | ) |
| 126 | 126 | ); |
| 127 | - $form [gettext ( 'Search' )] = array ( |
|
| 128 | - array ( |
|
| 129 | - gettext ( 'Account' ), |
|
| 127 | + $form [gettext('Search')] = array( |
|
| 128 | + array( |
|
| 129 | + gettext('Account'), |
|
| 130 | 130 | 'accountid', |
| 131 | 131 | 'SELECT', |
| 132 | 132 | '', |
@@ -138,16 +138,16 @@ discard block |
||
| 138 | 138 | 'accounts', |
| 139 | 139 | 'build_concat_dropdown', |
| 140 | 140 | 'where_arr', |
| 141 | - array ( |
|
| 141 | + array( |
|
| 142 | 142 | "reseller_id" => "0", |
| 143 | 143 | "type" => "0", |
| 144 | 144 | "deleted" => "0" |
| 145 | 145 | ) |
| 146 | 146 | ), |
| 147 | - array ( |
|
| 148 | - gettext ( 'Caller ID' ), |
|
| 147 | + array( |
|
| 148 | + gettext('Caller ID'), |
|
| 149 | 149 | 'INPUT', |
| 150 | - array ( |
|
| 150 | + array( |
|
| 151 | 151 | 'name' => 'number[number]', |
| 152 | 152 | '', |
| 153 | 153 | 'size' => '20', |
@@ -163,8 +163,8 @@ discard block |
||
| 163 | 163 | 'search_string_type', |
| 164 | 164 | '' |
| 165 | 165 | ), |
| 166 | - array ( |
|
| 167 | - gettext ( 'Status' ), |
|
| 166 | + array( |
|
| 167 | + gettext('Status'), |
|
| 168 | 168 | 'status', |
| 169 | 169 | 'SELECT', |
| 170 | 170 | '', |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | '', |
| 177 | 177 | 'set_search_status' |
| 178 | 178 | ), |
| 179 | - array ( |
|
| 179 | + array( |
|
| 180 | 180 | '', |
| 181 | 181 | 'HIDDEN', |
| 182 | 182 | 'ajax_search', |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | '' |
| 187 | 187 | ), |
| 188 | 188 | |
| 189 | - array ( |
|
| 189 | + array( |
|
| 190 | 190 | '', |
| 191 | 191 | 'HIDDEN', |
| 192 | 192 | 'advance_search', |
@@ -196,18 +196,18 @@ discard block |
||
| 196 | 196 | '' |
| 197 | 197 | ) |
| 198 | 198 | ); |
| 199 | - $form ['button_search'] = array ( |
|
| 199 | + $form ['button_search'] = array( |
|
| 200 | 200 | 'name' => 'action', |
| 201 | 201 | 'id' => "animap_search_btn", |
| 202 | - 'content' => gettext ( 'Search' ), |
|
| 202 | + 'content' => gettext('Search'), |
|
| 203 | 203 | 'value' => 'save', |
| 204 | 204 | 'type' => 'button', |
| 205 | 205 | 'class' => 'btn btn-line-parrot pull-right' |
| 206 | 206 | ); |
| 207 | - $form ['button_reset'] = array ( |
|
| 207 | + $form ['button_reset'] = array( |
|
| 208 | 208 | 'name' => 'action', |
| 209 | 209 | 'id' => "id_reset", |
| 210 | - 'content' => gettext ( 'Clear' ), |
|
| 210 | + 'content' => gettext('Clear'), |
|
| 211 | 211 | 'value' => 'cancel', |
| 212 | 212 | 'type' => 'reset', |
| 213 | 213 | 'class' => 'btn btn-line-sky pull-right margin-x-10' |
@@ -217,8 +217,8 @@ discard block |
||
| 217 | 217 | } |
| 218 | 218 | function build_animap_list_for_admin() { |
| 219 | 219 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
| 220 | - $grid_field_arr = json_encode ( array ( |
|
| 221 | - array ( |
|
| 220 | + $grid_field_arr = json_encode(array( |
|
| 221 | + array( |
|
| 222 | 222 | "<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", |
| 223 | 223 | "30", |
| 224 | 224 | "", |
@@ -229,8 +229,8 @@ discard block |
||
| 229 | 229 | "false", |
| 230 | 230 | "center" |
| 231 | 231 | ), |
| 232 | - array ( |
|
| 233 | - gettext ( "Account" ), |
|
| 232 | + array( |
|
| 233 | + gettext("Account"), |
|
| 234 | 234 | "250", |
| 235 | 235 | "accountid", |
| 236 | 236 | "first_name,last_name,number", |
@@ -240,8 +240,8 @@ discard block |
||
| 240 | 240 | "true", |
| 241 | 241 | "center" |
| 242 | 242 | ), |
| 243 | - array ( |
|
| 244 | - gettext ( "Caller ID" ), |
|
| 243 | + array( |
|
| 244 | + gettext("Caller ID"), |
|
| 245 | 245 | "250", |
| 246 | 246 | "number", |
| 247 | 247 | "", |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | ASTPP 3.0 |
| 256 | 256 | creation field show in grid |
| 257 | 257 | */ |
| 258 | - array ( |
|
| 259 | - gettext ( "Status" ), |
|
| 258 | + array( |
|
| 259 | + gettext("Status"), |
|
| 260 | 260 | "180", |
| 261 | 261 | "status", |
| 262 | 262 | "status", |
@@ -266,8 +266,8 @@ discard block |
||
| 266 | 266 | "true", |
| 267 | 267 | "center" |
| 268 | 268 | ), |
| 269 | - array ( |
|
| 270 | - gettext ( "Created Date" ), |
|
| 269 | + array( |
|
| 270 | + gettext("Created Date"), |
|
| 271 | 271 | "220", |
| 272 | 272 | "creation_date", |
| 273 | 273 | "creation_date", |
@@ -277,8 +277,8 @@ discard block |
||
| 277 | 277 | "true", |
| 278 | 278 | "center" |
| 279 | 279 | ), |
| 280 | - array ( |
|
| 281 | - gettext ( "Modified Date" ), |
|
| 280 | + array( |
|
| 281 | + gettext("Modified Date"), |
|
| 282 | 282 | "220", |
| 283 | 283 | "last_modified_date", |
| 284 | 284 | "last_modified_date", |
@@ -292,45 +292,45 @@ discard block |
||
| 292 | 292 | /** |
| 293 | 293 | * ***************************************************************** |
| 294 | 294 | */ |
| 295 | - array ( |
|
| 296 | - gettext ( "Action" ), |
|
| 295 | + array( |
|
| 296 | + gettext("Action"), |
|
| 297 | 297 | "100", |
| 298 | 298 | "", |
| 299 | 299 | "", |
| 300 | 300 | "", |
| 301 | - array ( |
|
| 302 | - "EDIT" => array ( |
|
| 301 | + array( |
|
| 302 | + "EDIT" => array( |
|
| 303 | 303 | "url" => "animap/animap_edit/", |
| 304 | 304 | "mode" => "popup", |
| 305 | 305 | 'popup' |
| 306 | 306 | ), |
| 307 | - "DELETE" => array ( |
|
| 307 | + "DELETE" => array( |
|
| 308 | 308 | "url" => "/animap/animap_delete/", |
| 309 | 309 | "mode" => "single" |
| 310 | 310 | ) |
| 311 | 311 | ) |
| 312 | 312 | ) |
| 313 | - ) ); |
|
| 313 | + )); |
|
| 314 | 314 | return $grid_field_arr; |
| 315 | 315 | } |
| 316 | 316 | function build_grid_buttons() { |
| 317 | - $buttons_json = json_encode ( array ( |
|
| 318 | - array ( |
|
| 319 | - gettext ( "Add" ), |
|
| 317 | + $buttons_json = json_encode(array( |
|
| 318 | + array( |
|
| 319 | + gettext("Add"), |
|
| 320 | 320 | "btn btn-line-warning btn", |
| 321 | 321 | "fa fa-plus-circle fa-lg", |
| 322 | 322 | "button_action", |
| 323 | 323 | "/animap/animap_add/", |
| 324 | 324 | "popup" |
| 325 | 325 | ), |
| 326 | - array ( |
|
| 327 | - gettext ( "Delete" ), |
|
| 326 | + array( |
|
| 327 | + gettext("Delete"), |
|
| 328 | 328 | "btn btn-line-danger", |
| 329 | 329 | "fa fa-times-circle fa-lg", |
| 330 | 330 | "button_action", |
| 331 | 331 | "/animap/animap_delete_multiple/" |
| 332 | 332 | ) |
| 333 | - ) ); |
|
| 333 | + )); |
|
| 334 | 334 | return $buttons_json; |
| 335 | 335 | } |
| 336 | 336 | } |
@@ -22,204 +22,204 @@ |
||
| 22 | 22 | // ############################################################################## |
| 23 | 23 | class System_model extends CI_Model { |
| 24 | 24 | function System_model() { |
| 25 | - parent::__construct (); |
|
| 25 | + parent::__construct(); |
|
| 26 | 26 | } |
| 27 | 27 | function getsystem_list($flag, $start, $limit) { |
| 28 | - $this->db_model->build_search ( 'configuration_search' ); |
|
| 28 | + $this->db_model->build_search('configuration_search'); |
|
| 29 | 29 | $where = "group_title NOT IN ('asterisk','osc','freepbx')"; |
| 30 | - $this->db->where ( $where ); |
|
| 30 | + $this->db->where($where); |
|
| 31 | 31 | if ($flag) { |
| 32 | - $query = $this->db_model->select ( "*", "system", "", "group_title,name", "ASC", $limit, $start ); |
|
| 32 | + $query = $this->db_model->select("*", "system", "", "group_title,name", "ASC", $limit, $start); |
|
| 33 | 33 | } else { |
| 34 | - $query = $this->db_model->countQuery ( "*", "system", "" ); |
|
| 34 | + $query = $this->db_model->countQuery("*", "system", ""); |
|
| 35 | 35 | } |
| 36 | 36 | return $query; |
| 37 | 37 | } |
| 38 | 38 | function gettemplate_list($flag = "", $start, $limit = "") { |
| 39 | - if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) { |
|
| 40 | - $account_data = $this->session->userdata ( "accountinfo" ); |
|
| 39 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
| 40 | + $account_data = $this->session->userdata("accountinfo"); |
|
| 41 | 41 | $reseller = $account_data ['id']; |
| 42 | - $this->db->where ( 'reseller_id', $reseller ); |
|
| 43 | - $query = $this->db_model->select ( "*", "default_templates", "", "", "", "", "" ); |
|
| 42 | + $this->db->where('reseller_id', $reseller); |
|
| 43 | + $query = $this->db_model->select("*", "default_templates", "", "", "", "", ""); |
|
| 44 | 44 | |
| 45 | - if ($query->num_rows () > 0) { |
|
| 46 | - $result = $query->result_array (); |
|
| 47 | - $match_array = array (); |
|
| 48 | - $unmatch_array = array (); |
|
| 45 | + if ($query->num_rows() > 0) { |
|
| 46 | + $result = $query->result_array(); |
|
| 47 | + $match_array = array(); |
|
| 48 | + $unmatch_array = array(); |
|
| 49 | 49 | $i = 0; |
| 50 | 50 | $str = 0; |
| 51 | - foreach ( $result as $value ) { |
|
| 52 | - $this->db->where ( 'name', $value ['name'] ); |
|
| 53 | - $this->db->where ( 'reseller_id', 0 ); |
|
| 54 | - $query = $this->db_model->select ( "id", "default_templates", "", "id", "ASC", $limit, $start ); |
|
| 55 | - $innerresult = $query->result_array (); |
|
| 56 | - foreach ( $innerresult as $value ) { |
|
| 57 | - $str .= $value ['id'] . ","; |
|
| 51 | + foreach ($result as $value) { |
|
| 52 | + $this->db->where('name', $value ['name']); |
|
| 53 | + $this->db->where('reseller_id', 0); |
|
| 54 | + $query = $this->db_model->select("id", "default_templates", "", "id", "ASC", $limit, $start); |
|
| 55 | + $innerresult = $query->result_array(); |
|
| 56 | + foreach ($innerresult as $value) { |
|
| 57 | + $str .= $value ['id'].","; |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | - $str = rtrim ( $str, ',' ); |
|
| 60 | + $str = rtrim($str, ','); |
|
| 61 | 61 | |
| 62 | 62 | $where = "id NOT IN ($str)"; |
| 63 | - $this->db->where ( 'reseller_id', $reseller ); |
|
| 64 | - $this->db->or_where ( 'reseller_id', 0 ); |
|
| 65 | - $this->db->where ( $where ); |
|
| 63 | + $this->db->where('reseller_id', $reseller); |
|
| 64 | + $this->db->or_where('reseller_id', 0); |
|
| 65 | + $this->db->where($where); |
|
| 66 | 66 | } else { |
| 67 | - $this->db->where ( 'reseller_id', 0 ); |
|
| 67 | + $this->db->where('reseller_id', 0); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | if ($flag) { |
| 71 | 71 | |
| 72 | - $query = $this->db_model->select ( "*", "default_templates", "", "id", "ASC", $limit, $start ); |
|
| 72 | + $query = $this->db_model->select("*", "default_templates", "", "id", "ASC", $limit, $start); |
|
| 73 | 73 | } else { |
| 74 | 74 | |
| 75 | - $query = $this->db_model->countQuery ( "*", "default_templates", "" ); |
|
| 75 | + $query = $this->db_model->countQuery("*", "default_templates", ""); |
|
| 76 | 76 | } |
| 77 | 77 | } else { |
| 78 | 78 | |
| 79 | - $where = array ( |
|
| 79 | + $where = array( |
|
| 80 | 80 | 'reseller_id' => 0 |
| 81 | 81 | ); |
| 82 | - $this->db->where ( $where ); |
|
| 83 | - $this->db_model->build_search ( 'template_search' ); |
|
| 82 | + $this->db->where($where); |
|
| 83 | + $this->db_model->build_search('template_search'); |
|
| 84 | 84 | if ($flag) { |
| 85 | - $query = $this->db_model->select ( "*", "default_templates", "", "id", "ASC", $limit, $start ); |
|
| 85 | + $query = $this->db_model->select("*", "default_templates", "", "id", "ASC", $limit, $start); |
|
| 86 | 86 | } else { |
| 87 | - $query = $this->db_model->countQuery ( "*", "default_templates", "" ); |
|
| 87 | + $query = $this->db_model->countQuery("*", "default_templates", ""); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | return $query; |
| 92 | 92 | } |
| 93 | 93 | function edit_configuration($add_array, $name) { |
| 94 | - unset ( $add_array ["action"] ); |
|
| 94 | + unset ($add_array ["action"]); |
|
| 95 | 95 | |
| 96 | - $this->db->where ( "name", $name ); |
|
| 97 | - $this->db->update ( "system", $add_array ); |
|
| 96 | + $this->db->where("name", $name); |
|
| 97 | + $this->db->update("system", $add_array); |
|
| 98 | 98 | if ($name == 'base_currency') { |
| 99 | 99 | |
| 100 | - $screen_path = getcwd () . "/cron"; |
|
| 101 | - $screen_filename = "CurrencyUpdate" . strtotime ( 'now' ); |
|
| 102 | - $command = "cd " . $screen_path . " && /usr/bin/screen -d -m -S $screen_filename php cron.php CurrencyUpdate"; |
|
| 103 | - exec ( $command ); |
|
| 104 | - $this->db->update ( "currency", array ( |
|
| 100 | + $screen_path = getcwd()."/cron"; |
|
| 101 | + $screen_filename = "CurrencyUpdate".strtotime('now'); |
|
| 102 | + $command = "cd ".$screen_path." && /usr/bin/screen -d -m -S $screen_filename php cron.php CurrencyUpdate"; |
|
| 103 | + exec($command); |
|
| 104 | + $this->db->update("currency", array( |
|
| 105 | 105 | "currencyrate" => '1' |
| 106 | - ), array ( |
|
| 106 | + ), array( |
|
| 107 | 107 | "currency" => "INR" |
| 108 | - ) ); |
|
| 108 | + )); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | function edit_template($data, $id) { |
| 112 | - unset ( $data ["action"] ); |
|
| 113 | - $data ["last_modified_date"] = date ( "Y-m-d H:i:s" ); |
|
| 114 | - $this->db->where ( "id", $id ); |
|
| 115 | - $this->db->update ( "default_templates", $data ); |
|
| 112 | + unset ($data ["action"]); |
|
| 113 | + $data ["last_modified_date"] = date("Y-m-d H:i:s"); |
|
| 114 | + $this->db->where("id", $id); |
|
| 115 | + $this->db->update("default_templates", $data); |
|
| 116 | 116 | } |
| 117 | 117 | function edit_resellertemplate($data, $id) { |
| 118 | 118 | $arraydata = $data; |
| 119 | - if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) { |
|
| 120 | - $account_data = $this->session->userdata ( "accountinfo" ); |
|
| 119 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
| 120 | + $account_data = $this->session->userdata("accountinfo"); |
|
| 121 | 121 | $reseller = $account_data ['id']; |
| 122 | 122 | $array = $data; |
| 123 | - $data = array ( |
|
| 123 | + $data = array( |
|
| 124 | 124 | 'reseller_id' => $reseller |
| 125 | 125 | ); |
| 126 | - $this->db->where ( "id", $id ); |
|
| 126 | + $this->db->where("id", $id); |
|
| 127 | 127 | } |
| 128 | - unset ( $arraydata ["action"] ); |
|
| 129 | - unset ( $arraydata ["form"] ); |
|
| 130 | - unset ( $arraydata ["page_title"] ); |
|
| 131 | - $this->db->update ( "default_templates", $arraydata ); |
|
| 128 | + unset ($arraydata ["action"]); |
|
| 129 | + unset ($arraydata ["form"]); |
|
| 130 | + unset ($arraydata ["page_title"]); |
|
| 131 | + $this->db->update("default_templates", $arraydata); |
|
| 132 | 132 | } |
| 133 | 133 | function remove_template($id) { |
| 134 | - $this->db->where ( "id", $id ); |
|
| 135 | - $this->db->update ( "default_templates", array ( |
|
| 134 | + $this->db->where("id", $id); |
|
| 135 | + $this->db->update("default_templates", array( |
|
| 136 | 136 | "status" => 2 |
| 137 | - ) ); |
|
| 137 | + )); |
|
| 138 | 138 | return true; |
| 139 | 139 | } |
| 140 | 140 | function add_resellertemplate($data) { |
| 141 | - unset ( $data ["action"] ); |
|
| 142 | - unset ( $data ['id'] ); |
|
| 143 | - $this->db->insert ( 'default_templates', $data ); |
|
| 141 | + unset ($data ["action"]); |
|
| 142 | + unset ($data ['id']); |
|
| 143 | + $this->db->insert('default_templates', $data); |
|
| 144 | 144 | return true; |
| 145 | 145 | } |
| 146 | 146 | function getcountry_list($flag, $start = 0, $limit = 0) { |
| 147 | - $this->db_model->build_search ( 'country_list_search' ); |
|
| 147 | + $this->db_model->build_search('country_list_search'); |
|
| 148 | 148 | if ($flag) { |
| 149 | - $query = $this->db_model->select ( "*", "countrycode", '', "id", "ASC", $limit, $start ); |
|
| 149 | + $query = $this->db_model->select("*", "countrycode", '', "id", "ASC", $limit, $start); |
|
| 150 | 150 | } else { |
| 151 | - $query = $this->db_model->countQuery ( "*", "countrycode", '' ); |
|
| 151 | + $query = $this->db_model->countQuery("*", "countrycode", ''); |
|
| 152 | 152 | } |
| 153 | 153 | return $query; |
| 154 | 154 | } |
| 155 | 155 | function add_country($add_array) { |
| 156 | - unset ( $add_array ["action"] ); |
|
| 157 | - $this->db->insert ( "countrycode", $add_array ); |
|
| 156 | + unset ($add_array ["action"]); |
|
| 157 | + $this->db->insert("countrycode", $add_array); |
|
| 158 | 158 | return true; |
| 159 | 159 | } |
| 160 | 160 | function edit_country($data, $id) { |
| 161 | - unset ( $data ["action"] ); |
|
| 162 | - $this->db->where ( "id", $id ); |
|
| 163 | - $this->db->update ( "countrycode", $data ); |
|
| 161 | + unset ($data ["action"]); |
|
| 162 | + $this->db->where("id", $id); |
|
| 163 | + $this->db->update("countrycode", $data); |
|
| 164 | 164 | } |
| 165 | 165 | function remove_country($id) { |
| 166 | - $this->db->where ( "id", $id ); |
|
| 167 | - $this->db->delete ( "countrycode" ); |
|
| 166 | + $this->db->where("id", $id); |
|
| 167 | + $this->db->delete("countrycode"); |
|
| 168 | 168 | return true; |
| 169 | 169 | } |
| 170 | 170 | function getcurrency_list($flag, $start = 0, $limit = 0) { |
| 171 | - $this->db_model->build_search ( 'currency_list_search' ); |
|
| 171 | + $this->db_model->build_search('currency_list_search'); |
|
| 172 | 172 | |
| 173 | - $where = array ( |
|
| 173 | + $where = array( |
|
| 174 | 174 | 'currency <>' => Common_model::$global_config ['system_config'] ['base_currency'] |
| 175 | 175 | ); |
| 176 | 176 | if ($flag) { |
| 177 | - $query = $this->db_model->select ( "*", "currency", $where, "id", "ASC", $limit, $start ); |
|
| 177 | + $query = $this->db_model->select("*", "currency", $where, "id", "ASC", $limit, $start); |
|
| 178 | 178 | } else { |
| 179 | - $query = $this->db_model->countQuery ( "*", "currency", $where ); |
|
| 179 | + $query = $this->db_model->countQuery("*", "currency", $where); |
|
| 180 | 180 | } |
| 181 | 181 | return $query; |
| 182 | 182 | } |
| 183 | 183 | function add_currency($add_array) { |
| 184 | - unset ( $add_array ["action"] ); |
|
| 185 | - $this->db->insert ( "currency", $add_array ); |
|
| 184 | + unset ($add_array ["action"]); |
|
| 185 | + $this->db->insert("currency", $add_array); |
|
| 186 | 186 | return true; |
| 187 | 187 | } |
| 188 | 188 | function edit_currency($data, $id) { |
| 189 | - unset ( $data ["action"] ); |
|
| 190 | - $this->db->where ( "id", $id ); |
|
| 191 | - $this->db->update ( "currency", $data ); |
|
| 189 | + unset ($data ["action"]); |
|
| 190 | + $this->db->where("id", $id); |
|
| 191 | + $this->db->update("currency", $data); |
|
| 192 | 192 | } |
| 193 | 193 | function remove_currency($id) { |
| 194 | - $this->db->where ( "id", $id ); |
|
| 195 | - $this->db->delete ( "currency" ); |
|
| 194 | + $this->db->where("id", $id); |
|
| 195 | + $this->db->delete("currency"); |
|
| 196 | 196 | return true; |
| 197 | 197 | } |
| 198 | 198 | function backup_insert($add_array = '') { |
| 199 | - unset ( $add_array ["action"] ); |
|
| 200 | - $this->db->insert ( "backup_database", $add_array ); |
|
| 199 | + unset ($add_array ["action"]); |
|
| 200 | + $this->db->insert("backup_database", $add_array); |
|
| 201 | 201 | return true; |
| 202 | 202 | } |
| 203 | 203 | function getbackup_list($flag, $start, $limit) { |
| 204 | 204 | if ($flag) { |
| 205 | - $query = $this->db_model->select ( "*", "backup_database", "", "date", "DESC", $limit, $start ); |
|
| 205 | + $query = $this->db_model->select("*", "backup_database", "", "date", "DESC", $limit, $start); |
|
| 206 | 206 | } else { |
| 207 | - $query = $this->db_model->countQuery ( "*", "backup_database", "" ); |
|
| 207 | + $query = $this->db_model->countQuery("*", "backup_database", ""); |
|
| 208 | 208 | } |
| 209 | 209 | return $query; |
| 210 | 210 | } |
| 211 | 211 | function get_backup_data($id) { |
| 212 | - $where = array ( |
|
| 212 | + $where = array( |
|
| 213 | 213 | 'id' => $id |
| 214 | 214 | ); |
| 215 | - $query = $this->db_model->getSelect ( "*", "backup_database", $where ); |
|
| 215 | + $query = $this->db_model->getSelect("*", "backup_database", $where); |
|
| 216 | 216 | return $query; |
| 217 | 217 | } |
| 218 | 218 | function import_database($filename, $target_path) { |
| 219 | - $this->db->insert ( "backup_database", array ( |
|
| 219 | + $this->db->insert("backup_database", array( |
|
| 220 | 220 | 'backup_name' => $filename, |
| 221 | 221 | 'path' => $target_path |
| 222 | - ) ); |
|
| 222 | + )); |
|
| 223 | 223 | return true; |
| 224 | 224 | } |
| 225 | 225 | } |
@@ -22,469 +22,469 @@ discard block |
||
| 22 | 22 | // ############################################################################## |
| 23 | 23 | class Systems extends CI_Controller { |
| 24 | 24 | function Systems() { |
| 25 | - parent::__construct (); |
|
| 25 | + parent::__construct(); |
|
| 26 | 26 | |
| 27 | - $this->load->helper ( 'template_inheritance' ); |
|
| 28 | - $this->load->helper ( 'file' ); |
|
| 29 | - $this->load->library ( 'session' ); |
|
| 30 | - $this->load->library ( "system_form" ); |
|
| 31 | - $this->load->library ( 'astpp/form' ); |
|
| 32 | - $this->load->model ( 'system_model' ); |
|
| 33 | - $this->load->dbutil (); |
|
| 27 | + $this->load->helper('template_inheritance'); |
|
| 28 | + $this->load->helper('file'); |
|
| 29 | + $this->load->library('session'); |
|
| 30 | + $this->load->library("system_form"); |
|
| 31 | + $this->load->library('astpp/form'); |
|
| 32 | + $this->load->model('system_model'); |
|
| 33 | + $this->load->dbutil(); |
|
| 34 | 34 | |
| 35 | - if ($this->session->userdata ( 'user_login' ) == FALSE) |
|
| 36 | - redirect ( base_url () . '/astpp/login' ); |
|
| 35 | + if ($this->session->userdata('user_login') == FALSE) |
|
| 36 | + redirect(base_url().'/astpp/login'); |
|
| 37 | 37 | } |
| 38 | 38 | function configuration_edit($edit_id = '') { |
| 39 | - $data ['page_title'] = gettext ( 'Edit Settings' ); |
|
| 40 | - $where = array ( |
|
| 39 | + $data ['page_title'] = gettext('Edit Settings'); |
|
| 40 | + $where = array( |
|
| 41 | 41 | 'id' => $edit_id |
| 42 | 42 | ); |
| 43 | - $account = $this->db_model->getSelect ( "*", "system", $where ); |
|
| 44 | - foreach ( $account->result_array () as $key => $value ) { |
|
| 43 | + $account = $this->db_model->getSelect("*", "system", $where); |
|
| 44 | + foreach ($account->result_array() as $key => $value) { |
|
| 45 | 45 | $edit_data = $value; |
| 46 | 46 | } |
| 47 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_configuration_form_fields (), $edit_data ); |
|
| 48 | - $this->load->view ( 'view_configuration_add_edit', $data ); |
|
| 47 | + $data ['form'] = $this->form->build_form($this->system_form->get_configuration_form_fields(), $edit_data); |
|
| 48 | + $this->load->view('view_configuration_add_edit', $data); |
|
| 49 | 49 | } |
| 50 | 50 | function configuration_search() { |
| 51 | - $ajax_search = $this->input->post ( 'ajax_search', 0 ); |
|
| 52 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
| 53 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
| 54 | - $action = $this->input->post (); |
|
| 55 | - unset ( $action ['action'] ); |
|
| 56 | - unset ( $action ['advance_search'] ); |
|
| 57 | - $this->session->set_userdata ( 'configuration_search', $action ); |
|
| 51 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
| 52 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
| 53 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
| 54 | + $action = $this->input->post(); |
|
| 55 | + unset ($action ['action']); |
|
| 56 | + unset ($action ['advance_search']); |
|
| 57 | + $this->session->set_userdata('configuration_search', $action); |
|
| 58 | 58 | } |
| 59 | 59 | if (@$ajax_search != 1) { |
| 60 | - redirect ( base_url () . 'systems/configuration/' ); |
|
| 60 | + redirect(base_url().'systems/configuration/'); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | function configuration_clearsearchfilter() { |
| 64 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
| 65 | - $this->session->set_userdata ( 'did_search', "" ); |
|
| 64 | + $this->session->set_userdata('advance_search', 0); |
|
| 65 | + $this->session->set_userdata('did_search', ""); |
|
| 66 | 66 | } |
| 67 | 67 | function configuration_save() { |
| 68 | - $add_array = $this->input->post (); |
|
| 69 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_configuration_form_fields (), $add_array ); |
|
| 68 | + $add_array = $this->input->post(); |
|
| 69 | + $data ['form'] = $this->form->build_form($this->system_form->get_configuration_form_fields(), $add_array); |
|
| 70 | 70 | if ($add_array ['id'] != '') { |
| 71 | - $data ['page_title'] = gettext ( 'Edit Settings' ); |
|
| 72 | - if ($this->form_validation->run () == FALSE) { |
|
| 73 | - $data ['validation_errors'] = validation_errors (); |
|
| 71 | + $data ['page_title'] = gettext('Edit Settings'); |
|
| 72 | + if ($this->form_validation->run() == FALSE) { |
|
| 73 | + $data ['validation_errors'] = validation_errors(); |
|
| 74 | 74 | echo $data ['validation_errors']; |
| 75 | 75 | exit (); |
| 76 | 76 | } else { |
| 77 | - $this->system_model->edit_configuration ( $add_array, $add_array ['id'] ); |
|
| 78 | - echo json_encode ( array ( |
|
| 77 | + $this->system_model->edit_configuration($add_array, $add_array ['id']); |
|
| 78 | + echo json_encode(array( |
|
| 79 | 79 | "SUCCESS" => "setting updated successfully!" |
| 80 | - ) ); |
|
| 80 | + )); |
|
| 81 | 81 | exit (); |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | function configuration($group_title = '') { |
| 86 | 86 | if ($group_title == "") { |
| 87 | - redirect ( base_url () . '/dashboard' ); |
|
| 87 | + redirect(base_url().'/dashboard'); |
|
| 88 | 88 | } |
| 89 | 89 | if ($group_title == "email") { |
| 90 | 90 | $data ['test_email_flag'] = true; |
| 91 | 91 | } |
| 92 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
| 93 | - $data ['page_title'] = gettext ( ucfirst ( $group_title ) ); |
|
| 92 | + $data ['username'] = $this->session->userdata('user_name'); |
|
| 93 | + $data ['page_title'] = gettext(ucfirst($group_title)); |
|
| 94 | 94 | $data ['group_title'] = $group_title; |
| 95 | - $where = array ( |
|
| 95 | + $where = array( |
|
| 96 | 96 | "group_title" => $group_title |
| 97 | 97 | ); |
| 98 | - $details = $this->db_model->getSelect ( "*", "system", $where ); |
|
| 99 | - $data ['details'] = $details->result_array (); |
|
| 100 | - $add_array = $this->input->post (); |
|
| 101 | - if (! empty ( $add_array )) { |
|
| 102 | - if (isset ( $add_array ['version'] )) { |
|
| 103 | - unset ( $add_array ['version'] ); |
|
| 98 | + $details = $this->db_model->getSelect("*", "system", $where); |
|
| 99 | + $data ['details'] = $details->result_array(); |
|
| 100 | + $add_array = $this->input->post(); |
|
| 101 | + if ( ! empty ($add_array)) { |
|
| 102 | + if (isset ($add_array ['version'])) { |
|
| 103 | + unset ($add_array ['version']); |
|
| 104 | 104 | } |
| 105 | - foreach ( $add_array as $key => $val ) { |
|
| 106 | - $update_array = array ( |
|
| 105 | + foreach ($add_array as $key => $val) { |
|
| 106 | + $update_array = array( |
|
| 107 | 107 | 'value' => $val |
| 108 | 108 | ); |
| 109 | - $this->system_model->edit_configuration ( $update_array, $key ); |
|
| 109 | + $this->system_model->edit_configuration($update_array, $key); |
|
| 110 | 110 | } |
| 111 | - $this->session->set_flashdata ( 'astpp_errormsg', ucfirst ( $group_title ) . ' Settings updated sucessfully!' ); |
|
| 112 | - redirect ( base_url () . 'systems/configuration/' . $group_title ); |
|
| 111 | + $this->session->set_flashdata('astpp_errormsg', ucfirst($group_title).' Settings updated sucessfully!'); |
|
| 112 | + redirect(base_url().'systems/configuration/'.$group_title); |
|
| 113 | 113 | } else { |
| 114 | - $this->load->view ( 'view_systemconf', $data ); |
|
| 114 | + $this->load->view('view_systemconf', $data); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | function configuration_json() { |
| 118 | - $json_data = array (); |
|
| 119 | - $count_all = $this->system_model->getsystem_list ( false, "", "" ); |
|
| 120 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
| 118 | + $json_data = array(); |
|
| 119 | + $count_all = $this->system_model->getsystem_list(false, "", ""); |
|
| 120 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
| 121 | 121 | $json_data = $paging_data ["json_paging"]; |
| 122 | 122 | |
| 123 | - $query = $this->system_model->getsystem_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] ); |
|
| 124 | - $grid_fields = json_decode ( $this->system_form->build_system_list_for_admin () ); |
|
| 125 | - $json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields ); |
|
| 123 | + $query = $this->system_model->getsystem_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]); |
|
| 124 | + $grid_fields = json_decode($this->system_form->build_system_list_for_admin()); |
|
| 125 | + $json_data ['rows'] = $this->form->build_grid($query, $grid_fields); |
|
| 126 | 126 | |
| 127 | - echo json_encode ( $json_data ); |
|
| 127 | + echo json_encode($json_data); |
|
| 128 | 128 | } |
| 129 | 129 | function template() { |
| 130 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
| 131 | - $data ['page_title'] = gettext ( 'Email Templates' ); |
|
| 130 | + $data ['username'] = $this->session->userdata('user_name'); |
|
| 131 | + $data ['page_title'] = gettext('Email Templates'); |
|
| 132 | 132 | $data ['search_flag'] = true; |
| 133 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
| 134 | - $data ['grid_fields'] = $this->system_form->build_template_list_for_admin (); |
|
| 135 | - $data ["grid_buttons"] = $this->system_form->build_grid_buttons (); |
|
| 136 | - $data ['form_search'] = $this->form->build_serach_form ( $this->system_form->get_template_search_form () ); |
|
| 137 | - $this->load->view ( 'view_template_list', $data ); |
|
| 133 | + $this->session->set_userdata('advance_search', 0); |
|
| 134 | + $data ['grid_fields'] = $this->system_form->build_template_list_for_admin(); |
|
| 135 | + $data ["grid_buttons"] = $this->system_form->build_grid_buttons(); |
|
| 136 | + $data ['form_search'] = $this->form->build_serach_form($this->system_form->get_template_search_form()); |
|
| 137 | + $this->load->view('view_template_list', $data); |
|
| 138 | 138 | } |
| 139 | 139 | function template_json() { |
| 140 | - $json_data = array (); |
|
| 141 | - $count_all = $this->system_model->gettemplate_list ( false, "", "" ); |
|
| 142 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
| 140 | + $json_data = array(); |
|
| 141 | + $count_all = $this->system_model->gettemplate_list(false, "", ""); |
|
| 142 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
| 143 | 143 | $json_data = $paging_data ["json_paging"]; |
| 144 | 144 | |
| 145 | - $query = $this->system_model->gettemplate_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] ); |
|
| 146 | - $grid_fields = json_decode ( $this->system_form->build_template_list_for_admin () ); |
|
| 147 | - $json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields ); |
|
| 145 | + $query = $this->system_model->gettemplate_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]); |
|
| 146 | + $grid_fields = json_decode($this->system_form->build_template_list_for_admin()); |
|
| 147 | + $json_data ['rows'] = $this->form->build_grid($query, $grid_fields); |
|
| 148 | 148 | |
| 149 | - echo json_encode ( $json_data ); |
|
| 149 | + echo json_encode($json_data); |
|
| 150 | 150 | } |
| 151 | 151 | function template_edit($edit_id = '') { |
| 152 | - $data ['page_title'] = gettext ( 'Edit Email template' ); |
|
| 153 | - $where = array ( |
|
| 152 | + $data ['page_title'] = gettext('Edit Email template'); |
|
| 153 | + $where = array( |
|
| 154 | 154 | 'id' => $edit_id |
| 155 | 155 | ); |
| 156 | - $account = $this->db_model->getSelect ( "*", "default_templates", $where ); |
|
| 157 | - foreach ( $account->result_array () as $key => $value ) { |
|
| 156 | + $account = $this->db_model->getSelect("*", "default_templates", $where); |
|
| 157 | + foreach ($account->result_array() as $key => $value) { |
|
| 158 | 158 | $edit_data = $value; |
| 159 | 159 | } |
| 160 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_template_form_fields (), $edit_data ); |
|
| 161 | - $this->load->view ( 'view_template_add_edit', $data ); |
|
| 160 | + $data ['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $edit_data); |
|
| 161 | + $this->load->view('view_template_add_edit', $data); |
|
| 162 | 162 | } |
| 163 | 163 | function template_save() { |
| 164 | - $add_array = $this->input->post (); |
|
| 164 | + $add_array = $this->input->post(); |
|
| 165 | 165 | // ITPLATP 22_05_2017 |
| 166 | - $template = preg_replace ( '<!-- (.|\s)*? -->', '', $add_array ['template'] ); |
|
| 167 | - $add_array ['template'] = str_replace ( "<", "", str_replace ( ">", "", $template ) ); |
|
| 166 | + $template = preg_replace('<!-- (.|\s)*? -->', '', $add_array ['template']); |
|
| 167 | + $add_array ['template'] = str_replace("<", "", str_replace(">", "", $template)); |
|
| 168 | 168 | // end |
| 169 | - if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) { |
|
| 170 | - $account_data = $this->session->userdata ( "accountinfo" ); |
|
| 169 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
| 170 | + $account_data = $this->session->userdata("accountinfo"); |
|
| 171 | 171 | $reseller = $account_data ['id']; |
| 172 | - $this->resellertemplate_save ( $add_array, $reseller ); |
|
| 172 | + $this->resellertemplate_save($add_array, $reseller); |
|
| 173 | 173 | } else { |
| 174 | - $this->admintemplate_save ( $add_array ); |
|
| 174 | + $this->admintemplate_save($add_array); |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | function resellertemplate_save($data, $resellerid) { |
| 178 | - $where = array ( |
|
| 178 | + $where = array( |
|
| 179 | 179 | 'name' => $data ['name'], |
| 180 | 180 | 'reseller_id' => $resellerid |
| 181 | 181 | ); |
| 182 | - $count = $this->db_model->countQuery ( "*", "default_templates", $where ); |
|
| 183 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_template_form_fields (), $data ); |
|
| 182 | + $count = $this->db_model->countQuery("*", "default_templates", $where); |
|
| 183 | + $data ['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $data); |
|
| 184 | 184 | if ($count > 0) { |
| 185 | - $data ['page_title'] = gettext ( 'Edit Template' ); |
|
| 186 | - if ($this->form_validation->run () == FALSE) { |
|
| 187 | - $data ['validation_errors'] = validation_errors (); |
|
| 185 | + $data ['page_title'] = gettext('Edit Template'); |
|
| 186 | + if ($this->form_validation->run() == FALSE) { |
|
| 187 | + $data ['validation_errors'] = validation_errors(); |
|
| 188 | 188 | } else { |
| 189 | 189 | |
| 190 | - $this->system_model->edit_resellertemplate ( $data, $data ['id'] ); |
|
| 191 | - $this->session->set_flashdata ( 'astpp_errormsg', 'Template updated successfully!' ); |
|
| 192 | - redirect ( base_url () . 'systems/template/' ); |
|
| 190 | + $this->system_model->edit_resellertemplate($data, $data ['id']); |
|
| 191 | + $this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!'); |
|
| 192 | + redirect(base_url().'systems/template/'); |
|
| 193 | 193 | exit (); |
| 194 | 194 | } |
| 195 | 195 | } else { |
| 196 | - if ($this->form_validation->run () == FALSE) { |
|
| 197 | - $data ['validation_errors'] = validation_errors (); |
|
| 196 | + if ($this->form_validation->run() == FALSE) { |
|
| 197 | + $data ['validation_errors'] = validation_errors(); |
|
| 198 | 198 | } else { |
| 199 | - unset ( $data ['form'] ); |
|
| 199 | + unset ($data ['form']); |
|
| 200 | 200 | $data ['reseller_id'] = $resellerid; |
| 201 | - $this->system_model->add_resellertemplate ( $data ); |
|
| 202 | - $this->session->set_flashdata ( 'astpp_errormsg', 'Template added successfully!' ); |
|
| 203 | - redirect ( base_url () . 'systems/template/' ); |
|
| 201 | + $this->system_model->add_resellertemplate($data); |
|
| 202 | + $this->session->set_flashdata('astpp_errormsg', 'Template added successfully!'); |
|
| 203 | + redirect(base_url().'systems/template/'); |
|
| 204 | 204 | exit (); |
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | - $this->load->view ( 'view_template_add_edit', $data ); |
|
| 207 | + $this->load->view('view_template_add_edit', $data); |
|
| 208 | 208 | } |
| 209 | 209 | function admintemplate_save($data) { |
| 210 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_template_form_fields (), $data ); |
|
| 210 | + $data ['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $data); |
|
| 211 | 211 | if ($data ['id'] != '') { |
| 212 | - $data ['page_title'] = gettext ( 'Edit Template' ); |
|
| 213 | - if ($this->form_validation->run () == FALSE) { |
|
| 214 | - $data ['validation_errors'] = validation_errors (); |
|
| 212 | + $data ['page_title'] = gettext('Edit Template'); |
|
| 213 | + if ($this->form_validation->run() == FALSE) { |
|
| 214 | + $data ['validation_errors'] = validation_errors(); |
|
| 215 | 215 | } else { |
| 216 | - unset ( $data ['form'] ); |
|
| 217 | - unset ( $data ['page_title'] ); |
|
| 218 | - $this->system_model->edit_template ( $data, $data ['id'] ); |
|
| 219 | - $this->session->set_flashdata ( 'astpp_errormsg', 'Template updated successfully!' ); |
|
| 220 | - redirect ( base_url () . 'systems/template/' ); |
|
| 216 | + unset ($data ['form']); |
|
| 217 | + unset ($data ['page_title']); |
|
| 218 | + $this->system_model->edit_template($data, $data ['id']); |
|
| 219 | + $this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!'); |
|
| 220 | + redirect(base_url().'systems/template/'); |
|
| 221 | 221 | exit (); |
| 222 | 222 | } |
| 223 | 223 | } else { |
| 224 | - $data ['page_title'] = gettext ( 'Termination Details' ); |
|
| 225 | - if ($this->form_validation->run () == FALSE) { |
|
| 226 | - $data ['validation_errors'] = validation_errors (); |
|
| 224 | + $data ['page_title'] = gettext('Termination Details'); |
|
| 225 | + if ($this->form_validation->run() == FALSE) { |
|
| 226 | + $data ['validation_errors'] = validation_errors(); |
|
| 227 | 227 | } else { |
| 228 | - unset ( $data ['form'] ); |
|
| 229 | - $this->system_model->add_template ( $data ); |
|
| 230 | - $this->session->set_flashdata ( 'astpp_errormsg', 'Template added successfully!' ); |
|
| 231 | - redirect ( base_url () . 'systems/template/' ); |
|
| 228 | + unset ($data ['form']); |
|
| 229 | + $this->system_model->add_template($data); |
|
| 230 | + $this->session->set_flashdata('astpp_errormsg', 'Template added successfully!'); |
|
| 231 | + redirect(base_url().'systems/template/'); |
|
| 232 | 232 | exit (); |
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | - $this->load->view ( 'view_template_add_edit', $data ); |
|
| 235 | + $this->load->view('view_template_add_edit', $data); |
|
| 236 | 236 | } |
| 237 | 237 | function template_search() { |
| 238 | - $ajax_search = $this->input->post ( 'ajax_search', 0 ); |
|
| 238 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
| 239 | 239 | |
| 240 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
| 241 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
| 242 | - $action = $this->input->post (); |
|
| 243 | - unset ( $action ['action'] ); |
|
| 244 | - unset ( $action ['advance_search'] ); |
|
| 245 | - $this->session->set_userdata ( 'template_search', $action ); |
|
| 240 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
| 241 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
| 242 | + $action = $this->input->post(); |
|
| 243 | + unset ($action ['action']); |
|
| 244 | + unset ($action ['advance_search']); |
|
| 245 | + $this->session->set_userdata('template_search', $action); |
|
| 246 | 246 | } |
| 247 | 247 | if (@$ajax_search != 1) { |
| 248 | - redirect ( base_url () . 'systems/template/' ); |
|
| 248 | + redirect(base_url().'systems/template/'); |
|
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | function template_clearsearchfilter() { |
| 252 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
| 253 | - $this->session->set_userdata ( 'did_search', "" ); |
|
| 252 | + $this->session->set_userdata('advance_search', 0); |
|
| 253 | + $this->session->set_userdata('did_search', ""); |
|
| 254 | 254 | } |
| 255 | 255 | function country_list() { |
| 256 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
| 257 | - $data ['page_title'] = gettext ( 'Countries' ); |
|
| 256 | + $data ['username'] = $this->session->userdata('user_name'); |
|
| 257 | + $data ['page_title'] = gettext('Countries'); |
|
| 258 | 258 | $data ['search_flag'] = true; |
| 259 | 259 | $data ['cur_menu_no'] = 4; |
| 260 | - $this->session->set_userdata ( 'country_search', 0 ); |
|
| 261 | - $data ['grid_fields'] = $this->system_form->build_country_list_for_admin (); |
|
| 262 | - if ($this->session->userdata ( 'logintype' ) == 2) { |
|
| 263 | - $data ["grid_buttons"] = $this->system_form->build_admin_grid_buttons (); |
|
| 260 | + $this->session->set_userdata('country_search', 0); |
|
| 261 | + $data ['grid_fields'] = $this->system_form->build_country_list_for_admin(); |
|
| 262 | + if ($this->session->userdata('logintype') == 2) { |
|
| 263 | + $data ["grid_buttons"] = $this->system_form->build_admin_grid_buttons(); |
|
| 264 | 264 | } else { |
| 265 | - $data ["grid_buttons"] = json_encode ( array () ); |
|
| 265 | + $data ["grid_buttons"] = json_encode(array()); |
|
| 266 | 266 | } |
| 267 | - $data ['form_search'] = $this->form->build_serach_form ( $this->system_form->get_search_country_form () ); |
|
| 268 | - $this->load->view ( 'view_country_list', $data ); |
|
| 267 | + $data ['form_search'] = $this->form->build_serach_form($this->system_form->get_search_country_form()); |
|
| 268 | + $this->load->view('view_country_list', $data); |
|
| 269 | 269 | } |
| 270 | 270 | function country_list_json() { |
| 271 | - $json_data = array (); |
|
| 272 | - $count_all = $this->system_model->getcountry_list ( false ); |
|
| 273 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
| 271 | + $json_data = array(); |
|
| 272 | + $count_all = $this->system_model->getcountry_list(false); |
|
| 273 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
| 274 | 274 | $json_data = $paging_data ["json_paging"]; |
| 275 | - $query = $this->system_model->getcountry_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] ); |
|
| 276 | - $grid_fields = json_decode ( $this->system_form->build_country_list_for_admin () ); |
|
| 277 | - $json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields ); |
|
| 275 | + $query = $this->system_model->getcountry_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]); |
|
| 276 | + $grid_fields = json_decode($this->system_form->build_country_list_for_admin()); |
|
| 277 | + $json_data ['rows'] = $this->form->build_grid($query, $grid_fields); |
|
| 278 | 278 | |
| 279 | - echo json_encode ( $json_data ); |
|
| 279 | + echo json_encode($json_data); |
|
| 280 | 280 | } |
| 281 | 281 | function country_list_search() { |
| 282 | - $ajax_search = $this->input->post ( 'ajax_search', 0 ); |
|
| 282 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
| 283 | 283 | |
| 284 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
| 285 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
| 286 | - $action = $this->input->post (); |
|
| 287 | - unset ( $action ['action'] ); |
|
| 288 | - unset ( $action ['advance_search'] ); |
|
| 289 | - $this->session->set_userdata ( 'country_list_search', $action ); |
|
| 284 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
| 285 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
| 286 | + $action = $this->input->post(); |
|
| 287 | + unset ($action ['action']); |
|
| 288 | + unset ($action ['advance_search']); |
|
| 289 | + $this->session->set_userdata('country_list_search', $action); |
|
| 290 | 290 | } |
| 291 | 291 | if (@$ajax_search != 1) { |
| 292 | - redirect ( base_url () . 'systems/country_list/' ); |
|
| 292 | + redirect(base_url().'systems/country_list/'); |
|
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | function country_list_clearsearchfilter() { |
| 296 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
| 297 | - $this->session->set_userdata ( 'country_search', "" ); |
|
| 296 | + $this->session->set_userdata('advance_search', 0); |
|
| 297 | + $this->session->set_userdata('country_search', ""); |
|
| 298 | 298 | } |
| 299 | 299 | function country_add() { |
| 300 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
| 300 | + $data ['username'] = $this->session->userdata('user_name'); |
|
| 301 | 301 | $data ['flag'] = 'create'; |
| 302 | - $data ['page_title'] = gettext ( 'Add Country' ); |
|
| 303 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_country_form_fields (), '' ); |
|
| 304 | - $this->load->view ( 'view_country_add_edit', $data ); |
|
| 302 | + $data ['page_title'] = gettext('Add Country'); |
|
| 303 | + $data ['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), ''); |
|
| 304 | + $this->load->view('view_country_add_edit', $data); |
|
| 305 | 305 | } |
| 306 | 306 | function country_list_edit($edit_id = '') { |
| 307 | - $data ['page_title'] = gettext ( 'Edit Country' ); |
|
| 308 | - $where = array ( |
|
| 307 | + $data ['page_title'] = gettext('Edit Country'); |
|
| 308 | + $where = array( |
|
| 309 | 309 | 'id' => $edit_id |
| 310 | 310 | ); |
| 311 | - $account = $this->db_model->getSelect ( "*", "countrycode", $where ); |
|
| 312 | - foreach ( $account->result_array () as $key => $value ) { |
|
| 311 | + $account = $this->db_model->getSelect("*", "countrycode", $where); |
|
| 312 | + foreach ($account->result_array() as $key => $value) { |
|
| 313 | 313 | $edit_data = $value; |
| 314 | 314 | } |
| 315 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_country_form_fields (), $edit_data ); |
|
| 316 | - $this->load->view ( 'view_country_add_edit', $data ); |
|
| 315 | + $data ['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), $edit_data); |
|
| 316 | + $this->load->view('view_country_add_edit', $data); |
|
| 317 | 317 | } |
| 318 | 318 | function country_save() { |
| 319 | - $add_array = $this->input->post (); |
|
| 320 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_country_form_fields (), $add_array ); |
|
| 319 | + $add_array = $this->input->post(); |
|
| 320 | + $data ['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), $add_array); |
|
| 321 | 321 | if ($add_array ['id'] != '') { |
| 322 | - $data ['page_title'] = gettext ( 'Edit Country' ); |
|
| 323 | - if ($this->form_validation->run () == FALSE) { |
|
| 324 | - $data ['validation_errors'] = validation_errors (); |
|
| 322 | + $data ['page_title'] = gettext('Edit Country'); |
|
| 323 | + if ($this->form_validation->run() == FALSE) { |
|
| 324 | + $data ['validation_errors'] = validation_errors(); |
|
| 325 | 325 | echo $data ['validation_errors']; |
| 326 | 326 | exit (); |
| 327 | 327 | } else { |
| 328 | - $this->system_model->edit_country ( $add_array, $add_array ['id'] ); |
|
| 329 | - echo json_encode ( array ( |
|
| 330 | - "SUCCESS" => $add_array ["country"] . " country updated successfully!" |
|
| 331 | - ) ); |
|
| 328 | + $this->system_model->edit_country($add_array, $add_array ['id']); |
|
| 329 | + echo json_encode(array( |
|
| 330 | + "SUCCESS" => $add_array ["country"]." country updated successfully!" |
|
| 331 | + )); |
|
| 332 | 332 | exit (); |
| 333 | 333 | } |
| 334 | 334 | } else { |
| 335 | - $data ['page_title'] = gettext ( 'Add Country' ); |
|
| 336 | - if ($this->form_validation->run () == FALSE) { |
|
| 337 | - $data ['validation_errors'] = validation_errors (); |
|
| 335 | + $data ['page_title'] = gettext('Add Country'); |
|
| 336 | + if ($this->form_validation->run() == FALSE) { |
|
| 337 | + $data ['validation_errors'] = validation_errors(); |
|
| 338 | 338 | echo $data ['validation_errors']; |
| 339 | 339 | exit (); |
| 340 | 340 | } else { |
| 341 | - $response = $this->system_model->add_country ( $add_array ); |
|
| 342 | - echo json_encode ( array ( |
|
| 343 | - "SUCCESS" => $add_array ["country"] . " country added successfully!" |
|
| 344 | - ) ); |
|
| 341 | + $response = $this->system_model->add_country($add_array); |
|
| 342 | + echo json_encode(array( |
|
| 343 | + "SUCCESS" => $add_array ["country"]." country added successfully!" |
|
| 344 | + )); |
|
| 345 | 345 | exit (); |
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | 349 | function country_remove($id) { |
| 350 | - $this->system_model->remove_country ( $id ); |
|
| 351 | - $country = $this->common->get_field_name ( 'country', 'countrycode', $id ); |
|
| 352 | - $this->session->set_flashdata ( 'astpp_notification', $country . 'Country removed successfully!' ); |
|
| 353 | - redirect ( base_url () . 'systems/country_list/' ); |
|
| 350 | + $this->system_model->remove_country($id); |
|
| 351 | + $country = $this->common->get_field_name('country', 'countrycode', $id); |
|
| 352 | + $this->session->set_flashdata('astpp_notification', $country.'Country removed successfully!'); |
|
| 353 | + redirect(base_url().'systems/country_list/'); |
|
| 354 | 354 | } |
| 355 | 355 | function country_delete_multiple() { |
| 356 | - $ids = $this->input->post ( "selected_ids", true ); |
|
| 356 | + $ids = $this->input->post("selected_ids", true); |
|
| 357 | 357 | $where = "id IN ($ids)"; |
| 358 | - $this->db->where ( $where ); |
|
| 359 | - echo $this->db->delete ( "countrycode" ); |
|
| 358 | + $this->db->where($where); |
|
| 359 | + echo $this->db->delete("countrycode"); |
|
| 360 | 360 | } |
| 361 | 361 | function currency_list() { |
| 362 | 362 | $base_currency = Common_model::$global_config ['system_config'] ['base_currency']; |
| 363 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
| 364 | - $data ['page_title'] = gettext ( 'Currencies' ); |
|
| 363 | + $data ['username'] = $this->session->userdata('user_name'); |
|
| 364 | + $data ['page_title'] = gettext('Currencies'); |
|
| 365 | 365 | $data ['search_flag'] = true; |
| 366 | 366 | $data ['cur_menu_no'] = 4; |
| 367 | - $this->session->set_userdata ( 'currency_search', 0 ); |
|
| 368 | - $data ['grid_fields'] = $this->system_form->build_currency_list_for_admin (); |
|
| 369 | - if ($this->session->userdata ( 'logintype' ) == 2) { |
|
| 370 | - $data ["grid_buttons"] = $this->system_form->build_admin_currency_grid_buttons (); |
|
| 367 | + $this->session->set_userdata('currency_search', 0); |
|
| 368 | + $data ['grid_fields'] = $this->system_form->build_currency_list_for_admin(); |
|
| 369 | + if ($this->session->userdata('logintype') == 2) { |
|
| 370 | + $data ["grid_buttons"] = $this->system_form->build_admin_currency_grid_buttons(); |
|
| 371 | 371 | } else { |
| 372 | - $data ["grid_buttons"] = json_encode ( array () ); |
|
| 372 | + $data ["grid_buttons"] = json_encode(array()); |
|
| 373 | 373 | } |
| 374 | - $data ['form_search'] = $this->form->build_serach_form ( $this->system_form->get_search_currency_form () ); |
|
| 375 | - $this->load->view ( 'view_currency_list', $data ); |
|
| 374 | + $data ['form_search'] = $this->form->build_serach_form($this->system_form->get_search_currency_form()); |
|
| 375 | + $this->load->view('view_currency_list', $data); |
|
| 376 | 376 | } |
| 377 | 377 | function currency_list_json() { |
| 378 | - $json_data = array (); |
|
| 378 | + $json_data = array(); |
|
| 379 | 379 | |
| 380 | - $count_all = $this->system_model->getcurrency_list ( false ); |
|
| 381 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
| 380 | + $count_all = $this->system_model->getcurrency_list(false); |
|
| 381 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
| 382 | 382 | $json_data = $paging_data ["json_paging"]; |
| 383 | 383 | |
| 384 | - $query = $this->system_model->getcurrency_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] ); |
|
| 385 | - $grid_fields = json_decode ( $this->system_form->build_currency_list_for_admin () ); |
|
| 386 | - $json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields ); |
|
| 384 | + $query = $this->system_model->getcurrency_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]); |
|
| 385 | + $grid_fields = json_decode($this->system_form->build_currency_list_for_admin()); |
|
| 386 | + $json_data ['rows'] = $this->form->build_grid($query, $grid_fields); |
|
| 387 | 387 | |
| 388 | - echo json_encode ( $json_data ); |
|
| 388 | + echo json_encode($json_data); |
|
| 389 | 389 | } |
| 390 | 390 | function currency_list_search() { |
| 391 | - $ajax_search = $this->input->post ( 'ajax_search', 0 ); |
|
| 391 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
| 392 | 392 | |
| 393 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
| 394 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
| 395 | - $action = $this->input->post (); |
|
| 396 | - unset ( $action ['action'] ); |
|
| 397 | - unset ( $action ['advance_search'] ); |
|
| 398 | - $this->session->set_userdata ( 'currency_list_search', $action ); |
|
| 393 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
| 394 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
| 395 | + $action = $this->input->post(); |
|
| 396 | + unset ($action ['action']); |
|
| 397 | + unset ($action ['advance_search']); |
|
| 398 | + $this->session->set_userdata('currency_list_search', $action); |
|
| 399 | 399 | } |
| 400 | 400 | if (@$ajax_search != 1) { |
| 401 | - redirect ( base_url () . 'systems/currency_list/' ); |
|
| 401 | + redirect(base_url().'systems/currency_list/'); |
|
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | function currency_list_clearsearchfilter() { |
| 405 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
| 406 | - $this->session->set_userdata ( 'currency_search', "" ); |
|
| 405 | + $this->session->set_userdata('advance_search', 0); |
|
| 406 | + $this->session->set_userdata('currency_search', ""); |
|
| 407 | 407 | } |
| 408 | 408 | function currency_add() { |
| 409 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
| 409 | + $data ['username'] = $this->session->userdata('user_name'); |
|
| 410 | 410 | $data ['flag'] = 'create'; |
| 411 | - $data ['page_title'] = gettext ( 'Add Currency' ); |
|
| 412 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_currency_form_fields (), '' ); |
|
| 413 | - $this->load->view ( 'view_currency_add_edit', $data ); |
|
| 411 | + $data ['page_title'] = gettext('Add Currency'); |
|
| 412 | + $data ['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), ''); |
|
| 413 | + $this->load->view('view_currency_add_edit', $data); |
|
| 414 | 414 | } |
| 415 | 415 | function currency_list_edit($edit_id = '') { |
| 416 | - $data ['page_title'] = gettext ( 'Edit Currency' ); |
|
| 417 | - $where = array ( |
|
| 416 | + $data ['page_title'] = gettext('Edit Currency'); |
|
| 417 | + $where = array( |
|
| 418 | 418 | 'id' => $edit_id |
| 419 | 419 | ); |
| 420 | - $account = $this->db_model->getSelect ( "*", "currency", $where ); |
|
| 421 | - foreach ( $account->result_array () as $key => $value ) { |
|
| 420 | + $account = $this->db_model->getSelect("*", "currency", $where); |
|
| 421 | + foreach ($account->result_array() as $key => $value) { |
|
| 422 | 422 | $edit_data = $value; |
| 423 | 423 | } |
| 424 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_currency_form_fields (), $edit_data ); |
|
| 425 | - $this->load->view ( 'view_country_add_edit', $data ); |
|
| 424 | + $data ['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), $edit_data); |
|
| 425 | + $this->load->view('view_country_add_edit', $data); |
|
| 426 | 426 | } |
| 427 | 427 | function currency_save() { |
| 428 | - $add_array = $this->input->post (); |
|
| 429 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_currency_form_fields (), $add_array ); |
|
| 428 | + $add_array = $this->input->post(); |
|
| 429 | + $data ['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), $add_array); |
|
| 430 | 430 | if ($add_array ['id'] != '') { |
| 431 | - $data ['page_title'] = gettext ( 'Edit Currency' ); |
|
| 432 | - $data ['page_title'] = gettext ( 'Edit Currency' ); |
|
| 433 | - if ($this->form_validation->run () == FALSE) { |
|
| 434 | - $data ['validation_errors'] = validation_errors (); |
|
| 431 | + $data ['page_title'] = gettext('Edit Currency'); |
|
| 432 | + $data ['page_title'] = gettext('Edit Currency'); |
|
| 433 | + if ($this->form_validation->run() == FALSE) { |
|
| 434 | + $data ['validation_errors'] = validation_errors(); |
|
| 435 | 435 | echo $data ['validation_errors']; |
| 436 | 436 | exit (); |
| 437 | 437 | } else { |
| 438 | - $this->system_model->edit_currency ( $add_array, $add_array ['id'] ); |
|
| 439 | - echo json_encode ( array ( |
|
| 440 | - "SUCCESS" => $add_array ["currencyname"] . " currency updated successfully!" |
|
| 441 | - ) ); |
|
| 438 | + $this->system_model->edit_currency($add_array, $add_array ['id']); |
|
| 439 | + echo json_encode(array( |
|
| 440 | + "SUCCESS" => $add_array ["currencyname"]." currency updated successfully!" |
|
| 441 | + )); |
|
| 442 | 442 | exit (); |
| 443 | 443 | } |
| 444 | 444 | } else { |
| 445 | - $data ['page_title'] = gettext ( 'Create Currency' ); |
|
| 446 | - if ($this->form_validation->run () == FALSE) { |
|
| 447 | - $data ['validation_errors'] = validation_errors (); |
|
| 445 | + $data ['page_title'] = gettext('Create Currency'); |
|
| 446 | + if ($this->form_validation->run() == FALSE) { |
|
| 447 | + $data ['validation_errors'] = validation_errors(); |
|
| 448 | 448 | echo $data ['validation_errors']; |
| 449 | 449 | exit (); |
| 450 | 450 | } else { |
| 451 | - $response = $this->system_model->add_currency ( $add_array ); |
|
| 452 | - echo json_encode ( array ( |
|
| 453 | - "SUCCESS" => $add_array ["currencyname"] . " currency added successfully!" |
|
| 454 | - ) ); |
|
| 451 | + $response = $this->system_model->add_currency($add_array); |
|
| 452 | + echo json_encode(array( |
|
| 453 | + "SUCCESS" => $add_array ["currencyname"]." currency added successfully!" |
|
| 454 | + )); |
|
| 455 | 455 | exit (); |
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | 458 | } |
| 459 | 459 | function currency_remove($id) { |
| 460 | - $currencyname = $this->common->get_field_name ( 'currencyname', 'currency', $id ); |
|
| 461 | - $this->system_model->remove_currency ( $id ); |
|
| 462 | - $this->session->set_flashdata ( 'astpp_notification', $currencyname . ' Currency removed successfully!' ); |
|
| 463 | - redirect ( base_url () . 'systems/currency_list/' ); |
|
| 460 | + $currencyname = $this->common->get_field_name('currencyname', 'currency', $id); |
|
| 461 | + $this->system_model->remove_currency($id); |
|
| 462 | + $this->session->set_flashdata('astpp_notification', $currencyname.' Currency removed successfully!'); |
|
| 463 | + redirect(base_url().'systems/currency_list/'); |
|
| 464 | 464 | } |
| 465 | 465 | function currency_delete_multiple() { |
| 466 | - $ids = $this->input->post ( "selected_ids", true ); |
|
| 466 | + $ids = $this->input->post("selected_ids", true); |
|
| 467 | 467 | $where = "id IN ($ids)"; |
| 468 | - $this->db->where ( $where ); |
|
| 469 | - echo $this->db->delete ( "currency" ); |
|
| 468 | + $this->db->where($where); |
|
| 469 | + echo $this->db->delete("currency"); |
|
| 470 | 470 | } |
| 471 | 471 | function database_backup() { |
| 472 | - $data = array (); |
|
| 473 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
| 474 | - $data ['page_title'] = gettext ( 'Database Backup' ); |
|
| 475 | - $filename = $this->db->database . "_" . date ( "YmdHms" ) . ".sql.gz"; |
|
| 476 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_backup_database_form_fields ( $filename ), '' ); |
|
| 477 | - $this->load->view ( 'view_database_backup', $data ); |
|
| 472 | + $data = array(); |
|
| 473 | + $data ['username'] = $this->session->userdata('user_name'); |
|
| 474 | + $data ['page_title'] = gettext('Database Backup'); |
|
| 475 | + $filename = $this->db->database."_".date("YmdHms").".sql.gz"; |
|
| 476 | + $data ['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($filename), ''); |
|
| 477 | + $this->load->view('view_database_backup', $data); |
|
| 478 | 478 | } |
| 479 | 479 | function database_backup_save() { |
| 480 | - $add_array = $this->input->post (); |
|
| 480 | + $add_array = $this->input->post(); |
|
| 481 | 481 | |
| 482 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_backup_database_form_fields ( $add_array ['path'], $add_array ['id'] ), $add_array ); |
|
| 483 | - $data ['page_title'] = gettext ( 'Database Backup' ); |
|
| 482 | + $data ['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($add_array ['path'], $add_array ['id']), $add_array); |
|
| 483 | + $data ['page_title'] = gettext('Database Backup'); |
|
| 484 | 484 | if ($add_array ['id'] != '') { |
| 485 | 485 | } else { |
| 486 | - if ($this->form_validation->run () == FALSE) { |
|
| 487 | - $data ['validation_errors'] = validation_errors (); |
|
| 486 | + if ($this->form_validation->run() == FALSE) { |
|
| 487 | + $data ['validation_errors'] = validation_errors(); |
|
| 488 | 488 | echo $data ['validation_errors']; |
| 489 | 489 | exit (); |
| 490 | 490 | } else { |
@@ -493,26 +493,26 @@ discard block |
||
| 493 | 493 | $db_password = $this->db->password; |
| 494 | 494 | $db_hostname = $this->db->hostname; |
| 495 | 495 | $filename = $add_array ['path']; |
| 496 | - $backup_file = DATABASE_DIRECTORY . $filename; |
|
| 497 | - if (substr ( $backup_file, - 3 ) == '.gz') { |
|
| 498 | - $backup_file = substr ( $backup_file, 0, - 3 ); |
|
| 496 | + $backup_file = DATABASE_DIRECTORY.$filename; |
|
| 497 | + if (substr($backup_file, - 3) == '.gz') { |
|
| 498 | + $backup_file = substr($backup_file, 0, - 3); |
|
| 499 | 499 | $do_gzip = 1; |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - $run_backup = "/usr/bin/mysqldump -all --databases " . $db_name . " -u'" . $db_username . "' -p'" . $db_password . "' > '$backup_file'"; |
|
| 502 | + $run_backup = "/usr/bin/mysqldump -all --databases ".$db_name." -u'".$db_username."' -p'".$db_password."' > '$backup_file'"; |
|
| 503 | 503 | $error_zip = 0; |
| 504 | - exec ( $run_backup, $output, $error ); |
|
| 504 | + exec($run_backup, $output, $error); |
|
| 505 | 505 | if ($do_gzip) { |
| 506 | - $gzip = $this->config->item ( 'gzip-path' ); |
|
| 507 | - $run_gzip = $gzip . " " . $backup_file; |
|
| 508 | - exec ( $run_gzip, $output, $error_zip ); |
|
| 506 | + $gzip = $this->config->item('gzip-path'); |
|
| 507 | + $run_gzip = $gzip." ".$backup_file; |
|
| 508 | + exec($run_gzip, $output, $error_zip); |
|
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | if ($error == 0 && $error_zip == 0) { |
| 512 | - $this->system_model->backup_insert ( $add_array ); |
|
| 513 | - echo json_encode ( array ( |
|
| 514 | - "SUCCESS" => $add_array ['backup_name'] . " backup exported successfully!" |
|
| 515 | - ) ); |
|
| 512 | + $this->system_model->backup_insert($add_array); |
|
| 513 | + echo json_encode(array( |
|
| 514 | + "SUCCESS" => $add_array ['backup_name']." backup exported successfully!" |
|
| 515 | + )); |
|
| 516 | 516 | exit (); |
| 517 | 517 | } else { |
| 518 | 518 | echo 'An error occur when the system tried to backup of the database. Please check yours system settings for the backup section'; |
@@ -522,108 +522,108 @@ discard block |
||
| 522 | 522 | } |
| 523 | 523 | } |
| 524 | 524 | function database_restore() { |
| 525 | - $data ['page_title'] = gettext ( 'Database Restore' ); |
|
| 526 | - $data ['grid_fields'] = $this->system_form->build_backupdastabase_list (); |
|
| 527 | - $data ["grid_buttons"] = $this->system_form->build_backupdastabase_buttons (); |
|
| 528 | - $this->load->view ( 'view_database_list', $data ); |
|
| 525 | + $data ['page_title'] = gettext('Database Restore'); |
|
| 526 | + $data ['grid_fields'] = $this->system_form->build_backupdastabase_list(); |
|
| 527 | + $data ["grid_buttons"] = $this->system_form->build_backupdastabase_buttons(); |
|
| 528 | + $this->load->view('view_database_list', $data); |
|
| 529 | 529 | } |
| 530 | 530 | function database_restore_json() { |
| 531 | - $json_data = array (); |
|
| 532 | - $count_all = $this->system_model->getbackup_list ( false, "", "" ); |
|
| 533 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
| 531 | + $json_data = array(); |
|
| 532 | + $count_all = $this->system_model->getbackup_list(false, "", ""); |
|
| 533 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
| 534 | 534 | $json_data = $paging_data ["json_paging"]; |
| 535 | 535 | |
| 536 | - $query = $this->system_model->getbackup_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] ); |
|
| 537 | - $grid_fields = json_decode ( $this->system_form->build_backupdastabase_list () ); |
|
| 538 | - $json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields ); |
|
| 536 | + $query = $this->system_model->getbackup_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]); |
|
| 537 | + $grid_fields = json_decode($this->system_form->build_backupdastabase_list()); |
|
| 538 | + $json_data ['rows'] = $this->form->build_grid($query, $grid_fields); |
|
| 539 | 539 | |
| 540 | - echo json_encode ( $json_data ); |
|
| 540 | + echo json_encode($json_data); |
|
| 541 | 541 | exit (); |
| 542 | 542 | } |
| 543 | 543 | function database_restore_one($id = '') { |
| 544 | - $result = $this->system_model->get_backup_data ( $id ); |
|
| 545 | - $result_array = $result->result_array (); |
|
| 546 | - if ($result->num_rows () > 0) { |
|
| 544 | + $result = $this->system_model->get_backup_data($id); |
|
| 545 | + $result_array = $result->result_array(); |
|
| 546 | + if ($result->num_rows() > 0) { |
|
| 547 | 547 | $db_name = $this->db->database; |
| 548 | 548 | $db_username = $this->db->username; |
| 549 | 549 | $db_password = $this->db->password; |
| 550 | 550 | $db_hostname = $this->db->hostname; |
| 551 | - $path = DATABASE_DIRECTORY . $result_array [0] ['path']; |
|
| 552 | - if (file_exists ( $path )) { |
|
| 553 | - if (substr ( $path, - 3 ) == '.gz') { |
|
| 554 | - $GUNZIP_EXE = $this->config->item ( 'gunzip-path' ); |
|
| 555 | - $run_gzip = $GUNZIP_EXE . " < " . $path . " | "; |
|
| 551 | + $path = DATABASE_DIRECTORY.$result_array [0] ['path']; |
|
| 552 | + if (file_exists($path)) { |
|
| 553 | + if (substr($path, - 3) == '.gz') { |
|
| 554 | + $GUNZIP_EXE = $this->config->item('gunzip-path'); |
|
| 555 | + $run_gzip = $GUNZIP_EXE." < ".$path." | "; |
|
| 556 | 556 | } |
| 557 | 557 | $MYSQL = "/usr/bin/mysql"; |
| 558 | - $run_restore = $run_gzip . $MYSQL . " -h" . $db_hostname . " -u" . $db_username . " -p" . $db_password . " " . $db_name; |
|
| 559 | - exec ( $run_restore ); |
|
| 560 | - $this->session->set_flashdata ( 'astpp_errormsg', 'Database Restore successfully.' ); |
|
| 561 | - redirect ( base_url () . 'systems/database_restore/' ); |
|
| 558 | + $run_restore = $run_gzip.$MYSQL." -h".$db_hostname." -u".$db_username." -p".$db_password." ".$db_name; |
|
| 559 | + exec($run_restore); |
|
| 560 | + $this->session->set_flashdata('astpp_errormsg', 'Database Restore successfully.'); |
|
| 561 | + redirect(base_url().'systems/database_restore/'); |
|
| 562 | 562 | } else { |
| 563 | - $this->session->set_flashdata ( 'astpp_notification', 'File not exists!' ); |
|
| 564 | - redirect ( base_url () . 'systems/database_restore/' ); |
|
| 563 | + $this->session->set_flashdata('astpp_notification', 'File not exists!'); |
|
| 564 | + redirect(base_url().'systems/database_restore/'); |
|
| 565 | 565 | } |
| 566 | 566 | } |
| 567 | - redirect ( base_url () . 'systems/database_restore/' ); |
|
| 567 | + redirect(base_url().'systems/database_restore/'); |
|
| 568 | 568 | } |
| 569 | 569 | function database_download($id = '') { |
| 570 | - $result = $this->system_model->get_backup_data ( $id ); |
|
| 571 | - $result_array = $result->result_array (); |
|
| 572 | - if ($result->num_rows () > 0) { |
|
| 573 | - $path = DATABASE_DIRECTORY. $result_array [0] ['path']; |
|
| 574 | - $filename = basename ( $path ); |
|
| 575 | - $len = filesize ( $path ); |
|
| 570 | + $result = $this->system_model->get_backup_data($id); |
|
| 571 | + $result_array = $result->result_array(); |
|
| 572 | + if ($result->num_rows() > 0) { |
|
| 573 | + $path = DATABASE_DIRECTORY.$result_array [0] ['path']; |
|
| 574 | + $filename = basename($path); |
|
| 575 | + $len = filesize($path); |
|
| 576 | 576 | |
| 577 | - header ( "Content-Encoding: binary" ); |
|
| 578 | - header ( "Content-Type: application/octet-stream" ); |
|
| 579 | - header ( "content-length: " . $len ); |
|
| 580 | - header ( "content-disposition: attachment; filename=" . $filename ); |
|
| 581 | - header ( "Expires: 0" ); |
|
| 582 | - header ( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); |
|
| 583 | - header ( "Cache-Control: private" ); |
|
| 584 | - header ( "Pragma: public" ); |
|
| 585 | - ob_clean (); |
|
| 586 | - $fp = fopen ( $path, "r" ); |
|
| 587 | - fpassthru ( $fp ); |
|
| 577 | + header("Content-Encoding: binary"); |
|
| 578 | + header("Content-Type: application/octet-stream"); |
|
| 579 | + header("content-length: ".$len); |
|
| 580 | + header("content-disposition: attachment; filename=".$filename); |
|
| 581 | + header("Expires: 0"); |
|
| 582 | + header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
|
| 583 | + header("Cache-Control: private"); |
|
| 584 | + header("Pragma: public"); |
|
| 585 | + ob_clean(); |
|
| 586 | + $fp = fopen($path, "r"); |
|
| 587 | + fpassthru($fp); |
|
| 588 | 588 | exit (); |
| 589 | 589 | } |
| 590 | 590 | } |
| 591 | 591 | function database_import() { |
| 592 | - $data ['page_title'] = gettext ( 'Import Database' ); |
|
| 593 | - $this->load->view ( 'view_import_database', $data ); |
|
| 592 | + $data ['page_title'] = gettext('Import Database'); |
|
| 593 | + $this->load->view('view_import_database', $data); |
|
| 594 | 594 | } |
| 595 | 595 | function database_import_file() { |
| 596 | 596 | $filename = $_POST ['fname']; |
| 597 | - $upload_greeting_file = strtolower ( $_FILES ['userfile'] ['name'] ); |
|
| 598 | - $db_file = explode ( ".", $upload_greeting_file ); |
|
| 599 | - $last_key = array_pop ( $db_file ); |
|
| 597 | + $upload_greeting_file = strtolower($_FILES ['userfile'] ['name']); |
|
| 598 | + $db_file = explode(".", $upload_greeting_file); |
|
| 599 | + $last_key = array_pop($db_file); |
|
| 600 | 600 | if ($last_key == 'csv' || $last_key == 'tar' || $last_key == 'sql') { |
| 601 | - $target_path = basename ( $_FILES ['userfile'] ['name'] ); |
|
| 602 | - move_uploaded_file ( $_FILES ["userfile"] ["tmp_name"], $target_path ); |
|
| 601 | + $target_path = basename($_FILES ['userfile'] ['name']); |
|
| 602 | + move_uploaded_file($_FILES ["userfile"] ["tmp_name"], $target_path); |
|
| 603 | 603 | |
| 604 | - $query = $this->system_model->import_database ( $filename, $_FILES ['userfile'] ['name'] ); |
|
| 605 | - $this->session->set_flashdata ( 'astpp_errormsg', "The file " . basename ( $_FILES ['userfile'] ['name'] ) . " has been uploaded" ); |
|
| 606 | - redirect ( base_url () . "systems/database_restore/" ); |
|
| 604 | + $query = $this->system_model->import_database($filename, $_FILES ['userfile'] ['name']); |
|
| 605 | + $this->session->set_flashdata('astpp_errormsg', "The file ".basename($_FILES ['userfile'] ['name'])." has been uploaded"); |
|
| 606 | + redirect(base_url()."systems/database_restore/"); |
|
| 607 | 607 | } else { |
| 608 | - $this->session->set_flashdata ( 'astpp_notification', "There is a some issue or invalid file format." ); |
|
| 609 | - redirect ( base_url () . "systems/database_restore/" ); |
|
| 608 | + $this->session->set_flashdata('astpp_notification', "There is a some issue or invalid file format."); |
|
| 609 | + redirect(base_url()."systems/database_restore/"); |
|
| 610 | 610 | } |
| 611 | 611 | } |
| 612 | 612 | function database_delete($id) { |
| 613 | - $where = array ( |
|
| 613 | + $where = array( |
|
| 614 | 614 | "id" => $id |
| 615 | 615 | ); |
| 616 | - $this->db->where ( $where ); |
|
| 617 | - $this->db->delete ( "backup_database" ); |
|
| 618 | - $this->session->set_flashdata ( 'astpp_errormsg', 'Database backup deleted successfully.' ); |
|
| 619 | - redirect ( base_url () . 'systems/database_restore/' ); |
|
| 616 | + $this->db->where($where); |
|
| 617 | + $this->db->delete("backup_database"); |
|
| 618 | + $this->session->set_flashdata('astpp_errormsg', 'Database backup deleted successfully.'); |
|
| 619 | + redirect(base_url().'systems/database_restore/'); |
|
| 620 | 620 | return true; |
| 621 | 621 | } |
| 622 | 622 | function database_backup_delete_multiple() { |
| 623 | - $ids = $this->input->post ( "selected_ids", true ); |
|
| 623 | + $ids = $this->input->post("selected_ids", true); |
|
| 624 | 624 | $where = "id IN ($ids)"; |
| 625 | - $this->db->where ( $where ); |
|
| 626 | - echo $this->db->delete ( "backup_database" ); |
|
| 625 | + $this->db->where($where); |
|
| 626 | + echo $this->db->delete("backup_database"); |
|
| 627 | 627 | } |
| 628 | 628 | } |
| 629 | 629 | |
@@ -20,22 +20,22 @@ discard block |
||
| 20 | 20 | // You should have received a copy of the GNU Affero General Public License |
| 21 | 21 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | 22 | // ############################################################################## |
| 23 | -if (! defined ( 'BASEPATH' )) |
|
| 24 | - exit ( 'No direct script access allowed' ); |
|
| 23 | +if ( ! defined('BASEPATH')) |
|
| 24 | + exit ('No direct script access allowed'); |
|
| 25 | 25 | class System_form { |
| 26 | 26 | function get_template_form_fields() { |
| 27 | - $form ['forms'] = array ( |
|
| 28 | - base_url () . 'systems/template_save/', |
|
| 29 | - array ( |
|
| 27 | + $form ['forms'] = array( |
|
| 28 | + base_url().'systems/template_save/', |
|
| 29 | + array( |
|
| 30 | 30 | "template_form", |
| 31 | 31 | "name" => "template_form" |
| 32 | 32 | ) |
| 33 | 33 | ); |
| 34 | - $form ['Email Template'] = array ( |
|
| 35 | - array ( |
|
| 34 | + $form ['Email Template'] = array( |
|
| 35 | + array( |
|
| 36 | 36 | '', |
| 37 | 37 | 'HIDDEN', |
| 38 | - array ( |
|
| 38 | + array( |
|
| 39 | 39 | 'name' => 'id' |
| 40 | 40 | ), |
| 41 | 41 | '', |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | '', |
| 44 | 44 | '' |
| 45 | 45 | ), |
| 46 | - array ( |
|
| 47 | - gettext ( ' Name' ), |
|
| 46 | + array( |
|
| 47 | + gettext(' Name'), |
|
| 48 | 48 | 'INPUT', |
| 49 | - array ( |
|
| 49 | + array( |
|
| 50 | 50 | 'name' => 'name', |
| 51 | 51 | 'size' => '20', |
| 52 | 52 | 'readonly' => true, |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | 'tOOL TIP', |
| 57 | 57 | '' |
| 58 | 58 | ), |
| 59 | - array ( |
|
| 60 | - gettext ( 'Subject' ), |
|
| 59 | + array( |
|
| 60 | + gettext('Subject'), |
|
| 61 | 61 | 'INPUT', |
| 62 | - array ( |
|
| 62 | + array( |
|
| 63 | 63 | 'name' => 'subject', |
| 64 | 64 | 'size' => '20', |
| 65 | 65 | 'class' => "text field medium" |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | 'tOOL TIP', |
| 69 | 69 | '' |
| 70 | 70 | ), |
| 71 | - array ( |
|
| 72 | - gettext ( 'Body' ), |
|
| 71 | + array( |
|
| 72 | + gettext('Body'), |
|
| 73 | 73 | 'TEXTAREA', |
| 74 | - array ( |
|
| 74 | + array( |
|
| 75 | 75 | 'name' => 'template', |
| 76 | 76 | 'id' => 'template', |
| 77 | 77 | 'size' => '20', |
@@ -82,17 +82,17 @@ discard block |
||
| 82 | 82 | '' |
| 83 | 83 | ) |
| 84 | 84 | ); |
| 85 | - $form ['button_cancel'] = array ( |
|
| 85 | + $form ['button_cancel'] = array( |
|
| 86 | 86 | 'name' => 'action', |
| 87 | - 'content' => gettext ( 'Cancel' ), |
|
| 87 | + 'content' => gettext('Cancel'), |
|
| 88 | 88 | 'value' => 'cancel', |
| 89 | 89 | 'type' => 'button', |
| 90 | 90 | 'class' => 'btn btn-line-sky margin-x-10', |
| 91 | 91 | 'onclick' => 'return redirect_page(\'systems/template/\')' |
| 92 | 92 | ); |
| 93 | - $form ['button_save'] = array ( |
|
| 93 | + $form ['button_save'] = array( |
|
| 94 | 94 | 'name' => 'action', |
| 95 | - 'content' => gettext ( 'Save' ), |
|
| 95 | + 'content' => gettext('Save'), |
|
| 96 | 96 | 'value' => 'save', |
| 97 | 97 | 'type' => 'submit', |
| 98 | 98 | 'class' => 'btn btn-line-parrot' |
@@ -101,18 +101,18 @@ discard block |
||
| 101 | 101 | return $form; |
| 102 | 102 | } |
| 103 | 103 | function get_template_search_form() { |
| 104 | - $form ['forms'] = array ( |
|
| 104 | + $form ['forms'] = array( |
|
| 105 | 105 | "", |
| 106 | - array ( |
|
| 106 | + array( |
|
| 107 | 107 | 'id' => "template_search" |
| 108 | 108 | ) |
| 109 | 109 | ); |
| 110 | - $form ['Search'] = array ( |
|
| 110 | + $form ['Search'] = array( |
|
| 111 | 111 | |
| 112 | - array ( |
|
| 113 | - gettext ( 'Name' ), |
|
| 112 | + array( |
|
| 113 | + gettext('Name'), |
|
| 114 | 114 | 'INPUT', |
| 115 | - array ( |
|
| 115 | + array( |
|
| 116 | 116 | 'name' => 'name[name]', |
| 117 | 117 | '', |
| 118 | 118 | 'size' => '20', |
@@ -128,10 +128,10 @@ discard block |
||
| 128 | 128 | 'search_string_type', |
| 129 | 129 | '' |
| 130 | 130 | ), |
| 131 | - array ( |
|
| 132 | - gettext ( 'Subject' ), |
|
| 131 | + array( |
|
| 132 | + gettext('Subject'), |
|
| 133 | 133 | 'INPUT', |
| 134 | - array ( |
|
| 134 | + array( |
|
| 135 | 135 | 'name' => 'subject[subject]', |
| 136 | 136 | '', |
| 137 | 137 | 'size' => '20', |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | 'search_string_type', |
| 148 | 148 | '' |
| 149 | 149 | ), |
| 150 | - array ( |
|
| 150 | + array( |
|
| 151 | 151 | '', |
| 152 | 152 | 'HIDDEN', |
| 153 | 153 | 'ajax_search', |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | '', |
| 157 | 157 | '' |
| 158 | 158 | ), |
| 159 | - array ( |
|
| 159 | + array( |
|
| 160 | 160 | '', |
| 161 | 161 | 'HIDDEN', |
| 162 | 162 | 'advance_search', |
@@ -166,18 +166,18 @@ discard block |
||
| 166 | 166 | '' |
| 167 | 167 | ) |
| 168 | 168 | ); |
| 169 | - $form ['button_search'] = array ( |
|
| 169 | + $form ['button_search'] = array( |
|
| 170 | 170 | 'name' => 'action', |
| 171 | 171 | 'id' => "template_search_btn", |
| 172 | - 'content' => gettext ( 'Search' ), |
|
| 172 | + 'content' => gettext('Search'), |
|
| 173 | 173 | 'value' => 'save', |
| 174 | 174 | 'type' => 'button', |
| 175 | 175 | 'class' => 'btn btn-line-parrot pull-right' |
| 176 | 176 | ); |
| 177 | - $form ['button_reset'] = array ( |
|
| 177 | + $form ['button_reset'] = array( |
|
| 178 | 178 | 'name' => 'action', |
| 179 | 179 | 'id' => "id_reset", |
| 180 | - 'content' => gettext ( 'Clear' ), |
|
| 180 | + 'content' => gettext('Clear'), |
|
| 181 | 181 | 'value' => 'cancel', |
| 182 | 182 | 'type' => 'reset', |
| 183 | 183 | 'class' => 'btn btn-line-sky pull-right margin-x-10' |
@@ -185,18 +185,18 @@ discard block |
||
| 185 | 185 | return $form; |
| 186 | 186 | } |
| 187 | 187 | function get_configuration_form_fields() { |
| 188 | - $form ['forms'] = array ( |
|
| 189 | - base_url () . 'systems/configuration_save/', |
|
| 190 | - array ( |
|
| 188 | + $form ['forms'] = array( |
|
| 189 | + base_url().'systems/configuration_save/', |
|
| 190 | + array( |
|
| 191 | 191 | "id" => "config_form", |
| 192 | 192 | "name" => "config_form" |
| 193 | 193 | ) |
| 194 | 194 | ); |
| 195 | - $form ['Edit Settings '] = array ( |
|
| 196 | - array ( |
|
| 195 | + $form ['Edit Settings '] = array( |
|
| 196 | + array( |
|
| 197 | 197 | '', |
| 198 | 198 | 'HIDDEN', |
| 199 | - array ( |
|
| 199 | + array( |
|
| 200 | 200 | 'name' => 'id' |
| 201 | 201 | ), |
| 202 | 202 | '', |
@@ -204,10 +204,10 @@ discard block |
||
| 204 | 204 | '', |
| 205 | 205 | '' |
| 206 | 206 | ), |
| 207 | - array ( |
|
| 208 | - gettext ( 'Name' ), |
|
| 207 | + array( |
|
| 208 | + gettext('Name'), |
|
| 209 | 209 | 'INPUT', |
| 210 | - array ( |
|
| 210 | + array( |
|
| 211 | 211 | 'name' => 'name', |
| 212 | 212 | 'size' => '20', |
| 213 | 213 | 'readonly' => true, |
@@ -217,10 +217,10 @@ discard block |
||
| 217 | 217 | 'tOOL TIP', |
| 218 | 218 | '' |
| 219 | 219 | ), |
| 220 | - array ( |
|
| 221 | - gettext ( 'Value' ), |
|
| 220 | + array( |
|
| 221 | + gettext('Value'), |
|
| 222 | 222 | 'INPUT', |
| 223 | - array ( |
|
| 223 | + array( |
|
| 224 | 224 | 'name' => 'value', |
| 225 | 225 | 'size' => '20', |
| 226 | 226 | 'class' => "text field medium" |
@@ -229,10 +229,10 @@ discard block |
||
| 229 | 229 | 'tOOL TIP', |
| 230 | 230 | '' |
| 231 | 231 | ), |
| 232 | - array ( |
|
| 233 | - gettext ( 'Comment' ), |
|
| 232 | + array( |
|
| 233 | + gettext('Comment'), |
|
| 234 | 234 | 'INPUT', |
| 235 | - array ( |
|
| 235 | + array( |
|
| 236 | 236 | 'name' => 'comment', |
| 237 | 237 | 'size' => '20', |
| 238 | 238 | 'class' => "text field medium" |
@@ -243,17 +243,17 @@ discard block |
||
| 243 | 243 | ) |
| 244 | 244 | ); |
| 245 | 245 | |
| 246 | - $form ['button_cancel'] = array ( |
|
| 246 | + $form ['button_cancel'] = array( |
|
| 247 | 247 | 'name' => 'action', |
| 248 | - 'content' => gettext ( 'Cancel' ), |
|
| 248 | + 'content' => gettext('Cancel'), |
|
| 249 | 249 | 'value' => 'cancel', |
| 250 | 250 | 'type' => 'button', |
| 251 | 251 | 'class' => 'btn btn-line-sky margin-x-10', |
| 252 | 252 | 'onclick' => 'return redirect_page(\'NULL\')' |
| 253 | 253 | ); |
| 254 | - $form ['button_save'] = array ( |
|
| 254 | + $form ['button_save'] = array( |
|
| 255 | 255 | 'name' => 'action', |
| 256 | - 'content' => gettext ( 'Save' ), |
|
| 256 | + 'content' => gettext('Save'), |
|
| 257 | 257 | 'value' => 'save', |
| 258 | 258 | 'id' => 'submit', |
| 259 | 259 | 'type' => 'button', |
@@ -263,18 +263,18 @@ discard block |
||
| 263 | 263 | return $form; |
| 264 | 264 | } |
| 265 | 265 | function get_configuration_search_form() { |
| 266 | - $form ['forms'] = array ( |
|
| 266 | + $form ['forms'] = array( |
|
| 267 | 267 | "", |
| 268 | - array ( |
|
| 268 | + array( |
|
| 269 | 269 | 'id' => "configuration_search" |
| 270 | 270 | ) |
| 271 | 271 | ); |
| 272 | - $form ['Search'] = array ( |
|
| 272 | + $form ['Search'] = array( |
|
| 273 | 273 | |
| 274 | - array ( |
|
| 275 | - gettext ( 'Name' ), |
|
| 274 | + array( |
|
| 275 | + gettext('Name'), |
|
| 276 | 276 | 'INPUT', |
| 277 | - array ( |
|
| 277 | + array( |
|
| 278 | 278 | 'name' => 'name[name]', |
| 279 | 279 | '', |
| 280 | 280 | 'size' => '20', |
@@ -290,10 +290,10 @@ discard block |
||
| 290 | 290 | 'search_string_type', |
| 291 | 291 | '' |
| 292 | 292 | ), |
| 293 | - array ( |
|
| 294 | - gettext ( 'Value' ), |
|
| 293 | + array( |
|
| 294 | + gettext('Value'), |
|
| 295 | 295 | 'INPUT', |
| 296 | - array ( |
|
| 296 | + array( |
|
| 297 | 297 | 'name' => 'value[value]', |
| 298 | 298 | '', |
| 299 | 299 | 'size' => '20', |
@@ -309,10 +309,10 @@ discard block |
||
| 309 | 309 | 'search_string_type', |
| 310 | 310 | '' |
| 311 | 311 | ), |
| 312 | - array ( |
|
| 313 | - gettext ( 'Description' ), |
|
| 312 | + array( |
|
| 313 | + gettext('Description'), |
|
| 314 | 314 | 'INPUT', |
| 315 | - array ( |
|
| 315 | + array( |
|
| 316 | 316 | 'name' => 'comment[comment]', |
| 317 | 317 | '', |
| 318 | 318 | 'size' => '20', |
@@ -328,8 +328,8 @@ discard block |
||
| 328 | 328 | 'search_string_type', |
| 329 | 329 | '' |
| 330 | 330 | ), |
| 331 | - array ( |
|
| 332 | - gettext ( 'Group' ), |
|
| 331 | + array( |
|
| 332 | + gettext('Group'), |
|
| 333 | 333 | 'group_title', |
| 334 | 334 | 'SELECT', |
| 335 | 335 | '', |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | 'group_by', |
| 346 | 346 | 'group_title' |
| 347 | 347 | ), |
| 348 | - array ( |
|
| 348 | + array( |
|
| 349 | 349 | '', |
| 350 | 350 | 'HIDDEN', |
| 351 | 351 | 'ajax_search', |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | '', |
| 355 | 355 | '' |
| 356 | 356 | ), |
| 357 | - array ( |
|
| 357 | + array( |
|
| 358 | 358 | '', |
| 359 | 359 | 'HIDDEN', |
| 360 | 360 | 'advance_search', |
@@ -364,18 +364,18 @@ discard block |
||
| 364 | 364 | '' |
| 365 | 365 | ) |
| 366 | 366 | ); |
| 367 | - $form ['button_search'] = array ( |
|
| 367 | + $form ['button_search'] = array( |
|
| 368 | 368 | 'name' => 'action', |
| 369 | 369 | 'id' => "configuration_search_btn", |
| 370 | - 'content' => gettext ( 'Search' ), |
|
| 370 | + 'content' => gettext('Search'), |
|
| 371 | 371 | 'value' => 'save', |
| 372 | 372 | 'type' => 'button', |
| 373 | 373 | 'class' => 'btn btn-line-parrot pull-right' |
| 374 | 374 | ); |
| 375 | - $form ['button_reset'] = array ( |
|
| 375 | + $form ['button_reset'] = array( |
|
| 376 | 376 | 'name' => 'action', |
| 377 | 377 | 'id' => "id_reset", |
| 378 | - 'content' => gettext ( 'Clear' ), |
|
| 378 | + 'content' => gettext('Clear'), |
|
| 379 | 379 | 'value' => 'cancel', |
| 380 | 380 | 'type' => 'reset', |
| 381 | 381 | 'class' => 'btn btn-line-sky pull-right margin-x-10' |
@@ -383,63 +383,63 @@ discard block |
||
| 383 | 383 | return $form; |
| 384 | 384 | } |
| 385 | 385 | function build_system_list_for_admin() { |
| 386 | - $grid_field_arr = json_encode ( array ( |
|
| 387 | - array ( |
|
| 388 | - gettext ( "Name" ), |
|
| 386 | + $grid_field_arr = json_encode(array( |
|
| 387 | + array( |
|
| 388 | + gettext("Name"), |
|
| 389 | 389 | "190", |
| 390 | 390 | "name", |
| 391 | 391 | "", |
| 392 | 392 | "", |
| 393 | 393 | "" |
| 394 | 394 | ), |
| 395 | - array ( |
|
| 396 | - gettext ( "Value" ), |
|
| 395 | + array( |
|
| 396 | + gettext("Value"), |
|
| 397 | 397 | "190", |
| 398 | 398 | "value", |
| 399 | 399 | "", |
| 400 | 400 | "", |
| 401 | 401 | "" |
| 402 | 402 | ), |
| 403 | - array ( |
|
| 404 | - gettext ( "Description" ), |
|
| 403 | + array( |
|
| 404 | + gettext("Description"), |
|
| 405 | 405 | "320", |
| 406 | 406 | "comment", |
| 407 | 407 | "", |
| 408 | 408 | "", |
| 409 | 409 | "" |
| 410 | 410 | ), |
| 411 | - array ( |
|
| 412 | - gettext ( "Group" ), |
|
| 411 | + array( |
|
| 412 | + gettext("Group"), |
|
| 413 | 413 | "120", |
| 414 | 414 | "group_title", |
| 415 | 415 | "", |
| 416 | 416 | "", |
| 417 | 417 | "" |
| 418 | 418 | ), |
| 419 | - array ( |
|
| 420 | - gettext ( "Action" ), |
|
| 419 | + array( |
|
| 420 | + gettext("Action"), |
|
| 421 | 421 | "442", |
| 422 | 422 | "", |
| 423 | 423 | "", |
| 424 | 424 | "", |
| 425 | - array ( |
|
| 426 | - "EDIT" => array ( |
|
| 425 | + array( |
|
| 426 | + "EDIT" => array( |
|
| 427 | 427 | "url" => "systems/configuration_edit/", |
| 428 | 428 | "mode" => "popup" |
| 429 | 429 | ) |
| 430 | 430 | ) |
| 431 | 431 | ) |
| 432 | - ) ); |
|
| 432 | + )); |
|
| 433 | 433 | return $grid_field_arr; |
| 434 | 434 | } |
| 435 | 435 | function build_grid_buttons() { |
| 436 | - $buttons_json = json_encode ( array () ); |
|
| 436 | + $buttons_json = json_encode(array()); |
|
| 437 | 437 | return $buttons_json; |
| 438 | 438 | } |
| 439 | 439 | function build_template_list_for_admin() { |
| 440 | - $grid_field_arr = json_encode ( array ( |
|
| 441 | - array ( |
|
| 442 | - gettext ( "Name" ), |
|
| 440 | + $grid_field_arr = json_encode(array( |
|
| 441 | + array( |
|
| 442 | + gettext("Name"), |
|
| 443 | 443 | "425", |
| 444 | 444 | "name", |
| 445 | 445 | "", |
@@ -449,8 +449,8 @@ discard block |
||
| 449 | 449 | "true", |
| 450 | 450 | "center" |
| 451 | 451 | ), |
| 452 | - array ( |
|
| 453 | - gettext ( "Subject" ), |
|
| 452 | + array( |
|
| 453 | + gettext("Subject"), |
|
| 454 | 454 | "650", |
| 455 | 455 | "subject", |
| 456 | 456 | "", |
@@ -460,28 +460,28 @@ discard block |
||
| 460 | 460 | "true", |
| 461 | 461 | "center" |
| 462 | 462 | ), |
| 463 | - array ( |
|
| 464 | - gettext ( "Action" ), |
|
| 463 | + array( |
|
| 464 | + gettext("Action"), |
|
| 465 | 465 | "200", |
| 466 | 466 | "", |
| 467 | 467 | "", |
| 468 | 468 | "", |
| 469 | - array ( |
|
| 470 | - "EDIT" => array ( |
|
| 469 | + array( |
|
| 470 | + "EDIT" => array( |
|
| 471 | 471 | "url" => "systems/template_edit/", |
| 472 | 472 | "mode" => "single" |
| 473 | 473 | ) |
| 474 | 474 | ) |
| 475 | 475 | ) |
| 476 | - ) ); |
|
| 476 | + )); |
|
| 477 | 477 | return $grid_field_arr; |
| 478 | 478 | } |
| 479 | 479 | function build_country_list_for_admin() { |
| 480 | 480 | $action = 'systems/country_list_edit/'; |
| 481 | 481 | $action_remove = 'systems/country_remove/'; |
| 482 | 482 | $mode = "popup"; |
| 483 | - $grid_field_arr = json_encode ( array ( |
|
| 484 | - array ( |
|
| 483 | + $grid_field_arr = json_encode(array( |
|
| 484 | + array( |
|
| 485 | 485 | "<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", |
| 486 | 486 | "50", |
| 487 | 487 | "", |
@@ -492,8 +492,8 @@ discard block |
||
| 492 | 492 | "false", |
| 493 | 493 | "center" |
| 494 | 494 | ), |
| 495 | - array ( |
|
| 496 | - gettext ( "Name" ), |
|
| 495 | + array( |
|
| 496 | + gettext("Name"), |
|
| 497 | 497 | "705", |
| 498 | 498 | "country", |
| 499 | 499 | "", |
@@ -503,56 +503,56 @@ discard block |
||
| 503 | 503 | "true", |
| 504 | 504 | "center" |
| 505 | 505 | ), |
| 506 | - array ( |
|
| 507 | - gettext ( "Action" ), |
|
| 506 | + array( |
|
| 507 | + gettext("Action"), |
|
| 508 | 508 | "100", |
| 509 | 509 | "", |
| 510 | 510 | "", |
| 511 | 511 | "", |
| 512 | - array ( |
|
| 513 | - "EDIT" => array ( |
|
| 512 | + array( |
|
| 513 | + "EDIT" => array( |
|
| 514 | 514 | "url" => "$action", |
| 515 | 515 | "mode" => "$mode" |
| 516 | 516 | ), |
| 517 | - "DELETE" => array ( |
|
| 517 | + "DELETE" => array( |
|
| 518 | 518 | "url" => "$action_remove", |
| 519 | 519 | "mode" => "single" |
| 520 | 520 | ) |
| 521 | 521 | ) |
| 522 | 522 | ) |
| 523 | - ) ); |
|
| 523 | + )); |
|
| 524 | 524 | return $grid_field_arr; |
| 525 | 525 | } |
| 526 | 526 | function build_admin_grid_buttons() { |
| 527 | - $buttons_json = json_encode ( array ( |
|
| 528 | - array ( |
|
| 529 | - gettext ( "Create" ), |
|
| 527 | + $buttons_json = json_encode(array( |
|
| 528 | + array( |
|
| 529 | + gettext("Create"), |
|
| 530 | 530 | "btn btn-line-warning btn", |
| 531 | 531 | "fa fa-plus-circle fa-lg", |
| 532 | 532 | "button_action", |
| 533 | 533 | "systems/country_add/", |
| 534 | 534 | "popup" |
| 535 | 535 | ), |
| 536 | - array ( |
|
| 537 | - gettext ( "Delete" ), |
|
| 536 | + array( |
|
| 537 | + gettext("Delete"), |
|
| 538 | 538 | "btn btn-line-danger", |
| 539 | 539 | "fa fa-times-circle fa-lg", |
| 540 | 540 | "button_action", |
| 541 | 541 | "systems/country_delete_multiple" |
| 542 | 542 | ) |
| 543 | - ) ); |
|
| 543 | + )); |
|
| 544 | 544 | return $buttons_json; |
| 545 | 545 | } |
| 546 | 546 | function get_search_country_form() { |
| 547 | - $form ['forms'] = array ( |
|
| 547 | + $form ['forms'] = array( |
|
| 548 | 548 | "", |
| 549 | - array ( |
|
| 549 | + array( |
|
| 550 | 550 | 'id' => "country_search" |
| 551 | 551 | ) |
| 552 | 552 | ); |
| 553 | - $form ['Search'] = array ( |
|
| 554 | - array ( |
|
| 555 | - gettext ( 'Name' ), |
|
| 553 | + $form ['Search'] = array( |
|
| 554 | + array( |
|
| 555 | + gettext('Name'), |
|
| 556 | 556 | 'id', |
| 557 | 557 | 'SELECT', |
| 558 | 558 | '', |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | '', |
| 567 | 567 | '' |
| 568 | 568 | ), |
| 569 | - array ( |
|
| 569 | + array( |
|
| 570 | 570 | '', |
| 571 | 571 | 'HIDDEN', |
| 572 | 572 | 'ajax_search', |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | '', |
| 576 | 576 | '' |
| 577 | 577 | ), |
| 578 | - array ( |
|
| 578 | + array( |
|
| 579 | 579 | '', |
| 580 | 580 | 'HIDDEN', |
| 581 | 581 | 'advance_search', |
@@ -587,18 +587,18 @@ discard block |
||
| 587 | 587 | ) |
| 588 | 588 | ; |
| 589 | 589 | |
| 590 | - $form ['button_search'] = array ( |
|
| 590 | + $form ['button_search'] = array( |
|
| 591 | 591 | 'name' => 'action', |
| 592 | 592 | 'id' => "country_search_btn", |
| 593 | - 'content' => gettext ( 'Search' ), |
|
| 593 | + 'content' => gettext('Search'), |
|
| 594 | 594 | 'value' => 'save', |
| 595 | 595 | 'type' => 'button', |
| 596 | 596 | 'class' => 'btn btn-line-parrot pull-right' |
| 597 | 597 | ); |
| 598 | - $form ['button_reset'] = array ( |
|
| 598 | + $form ['button_reset'] = array( |
|
| 599 | 599 | 'name' => 'action', |
| 600 | 600 | 'id' => "id_reset", |
| 601 | - 'content' => gettext ( 'Clear' ), |
|
| 601 | + 'content' => gettext('Clear'), |
|
| 602 | 602 | 'value' => 'cancel', |
| 603 | 603 | 'type' => 'reset', |
| 604 | 604 | 'class' => 'btn btn-line-sky pull-right margin-x-10' |
@@ -607,19 +607,19 @@ discard block |
||
| 607 | 607 | return $form; |
| 608 | 608 | } |
| 609 | 609 | function get_country_form_fields() { |
| 610 | - $form ['forms'] = array ( |
|
| 611 | - base_url () . 'systems/country_save/', |
|
| 612 | - array ( |
|
| 610 | + $form ['forms'] = array( |
|
| 611 | + base_url().'systems/country_save/', |
|
| 612 | + array( |
|
| 613 | 613 | 'id' => 'system_form', |
| 614 | 614 | 'method' => 'POST', |
| 615 | 615 | 'name' => 'system_form' |
| 616 | 616 | ) |
| 617 | 617 | ); |
| 618 | - $form ['Country List'] = array ( |
|
| 619 | - array ( |
|
| 618 | + $form ['Country List'] = array( |
|
| 619 | + array( |
|
| 620 | 620 | '', |
| 621 | 621 | 'HIDDEN', |
| 622 | - array ( |
|
| 622 | + array( |
|
| 623 | 623 | 'name' => 'id' |
| 624 | 624 | ), |
| 625 | 625 | '', |
@@ -627,10 +627,10 @@ discard block |
||
| 627 | 627 | '', |
| 628 | 628 | '' |
| 629 | 629 | ), |
| 630 | - array ( |
|
| 631 | - gettext ( 'Name' ), |
|
| 630 | + array( |
|
| 631 | + gettext('Name'), |
|
| 632 | 632 | 'INPUT', |
| 633 | - array ( |
|
| 633 | + array( |
|
| 634 | 634 | 'name' => 'country', |
| 635 | 635 | 'size' => '20', |
| 636 | 636 | 'class' => "text field medium" |
@@ -641,17 +641,17 @@ discard block |
||
| 641 | 641 | ) |
| 642 | 642 | ) |
| 643 | 643 | ; |
| 644 | - $form ['button_save'] = array ( |
|
| 644 | + $form ['button_save'] = array( |
|
| 645 | 645 | 'name' => 'action', |
| 646 | - 'content' => gettext ( 'Save' ), |
|
| 646 | + 'content' => gettext('Save'), |
|
| 647 | 647 | 'value' => 'save', |
| 648 | 648 | 'id' => 'submit', |
| 649 | 649 | 'type' => 'button', |
| 650 | 650 | 'class' => 'btn btn-line-parrot' |
| 651 | 651 | ); |
| 652 | - $form ['button_cancel'] = array ( |
|
| 652 | + $form ['button_cancel'] = array( |
|
| 653 | 653 | 'name' => 'action', |
| 654 | - 'content' => gettext ( 'Close' ), |
|
| 654 | + 'content' => gettext('Close'), |
|
| 655 | 655 | 'value' => 'cancel', |
| 656 | 656 | 'type' => 'button', |
| 657 | 657 | 'class' => 'btn btn-line-sky margin-x-10', |
@@ -664,8 +664,8 @@ discard block |
||
| 664 | 664 | $action_remove = 'systems/currency_remove/'; |
| 665 | 665 | $mode = "popup"; |
| 666 | 666 | |
| 667 | - $grid_field_arr = json_encode ( array ( |
|
| 668 | - array ( |
|
| 667 | + $grid_field_arr = json_encode(array( |
|
| 668 | + array( |
|
| 669 | 669 | "<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", |
| 670 | 670 | "70", |
| 671 | 671 | "", |
@@ -676,8 +676,8 @@ discard block |
||
| 676 | 676 | "false", |
| 677 | 677 | "center" |
| 678 | 678 | ), |
| 679 | - array ( |
|
| 680 | - gettext ( "Name" ), |
|
| 679 | + array( |
|
| 680 | + gettext("Name"), |
|
| 681 | 681 | "320", |
| 682 | 682 | "currencyname", |
| 683 | 683 | "", |
@@ -687,8 +687,8 @@ discard block |
||
| 687 | 687 | "true", |
| 688 | 688 | "center" |
| 689 | 689 | ), |
| 690 | - array ( |
|
| 691 | - gettext ( "Code" ), |
|
| 690 | + array( |
|
| 691 | + gettext("Code"), |
|
| 692 | 692 | "290", |
| 693 | 693 | "currency", |
| 694 | 694 | "", |
@@ -698,8 +698,8 @@ discard block |
||
| 698 | 698 | "true", |
| 699 | 699 | "center" |
| 700 | 700 | ), |
| 701 | - array ( |
|
| 702 | - gettext ( "Rate" ), |
|
| 701 | + array( |
|
| 702 | + gettext("Rate"), |
|
| 703 | 703 | "330", |
| 704 | 704 | "currencyrate", |
| 705 | 705 | "", |
@@ -709,39 +709,39 @@ discard block |
||
| 709 | 709 | "true", |
| 710 | 710 | "right" |
| 711 | 711 | ), |
| 712 | - array ( |
|
| 713 | - gettext ( "Action" ), |
|
| 712 | + array( |
|
| 713 | + gettext("Action"), |
|
| 714 | 714 | "265", |
| 715 | 715 | "", |
| 716 | 716 | "", |
| 717 | 717 | "", |
| 718 | - array ( |
|
| 719 | - "EDIT" => array ( |
|
| 718 | + array( |
|
| 719 | + "EDIT" => array( |
|
| 720 | 720 | "url" => "$action", |
| 721 | 721 | "mode" => "$mode" |
| 722 | 722 | ), |
| 723 | - "DELETE" => array ( |
|
| 723 | + "DELETE" => array( |
|
| 724 | 724 | "url" => "$action_remove", |
| 725 | 725 | "mode" => "single" |
| 726 | 726 | ) |
| 727 | 727 | ) |
| 728 | 728 | ) |
| 729 | - ) ); |
|
| 729 | + )); |
|
| 730 | 730 | return $grid_field_arr; |
| 731 | 731 | } |
| 732 | 732 | function get_search_currency_form() { |
| 733 | - $form ['forms'] = array ( |
|
| 733 | + $form ['forms'] = array( |
|
| 734 | 734 | "", |
| 735 | - array ( |
|
| 735 | + array( |
|
| 736 | 736 | 'id' => "currency_search" |
| 737 | 737 | ) |
| 738 | 738 | ); |
| 739 | - $form ['Search'] = array ( |
|
| 739 | + $form ['Search'] = array( |
|
| 740 | 740 | |
| 741 | - array ( |
|
| 742 | - gettext ( 'Name' ), |
|
| 741 | + array( |
|
| 742 | + gettext('Name'), |
|
| 743 | 743 | 'INPUT', |
| 744 | - array ( |
|
| 744 | + array( |
|
| 745 | 745 | 'name' => 'currencyname[currencyname]', |
| 746 | 746 | '', |
| 747 | 747 | 'size' => '20', |
@@ -757,10 +757,10 @@ discard block |
||
| 757 | 757 | 'search_string_type', |
| 758 | 758 | '' |
| 759 | 759 | ), |
| 760 | - array ( |
|
| 761 | - gettext ( 'Code' ), |
|
| 760 | + array( |
|
| 761 | + gettext('Code'), |
|
| 762 | 762 | 'INPUT', |
| 763 | - array ( |
|
| 763 | + array( |
|
| 764 | 764 | 'name' => 'currency[currency]', |
| 765 | 765 | '', |
| 766 | 766 | 'size' => '20', |
@@ -776,10 +776,10 @@ discard block |
||
| 776 | 776 | 'search_string_type', |
| 777 | 777 | '' |
| 778 | 778 | ), |
| 779 | - array ( |
|
| 780 | - gettext ( 'Rate' ), |
|
| 779 | + array( |
|
| 780 | + gettext('Rate'), |
|
| 781 | 781 | 'INPUT', |
| 782 | - array ( |
|
| 782 | + array( |
|
| 783 | 783 | 'name' => 'currencyrate[currencyrate]', |
| 784 | 784 | '', |
| 785 | 785 | 'size' => '20', |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | 'search_int_type', |
| 796 | 796 | '' |
| 797 | 797 | ), |
| 798 | - array ( |
|
| 798 | + array( |
|
| 799 | 799 | '', |
| 800 | 800 | 'HIDDEN', |
| 801 | 801 | 'ajax_search', |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | '', |
| 805 | 805 | '' |
| 806 | 806 | ), |
| 807 | - array ( |
|
| 807 | + array( |
|
| 808 | 808 | '', |
| 809 | 809 | 'HIDDEN', |
| 810 | 810 | 'advance_search', |
@@ -815,18 +815,18 @@ discard block |
||
| 815 | 815 | ) |
| 816 | 816 | ); |
| 817 | 817 | |
| 818 | - $form ['button_search'] = array ( |
|
| 818 | + $form ['button_search'] = array( |
|
| 819 | 819 | 'name' => 'action', |
| 820 | 820 | 'id' => "currency_search_btn", |
| 821 | - 'content' => gettext ( 'Search' ), |
|
| 821 | + 'content' => gettext('Search'), |
|
| 822 | 822 | 'value' => 'save', |
| 823 | 823 | 'type' => 'button', |
| 824 | 824 | 'class' => 'btn btn-line-parrot pull-right' |
| 825 | 825 | ); |
| 826 | - $form ['button_reset'] = array ( |
|
| 826 | + $form ['button_reset'] = array( |
|
| 827 | 827 | 'name' => 'action', |
| 828 | 828 | 'id' => "id_reset", |
| 829 | - 'content' => gettext ( 'Clear' ), |
|
| 829 | + 'content' => gettext('Clear'), |
|
| 830 | 830 | 'value' => 'cancel', |
| 831 | 831 | 'type' => 'reset', |
| 832 | 832 | 'class' => 'btn btn-line-sky pull-right margin-x-10' |
@@ -835,19 +835,19 @@ discard block |
||
| 835 | 835 | return $form; |
| 836 | 836 | } |
| 837 | 837 | function get_currency_form_fields() { |
| 838 | - $form ['forms'] = array ( |
|
| 839 | - base_url () . 'systems/currency_save/', |
|
| 840 | - array ( |
|
| 838 | + $form ['forms'] = array( |
|
| 839 | + base_url().'systems/currency_save/', |
|
| 840 | + array( |
|
| 841 | 841 | 'id' => 'system_form', |
| 842 | 842 | 'method' => 'POST', |
| 843 | 843 | 'name' => 'system_form' |
| 844 | 844 | ) |
| 845 | 845 | ); |
| 846 | - $form ['Currency List'] = array ( |
|
| 847 | - array ( |
|
| 846 | + $form ['Currency List'] = array( |
|
| 847 | + array( |
|
| 848 | 848 | '', |
| 849 | 849 | 'HIDDEN', |
| 850 | - array ( |
|
| 850 | + array( |
|
| 851 | 851 | 'name' => 'id' |
| 852 | 852 | ), |
| 853 | 853 | '', |
@@ -855,10 +855,10 @@ discard block |
||
| 855 | 855 | '', |
| 856 | 856 | '' |
| 857 | 857 | ), |
| 858 | - array ( |
|
| 859 | - gettext ( 'Name' ), |
|
| 858 | + array( |
|
| 859 | + gettext('Name'), |
|
| 860 | 860 | 'INPUT', |
| 861 | - array ( |
|
| 861 | + array( |
|
| 862 | 862 | 'name' => 'currencyname', |
| 863 | 863 | 'size' => '20', |
| 864 | 864 | 'maxlength' => '40', |
@@ -868,10 +868,10 @@ discard block |
||
| 868 | 868 | 'tOOL TIP', |
| 869 | 869 | 'Please Enter country' |
| 870 | 870 | ), |
| 871 | - array ( |
|
| 872 | - gettext ( 'Code' ), |
|
| 871 | + array( |
|
| 872 | + gettext('Code'), |
|
| 873 | 873 | 'INPUT', |
| 874 | - array ( |
|
| 874 | + array( |
|
| 875 | 875 | 'name' => 'currency', |
| 876 | 876 | 'size' => '20', |
| 877 | 877 | 'maxlength' => '3', |
@@ -881,10 +881,10 @@ discard block |
||
| 881 | 881 | 'tOOL TIP', |
| 882 | 882 | 'Please Enter country' |
| 883 | 883 | ), |
| 884 | - array ( |
|
| 885 | - gettext ( 'Rate' ), |
|
| 884 | + array( |
|
| 885 | + gettext('Rate'), |
|
| 886 | 886 | 'INPUT', |
| 887 | - array ( |
|
| 887 | + array( |
|
| 888 | 888 | 'name' => 'currencyrate', |
| 889 | 889 | 'size' => '20', |
| 890 | 890 | 'maxlength' => '7', |
@@ -896,17 +896,17 @@ discard block |
||
| 896 | 896 | ) |
| 897 | 897 | ) |
| 898 | 898 | ; |
| 899 | - $form ['button_save'] = array ( |
|
| 899 | + $form ['button_save'] = array( |
|
| 900 | 900 | 'name' => 'action', |
| 901 | - 'content' => gettext ( 'Save' ), |
|
| 901 | + 'content' => gettext('Save'), |
|
| 902 | 902 | 'value' => 'save', |
| 903 | 903 | 'id' => 'submit', |
| 904 | 904 | 'type' => 'button', |
| 905 | 905 | 'class' => 'btn btn-line-parrot' |
| 906 | 906 | ); |
| 907 | - $form ['button_cancel'] = array ( |
|
| 907 | + $form ['button_cancel'] = array( |
|
| 908 | 908 | 'name' => 'action', |
| 909 | - 'content' => gettext ( 'Close' ), |
|
| 909 | + 'content' => gettext('Close'), |
|
| 910 | 910 | 'value' => 'cancel', |
| 911 | 911 | 'type' => 'button', |
| 912 | 912 | 'class' => 'btn btn-line-sky margin-x-10', |
@@ -915,48 +915,48 @@ discard block |
||
| 915 | 915 | return $form; |
| 916 | 916 | } |
| 917 | 917 | function build_admin_currency_grid_buttons() { |
| 918 | - $buttons_json = json_encode ( array ( |
|
| 919 | - array ( |
|
| 920 | - gettext ( "Create" ), |
|
| 918 | + $buttons_json = json_encode(array( |
|
| 919 | + array( |
|
| 920 | + gettext("Create"), |
|
| 921 | 921 | "btn btn-line-warning btn", |
| 922 | 922 | "fa fa-plus-circle fa-lg", |
| 923 | 923 | "button_action", |
| 924 | 924 | "systems/currency_add/", |
| 925 | 925 | "popup" |
| 926 | 926 | ), |
| 927 | - array ( |
|
| 928 | - gettext ( "Update Currencies" ), |
|
| 927 | + array( |
|
| 928 | + gettext("Update Currencies"), |
|
| 929 | 929 | "btn btn-line-blue", |
| 930 | 930 | "fa fa-upload fa-lg", |
| 931 | 931 | "button_action", |
| 932 | 932 | "currencyupdate/update_currency/", |
| 933 | 933 | 'single' |
| 934 | 934 | ), |
| 935 | - array ( |
|
| 936 | - gettext ( "Delete" ), |
|
| 935 | + array( |
|
| 936 | + gettext("Delete"), |
|
| 937 | 937 | "btn btn-line-danger", |
| 938 | 938 | "fa fa-times-circle fa-lg", |
| 939 | 939 | "button_action", |
| 940 | 940 | "systems/currency_delete_multiple" |
| 941 | 941 | ) |
| 942 | - ) ); |
|
| 942 | + )); |
|
| 943 | 943 | return $buttons_json; |
| 944 | 944 | } |
| 945 | 945 | function get_backup_database_form_fields($file_name, $id = '') { |
| 946 | 946 | $val = $id > 0 ? "backup_database.path.$id" : 'backup_database.path'; |
| 947 | - $form ['forms'] = array ( |
|
| 948 | - base_url () . 'systems/database_backup_save/', |
|
| 949 | - array ( |
|
| 947 | + $form ['forms'] = array( |
|
| 948 | + base_url().'systems/database_backup_save/', |
|
| 949 | + array( |
|
| 950 | 950 | 'id' => 'backup_form', |
| 951 | 951 | 'method' => 'POST', |
| 952 | 952 | 'name' => 'backup_form' |
| 953 | 953 | ) |
| 954 | 954 | ); |
| 955 | - $form ['Database Information'] = array ( |
|
| 956 | - array ( |
|
| 955 | + $form ['Database Information'] = array( |
|
| 956 | + array( |
|
| 957 | 957 | '', |
| 958 | 958 | 'HIDDEN', |
| 959 | - array ( |
|
| 959 | + array( |
|
| 960 | 960 | 'name' => 'id' |
| 961 | 961 | ), |
| 962 | 962 | '', |
@@ -964,10 +964,10 @@ discard block |
||
| 964 | 964 | '', |
| 965 | 965 | '' |
| 966 | 966 | ), |
| 967 | - array ( |
|
| 968 | - gettext ( 'Name' ), |
|
| 967 | + array( |
|
| 968 | + gettext('Name'), |
|
| 969 | 969 | 'INPUT', |
| 970 | - array ( |
|
| 970 | + array( |
|
| 971 | 971 | 'name' => 'backup_name', |
| 972 | 972 | 'size' => '20', |
| 973 | 973 | 'class' => "text field medium" |
@@ -976,31 +976,31 @@ discard block |
||
| 976 | 976 | 'tOOL TIP', |
| 977 | 977 | '' |
| 978 | 978 | ), |
| 979 | - array ( |
|
| 980 | - gettext ( 'File Name' ), |
|
| 979 | + array( |
|
| 980 | + gettext('File Name'), |
|
| 981 | 981 | 'INPUT', |
| 982 | - array ( |
|
| 982 | + array( |
|
| 983 | 983 | 'name' => 'path', |
| 984 | 984 | 'size' => '20', |
| 985 | 985 | 'value' => $file_name, |
| 986 | 986 | 'class' => "text field medium" |
| 987 | 987 | ), |
| 988 | - 'trim|required|is_unique[' . $val . ']', |
|
| 988 | + 'trim|required|is_unique['.$val.']', |
|
| 989 | 989 | 'tOOL TIP', |
| 990 | 990 | '' |
| 991 | 991 | ) |
| 992 | 992 | ); |
| 993 | - $form ['button_cancel'] = array ( |
|
| 993 | + $form ['button_cancel'] = array( |
|
| 994 | 994 | 'name' => 'action', |
| 995 | - 'content' => gettext ( 'Close' ), |
|
| 995 | + 'content' => gettext('Close'), |
|
| 996 | 996 | 'value' => 'cancel', |
| 997 | 997 | 'type' => 'button', |
| 998 | 998 | 'class' => 'btn btn-line-sky margin-x-10', |
| 999 | 999 | 'onclick' => 'return redirect_page(\'NULL\')' |
| 1000 | 1000 | ); |
| 1001 | - $form ['button_save'] = array ( |
|
| 1001 | + $form ['button_save'] = array( |
|
| 1002 | 1002 | 'name' => 'action', |
| 1003 | - 'content' => gettext ( 'Save' ), |
|
| 1003 | + 'content' => gettext('Save'), |
|
| 1004 | 1004 | 'value' => 'save', |
| 1005 | 1005 | 'id' => 'submit', |
| 1006 | 1006 | 'type' => 'button', |
@@ -1009,8 +1009,8 @@ discard block |
||
| 1009 | 1009 | return $form; |
| 1010 | 1010 | } |
| 1011 | 1011 | function build_backupdastabase_list() { |
| 1012 | - $grid_field_arr = json_encode ( array ( |
|
| 1013 | - array ( |
|
| 1012 | + $grid_field_arr = json_encode(array( |
|
| 1013 | + array( |
|
| 1014 | 1014 | "<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", |
| 1015 | 1015 | "50", |
| 1016 | 1016 | "", |
@@ -1021,8 +1021,8 @@ discard block |
||
| 1021 | 1021 | "false", |
| 1022 | 1022 | "center" |
| 1023 | 1023 | ), |
| 1024 | - array ( |
|
| 1025 | - gettext ( "Date" ), |
|
| 1024 | + array( |
|
| 1025 | + gettext("Date"), |
|
| 1026 | 1026 | "260", |
| 1027 | 1027 | "date", |
| 1028 | 1028 | "date", |
@@ -1032,8 +1032,8 @@ discard block |
||
| 1032 | 1032 | "true", |
| 1033 | 1033 | "center" |
| 1034 | 1034 | ), |
| 1035 | - array ( |
|
| 1036 | - gettext ( "Name" ), |
|
| 1035 | + array( |
|
| 1036 | + gettext("Name"), |
|
| 1037 | 1037 | "295", |
| 1038 | 1038 | "backup_name", |
| 1039 | 1039 | "", |
@@ -1043,8 +1043,8 @@ discard block |
||
| 1043 | 1043 | "true", |
| 1044 | 1044 | "center" |
| 1045 | 1045 | ), |
| 1046 | - array ( |
|
| 1047 | - gettext ( "File Name" ), |
|
| 1046 | + array( |
|
| 1047 | + gettext("File Name"), |
|
| 1048 | 1048 | "480", |
| 1049 | 1049 | "path", |
| 1050 | 1050 | "", |
@@ -1054,56 +1054,56 @@ discard block |
||
| 1054 | 1054 | "true", |
| 1055 | 1055 | "center" |
| 1056 | 1056 | ), |
| 1057 | - array ( |
|
| 1058 | - gettext ( "Action" ), |
|
| 1057 | + array( |
|
| 1058 | + gettext("Action"), |
|
| 1059 | 1059 | "185", |
| 1060 | 1060 | "", |
| 1061 | 1061 | "", |
| 1062 | 1062 | "", |
| 1063 | - array ( |
|
| 1064 | - "EDIT_RESTORE" => array ( |
|
| 1063 | + array( |
|
| 1064 | + "EDIT_RESTORE" => array( |
|
| 1065 | 1065 | "url" => "systems/database_restore_one/", |
| 1066 | 1066 | "mode" => "" |
| 1067 | 1067 | ), |
| 1068 | - "DOWNLOAD_DATABASE" => array ( |
|
| 1068 | + "DOWNLOAD_DATABASE" => array( |
|
| 1069 | 1069 | "url" => "systems/database_download/", |
| 1070 | 1070 | "mode" => "" |
| 1071 | 1071 | ), |
| 1072 | - "Delete" => array ( |
|
| 1072 | + "Delete" => array( |
|
| 1073 | 1073 | "url" => "systems/database_delete/", |
| 1074 | 1074 | "mode" => "" |
| 1075 | 1075 | ) |
| 1076 | 1076 | ) |
| 1077 | 1077 | ) |
| 1078 | - ) ); |
|
| 1078 | + )); |
|
| 1079 | 1079 | return $grid_field_arr; |
| 1080 | 1080 | } |
| 1081 | 1081 | function build_backupdastabase_buttons() { |
| 1082 | - $buttons_json = json_encode ( array ( |
|
| 1083 | - array ( |
|
| 1084 | - gettext ( "Create" ), |
|
| 1082 | + $buttons_json = json_encode(array( |
|
| 1083 | + array( |
|
| 1084 | + gettext("Create"), |
|
| 1085 | 1085 | "btn btn-line-warning btn", |
| 1086 | 1086 | "fa fa-plus-circle fa-lg", |
| 1087 | 1087 | "button_action", |
| 1088 | 1088 | "systems/database_backup/", |
| 1089 | 1089 | "popup" |
| 1090 | 1090 | ), |
| 1091 | - array ( |
|
| 1092 | - gettext ( "import" ), |
|
| 1091 | + array( |
|
| 1092 | + gettext("import"), |
|
| 1093 | 1093 | "btn btn-line-blue", |
| 1094 | 1094 | "fa fa-upload fa-lg", |
| 1095 | 1095 | "button_action", |
| 1096 | 1096 | "systems/database_import/", |
| 1097 | 1097 | "popup" |
| 1098 | 1098 | ), |
| 1099 | - array ( |
|
| 1100 | - gettext ( "Delete" ), |
|
| 1099 | + array( |
|
| 1100 | + gettext("Delete"), |
|
| 1101 | 1101 | "btn btn-line-danger", |
| 1102 | 1102 | "fa fa-times-circle fa-lg", |
| 1103 | 1103 | "button_action", |
| 1104 | 1104 | "systems/database_backup_delete_multiple" |
| 1105 | 1105 | ) |
| 1106 | - ) ); |
|
| 1106 | + )); |
|
| 1107 | 1107 | return $buttons_json; |
| 1108 | 1108 | } |
| 1109 | 1109 | } |
@@ -23,35 +23,35 @@ discard block |
||
| 23 | 23 | // ############################################################################## |
| 24 | 24 | class Summary_model extends CI_Model { |
| 25 | 25 | function Summary_model() { |
| 26 | - parent::__construct (); |
|
| 26 | + parent::__construct(); |
|
| 27 | 27 | } |
| 28 | 28 | function get_resellersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select, $order, $export = false) { |
| 29 | - $this->db_model->build_search ( 'summary_reseller_search' ); |
|
| 30 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 29 | + $this->db_model->build_search('summary_reseller_search'); |
|
| 30 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 31 | 31 | $reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0; |
| 32 | 32 | $where ['reseller_id'] = $reseller_id; |
| 33 | - if ($this->session->userdata ( 'advance_search' ) != 1) { |
|
| 34 | - $where ['callstart >='] = date ( 'Y-m-d' ) . " 00:00:00"; |
|
| 35 | - $where ['callstart <='] = date ( 'Y-m-d' ) . " 23:59:59"; |
|
| 33 | + if ($this->session->userdata('advance_search') != 1) { |
|
| 34 | + $where ['callstart >='] = date('Y-m-d')." 00:00:00"; |
|
| 35 | + $where ['callstart <='] = date('Y-m-d')." 23:59:59"; |
|
| 36 | 36 | } |
| 37 | - $this->db->where ( $where ); |
|
| 38 | - if (! empty ( $group_by )) { |
|
| 37 | + $this->db->where($where); |
|
| 38 | + if ( ! empty ($group_by)) { |
|
| 39 | 39 | $this->db->_protect_identifiers = false; |
| 40 | - $this->db->group_by ( $group_by, false ); |
|
| 40 | + $this->db->group_by($group_by, false); |
|
| 41 | 41 | $this->db->_protect_identifiers = true; |
| 42 | 42 | } |
| 43 | 43 | if ($flag) { |
| 44 | - $this->db->select ( $select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", false ); |
|
| 45 | - $this->db->order_by ( $order, "ASC" ); |
|
| 46 | - if (! $export) { |
|
| 47 | - $this->db->limit ( $limit, $start ); |
|
| 44 | + $this->db->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", false); |
|
| 45 | + $this->db->order_by($order, "ASC"); |
|
| 46 | + if ( ! $export) { |
|
| 47 | + $this->db->limit($limit, $start); |
|
| 48 | 48 | } |
| 49 | - $this->db->from ( "reseller_cdrs" ); |
|
| 50 | - $result = $this->db->get (); |
|
| 49 | + $this->db->from("reseller_cdrs"); |
|
| 50 | + $result = $this->db->get(); |
|
| 51 | 51 | } else { |
| 52 | - $result = $this->db_model->getSelect ( "count(*) as total_count", "reseller_cdrs", '' ); |
|
| 53 | - if ($result->num_rows () > 0) { |
|
| 54 | - return $result->num_rows (); |
|
| 52 | + $result = $this->db_model->getSelect("count(*) as total_count", "reseller_cdrs", ''); |
|
| 53 | + if ($result->num_rows() > 0) { |
|
| 54 | + return $result->num_rows(); |
|
| 55 | 55 | } else { |
| 56 | 56 | return 0; |
| 57 | 57 | } |
@@ -59,30 +59,30 @@ discard block |
||
| 59 | 59 | return $result; |
| 60 | 60 | } |
| 61 | 61 | function get_providersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select, $order, $export = false) { |
| 62 | - $this->db_model->build_search ( 'summary_provider_search' ); |
|
| 62 | + $this->db_model->build_search('summary_provider_search'); |
|
| 63 | 63 | $where ['provider_id >'] = 0; |
| 64 | - if ($this->session->userdata ( 'advance_search' ) != 1) { |
|
| 65 | - $where ['callstart >='] = date ( 'Y-m-d' ) . " 00:00:00"; |
|
| 66 | - $where ['callstart <='] = date ( 'Y-m-d' ) . " 23:59:59"; |
|
| 64 | + if ($this->session->userdata('advance_search') != 1) { |
|
| 65 | + $where ['callstart >='] = date('Y-m-d')." 00:00:00"; |
|
| 66 | + $where ['callstart <='] = date('Y-m-d')." 23:59:59"; |
|
| 67 | 67 | } |
| 68 | - $this->db->where ( $where ); |
|
| 69 | - if (! empty ( $group_by )) { |
|
| 68 | + $this->db->where($where); |
|
| 69 | + if ( ! empty ($group_by)) { |
|
| 70 | 70 | $this->db->_protect_identifiers = false; |
| 71 | - $this->db->group_by ( $group_by, false ); |
|
| 71 | + $this->db->group_by($group_by, false); |
|
| 72 | 72 | $this->db->_protect_identifiers = true; |
| 73 | 73 | } |
| 74 | 74 | if ($flag) { |
| 75 | - $this->db->select ( $select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", false ); |
|
| 76 | - $this->db->order_by ( $order, "ASC" ); |
|
| 77 | - if (! $export) { |
|
| 78 | - $this->db->limit ( $limit, $start ); |
|
| 75 | + $this->db->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", false); |
|
| 76 | + $this->db->order_by($order, "ASC"); |
|
| 77 | + if ( ! $export) { |
|
| 78 | + $this->db->limit($limit, $start); |
|
| 79 | 79 | } |
| 80 | - $this->db->from ( 'cdrs' ); |
|
| 81 | - $result = $this->db->get (); |
|
| 80 | + $this->db->from('cdrs'); |
|
| 81 | + $result = $this->db->get(); |
|
| 82 | 82 | } else { |
| 83 | - $result = $this->db_model->getSelect ( "count(*) as total_count", "cdrs", '' ); |
|
| 84 | - if ($result->num_rows () > 0) { |
|
| 85 | - return $result->num_rows (); |
|
| 83 | + $result = $this->db_model->getSelect("count(*) as total_count", "cdrs", ''); |
|
| 84 | + if ($result->num_rows() > 0) { |
|
| 85 | + return $result->num_rows(); |
|
| 86 | 86 | } else { |
| 87 | 87 | return 0; |
| 88 | 88 | } |
@@ -90,37 +90,37 @@ discard block |
||
| 90 | 90 | return $result; |
| 91 | 91 | } |
| 92 | 92 | function get_customersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select, $order, $export) { |
| 93 | - $this->db_model->build_search ( 'summary_customer_search' ); |
|
| 94 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 93 | + $this->db_model->build_search('summary_customer_search'); |
|
| 94 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 95 | 95 | $reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0; |
| 96 | 96 | $where ['reseller_id'] = $reseller_id; |
| 97 | - if ($this->session->userdata ( 'advance_search' ) != 1) { |
|
| 98 | - $where ['callstart >='] = date ( 'Y-m-d' ) . " 00:00:00"; |
|
| 99 | - $where ['callstart <='] = date ( 'Y-m-d' ) . " 23:59:59"; |
|
| 97 | + if ($this->session->userdata('advance_search') != 1) { |
|
| 98 | + $where ['callstart >='] = date('Y-m-d')." 00:00:00"; |
|
| 99 | + $where ['callstart <='] = date('Y-m-d')." 23:59:59"; |
|
| 100 | 100 | } |
| 101 | - $this->db->where ( $where ); |
|
| 102 | - $types = array ( |
|
| 101 | + $this->db->where($where); |
|
| 102 | + $types = array( |
|
| 103 | 103 | '0', |
| 104 | 104 | '3' |
| 105 | 105 | ); |
| 106 | - $this->db->where_in ( 'type', $types ); |
|
| 107 | - if (! empty ( $group_by )) { |
|
| 106 | + $this->db->where_in('type', $types); |
|
| 107 | + if ( ! empty ($group_by)) { |
|
| 108 | 108 | $this->db->_protect_identifiers = false; |
| 109 | - $this->db->group_by ( $group_by, false ); |
|
| 109 | + $this->db->group_by($group_by, false); |
|
| 110 | 110 | $this->db->_protect_identifiers = true; |
| 111 | 111 | } |
| 112 | 112 | if ($flag) { |
| 113 | - $this->db->select ( $select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", false ); |
|
| 114 | - $this->db->order_by ( $order, "ASC" ); |
|
| 115 | - if (! $export) { |
|
| 116 | - $this->db->limit ( $limit, $start ); |
|
| 113 | + $this->db->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", false); |
|
| 114 | + $this->db->order_by($order, "ASC"); |
|
| 115 | + if ( ! $export) { |
|
| 116 | + $this->db->limit($limit, $start); |
|
| 117 | 117 | } |
| 118 | - $this->db->from ( "cdrs" ); |
|
| 119 | - $result = $this->db->get (); |
|
| 118 | + $this->db->from("cdrs"); |
|
| 119 | + $result = $this->db->get(); |
|
| 120 | 120 | } else { |
| 121 | - $result = $this->db_model->getSelect ( "count(*) as total_count", "cdrs", '' ); |
|
| 122 | - if ($result->num_rows () > 0) { |
|
| 123 | - return $result->num_rows (); |
|
| 121 | + $result = $this->db_model->getSelect("count(*) as total_count", "cdrs", ''); |
|
| 122 | + if ($result->num_rows() > 0) { |
|
| 123 | + return $result->num_rows(); |
|
| 124 | 124 | } else { |
| 125 | 125 | return 0; |
| 126 | 126 | } |
@@ -23,54 +23,54 @@ discard block |
||
| 23 | 23 | // ############################################################################## |
| 24 | 24 | class Summary extends MX_Controller { |
| 25 | 25 | function Summary() { |
| 26 | - parent::__construct (); |
|
| 26 | + parent::__construct(); |
|
| 27 | 27 | |
| 28 | - $this->load->helper ( 'template_inheritance' ); |
|
| 28 | + $this->load->helper('template_inheritance'); |
|
| 29 | 29 | |
| 30 | - $this->load->library ( 'session' ); |
|
| 31 | - $this->load->library ( 'astpp/form' ); |
|
| 32 | - $this->load->library ( "summary_form" ); |
|
| 33 | - $this->load->model ( 'summary_model' ); |
|
| 34 | - $this->load->library ( 'fpdf' ); |
|
| 35 | - $this->load->library ( 'pdf' ); |
|
| 36 | - $this->fpdf = new PDF ( 'P', 'pt' ); |
|
| 37 | - $this->fpdf->initialize ( 'P', 'mm', 'A4' ); |
|
| 30 | + $this->load->library('session'); |
|
| 31 | + $this->load->library('astpp/form'); |
|
| 32 | + $this->load->library("summary_form"); |
|
| 33 | + $this->load->model('summary_model'); |
|
| 34 | + $this->load->library('fpdf'); |
|
| 35 | + $this->load->library('pdf'); |
|
| 36 | + $this->fpdf = new PDF('P', 'pt'); |
|
| 37 | + $this->fpdf->initialize('P', 'mm', 'A4'); |
|
| 38 | 38 | |
| 39 | - if ($this->session->userdata ( 'user_login' ) == FALSE) |
|
| 40 | - redirect ( base_url () . '/astpp/login' ); |
|
| 39 | + if ($this->session->userdata('user_login') == FALSE) |
|
| 40 | + redirect(base_url().'/astpp/login'); |
|
| 41 | 41 | } |
| 42 | 42 | function customer() { |
| 43 | - $data ['page_title'] = gettext ( 'Customer Summary Report' ); |
|
| 43 | + $data ['page_title'] = gettext('Customer Summary Report'); |
|
| 44 | 44 | $data ['search_flag'] = true; |
| 45 | - $session_info = $this->session->userdata ( 'customersummary_reports_search' ); |
|
| 46 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 45 | + $session_info = $this->session->userdata('customersummary_reports_search'); |
|
| 46 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 47 | 47 | $reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0; |
| 48 | - $accountlist = $this->db_model->build_dropdown_deleted ( 'id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array ( |
|
| 48 | + $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array( |
|
| 49 | 49 | 'reseller_id' => $reseller_id, |
| 50 | 50 | "type" => "GLOBAL" |
| 51 | - ) ); |
|
| 51 | + )); |
|
| 52 | 52 | $data ['accountlist'] = $accountlist; |
| 53 | 53 | $data ['session_info'] = $session_info; |
| 54 | - $data ['search_string_type'] = $this->common->search_string_type (); |
|
| 55 | - $data ['search_report'] = $this->common->search_report_in (); |
|
| 56 | - $new_column_arr = $this->summary_column_arr ( 'customer' ); |
|
| 57 | - $data ['grid_fields'] = $this->summary_form->build_customersummary ( $new_column_arr ); |
|
| 58 | - $data ["grid_buttons"] = $this->summary_form->build_grid_buttons_customersummary (); |
|
| 59 | - $data ['groupby_field'] = $this->common->set_summarycustomer_groupby (); |
|
| 60 | - $data ['groupby_time'] = $this->common->group_by_time (); |
|
| 61 | - $this->load->view ( 'view_customersummary_report', $data ); |
|
| 54 | + $data ['search_string_type'] = $this->common->search_string_type(); |
|
| 55 | + $data ['search_report'] = $this->common->search_report_in(); |
|
| 56 | + $new_column_arr = $this->summary_column_arr('customer'); |
|
| 57 | + $data ['grid_fields'] = $this->summary_form->build_customersummary($new_column_arr); |
|
| 58 | + $data ["grid_buttons"] = $this->summary_form->build_grid_buttons_customersummary(); |
|
| 59 | + $data ['groupby_field'] = $this->common->set_summarycustomer_groupby(); |
|
| 60 | + $data ['groupby_time'] = $this->common->group_by_time(); |
|
| 61 | + $this->load->view('view_customersummary_report', $data); |
|
| 62 | 62 | } |
| 63 | 63 | function customer_json() { |
| 64 | - $search_arr = $this->summary_search_info ( 'customer' ); |
|
| 65 | - $count_all = $this->summary_model->get_customersummary_report_list ( false, 0, 0, $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false ); |
|
| 66 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
| 64 | + $search_arr = $this->summary_search_info('customer'); |
|
| 65 | + $count_all = $this->summary_model->get_customersummary_report_list(false, 0, 0, $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false); |
|
| 66 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
| 67 | 67 | $json_data = $paging_data ["json_paging"]; |
| 68 | - $query = $this->summary_model->get_customersummary_report_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false ); |
|
| 69 | - if ($query->num_rows () > 0) { |
|
| 70 | - $json_data ['rows'] = $this->summary_report_grid ( $search_arr, $query, 'customer', 'grid' ); |
|
| 68 | + $query = $this->summary_model->get_customersummary_report_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false); |
|
| 69 | + if ($query->num_rows() > 0) { |
|
| 70 | + $json_data ['rows'] = $this->summary_report_grid($search_arr, $query, 'customer', 'grid'); |
|
| 71 | 71 | } |
| 72 | - $this->session->set_userdata ( 'customersummary_reports_export', $search_arr ); |
|
| 73 | - echo json_encode ( $json_data ); |
|
| 72 | + $this->session->set_userdata('customersummary_reports_export', $search_arr); |
|
| 73 | + echo json_encode($json_data); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -78,26 +78,26 @@ discard block |
||
| 78 | 78 | * @param string $entity |
| 79 | 79 | */ |
| 80 | 80 | function summary_column_arr($entity) { |
| 81 | - $new_column_arr = array (); |
|
| 81 | + $new_column_arr = array(); |
|
| 82 | 82 | $total_width = '322'; |
| 83 | 83 | $column_name = 'accountid'; |
| 84 | - if ($this->session->userdata ( 'advance_search' ) == '1') { |
|
| 85 | - $search_array = $this->session->userdata ( $entity . 'summary_reports_search' ); |
|
| 86 | - if (isset ( $search_array ['time'] ) && ! empty ( $search_array ['time'] )) { |
|
| 87 | - $new_column_arr [] = array ( |
|
| 88 | - ucfirst ( strtolower ( $search_array ['time'] ) ), |
|
| 84 | + if ($this->session->userdata('advance_search') == '1') { |
|
| 85 | + $search_array = $this->session->userdata($entity.'summary_reports_search'); |
|
| 86 | + if (isset ($search_array ['time']) && ! empty ($search_array ['time'])) { |
|
| 87 | + $new_column_arr [] = array( |
|
| 88 | + ucfirst(strtolower($search_array ['time'])), |
|
| 89 | 89 | "58", |
| 90 | - $search_array ['time'] . "(callstart)", |
|
| 90 | + $search_array ['time']."(callstart)", |
|
| 91 | 91 | "", |
| 92 | 92 | "", |
| 93 | 93 | "" |
| 94 | 94 | ); |
| 95 | 95 | } |
| 96 | - if (isset ( $search_array ['groupby_1'] ) && ! empty ( $search_array ['groupby_1'] )) { |
|
| 96 | + if (isset ($search_array ['groupby_1']) && ! empty ($search_array ['groupby_1'])) { |
|
| 97 | 97 | $first_column_groupby = $search_array ['groupby_1']; |
| 98 | 98 | |
| 99 | 99 | if ($first_column_groupby == 'accountid') { |
| 100 | - $new_column_arr [] = array ( |
|
| 100 | + $new_column_arr [] = array( |
|
| 101 | 101 | "Account", |
| 102 | 102 | "105", |
| 103 | 103 | 'accountid', |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | "build_concat_string" |
| 107 | 107 | ); |
| 108 | 108 | } elseif ($first_column_groupby == 'pattern') { |
| 109 | - $new_column_arr [] = array ( |
|
| 109 | + $new_column_arr [] = array( |
|
| 110 | 110 | "Code", |
| 111 | 111 | "45", |
| 112 | 112 | "pattern", |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | "", |
| 115 | 115 | "get_only_numeric_val" |
| 116 | 116 | ); |
| 117 | - $new_column_arr [] = array ( |
|
| 117 | + $new_column_arr [] = array( |
|
| 118 | 118 | "Destination", |
| 119 | 119 | "59", |
| 120 | 120 | "notes", |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | "" |
| 124 | 124 | ); |
| 125 | 125 | } elseif ($first_column_groupby == 'package_id') { |
| 126 | - $new_column_arr [] = array ( |
|
| 126 | + $new_column_arr [] = array( |
|
| 127 | 127 | "Package", |
| 128 | 128 | "105", |
| 129 | 129 | 'package_id', |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | ); |
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | - if (isset ( $search_array ['groupby_2'] ) && ! empty ( $search_array ['groupby_2'] )) { |
|
| 136 | + if (isset ($search_array ['groupby_2']) && ! empty ($search_array ['groupby_2'])) { |
|
| 137 | 137 | $third_column_groupby = $search_array ['groupby_2']; |
| 138 | 138 | if ($third_column_groupby == 'accountid') { |
| 139 | - $new_column_arr [] = array ( |
|
| 139 | + $new_column_arr [] = array( |
|
| 140 | 140 | "Account", |
| 141 | 141 | "105", |
| 142 | 142 | 'accountid', |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | "build_concat_string" |
| 146 | 146 | ); |
| 147 | 147 | } elseif ($third_column_groupby == 'pattern') { |
| 148 | - $new_column_arr [] = array ( |
|
| 148 | + $new_column_arr [] = array( |
|
| 149 | 149 | "Code", |
| 150 | 150 | "45", |
| 151 | 151 | "pattern", |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | "", |
| 154 | 154 | "get_only_numeric_val" |
| 155 | 155 | ); |
| 156 | - $new_column_arr [] = array ( |
|
| 156 | + $new_column_arr [] = array( |
|
| 157 | 157 | "Destination", |
| 158 | 158 | "59", |
| 159 | 159 | "notes", |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | "" |
| 163 | 163 | ); |
| 164 | 164 | } elseif ($third_column_groupby == 'package_id') { |
| 165 | - $new_column_arr [] = array ( |
|
| 165 | + $new_column_arr [] = array( |
|
| 166 | 166 | "Package", |
| 167 | 167 | "105", |
| 168 | 168 | 'package_id', |
@@ -172,10 +172,10 @@ discard block |
||
| 172 | 172 | ); |
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | - if (isset ( $search_array ['groupby_3'] ) && ! empty ( $search_array ['groupby_3'] )) { |
|
| 175 | + if (isset ($search_array ['groupby_3']) && ! empty ($search_array ['groupby_3'])) { |
|
| 176 | 176 | $fifth_column_groupby = $search_array ['groupby_3']; |
| 177 | 177 | if ($fifth_column_groupby == 'accountid') { |
| 178 | - $new_column_arr [] = array ( |
|
| 178 | + $new_column_arr [] = array( |
|
| 179 | 179 | "Account", |
| 180 | 180 | "105", |
| 181 | 181 | 'accountid', |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | "build_concat_string" |
| 185 | 185 | ); |
| 186 | 186 | } elseif ($fifth_column_groupby == 'pattern') { |
| 187 | - $new_column_arr [] = array ( |
|
| 187 | + $new_column_arr [] = array( |
|
| 188 | 188 | "Code", |
| 189 | 189 | "45", |
| 190 | 190 | "pattern", |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | "", |
| 193 | 193 | "get_only_numeric_val" |
| 194 | 194 | ); |
| 195 | - $new_column_arr [] = array ( |
|
| 195 | + $new_column_arr [] = array( |
|
| 196 | 196 | "Destination", |
| 197 | 197 | "59", |
| 198 | 198 | "notes", |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | "" |
| 202 | 202 | ); |
| 203 | 203 | } elseif ($fifth_column_groupby == 'package_id') { |
| 204 | - $new_column_arr [] = array ( |
|
| 204 | + $new_column_arr [] = array( |
|
| 205 | 205 | "Package", |
| 206 | 206 | "105", |
| 207 | 207 | 'package_id', |
@@ -211,8 +211,8 @@ discard block |
||
| 211 | 211 | ); |
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | - if (empty ( $new_column_arr )) { |
|
| 215 | - $new_column_arr [] = array ( |
|
| 214 | + if (empty ($new_column_arr)) { |
|
| 215 | + $new_column_arr [] = array( |
|
| 216 | 216 | "Account", |
| 217 | 217 | '322', |
| 218 | 218 | 'accountid', |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | ); |
| 223 | 223 | } |
| 224 | 224 | } else { |
| 225 | - $new_column_arr [] = array ( |
|
| 225 | + $new_column_arr [] = array( |
|
| 226 | 226 | "Account", |
| 227 | 227 | '322', |
| 228 | 228 | 'accountid', |
@@ -241,89 +241,89 @@ discard block |
||
| 241 | 241 | * @param string $purpose |
| 242 | 242 | */ |
| 243 | 243 | function summary_report_grid($search_arr, $query, $entity, $purpose) { |
| 244 | - $export_arr = array (); |
|
| 244 | + $export_arr = array(); |
|
| 245 | 245 | $db_field_name = $entity == 'provider' ? 'provider_id' : 'accountid'; |
| 246 | - $show_seconds = (! empty ( $search_arr ['search_in'] )) ? $search_arr ['search_in'] : 'minutes'; |
|
| 247 | - $currency_info = $this->common->get_currency_info (); |
|
| 248 | - foreach ( $query->result_array () as $row1 ) { |
|
| 246 | + $show_seconds = ( ! empty ($search_arr ['search_in'])) ? $search_arr ['search_in'] : 'minutes'; |
|
| 247 | + $currency_info = $this->common->get_currency_info(); |
|
| 248 | + foreach ($query->result_array() as $row1) { |
|
| 249 | 249 | $atmpt = $row1 ['attempts']; |
| 250 | 250 | $cmplt = ($row1 ['completed'] != 0) ? $row1 ['completed'] : 0; |
| 251 | - $acd = ($row1 ['completed'] > 0) ? round ( $row1 ['billable'] / $row1 ['completed'] ) : 0; |
|
| 251 | + $acd = ($row1 ['completed'] > 0) ? round ($row1 ['billable'] / $row1 ['completed']) : 0; |
|
| 252 | 252 | $mcd = $row1 ['mcd']; |
| 253 | 253 | if ($show_seconds == 'minutes') { |
| 254 | - $avgsec = $acd > 0 ? sprintf ( '%02d', $acd / 60 ) . ":" . sprintf ( '%02d', ($acd % 60) ) : "00:00"; |
|
| 255 | - $maxsec = $mcd > 0 ? sprintf ( '%02d', $mcd / 60 ) . ":" . sprintf ( '%02d', ($mcd % 60) ) : "00:00"; |
|
| 256 | - $duration = ($row1 ['duration'] > 0) ? sprintf ( '%02d', $row1 ['duration'] / 60 ) . ":" . sprintf ( '%02d', ($row1 ['duration'] % 60) ) : "00:00"; |
|
| 257 | - $billsec = ($row1 ['billable'] > 0) ? sprintf ( '%02d', $row1 ['billable'] / 60 ) . ":" . sprintf ( '%02d', ($row1 ['billable'] % 60) ) : "00:00"; |
|
| 254 | + $avgsec = $acd > 0 ? sprintf ('%02d', $acd / 60).":".sprintf('%02d', ($acd % 60)) : "00:00"; |
|
| 255 | + $maxsec = $mcd > 0 ? sprintf ('%02d', $mcd / 60).":".sprintf('%02d', ($mcd % 60)) : "00:00"; |
|
| 256 | + $duration = ($row1 ['duration'] > 0) ? sprintf ('%02d', $row1 ['duration'] / 60).":".sprintf('%02d', ($row1 ['duration'] % 60)) : "00:00"; |
|
| 257 | + $billsec = ($row1 ['billable'] > 0) ? sprintf ('%02d', $row1 ['billable'] / 60).":".sprintf('%02d', ($row1 ['billable'] % 60)) : "00:00"; |
|
| 258 | 258 | } else { |
| 259 | - $duration = sprintf ( '%02d', $row1 ['duration'] ); |
|
| 259 | + $duration = sprintf('%02d', $row1 ['duration']); |
|
| 260 | 260 | $avgsec = $acd; |
| 261 | 261 | $maxsec = $mcd; |
| 262 | - $billsec = sprintf ( '%02d', $row1 ['billable'] ); |
|
| 262 | + $billsec = sprintf('%02d', $row1 ['billable']); |
|
| 263 | 263 | } |
| 264 | 264 | if ($entity != 'provider') { |
| 265 | - $profit = $this->common->calculate_currency_manually ( $currency_info, $row1 ['debit'] - $row1 ['cost'], false ); |
|
| 266 | - $debit = $this->common->calculate_currency_manually ( $currency_info, $row1 ['debit'], false ); |
|
| 265 | + $profit = $this->common->calculate_currency_manually($currency_info, $row1 ['debit'] - $row1 ['cost'], false); |
|
| 266 | + $debit = $this->common->calculate_currency_manually($currency_info, $row1 ['debit'], false); |
|
| 267 | 267 | } |
| 268 | - $cost = $this->common->calculate_currency_manually ( $currency_info, $row1 ['cost'], false ); |
|
| 269 | - $asr = ($atmpt > 0) ? (round ( ($cmplt / $atmpt) * 100, 2 )) : '0.00'; |
|
| 270 | - $new_arr = array (); |
|
| 271 | - if ($this->session->userdata ( 'advance_search' ) == 1) { |
|
| 272 | - if (! empty ( $search_arr ['groupby_time'] )) { |
|
| 268 | + $cost = $this->common->calculate_currency_manually($currency_info, $row1 ['cost'], false); |
|
| 269 | + $asr = ($atmpt > 0) ? (round(($cmplt / $atmpt) * 100, 2)) : '0.00'; |
|
| 270 | + $new_arr = array(); |
|
| 271 | + if ($this->session->userdata('advance_search') == 1) { |
|
| 272 | + if ( ! empty ($search_arr ['groupby_time'])) { |
|
| 273 | 273 | $time = $row1 [$search_arr ['groupby_time']]; |
| 274 | 274 | if ($search_arr ['groupby_time'] == "HOUR" || $search_arr ['groupby_time'] == "DAY") { |
| 275 | - $time = sprintf ( '%02d', $time ); |
|
| 275 | + $time = sprintf('%02d', $time); |
|
| 276 | 276 | } |
| 277 | 277 | if ($search_arr ['groupby_time'] == "MONTH") { |
| 278 | - $dateObj = DateTime::createFromFormat ( '!m', $time ); |
|
| 279 | - $time = $dateObj->format ( 'F' ); |
|
| 278 | + $dateObj = DateTime::createFromFormat('!m', $time); |
|
| 279 | + $time = $dateObj->format('F'); |
|
| 280 | 280 | } |
| 281 | 281 | $new_arr [] = $time; |
| 282 | 282 | } |
| 283 | 283 | if ($search_arr ['groupby_1'] == $db_field_name) { |
| 284 | - $new_arr [] = $this->common->build_concat_string ( "first_name,last_name,number", "accounts", $row1 [$db_field_name] ); |
|
| 284 | + $new_arr [] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1 [$db_field_name]); |
|
| 285 | 285 | } elseif ($search_arr ['groupby_1'] == 'pattern') { |
| 286 | - $new_arr [] = filter_var ( $row1 ['pattern'], FILTER_SANITIZE_NUMBER_INT ); |
|
| 286 | + $new_arr [] = filter_var($row1 ['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
| 287 | 287 | $new_arr [] = $row1 ['notes']; |
| 288 | 288 | } elseif ($search_arr ['groupby_1'] == 'trunk_id') { |
| 289 | - $new_arr [] = $this->common->get_field_name ( 'name', 'trunks', $row1 ['trunk_id'] ); |
|
| 289 | + $new_arr [] = $this->common->get_field_name('name', 'trunks', $row1 ['trunk_id']); |
|
| 290 | 290 | } elseif ($search_arr ['groupby_1'] == 'package_id') { |
| 291 | - $new_arr [] = $this->common->get_field_name ( 'package_name', 'packages', $row1 ['package_id'] ); |
|
| 291 | + $new_arr [] = $this->common->get_field_name('package_name', 'packages', $row1 ['package_id']); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | if ($search_arr ['groupby_2'] == $db_field_name) { |
| 295 | - $new_arr [] = $this->common->build_concat_string ( "first_name,last_name,number", "accounts", $row1 [$db_field_name] ); |
|
| 295 | + $new_arr [] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1 [$db_field_name]); |
|
| 296 | 296 | } elseif ($search_arr ['groupby_2'] == 'pattern') { |
| 297 | - $new_arr [] = filter_var ( $row1 ['pattern'], FILTER_SANITIZE_NUMBER_INT ); |
|
| 297 | + $new_arr [] = filter_var($row1 ['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
| 298 | 298 | $new_arr [] = $row1 ['notes']; |
| 299 | 299 | } elseif ($search_arr ['groupby_2'] == 'trunk_id') { |
| 300 | - $new_arr [] = $this->common->get_field_name ( 'name', 'trunks', $row1 ['trunk_id'] ); |
|
| 300 | + $new_arr [] = $this->common->get_field_name('name', 'trunks', $row1 ['trunk_id']); |
|
| 301 | 301 | } elseif ($search_arr ['groupby_2'] == 'package_id') { |
| 302 | - $new_arr [] = $this->common->get_field_name ( 'package_name', 'packages', $row1 ['package_id'] ); |
|
| 302 | + $new_arr [] = $this->common->get_field_name('package_name', 'packages', $row1 ['package_id']); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | if ($search_arr ['groupby_3'] == $db_field_name) { |
| 306 | - $new_arr [] = $this->common->build_concat_string ( "first_name,last_name,number", "accounts", $row1 [$db_field_name] ); |
|
| 306 | + $new_arr [] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1 [$db_field_name]); |
|
| 307 | 307 | } elseif ($search_arr ['groupby_3'] == 'pattern') { |
| 308 | - $new_arr [] = filter_var ( $row1 ['pattern'], FILTER_SANITIZE_NUMBER_INT ); |
|
| 308 | + $new_arr [] = filter_var($row1 ['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
| 309 | 309 | $new_arr [] = $row1 ['notes']; |
| 310 | 310 | } elseif ($search_arr ['groupby_3'] == 'trunk_id') { |
| 311 | - $new_arr [] = $this->common->get_field_name ( 'name', 'trunks', $row1 ['trunk_id'] ); |
|
| 311 | + $new_arr [] = $this->common->get_field_name('name', 'trunks', $row1 ['trunk_id']); |
|
| 312 | 312 | } elseif ($search_arr ['groupby_3'] == 'package_id') { |
| 313 | - $new_arr [] = $this->common->get_field_name ( 'package_name', 'packages', $row1 ['package_id'] ); |
|
| 313 | + $new_arr [] = $this->common->get_field_name('package_name', 'packages', $row1 ['package_id']); |
|
| 314 | 314 | } |
| 315 | - if (empty ( $new_arr )) { |
|
| 316 | - $new_arr [] = $this->common->build_concat_string ( "first_name,last_name,number", "accounts", $row1 [$db_field_name] ); |
|
| 315 | + if (empty ($new_arr)) { |
|
| 316 | + $new_arr [] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1 [$db_field_name]); |
|
| 317 | 317 | } |
| 318 | 318 | } else { |
| 319 | - $new_arr [] = $this->common->build_concat_string ( "first_name,last_name,number", "accounts", $row1 [$db_field_name] ); |
|
| 319 | + $new_arr [] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1 [$db_field_name]); |
|
| 320 | 320 | } |
| 321 | 321 | if ($entity != 'provider') { |
| 322 | - $custom_array = array ( |
|
| 322 | + $custom_array = array( |
|
| 323 | 323 | $atmpt, |
| 324 | 324 | $cmplt, |
| 325 | 325 | $duration, |
| 326 | - round ( $asr, 2 ), |
|
| 326 | + round($asr, 2), |
|
| 327 | 327 | $avgsec, |
| 328 | 328 | $maxsec, |
| 329 | 329 | $billsec, |
@@ -332,95 +332,95 @@ discard block |
||
| 332 | 332 | $profit |
| 333 | 333 | ); |
| 334 | 334 | } else { |
| 335 | - $custom_array = array ( |
|
| 335 | + $custom_array = array( |
|
| 336 | 336 | $atmpt, |
| 337 | 337 | $cmplt, |
| 338 | 338 | $duration, |
| 339 | - round ( $asr, 2 ), |
|
| 339 | + round($asr, 2), |
|
| 340 | 340 | $avgsec, |
| 341 | 341 | $maxsec, |
| 342 | 342 | $billsec, |
| 343 | 343 | $cost |
| 344 | 344 | ); |
| 345 | 345 | } |
| 346 | - $final_array = array_merge ( $new_arr, $custom_array ); |
|
| 347 | - $json_data [] = array ( |
|
| 346 | + $final_array = array_merge($new_arr, $custom_array); |
|
| 347 | + $json_data [] = array( |
|
| 348 | 348 | 'cell' => $final_array |
| 349 | 349 | ); |
| 350 | 350 | $export_arr [] = $final_array; |
| 351 | 351 | } |
| 352 | - $function_name = 'get_' . $entity . 'summary_report_list'; |
|
| 353 | - $total_info = $this->summary_model->$function_name ( true, '', '', '', $search_arr ['select_str'], $search_arr ['order_str'], true ); |
|
| 354 | - $total_info = $total_info->result_array (); |
|
| 352 | + $function_name = 'get_'.$entity.'summary_report_list'; |
|
| 353 | + $total_info = $this->summary_model->$function_name(true, '', '', '', $search_arr ['select_str'], $search_arr ['order_str'], true); |
|
| 354 | + $total_info = $total_info->result_array(); |
|
| 355 | 355 | $total_info = $total_info [0]; |
| 356 | - $total_asr = ($total_info ['attempts'] > 0) ? round ( ($total_info ['completed'] / $total_info ['attempts']) * 100, 2 ) : 0; |
|
| 357 | - $total_acd = ($total_info ['completed'] > 0) ? round ( $total_info ['billable'] / $total_info ['completed'] ) : 0; |
|
| 356 | + $total_asr = ($total_info ['attempts'] > 0) ? round (($total_info ['completed'] / $total_info ['attempts']) * 100, 2) : 0; |
|
| 357 | + $total_acd = ($total_info ['completed'] > 0) ? round ($total_info ['billable'] / $total_info ['completed']) : 0; |
|
| 358 | 358 | if ($show_seconds == 'minutes') { |
| 359 | - $total_info ['duration'] = $total_info ['duration'] > 0 ? sprintf ( '%02d', $total_info ['duration'] / 60 ) . ":" . sprintf ( '%02d', ($total_info ['duration'] % 60) ) : "00:00"; |
|
| 360 | - $total_info ['billable'] = $total_info ['billable'] > 0 ? sprintf ( '%02d', $total_info ['billable'] / 60 ) . ":" . sprintf ( '%02d', ($total_info ['billable'] % 60) ) : "00:00"; |
|
| 361 | - $total_acd = $total_acd > 0 ? sprintf ( '%02d', $total_acd / 60 ) . ":" . sprintf ( '%02d', ($total_acd % 60) ) : "00:00"; |
|
| 362 | - $total_info ['mcd'] = $total_info ['mcd'] > 0 ? sprintf ( '%02d', $total_info ['mcd'] / 60 ) . ":" . sprintf ( '%02d', ($total_info ['mcd'] % 60) ) : "00:00"; |
|
| 359 | + $total_info ['duration'] = $total_info ['duration'] > 0 ? sprintf ('%02d', $total_info ['duration'] / 60).":".sprintf('%02d', ($total_info ['duration'] % 60)) : "00:00"; |
|
| 360 | + $total_info ['billable'] = $total_info ['billable'] > 0 ? sprintf ('%02d', $total_info ['billable'] / 60).":".sprintf('%02d', ($total_info ['billable'] % 60)) : "00:00"; |
|
| 361 | + $total_acd = $total_acd > 0 ? sprintf ('%02d', $total_acd / 60).":".sprintf('%02d', ($total_acd % 60)) : "00:00"; |
|
| 362 | + $total_info ['mcd'] = $total_info ['mcd'] > 0 ? sprintf ('%02d', $total_info ['mcd'] / 60).":".sprintf('%02d', ($total_info ['mcd'] % 60)) : "00:00"; |
|
| 363 | 363 | } |
| 364 | 364 | if ($entity != 'provider') { |
| 365 | - $total_profit = $this->common->calculate_currency_manually ( $currency_info, $total_info ['debit'] - $total_info ['cost'], false ); |
|
| 366 | - $total_debit = $this->common->calculate_currency_manually ( $currency_info, $total_info ['debit'], false ); |
|
| 365 | + $total_profit = $this->common->calculate_currency_manually($currency_info, $total_info ['debit'] - $total_info ['cost'], false); |
|
| 366 | + $total_debit = $this->common->calculate_currency_manually($currency_info, $total_info ['debit'], false); |
|
| 367 | 367 | } |
| 368 | - $total_cost = $this->common->calculate_currency_manually ( $currency_info, $total_info ['cost'], false ); |
|
| 368 | + $total_cost = $this->common->calculate_currency_manually($currency_info, $total_info ['cost'], false); |
|
| 369 | 369 | if ($entity != 'provider') { |
| 370 | - $last_array = array ( |
|
| 371 | - "<b>" . $total_info ['attempts'] . "</b>", |
|
| 372 | - "<b>" . $total_info ['completed'] . "</b>", |
|
| 373 | - "<b>" . $total_info ['duration'] . "</b>", |
|
| 374 | - "<b>" . $total_asr . "</b>", |
|
| 375 | - "<b>" . $total_acd . "</b>", |
|
| 376 | - "<b>" . $total_info ['mcd'] . "</b>", |
|
| 377 | - "<b>" . $total_info ['billable'] . "</b>", |
|
| 378 | - "<b>" . $total_debit . "</b>", |
|
| 379 | - "<b>" . $total_cost . "</b>", |
|
| 380 | - "<b>" . $total_profit . "</b>" |
|
| 370 | + $last_array = array( |
|
| 371 | + "<b>".$total_info ['attempts']."</b>", |
|
| 372 | + "<b>".$total_info ['completed']."</b>", |
|
| 373 | + "<b>".$total_info ['duration']."</b>", |
|
| 374 | + "<b>".$total_asr."</b>", |
|
| 375 | + "<b>".$total_acd."</b>", |
|
| 376 | + "<b>".$total_info ['mcd']."</b>", |
|
| 377 | + "<b>".$total_info ['billable']."</b>", |
|
| 378 | + "<b>".$total_debit."</b>", |
|
| 379 | + "<b>".$total_cost."</b>", |
|
| 380 | + "<b>".$total_profit."</b>" |
|
| 381 | 381 | ); |
| 382 | 382 | } else { |
| 383 | - $last_array = array ( |
|
| 384 | - "<b>" . $total_info ['attempts'] . "</b>", |
|
| 385 | - "<b>" . $total_info ['completed'] . "</b>", |
|
| 386 | - "<b>" . $total_info ['duration'] . "</b>", |
|
| 387 | - "<b>" . $total_asr . "</b>", |
|
| 388 | - "<b>" . $total_acd . "</b>", |
|
| 389 | - "<b>" . $total_info ['mcd'] . "</b>", |
|
| 390 | - "<b>" . $total_info ['billable'] . "</b>", |
|
| 391 | - "<b>" . $total_cost . "</b>" |
|
| 383 | + $last_array = array( |
|
| 384 | + "<b>".$total_info ['attempts']."</b>", |
|
| 385 | + "<b>".$total_info ['completed']."</b>", |
|
| 386 | + "<b>".$total_info ['duration']."</b>", |
|
| 387 | + "<b>".$total_asr."</b>", |
|
| 388 | + "<b>".$total_acd."</b>", |
|
| 389 | + "<b>".$total_info ['mcd']."</b>", |
|
| 390 | + "<b>".$total_info ['billable']."</b>", |
|
| 391 | + "<b>".$total_cost."</b>" |
|
| 392 | 392 | ); |
| 393 | 393 | } |
| 394 | 394 | if ($purpose == 'export') { |
| 395 | 395 | $search_arr ['custom_total_array'] [0] = "Grand Total"; |
| 396 | 396 | } |
| 397 | - $new_export_array = array (); |
|
| 398 | - foreach ( $last_array as $key => $value ) { |
|
| 399 | - $value = str_replace ( "<b>", "", $value ); |
|
| 400 | - $value = str_replace ( "</b>", '', $value ); |
|
| 397 | + $new_export_array = array(); |
|
| 398 | + foreach ($last_array as $key => $value) { |
|
| 399 | + $value = str_replace("<b>", "", $value); |
|
| 400 | + $value = str_replace("</b>", '', $value); |
|
| 401 | 401 | if ($key == 7 || $key == 8 || $key == 9) { |
| 402 | - $value = sprintf ( "%." . $currency_info ['decimalpoints'] . "f", floatval ( preg_replace ( '/[^\d.]/', '', $value ) ) ); |
|
| 402 | + $value = sprintf("%.".$currency_info ['decimalpoints']."f", floatval(preg_replace('/[^\d.]/', '', $value))); |
|
| 403 | 403 | } |
| 404 | 404 | $new_export_array [$key] = $value; |
| 405 | 405 | } |
| 406 | - $total_array = array_merge ( $search_arr ['custom_total_array'], $last_array ); |
|
| 407 | - $custom_export_arr = array_merge ( $search_arr ['custom_total_array'], $new_export_array ); |
|
| 406 | + $total_array = array_merge($search_arr ['custom_total_array'], $last_array); |
|
| 407 | + $custom_export_arr = array_merge($search_arr ['custom_total_array'], $new_export_array); |
|
| 408 | 408 | $export_arr [] = $custom_export_arr; |
| 409 | - $json_data [] = array ( |
|
| 409 | + $json_data [] = array( |
|
| 410 | 410 | 'cell' => $total_array |
| 411 | 411 | ); |
| 412 | 412 | return $purpose == 'grid' ? $json_data : $export_arr; |
| 413 | 413 | } |
| 414 | 414 | function customer_export_csv() { |
| 415 | - $account_info = $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 415 | + $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
|
| 416 | 416 | $currency_id = $account_info ['currency_id']; |
| 417 | - $currency = $this->common->get_field_name ( 'currency', 'currency', $currency_id ); |
|
| 418 | - $search_arr = $this->session->userdata ( 'customersummary_reports_export' ); |
|
| 419 | - $data_arr = array (); |
|
| 420 | - $query = $this->summary_model->get_customersummary_report_list ( true, '', '', $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], true ); |
|
| 421 | - $search_header = explode ( ",", $search_arr ['export_str'] ); |
|
| 422 | - ob_clean (); |
|
| 423 | - $fixed_header = array ( |
|
| 417 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
| 418 | + $search_arr = $this->session->userdata('customersummary_reports_export'); |
|
| 419 | + $data_arr = array(); |
|
| 420 | + $query = $this->summary_model->get_customersummary_report_list(true, '', '', $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], true); |
|
| 421 | + $search_header = explode(",", $search_arr ['export_str']); |
|
| 422 | + ob_clean(); |
|
| 423 | + $fixed_header = array( |
|
| 424 | 424 | 'Attempted Calls', |
| 425 | 425 | 'Completed Calls', |
| 426 | 426 | 'Duration', |
@@ -428,33 +428,33 @@ discard block |
||
| 428 | 428 | 'ACD', |
| 429 | 429 | 'MCD', |
| 430 | 430 | 'Billable', |
| 431 | - 'Debit(' . $currency . ')', |
|
| 432 | - 'Cost(' . $currency . ')', |
|
| 431 | + 'Debit('.$currency.')', |
|
| 432 | + 'Cost('.$currency.')', |
|
| 433 | 433 | 'Profit' |
| 434 | 434 | ); |
| 435 | - $header_arr [] = array_merge ( $search_header, $fixed_header ); |
|
| 436 | - if ($query->num_rows () > 0) { |
|
| 437 | - $data_arr = $this->summary_report_grid ( $search_arr, $query, 'customer', 'export' ); |
|
| 435 | + $header_arr [] = array_merge($search_header, $fixed_header); |
|
| 436 | + if ($query->num_rows() > 0) { |
|
| 437 | + $data_arr = $this->summary_report_grid($search_arr, $query, 'customer', 'export'); |
|
| 438 | 438 | } |
| 439 | - $customer_array = array_merge ( $header_arr, $data_arr ); |
|
| 439 | + $customer_array = array_merge($header_arr, $data_arr); |
|
| 440 | 440 | |
| 441 | - $this->load->helper ( 'csv' ); |
|
| 442 | - array_to_csv ( $customer_array, 'Customer_Summary_Report_' . date ( "Y-m-d" ) . '.csv' ); |
|
| 441 | + $this->load->helper('csv'); |
|
| 442 | + array_to_csv($customer_array, 'Customer_Summary_Report_'.date("Y-m-d").'.csv'); |
|
| 443 | 443 | } |
| 444 | 444 | function customer_search() { |
| 445 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
| 446 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
| 447 | - unset ( $_POST ['action'] ); |
|
| 448 | - unset ( $_POST ['advance_search'] ); |
|
| 449 | - $this->session->set_userdata ( 'customersummary_reports_search', $this->input->post () ); |
|
| 445 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
| 446 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
| 447 | + unset ($_POST ['action']); |
|
| 448 | + unset ($_POST ['advance_search']); |
|
| 449 | + $this->session->set_userdata('customersummary_reports_search', $this->input->post()); |
|
| 450 | 450 | } |
| 451 | - redirect ( base_url () . 'summary/customer/' ); |
|
| 451 | + redirect(base_url().'summary/customer/'); |
|
| 452 | 452 | } |
| 453 | 453 | function customer_clearsearchfilter() { |
| 454 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
| 455 | - $this->session->set_userdata ( 'customersummary_reports_search', "" ); |
|
| 456 | - $this->session->set_userdata ( 'customersummary_reports_export', "" ); |
|
| 457 | - redirect ( base_url () . 'summary/customer/' ); |
|
| 454 | + $this->session->set_userdata('advance_search', 0); |
|
| 455 | + $this->session->set_userdata('customersummary_reports_search', ""); |
|
| 456 | + $this->session->set_userdata('customersummary_reports_export', ""); |
|
| 457 | + redirect(base_url().'summary/customer/'); |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | /** |
@@ -462,17 +462,17 @@ discard block |
||
| 462 | 462 | * @param string $entity |
| 463 | 463 | */ |
| 464 | 464 | function summary_search_info($entity) { |
| 465 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 466 | - $this->db->select ( 'gmttime' ); |
|
| 467 | - $timezone_info = ( array ) $this->db->get_where ( 'timezone', array ( |
|
| 465 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 466 | + $this->db->select('gmttime'); |
|
| 467 | + $timezone_info = (array)$this->db->get_where('timezone', array( |
|
| 468 | 468 | "id" => $accountinfo ['timezone_id'] |
| 469 | - ) )->first_row (); |
|
| 470 | - if (! empty ( $timezone_info ['gmttime'] )) { |
|
| 469 | + ))->first_row(); |
|
| 470 | + if ( ! empty ($timezone_info ['gmttime'])) { |
|
| 471 | 471 | $user_timezone = $timezone_info ['gmttime']; |
| 472 | 472 | } else { |
| 473 | 473 | $user_timezone = "GMT+00:00"; |
| 474 | 474 | } |
| 475 | - $user_timezone_arr = explode ( "GMT", $user_timezone ); |
|
| 475 | + $user_timezone_arr = explode("GMT", $user_timezone); |
|
| 476 | 476 | $user_timezone_gmttime = $user_timezone_arr [1]; |
| 477 | 477 | $group_by_str = null; |
| 478 | 478 | $select_str = null; |
@@ -481,26 +481,26 @@ discard block |
||
| 481 | 481 | $group_by_2 = null; |
| 482 | 482 | $group_by_3 = null; |
| 483 | 483 | $order_str = null; |
| 484 | - $custom_total_array = array (); |
|
| 485 | - $custom_search = array (); |
|
| 484 | + $custom_total_array = array(); |
|
| 485 | + $custom_search = array(); |
|
| 486 | 486 | $export_select_str = null; |
| 487 | 487 | $new_arr ['search_in'] = 'minutes'; |
| 488 | 488 | $i = 0; |
| 489 | 489 | $db_field_name = $entity == 'provider' ? 'provider_id' : 'accountid'; |
| 490 | - if ($this->session->userdata ( 'advance_search' ) == 1) { |
|
| 491 | - $custom_search = $this->session->userdata ( $entity . 'summary_reports_search' ); |
|
| 492 | - if (isset ( $custom_search ['time'] ) && ! empty ( $custom_search ['time'] )) { |
|
| 493 | - $group_by_str .= $custom_search ['time'] . "(convert_tz(callstart,'+00:00','$user_timezone_gmttime')),"; |
|
| 494 | - $select_str .= $custom_search ['time'] . "(convert_tz(callstart,'+00:00','$user_timezone_gmttime')) as " . $order_str .= $custom_search ['time'] . ","; |
|
| 490 | + if ($this->session->userdata('advance_search') == 1) { |
|
| 491 | + $custom_search = $this->session->userdata($entity.'summary_reports_search'); |
|
| 492 | + if (isset ($custom_search ['time']) && ! empty ($custom_search ['time'])) { |
|
| 493 | + $group_by_str .= $custom_search ['time']."(convert_tz(callstart,'+00:00','$user_timezone_gmttime')),"; |
|
| 494 | + $select_str .= $custom_search ['time']."(convert_tz(callstart,'+00:00','$user_timezone_gmttime')) as ".$order_str .= $custom_search ['time'].","; |
|
| 495 | 495 | $group_by_time = $custom_search ['time']; |
| 496 | - $export_select_str .= $custom_search ['time'] . ","; |
|
| 496 | + $export_select_str .= $custom_search ['time'].","; |
|
| 497 | 497 | $custom_total_array [$i] = null; |
| 498 | - $i ++; |
|
| 498 | + $i++; |
|
| 499 | 499 | } |
| 500 | - if (isset ( $custom_search ['groupby_1'] ) && ! empty ( $custom_search ['groupby_1'] )) { |
|
| 501 | - $group_by_str .= $custom_search ['groupby_1'] . ","; |
|
| 502 | - $select_str .= $custom_search ['groupby_1'] . ","; |
|
| 503 | - $order_str .= $custom_search ['groupby_1'] . ","; |
|
| 500 | + if (isset ($custom_search ['groupby_1']) && ! empty ($custom_search ['groupby_1'])) { |
|
| 501 | + $group_by_str .= $custom_search ['groupby_1'].","; |
|
| 502 | + $select_str .= $custom_search ['groupby_1'].","; |
|
| 503 | + $order_str .= $custom_search ['groupby_1'].","; |
|
| 504 | 504 | $group_by_1 = $custom_search ['groupby_1']; |
| 505 | 505 | if ($custom_search ['groupby_1'] == $db_field_name) { |
| 506 | 506 | $export_select_str .= 'Account,'; |
@@ -511,18 +511,18 @@ discard block |
||
| 511 | 511 | $order_str .= 'notes,'; |
| 512 | 512 | $export_select_str .= "Code,Destination,"; |
| 513 | 513 | $custom_total_array [$i] = null; |
| 514 | - $i ++; |
|
| 514 | + $i++; |
|
| 515 | 515 | } elseif ($custom_search ['groupby_1'] == 'package_id') { |
| 516 | 516 | $export_select_str .= 'Package,'; |
| 517 | 517 | } |
| 518 | 518 | $custom_total_array [$i] = null; |
| 519 | - $i ++; |
|
| 519 | + $i++; |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | - if (isset ( $custom_search ['groupby_2'] ) && ! empty ( $custom_search ['groupby_2'] )) { |
|
| 523 | - $group_by_str .= $custom_search ['groupby_2'] . ","; |
|
| 524 | - $select_str .= $custom_search ['groupby_2'] . ","; |
|
| 525 | - $order_str .= $custom_search ['groupby_2'] . ","; |
|
| 522 | + if (isset ($custom_search ['groupby_2']) && ! empty ($custom_search ['groupby_2'])) { |
|
| 523 | + $group_by_str .= $custom_search ['groupby_2'].","; |
|
| 524 | + $select_str .= $custom_search ['groupby_2'].","; |
|
| 525 | + $order_str .= $custom_search ['groupby_2'].","; |
|
| 526 | 526 | $group_by_2 = $custom_search ['groupby_2']; |
| 527 | 527 | if ($custom_search ['groupby_2'] == $db_field_name) { |
| 528 | 528 | $export_select_str .= 'Account,'; |
@@ -533,18 +533,18 @@ discard block |
||
| 533 | 533 | $order_str .= 'notes,'; |
| 534 | 534 | $export_select_str .= "Code,Destination,"; |
| 535 | 535 | $custom_total_array [$i] = null; |
| 536 | - $i ++; |
|
| 536 | + $i++; |
|
| 537 | 537 | } elseif ($custom_search ['groupby_2'] == 'package_id') { |
| 538 | 538 | $export_select_str .= 'Package,'; |
| 539 | 539 | } |
| 540 | 540 | $custom_total_array [$i] = null; |
| 541 | - $i ++; |
|
| 541 | + $i++; |
|
| 542 | 542 | } |
| 543 | 543 | |
| 544 | - if (isset ( $custom_search ['groupby_3'] ) && ! empty ( $custom_search ['groupby_3'] )) { |
|
| 545 | - $group_by_str .= $custom_search ['groupby_3'] . ","; |
|
| 546 | - $select_str .= $custom_search ['groupby_3'] . ","; |
|
| 547 | - $order_str .= $custom_search ['groupby_3'] . ","; |
|
| 544 | + if (isset ($custom_search ['groupby_3']) && ! empty ($custom_search ['groupby_3'])) { |
|
| 545 | + $group_by_str .= $custom_search ['groupby_3'].","; |
|
| 546 | + $select_str .= $custom_search ['groupby_3'].","; |
|
| 547 | + $order_str .= $custom_search ['groupby_3'].","; |
|
| 548 | 548 | $group_by_3 = $custom_search ['groupby_3']; |
| 549 | 549 | if ($custom_search ['groupby_3'] == 'accountid' || $custom_search ['groupby_3'] == 'provider_id') { |
| 550 | 550 | $export_select_str .= 'Account,'; |
@@ -555,22 +555,22 @@ discard block |
||
| 555 | 555 | $order_str .= 'notes,'; |
| 556 | 556 | $export_select_str .= "Code,Destination,"; |
| 557 | 557 | $custom_total_array [$i] = null; |
| 558 | - $i ++; |
|
| 558 | + $i++; |
|
| 559 | 559 | } elseif ($custom_search ['groupby_3'] == 'package_id') { |
| 560 | 560 | $export_select_str .= 'Package,'; |
| 561 | 561 | } |
| 562 | 562 | $custom_total_array [$i] = null; |
| 563 | - $i ++; |
|
| 563 | + $i++; |
|
| 564 | 564 | } |
| 565 | - $new_arr ['search_in'] = (isset ( $custom_search ['search_in'] ) && ! empty ( $custom_search ['search_in'] )) ? $custom_search ['search_in'] : 'minutes'; |
|
| 566 | - unset ( $custom_search ['groupby_1'], $custom_search ['groupby_2'], $custom_search ['groupby_3'], $custom_search ['search_in'] ); |
|
| 567 | - $this->session->set_userdata ( 'summary_' . $entity . '_search', $custom_search ); |
|
| 565 | + $new_arr ['search_in'] = (isset ($custom_search ['search_in']) && ! empty ($custom_search ['search_in'])) ? $custom_search ['search_in'] : 'minutes'; |
|
| 566 | + unset ($custom_search ['groupby_1'], $custom_search ['groupby_2'], $custom_search ['groupby_3'], $custom_search ['search_in']); |
|
| 567 | + $this->session->set_userdata('summary_'.$entity.'_search', $custom_search); |
|
| 568 | 568 | } |
| 569 | - if (! empty ( $group_by_str )) { |
|
| 570 | - $group_by_str = rtrim ( $group_by_str, "," ); |
|
| 571 | - $select_str = rtrim ( $select_str, "," ); |
|
| 572 | - $order_str = rtrim ( $order_str, "," ); |
|
| 573 | - $export_select_str = rtrim ( $export_select_str, "," ); |
|
| 569 | + if ( ! empty ($group_by_str)) { |
|
| 570 | + $group_by_str = rtrim($group_by_str, ","); |
|
| 571 | + $select_str = rtrim($select_str, ","); |
|
| 572 | + $order_str = rtrim($order_str, ","); |
|
| 573 | + $export_select_str = rtrim($export_select_str, ","); |
|
| 574 | 574 | } else { |
| 575 | 575 | $select_str = $db_field_name; |
| 576 | 576 | $order_str = $db_field_name; |
@@ -578,8 +578,8 @@ discard block |
||
| 578 | 578 | $export_select_str = "Account"; |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | - array_pop ( $custom_total_array ); |
|
| 582 | - array_unshift ( $custom_total_array, '<b>Grand Total</b>' ); |
|
| 581 | + array_pop($custom_total_array); |
|
| 582 | + array_unshift($custom_total_array, '<b>Grand Total</b>'); |
|
| 583 | 583 | $new_arr ['export_str'] = $export_select_str; |
| 584 | 584 | $new_arr ['select_str'] = $select_str; |
| 585 | 585 | $new_arr ['order_str'] = $order_str; |
@@ -592,47 +592,47 @@ discard block |
||
| 592 | 592 | return $new_arr; |
| 593 | 593 | } |
| 594 | 594 | function provider() { |
| 595 | - $data ['page_title'] = gettext ( 'Provider Summary Report' ); |
|
| 595 | + $data ['page_title'] = gettext('Provider Summary Report'); |
|
| 596 | 596 | $data ['search_flag'] = true; |
| 597 | - $session_info = $this->session->userdata ( 'providersummary_reports_search' ); |
|
| 598 | - $accountlist = $this->db_model->build_dropdown_deleted ( 'id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array ( |
|
| 597 | + $session_info = $this->session->userdata('providersummary_reports_search'); |
|
| 598 | + $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array( |
|
| 599 | 599 | "type" => "3" |
| 600 | - ) ); |
|
| 601 | - $trunklist = $this->db_model->build_dropdown ( 'id,name', 'trunks', '', array () ); |
|
| 600 | + )); |
|
| 601 | + $trunklist = $this->db_model->build_dropdown('id,name', 'trunks', '', array()); |
|
| 602 | 602 | $data ['trunklist'] = $trunklist; |
| 603 | 603 | $data ['accountlist'] = $accountlist; |
| 604 | 604 | $data ['session_info'] = $session_info; |
| 605 | - $data ['seconds'] = $this->session->userdata ( 'provider_seconds' ); |
|
| 606 | - $data ['search_report'] = $this->common->search_report_in (); |
|
| 607 | - $data ['grid_fields'] = $this->summary_form->build_providersummary (); |
|
| 608 | - $data ["grid_buttons"] = $this->summary_form->build_grid_buttons_providersummary (); |
|
| 609 | - $data ['search_string_type'] = $this->common->search_string_type (); |
|
| 610 | - $data ['groupby_field'] = $this->common->set_summaryprovider_groupby (); |
|
| 611 | - $data ['groupby_time'] = $this->common->group_by_time (); |
|
| 612 | - $this->load->view ( 'view_providersummary_report', $data ); |
|
| 605 | + $data ['seconds'] = $this->session->userdata('provider_seconds'); |
|
| 606 | + $data ['search_report'] = $this->common->search_report_in(); |
|
| 607 | + $data ['grid_fields'] = $this->summary_form->build_providersummary(); |
|
| 608 | + $data ["grid_buttons"] = $this->summary_form->build_grid_buttons_providersummary(); |
|
| 609 | + $data ['search_string_type'] = $this->common->search_string_type(); |
|
| 610 | + $data ['groupby_field'] = $this->common->set_summaryprovider_groupby(); |
|
| 611 | + $data ['groupby_time'] = $this->common->group_by_time(); |
|
| 612 | + $this->load->view('view_providersummary_report', $data); |
|
| 613 | 613 | } |
| 614 | 614 | function provider_json() { |
| 615 | - $search_arr = $this->summary_search_info ( 'provider' ); |
|
| 616 | - $count_all = $this->summary_model->get_providersummary_report_list ( false, '', '', $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false ); |
|
| 617 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
| 615 | + $search_arr = $this->summary_search_info('provider'); |
|
| 616 | + $count_all = $this->summary_model->get_providersummary_report_list(false, '', '', $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false); |
|
| 617 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
| 618 | 618 | $json_data = $paging_data ["json_paging"]; |
| 619 | - $query = $this->summary_model->get_providersummary_report_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false ); |
|
| 620 | - if ($query->num_rows () > 0) { |
|
| 621 | - $json_data ['rows'] = $this->summary_report_grid ( $search_arr, $query, 'provider', 'grid' ); |
|
| 619 | + $query = $this->summary_model->get_providersummary_report_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false); |
|
| 620 | + if ($query->num_rows() > 0) { |
|
| 621 | + $json_data ['rows'] = $this->summary_report_grid($search_arr, $query, 'provider', 'grid'); |
|
| 622 | 622 | } |
| 623 | - $this->session->set_userdata ( 'providersummary_reports_export', $search_arr ); |
|
| 624 | - echo json_encode ( $json_data ); |
|
| 623 | + $this->session->set_userdata('providersummary_reports_export', $search_arr); |
|
| 624 | + echo json_encode($json_data); |
|
| 625 | 625 | } |
| 626 | 626 | function provider_export_csv() { |
| 627 | - $account_info = $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 627 | + $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
|
| 628 | 628 | $currency_id = $account_info ['currency_id']; |
| 629 | - $currency = $this->common->get_field_name ( 'currency', 'currency', $currency_id ); |
|
| 630 | - $search_arr = $this->session->userdata ( 'providersummary_reports_export' ); |
|
| 631 | - $data_arr = array (); |
|
| 632 | - $query = $this->summary_model->get_providersummary_report_list ( true, '', '', $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], true ); |
|
| 633 | - $search_header = explode ( ",", $search_arr ['export_str'] ); |
|
| 634 | - ob_clean (); |
|
| 635 | - $fixed_header = array ( |
|
| 629 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
| 630 | + $search_arr = $this->session->userdata('providersummary_reports_export'); |
|
| 631 | + $data_arr = array(); |
|
| 632 | + $query = $this->summary_model->get_providersummary_report_list(true, '', '', $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], true); |
|
| 633 | + $search_header = explode(",", $search_arr ['export_str']); |
|
| 634 | + ob_clean(); |
|
| 635 | + $fixed_header = array( |
|
| 636 | 636 | "Attempted Calls", |
| 637 | 637 | "Completed Calls", |
| 638 | 638 | "Duration", |
@@ -642,89 +642,89 @@ discard block |
||
| 642 | 642 | "Billable", |
| 643 | 643 | "Cost($currency)" |
| 644 | 644 | ); |
| 645 | - $header_arr [] = array_merge ( $search_header, $fixed_header ); |
|
| 646 | - if ($query->num_rows () > 0) { |
|
| 647 | - $data_arr = $this->summary_report_grid ( $search_arr, $query, 'provider', 'export' ); |
|
| 645 | + $header_arr [] = array_merge($search_header, $fixed_header); |
|
| 646 | + if ($query->num_rows() > 0) { |
|
| 647 | + $data_arr = $this->summary_report_grid($search_arr, $query, 'provider', 'export'); |
|
| 648 | 648 | } |
| 649 | - $provider_array = array_merge ( $header_arr, $data_arr ); |
|
| 649 | + $provider_array = array_merge($header_arr, $data_arr); |
|
| 650 | 650 | |
| 651 | - $this->load->helper ( 'csv' ); |
|
| 652 | - array_to_csv ( $provider_array, 'Provider_Summary_Report_' . date ( "Y-m-d" ) . '.csv' ); |
|
| 651 | + $this->load->helper('csv'); |
|
| 652 | + array_to_csv($provider_array, 'Provider_Summary_Report_'.date("Y-m-d").'.csv'); |
|
| 653 | 653 | } |
| 654 | 654 | function provider_search() { |
| 655 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
| 656 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
| 657 | - unset ( $_POST ['action'], $_POST ['advance_search'] ); |
|
| 658 | - $this->session->set_userdata ( 'providersummary_reports_search', $this->input->post () ); |
|
| 655 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
| 656 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
| 657 | + unset ($_POST ['action'], $_POST ['advance_search']); |
|
| 658 | + $this->session->set_userdata('providersummary_reports_search', $this->input->post()); |
|
| 659 | 659 | } |
| 660 | - redirect ( base_url () . 'summary/provider/' ); |
|
| 660 | + redirect(base_url().'summary/provider/'); |
|
| 661 | 661 | } |
| 662 | 662 | function provider_clearsearchfilter() { |
| 663 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
| 664 | - $this->session->set_userdata ( 'providersummary_reports_search', "" ); |
|
| 665 | - $this->session->set_userdata ( 'providersummary_reports_export', "" ); |
|
| 666 | - redirect ( base_url () . "summary/provider/" ); |
|
| 663 | + $this->session->set_userdata('advance_search', 0); |
|
| 664 | + $this->session->set_userdata('providersummary_reports_search', ""); |
|
| 665 | + $this->session->set_userdata('providersummary_reports_export', ""); |
|
| 666 | + redirect(base_url()."summary/provider/"); |
|
| 667 | 667 | } |
| 668 | 668 | function reseller() { |
| 669 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
| 670 | - $data ['page_title'] = gettext ( 'Reseller Summary Report' ); |
|
| 669 | + $data ['username'] = $this->session->userdata('user_name'); |
|
| 670 | + $data ['page_title'] = gettext('Reseller Summary Report'); |
|
| 671 | 671 | $data ['search_flag'] = true; |
| 672 | - $session_info = $this->session->userdata ( 'resellersummary_reports_search' ); |
|
| 673 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 672 | + $session_info = $this->session->userdata('resellersummary_reports_search'); |
|
| 673 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 674 | 674 | $reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0; |
| 675 | - $accountlist = $this->db_model->build_dropdown_deleted ( 'id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array ( |
|
| 675 | + $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array( |
|
| 676 | 676 | 'reseller_id' => $reseller_id, |
| 677 | 677 | "type" => "1" |
| 678 | - ) ); |
|
| 678 | + )); |
|
| 679 | 679 | $data ['accountlist'] = $accountlist; |
| 680 | - $data ['seconds'] = $this->session->userdata ( 'reseller_seconds' ); |
|
| 680 | + $data ['seconds'] = $this->session->userdata('reseller_seconds'); |
|
| 681 | 681 | $data ['session_info'] = $session_info; |
| 682 | - $data ['search_report'] = $this->common->search_report_in (); |
|
| 683 | - $data ['search_string_type'] = $this->common->search_string_type (); |
|
| 684 | - $new_column_arr = $this->summary_column_arr ( 'reseller' ); |
|
| 685 | - $data ['grid_fields'] = $this->summary_form->build_resellersummary ( $new_column_arr ); |
|
| 686 | - $data ["grid_buttons"] = $this->summary_form->build_grid_buttons_resellersummary (); |
|
| 687 | - $data ['groupby_field'] = $this->common->set_summarycustomer_groupby (); |
|
| 688 | - $data ['groupby_time'] = $this->common->group_by_time (); |
|
| 689 | - $this->load->view ( 'view_resellersummary_report', $data ); |
|
| 682 | + $data ['search_report'] = $this->common->search_report_in(); |
|
| 683 | + $data ['search_string_type'] = $this->common->search_string_type(); |
|
| 684 | + $new_column_arr = $this->summary_column_arr('reseller'); |
|
| 685 | + $data ['grid_fields'] = $this->summary_form->build_resellersummary($new_column_arr); |
|
| 686 | + $data ["grid_buttons"] = $this->summary_form->build_grid_buttons_resellersummary(); |
|
| 687 | + $data ['groupby_field'] = $this->common->set_summarycustomer_groupby(); |
|
| 688 | + $data ['groupby_time'] = $this->common->group_by_time(); |
|
| 689 | + $this->load->view('view_resellersummary_report', $data); |
|
| 690 | 690 | } |
| 691 | 691 | function reseller_json() { |
| 692 | - $search_arr = $this->summary_search_info ( 'reseller' ); |
|
| 693 | - $count_all = $this->summary_model->get_resellersummary_report_list ( false, 0, 0, $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false ); |
|
| 694 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
| 692 | + $search_arr = $this->summary_search_info('reseller'); |
|
| 693 | + $count_all = $this->summary_model->get_resellersummary_report_list(false, 0, 0, $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false); |
|
| 694 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
| 695 | 695 | $json_data = $paging_data ["json_paging"]; |
| 696 | - $query = $this->summary_model->get_resellersummary_report_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false ); |
|
| 697 | - if ($query->num_rows () > 0) { |
|
| 698 | - $json_data ['rows'] = $this->summary_report_grid ( $search_arr, $query, 'reseller', 'grid' ); |
|
| 696 | + $query = $this->summary_model->get_resellersummary_report_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false); |
|
| 697 | + if ($query->num_rows() > 0) { |
|
| 698 | + $json_data ['rows'] = $this->summary_report_grid($search_arr, $query, 'reseller', 'grid'); |
|
| 699 | 699 | } |
| 700 | - $this->session->set_userdata ( 'resellersummary_reports_export', $search_arr ); |
|
| 701 | - echo json_encode ( $json_data ); |
|
| 700 | + $this->session->set_userdata('resellersummary_reports_export', $search_arr); |
|
| 701 | + echo json_encode($json_data); |
|
| 702 | 702 | } |
| 703 | 703 | function reseller_search() { |
| 704 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
| 705 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
| 706 | - unset ( $_POST ['action'], $_POST ['advance_search'] ); |
|
| 707 | - $this->session->set_userdata ( 'resellersummary_reports_search', $this->input->post () ); |
|
| 704 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
| 705 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
| 706 | + unset ($_POST ['action'], $_POST ['advance_search']); |
|
| 707 | + $this->session->set_userdata('resellersummary_reports_search', $this->input->post()); |
|
| 708 | 708 | } |
| 709 | - redirect ( base_url () . "summary/reseller/" ); |
|
| 709 | + redirect(base_url()."summary/reseller/"); |
|
| 710 | 710 | } |
| 711 | 711 | function reseller_clearsearchfilter() { |
| 712 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
| 713 | - $this->session->set_userdata ( 'resellersummary_reports_search', "" ); |
|
| 714 | - $this->session->set_userdata ( 'resellersummary_reports_export', "" ); |
|
| 715 | - redirect ( base_url () . "summary/reseller/" ); |
|
| 712 | + $this->session->set_userdata('advance_search', 0); |
|
| 713 | + $this->session->set_userdata('resellersummary_reports_search', ""); |
|
| 714 | + $this->session->set_userdata('resellersummary_reports_export', ""); |
|
| 715 | + redirect(base_url()."summary/reseller/"); |
|
| 716 | 716 | } |
| 717 | 717 | function reseller_export_csv() { |
| 718 | - $account_info = $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 718 | + $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
|
| 719 | 719 | $currency_id = $account_info ['currency_id']; |
| 720 | - $currency = $this->common->get_field_name ( 'currency', 'currency', $currency_id ); |
|
| 720 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
| 721 | 721 | |
| 722 | - $search_arr = $this->session->userdata ( 'resellersummary_reports_export' ); |
|
| 723 | - $data_arr = array (); |
|
| 724 | - $query = $this->summary_model->get_resellersummary_report_list ( true, '', '', $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], true ); |
|
| 725 | - $search_header = explode ( ",", $search_arr ['export_str'] ); |
|
| 726 | - ob_clean (); |
|
| 727 | - $fixed_header = array ( |
|
| 722 | + $search_arr = $this->session->userdata('resellersummary_reports_export'); |
|
| 723 | + $data_arr = array(); |
|
| 724 | + $query = $this->summary_model->get_resellersummary_report_list(true, '', '', $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], true); |
|
| 725 | + $search_header = explode(",", $search_arr ['export_str']); |
|
| 726 | + ob_clean(); |
|
| 727 | + $fixed_header = array( |
|
| 728 | 728 | "Attempted Calls", |
| 729 | 729 | "Completed Calls", |
| 730 | 730 | "Duration", |
@@ -736,13 +736,13 @@ discard block |
||
| 736 | 736 | "Cost($currency)", |
| 737 | 737 | "Profit" |
| 738 | 738 | ); |
| 739 | - $header_arr [] = array_merge ( $search_header, $fixed_header ); |
|
| 740 | - if ($query->num_rows () > 0) { |
|
| 741 | - $data_arr = $this->summary_report_grid ( $search_arr, $query, 'reseller', 'export' ); |
|
| 739 | + $header_arr [] = array_merge($search_header, $fixed_header); |
|
| 740 | + if ($query->num_rows() > 0) { |
|
| 741 | + $data_arr = $this->summary_report_grid($search_arr, $query, 'reseller', 'export'); |
|
| 742 | 742 | } |
| 743 | - $reseller_array = array_merge ( $header_arr, $data_arr ); |
|
| 744 | - $this->load->helper ( 'csv' ); |
|
| 745 | - array_to_csv ( $reseller_array, 'Reseller_Summary_Report_' . date ( "Y-m-d" ) . '.csv' ); |
|
| 743 | + $reseller_array = array_merge($header_arr, $data_arr); |
|
| 744 | + $this->load->helper('csv'); |
|
| 745 | + array_to_csv($reseller_array, 'Reseller_Summary_Report_'.date("Y-m-d").'.csv'); |
|
| 746 | 746 | } |
| 747 | 747 | } |
| 748 | 748 | ?> |