<?php
 class WebRAD { var $can_access = false; var $can_add = false; var $can_edit = false; var $can_remove = false; var $t_types = array(); var $d_types = array(); var $dt_types = array(); var $f_types = array(); var $db; public function __construct( $app) { $this->owner = $app; $this->owner->set_help( get_class($this)); $this->owner->load_string_resource('webrad'); $this->db = $this->owner->load_db_resource('WebRAD'); $gdc = get_defined_constants(); for ( $i = 0; $i < 5; $i++) { $this->t_types[$i][0] = $i; $tmp = 'STR_WR2_TOS_'.$i; $this->t_types[$i][1]=$gdc[$tmp]; } for ( $i = 0; $i < 6; $i++) { $this->d_types[$i][0] = $i; $tmp = 'STR_WR2_DIR_'.$i; $this->d_types[$i][1]=$gdc[$tmp]; } for ( $i = 0; $i < 2; $i++) { $this->dt_types[$i][0] = $i; $tmp = 'STR_WR2_DOTOS_'.$i; $this->dt_types[$i][1]=$gdc[$tmp]; } for ( $i = 0; $i < 4; $i++) { $this->f_types[$i][0] = $i; $tmp = 'STR_WR2_FIXACT_'.$i; $this->f_types[$i][1]=$gdc[$tmp]; } } protected function get_users_from_gid($value, $ncol, $prefix='') { if ( $ncol>0) { return '<a class="btn btn-link" href="'.$_SERVER['PHP_SELF'].'?q=rad.'.$prefix.'User2.table_view&amp;page=0&amp;gid='.$value.'">'.$ncol.'</a>'; } return '&nbsp;'; } protected function get_track_users_from_gid($value, $ncol) { if ( $ncol) { return '<a class="btn btn-link" href="'.$_SERVER['PHP_SELF'].'?q=rad.OpUser2.table_view&amp;page=0&amp;gid='.$value.'">'.$ncol.'</a>'; } return '&nbsp;'; } protected function get_users_from_sid($value, $ncol, $prefix='') { if ( $ncol>0) { return '<a class="btn btn-link" href="'.$_SERVER['PHP_SELF'].'?q=rad.'.$prefix.'User2.table_view&amp;page=0&amp;sid='.$value.'">'.$ncol.'</a>'; } return '&nbsp;'; } protected function get_packets_combo($default = '1', $cbName = 'gid') { $a = $this->db->GetAll("SELECT gid, packet FROM sk_packets"); return Selector($cbName, $a, $default); } protected function get_packet_name($default = '1') { $a = $this->db->GetAll("SELECT packet FROM sk_packets WHERE gid=".$default); return $a[0][0]; } protected function get_provider_packets_combo($default = '1', $cbName = 'gid') { $a = $this->db->GetAll("SELECT sk_packets.gid, sk_packets.packet FROM sk_packets, sk_service_set WHERE sk_packets.servce_set_id=sk_service_set.service_set_id AND sk_service_set.provider_id='".$GLOBALS['PROVIDER']."'"); return Selector($cbName, $a, $default); } protected function get_track_packets_combo($val, $default = '1', $cbName = 'gid') { $a = $this->db->GetAll("SELECT sk_packets.gid, sk_packets.packet FROM sk_packets, sk_group_tracker WHERE sk_packets.gid=sk_group_tracker.gid AND sk_group_tracker.obj_id='".$val."'"); return Selector($cbName, $a, $default); } public function get_cr_packet_name($default = '1') { $a = $this->db->GetAll("SELECT sk_packet FROM packets WHERE tos>0 AND gid=".$default); return $a[0][0]; } public function get_cr_provider_packets_combo($default = '1', $cbName = 'gid') { $a = $this->db->GetAll("SELECT sk_packets.gid, sk_packets.packet FROM sk_packets,sk_service_set WHERE sk_packets.tos>0 AND sk_packets.service_set_id=sk_service_set.service_set_id AND sk_service_set.provider_id='".$GLOBALS['PROVIDER']."'"); return Selector($cbName, $a, $default); } public function get_cr_track_packets_combo($val, $default = '1', $cbName = 'gid') { $a = $this->db->GetAll("SELECT sk_packets.gid, sk_packets.packet FROM sk_packets, sk_group_tracker WHERE sk_packets.tos>0 AND sk_packets.gid=sk_group_tracker.gid AND sk_group_tracker.obj_id='".$val."'"); return Selector($cbName, $a, $default); } protected function get_tos_combo($default = '0', $cbName = 'tos') { return Selector($cbName, $this->t_types, $default); } protected function get_dir_combo($default = '0', $cbName = 'direction') { return Selector($cbName, $this->d_types, $default); } protected function get_dt_combo($default = '0', $cbName = 'do_with_tos') { return Selector($cbName, $this->dt_types, $default); } protected function get_fixed_combo($default = '0', $cbName = 'fixed') { return Selector($cbName, $this->f_types, $default); } } ?>
