コード例 #1
0
ファイル: call_history.php プロジェクト: didww/demo
 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();
 }
コード例 #2
0
ファイル: pbxww.php プロジェクト: didww/demo
 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]);
 }
コード例 #3
0
ファイル: sms.php プロジェクト: didww/demo
 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();
 }
コード例 #4
0
ファイル: coverage.php プロジェクト: didww/demo
 function show()
 {
     $countryIso = \Yoda\Request::getString('iso');
     $country = new Didww\API2\Country();
     $country->setCountryIso($countryIso);
     $country->loadCities();
     $cities = $country->getCities();
     $this->getView()->setProperties(['cities' => $cities])->display();
 }
コード例 #5
0
ファイル: call_history_invoices.php プロジェクト: didww/demo
 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();
 }
コード例 #6
0
ファイル: cities.php プロジェクト: didww/demo
 function index()
 {
     $countryIso = \Yoda\Request::getString('iso');
     $country = new Didww\API2\Country();
     $country->setCountryIso($countryIso);
     $country->loadCities();
     $cities = $country->getCities();
     $result = [];
     foreach ($cities as $city) {
         $o = new stdClass();
         $o->id = $city->getCityId();
         $o->name = $city->getCityName();
         $o->prefix = $city->getCityPrefix();
         $result[] = $o;
     }
     echo json_encode($result);
 }
コード例 #7
0
ファイル: pstn.php プロジェクト: didww/demo
 function update()
 {
     $sell_rates = \Yoda\Request::getArray('sell_rate');
     $rates = [];
     foreach ($sell_rates as $network_prefix => $sell_rate) {
         $rates[] = ['network_prefix' => trim($network_prefix), 'sell_rate' => $sell_rate];
     }
     try {
         Didww\API2\PSTNNetwork::updateNetworksFromArray($rates);
         $this->setMessage('PSTN rates updated 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=pstn');
 }
コード例 #8
0
ファイル: balance.php プロジェクト: didww/demo
 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');
 }
コード例 #9
0
ファイル: authorize.php プロジェクト: didww/demo
 function login()
 {
     $userName = \Yoda\Request::getString('username');
     $password = \Yoda\Request::getString('password');
     $testMode = \Yoda\Request::getBool('test_mode');
     try {
         APIHelper::setupClient($userName, $password, $testMode);
         $details = new ApiDetails();
     } catch (SoapFault $e) {
         $this->redirect('index.php?controller=authorize', 'Error: (' . $e->faultcode . ') ' . $e->faultstring, 'error');
     } catch (Exception $e) {
         $this->redirect('index.php?controller=authorize', $e->getMessage(), 'error');
     }
     $_SESSION['username'] = $userName;
     $_SESSION['resellerKey'] = $password;
     $_SESSION['isTestMode'] = $testMode;
     $_SESSION['reseller_id'] = $details->getResellerId();
     $this->redirect('index.php');
 }
コード例 #10
0
ファイル: orders.php プロジェクト: didww/demo
 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);
 }
コード例 #11
0
ファイル: breadcrumbs.php プロジェクト: didww/demo
 /**
  * @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]);
         }
     }
 }