<?php
 require_once('class.WebRAD.inc.php'); class Actions2 extends WebRAD { var $db; public function __construct( $app) { parent::__construct( $app); $this->owner->set_help( get_class($this)); $this->db = $this->owner->load_db_resource( get_class($this)); $this->can_access = ValidateLevel( $this->owner->config['SECURITY']['RESELLER_OPERATORS']); $this->can_add = ValidateLevel( $this->owner->config['SECURITY']['RESELLER_OPERATORS']+LVL_ADD); $this->can_edit = ValidateLevel( $this->owner->config['SECURITY']['RESELLER_OPERATORS']+LVL_EDIT); $this->can_remove = ValidateLevel( $this->owner->config['SECURITY']['SYSTEM_OPERATORS']+LVL_REMOVE); } protected function int_searchform( $id='', $page=-1) { if ( $page >= 0) array_push($this->owner->pan_menu,array('rad.Actions2.table_view&amp;page='.$page.'&amp;user='.$id,'bbar/table.png',STR_CMMN_TABLE)); $Template = $this->owner->load_template_resource(array('hForm'=>'actsearch')); $Template->set_block('hForm', 'list', 'hList'); $Template->set_var('hList', ''); $Template->set_block('hForm', 'save', 'hSave'); $Template->set_var('hSave', ''); $Template->set_block('hForm', 'callfrom', 'hCall'); $Template->set_var('hCall', ''); $Template->set_var('VAL_FORMACTION', Linkage()); $Template->set_var('LS_PATH', $this->owner->get_ls_path()); $Template->set_var('TXT_FUNC_SAVED_SEARCH_JS', ''); $this->owner->page_title = STR_ACT_SEARCH; $Template->set_var('TXT_SEARCHACCNUM', STR_ACT_CALLFROM); $Template->set_var('TXT_SEARCHDATE1', STR_ACT_STARTTIME); $Template->set_var('TXT_SEARCHDATE2', STR_ACT_STOPTIME); $Template->set_var('BTN_SEARCH', STR_CMMN_SEARCH); $Template->set_var('TXT_FUNC_SEARCHDATE', $this->owner->get_calendar_link('date')); $Template->set_var('TXT_FUNC_SEARCHDATE2', $this->owner->get_calendar_link('edate')); if ( $id != '') $Template->set_var('HIDDEN_VARS', '<input type="hidden" name="q" value="rad.Actions2.table_view" /><input type="hidden" name="user" value="'.$id.'" />'); else { $Template->set_var('HIDDEN_VARS', '<input type="hidden" name="q" value="rad.Actions2.table_view" />'); $Template->set_var('TXT_UNAME', STR_ACT_USERNAME); $Template->set_var('VAL_UNAME', ''); $Template->parse('hList', 'list', true); } $Template->parse('hCall', 'callfrom', true); $Template->pparse('out', 'hForm'); } public function table_view() { if ( !$this->can_access) { $this->owner->permission_denied(); return; } if ( isset($GLOBALS['page'])) $page = $GLOBALS['page']; else $page = -1; if ( isset($GLOBALS['user'])) $id = $GLOBALS['user']; else { $this->owner->permission_denied(); return; } $date = ''; $edate = ''; $callfrom = ''; if ( isset($GLOBALS['date'])) $date = $GLOBALS['date']; if ( isset($GLOBALS['edate'])) $edate = $GLOBALS['edate']; if ( isset($GLOBALS['callfrom'])) $callfrom = $GLOBALS['callfrom']; call_user_func(array($this,'int_show'), $id, $date, $edate, $callfrom, $page); } public function search() { if ( !$this->can_access) { $this->owner->permission_denied(); return; } $page = -1; if ( isset($GLOBALS['page'])) $page = $GLOBALS['page']; $id = ''; if ( isset($GLOBALS['user'])) $id = $GLOBALS['user']; call_user_func(array($this,'int_searchform'), $id, $page); } protected function int_show($id='', $date='', $edate='', $callfrom='', $page=0) { $a = $this->db->get_records( $this->owner->config['LINES_PER_PAGE'], $page, $id, $date, $edate, $callfrom); $recs = $a[0][0]; $allRecs = $a[1]; $allTime = $a[0][1]; array_push($this->owner->pan_menu,array('rad.Actions2.search&amp;user='.$id.'&amp;page='.$page,'bbar/search.png',STR_CMMN_FIND)); $this->owner->pager('rad.Actions2.table_view&amp;user='.$id.'&amp;callfrom='.$callfrom.'&amp;date='.$date, $recs, $page); $allSum = 0; $allIn = 0; $allOut = 0; if (count($allRecs) > 0) { for ($i = 0; $i < count($allRecs); $i++) { $allRecs[$i][7] = round(($allRecs[$i][7]/1024),0); $allRecs[$i][8] = round(($allRecs[$i][8]/1024),0); $allRecs[$i][9] = round($allRecs[$i][9],2); $allIn += $allRecs[$i][7]; $allOut += $allRecs[$i][8]; $allSum += $allRecs[$i][9]; $allRecs[$i][4] = $allRecs[$i][4].':'.$allRecs[$i][11]; } $allName = array( 0 => STR_ACT_USERNAME, 1 => STR_ACT_STARTTIME, 2 => STR_ACT_STOPTIME, 3 => STR_ACT_CALLFROM, 4 => STR_ACT_CALLTO, 5 => STR_ACT_IP, 6 => STR_ACT_TIMEON, 7 => STR_ACT_INBYTES, 8 => STR_ACT_OUTBYTES, 9 => STR_ACT_MBILLING, 10 => STR_ACT_CAUSE); $this->owner->print_array_as_table($allName, $allRecs, sprintf(STR_ACT_TABLETITLE, $id, $date), sprintf(STR_ACT_TOTAL,$recs, $allTime, $allIn, $allOut, $allSum)); } else $this->owner->info_msg(STR_CMMN_NOTFOUND); } } ?>
