function index() { $this->getView()->addStylesheetURL('assets/stylesheets/sorting.css'); $customer_id = \Yoda\Request::getInt('customer_id'); $did_number = \Yoda\Request::getString('did_number'); $from_date = \Yoda\Request::getString('from_date'); $to_date = \Yoda\Request::getString('to_date'); $order = \Yoda\Request::getString('order', 'duration'); $direction = \Yoda\Request::getString('direction', 'ASC'); $pagination = new Pagination(); $pagination->setLimit(10); $pagination->setPage(\Yoda\Request::getInt('page', 1)); $pagination->setLink('index.php?controller=call_history&did_number=' . $did_number . '&customer_id=' . $customer_id . '&from_date=' . $from_date . '&to_date=' . $to_date); $cdr = new Didww\API2\CDRCollection(); $cdr->setCustomerId($customer_id); $cdr->setDidNumber($did_number); $cdr->setFromDate($from_date); $cdr->setToDate($to_date); $cdr->setOrderBy($order); $cdr->setOrderDir(strtoupper($direction)); $cdr->setLimit($pagination->getLimit()); $cdr->setOffset($pagination->getOffset()); $cdrs = $cdr->getList(); $total = $cdr->getTotal(); $pagination->setTotal($total); $this->getView()->setProperties(['view' => $this->getView(), 'cdrs' => $cdrs, 'customer_id' => $customer_id, 'did_number' => $did_number, 'from_date' => $from_date, 'to_date' => $to_date, 'pagination' => $pagination, 'order' => $order, 'direction' => $direction, 'total' => $total])->display(); }
function panel() { $customer_id = \Yoda\Request::getInt('customer_id'); $timezone = \Yoda\Request::getInt('timezone', 2); $language = \Yoda\Request::getString('language', 'en-GB'); $site_name = \Yoda\Request::getString('site_name', 'DIDWW Demo'); $site_url = \Yoda\Request::getString('site_url', 'http://example.com/'); $help_url = \Yoda\Request::getString('help_url', 'http://example.com/help_url'); $support_url = \Yoda\Request::getString('support_url', 'http://example.com/support_url'); $order_url = \Yoda\Application::liveSite(true) . 'index.php?controller=orders&action=add&customer_id=' . $customer_id . '&pbxww_form=1'; $request = new Didww\PBXww\Request(); $request->setCustomerId($customer_id); $request->setResellerId($_SESSION['reseller_id']); $did_numbers = DIDHelper::getPBXwwDIDsByCustomerID($customer_id); $request->setNumbers($did_numbers); $request->setSiteName($site_name); $request->setSiteUrl($site_url); $request->setHelpUrl($help_url); $request->setSupportUrl($support_url); $request->setOrderUrl($order_url); $request->setTimezone($timezone); $request->setLanguage($language); $request->getParams($_SESSION['resellerKey']); $this->getView()->display(null, ['request' => $request, 'pbxwwdomain' => Didww\PBXww\Request::PBXWW_DEFAULT_HOST]); }
function index() { $this->getView()->addStylesheetURL('assets/stylesheets/sorting.css'); $customer_id = \Yoda\Request::getInt('customer_id'); $destination = \Yoda\Request::getString('destination'); $source = \Yoda\Request::getString('source'); $success = \Yoda\Request::getString('success', ''); $from_date = \Yoda\Request::getString('from_date'); $to_date = \Yoda\Request::getString('to_date'); $order = \Yoda\Request::getString('order', 'destination'); $direction = \Yoda\Request::getString('direction', 'ASC'); $pagination = new Pagination(); $pagination->setLimit(10); $pagination->setPage(\Yoda\Request::getInt('page', 1)); $pagination->setLink('index.php?controller=sms&customer_id=' . $customer_id . '&destination=' . $destination . '&source=' . $source . '&success=' . $success . '&from_date=' . $from_date . '&to_date=' . $to_date); $sms = new Didww\API2\SMSCollection(); $sms->setCustomerId($customer_id); $sms->setDestination($destination); $sms->setSource($source); if ($success !== '') { $sms->setSuccess($success); } $sms->setFromDate($from_date); $sms->setToDate($to_date); $sms->setOrderBy($order); $sms->setOrderDir(strtoupper($direction)); $sms->setLimit($pagination->getLimit()); $sms->setOffset($pagination->getOffset()); $sms_log = $sms->getList(); $total = $sms->getTotal(); $pagination->setTotal($total); $this->getView()->setProperties(['view' => $this->getView(), 'sms_log' => $sms_log, 'customer_id' => $customer_id, 'destination' => $destination, 'source' => $source, 'success' => $success, 'from_date' => $from_date, 'to_date' => $to_date, 'pagination' => $pagination, 'order' => $order, 'direction' => $direction, 'total' => $total])->display(); }
function index() { $customer_id = \Yoda\Request::getInt('customer_id', 1); $from_date = \Yoda\Request::getString('from_date', gmdate('Y-m-d H:i:s', strtotime('-2 months'))); $to_date = \Yoda\Request::getString('to_date', gmdate('Y-m-d H:i:s')); $invoice = new Didww\API2\CDRInvoice(); $invoice->setCustomerId($customer_id); $invoice->setFromDate($from_date); $invoice->setToDate($to_date); $invoice->load(); $this->getView()->setProperties(['view' => $this->getView(), 'invoice' => $invoice, 'from_date' => $from_date, 'to_date' => $to_date, 'customer_id' => $customer_id])->display(); }
function update() { $customer_id = \Yoda\Request::getInt('customer_id'); $amount = \Yoda\Request::getFloat('amount'); try { $balance = new Didww\API2\Balance(); $balance->setCustomerId($customer_id); $balance->changeBalance($amount); $this->setMessage($amount . ' points was added to customer ID #' . $customer_id); } catch (SoapFault $e) { $this->setMessage("Error: (" . $e->faultcode . ") " . $e->faultstring, 'danger'); $this->redirect('index.php?controller=balance&action=add'); } catch (Exception $e) { $this->setMessage($e->getMessage(), 'danger'); $this->redirect('index.php?controller=balance&action=add'); } $this->redirect('index.php?controller=customers'); }
function autorenew() { $did_number = \Yoda\Request::getString('did_number'); $customer_id = \Yoda\Request::getInt('customer_id'); $status = \Yoda\Request::getInt('status'); try { $order = new Didww\API2\Order(); $order->setCustomerId($customer_id); $did = new Didww\API2\DIDNumber(); $did->setDidNumber($did_number); $did->setOrder($order); $did->changeAutorenew($status); $this->setMessage('Autorenew status for DID #' . $did->getDidNumber() . ' was changed successfully'); } catch (SoapFault $e) { $this->setMessage('Error: (' . $e->faultcode . ') ' . $e->faultstring, 'danger'); } catch (Exception $e) { $this->setMessage($e->getMessage(), 'danger'); } $this->redirect('index.php?controller=orders&customer_id=' . $customer_id); }
/** * @param $event * @param $controller \Yoda\Controller */ public function notify($event, $controller) { if ($event == 'onBeforeControllerExecute') { $name = $controller->getName(); $action = $controller->getCurrentAction(); $titles = ['Dashboard']; $links = []; if ($name == 'customers') { $titles[] = "Customers"; $links[] = 'index.php'; } if ($name == 'balance') { $titles[] = "Balance"; $links[] = 'index.php'; } if ($name == 'call_history') { $titles[] = "Call History"; $links[] = 'index.php'; } if ($name == 'sms') { $titles[] = "SMS Log"; $links[] = 'index.php'; } if ($name == 'call_history_invoices') { $titles[] = "Call History Invoices"; $links[] = 'index.php'; } if ($name == 'pstn') { $titles[] = "PSTN"; $links[] = 'index.php'; } if ($name == 'mapping') { $titles[] = "Change Mapping"; $links[] = 'index.php'; } if ($name == 'pbxww') { $titles[] = "PBXww"; $links[] = 'index.php'; } if ($name == 'toll_free') { $titles[] = "Toll Free"; $links[] = 'index.php'; } if ($name == 'orders') { $titles[] = "Customers"; $links[] = 'index.php'; $titles[] = "Orders"; $links[] = 'index.php?controller=customers'; } if ($name == 'orders' && $controller->getCurrentAction() == 'add') { $titles[] = "New Order"; $links[] = 'index.php?controller=orders&customer_id=' . \Yoda\Request::getInt('customer_id'); } if ($name == 'coverage') { $titles[] = "Coverage"; $links[] = 'index.php'; if ($action == 'show') { $titles[] = \Yoda\Request::getString('iso'); $links[] = 'index.php?controller=coverage'; } } $html = ""; for ($i = 0; $i < sizeof($titles); $i++) { if (isset($links[$i])) { $html .= "<li><a href='" . $links[$i] . "'>" . $titles[$i] . "</a></li>"; } else { $html .= "<li class='active'>" . $titles[$i] . "</li>"; } } $html = "<ul class='breadcrumb'>" . $html . "</ul>"; if (count($titles)) { $controller->getView()->setProperties(['breadcrumbs' => $html]); } } }