/** * Execute the job. * * @return void */ public function handle() { // Query the CUCM to get numbers in the None partition $res = Utils::executeQuery('SELECT dnorpattern, description FROM numplan WHERE fkroutepartition IS NULL AND tkpatternusage = 2', $this->cluster); // Create a line in the CSV for the Cluster heading Storage::append($this->outFile, $this->cluster->name . ',' . $this->cluster->ip); //If we got results..... if ($res) { //Add the results to our CSV file foreach ($res as $dn) { Storage::append($this->outFile, implode(",", [$dn->dnorpattern, $dn->description])); } } }
/** * @return \BladeView|bool|\Illuminate\View\View */ public function registrationIndex() { // Avoid PHP timeouts when querying large clusters set_time_limit(0); $cluster = \Auth::user()->activeCluster(); // Query CUCM for device name and model $data = Utils::executeQuery('SELECT d.name devicename, t.name model FROM device d INNER JOIN typemodel t ON d.tkmodel = t.enum', $cluster); // $deviceList will hold our array for RisPort $deviceList = []; // Loop SQL data and assign devicename to $deviceList foreach ($data as $key => $val) { $deviceList[$key]['DeviceName'] = $val->devicename; } $registrationReport = \App\Libraries\Utils::generateEraserList($deviceList, $cluster); return view('reports.registration.show', compact('registrationReport')); }
public function show($sql) { $sql = $this->sql->find($sql); $sql = $sql->sql; if (!\Auth::user()->activeCluster()) { alert()->error('Please set your active CUCM Cluster')->persistent('Close'); return redirect()->action('SqlController@index'); } $data = Utils::executeQuery($sql, \Auth::user()->activeCluster()); if (is_null($data)) { alert()->error('No Results Found')->persistent('Close'); return redirect()->back(); } $format = $this->sql->getHeaders($data); $page_title = 'SQL'; $page_description = 'Query'; return view('sql.show', compact('data', 'format', 'sql', 'page_title', 'page_description')); }
/** * Execute the job. * * @return void */ public function handle() { //Query the CUCM to get all DN's, descriptions and what number (if any) they are forwarded to $res = Utils::executeQuery('SELECT n.dnorpattern, n.description, cfwd.cfadestination FROM numplan n INNER JOIN callforwarddynamic cfwd ON n.pkid = cfwd.fknumplan', $this->cluster); // Create a line in the CSV for the Cluster heading Storage::append($this->outFile, $this->cluster->name . ',' . $this->cluster->ip); //If we got results..... if (!is_null($res)) { //Check to see what moron forwarded their line to themselves foreach ($res as $dn) { //If the right 10 digits of the dnorpattern matches the right 10 digits of the forward number.... if (substr($dn->dnorpattern, -10) == substr($dn->cfadestination, -10)) { //Write this to the report Storage::append($this->outFile, implode(",", [$dn->dnorpattern, $dn->description, $dn->cfadestination])); } } } }