protected function prepareUpdateView($baseModel = NULL) { $route_types = array(); $trunkList = array(); $interfaceList = array(); if (class_exists('Trunk')) { $trunks = Doctrine::getTable('Trunk')->findAll(Doctrine::HYDRATE_ARRAY); foreach ($trunks as $trunk) { $trunkList[$trunk['trunk_id']] = $trunk['name']; } if (!empty($trunkList)) { $route_types[ExternalXfer::TYPE_TRUNK] = 'via Trunk'; } } if (class_exists('SipInterface')) { $interfaces = Doctrine::getTable('SipInterface')->findAll(Doctrine::HYDRATE_ARRAY); foreach ($interfaces as $interface) { $interfaceList[$interface['sipinterface_id']] = $interface['name']; } if (!empty($interfaceList)) { $route_types[ExternalXfer::TYPE_SIP] = 'via SIP URI'; } } if (empty($route_types)) { message::set('No Trunk or Sip Interfaces avaliable to route external destinations through!'); $this->returnQtipAjaxForm(NULL); url::redirect(Router_Core::$controller); } $this->view->trunks = $trunkList; $this->view->interfaces = $interfaceList; $this->view->route_types = $route_types; parent::prepareUpdateView($baseModel); }
public function prepareUpdateView() { // NOTE: This runs first because the plugins hook into this event and // populate the supportedTrunkTypes parent::prepareUpdateView(); $this->view->supportedTrunkTypes = empty($this->supportedTrunkTypes) ? array() : $this->supportedTrunkTypes; }
protected function prepareUpdateView() { $avaliableMemebers = array(); Event::run('ringgroup.avaliablemembers', $avaliableMemebers); $this->view->members = json_encode(array_reverse($this->ringgroup['members'])); $this->view->avaliableMembers = json_encode($avaliableMemebers); parent::prepareUpdateView(); }
public function prepareUpdateView() { $featurecodes = array(); foreach (Doctrine::getTable('CustomFeatureCode')->findAll(Doctrine::HYDRATE_ARRAY) as $customfeature) { $featurecodes[$customfeature['custom_feature_code_id']] = $customfeature['name']; } $this->view->featurecodes = $featurecodes; return parent::prepareUpdateView(); }
protected function prepareUpdateView($baseModel = NULL) { $sampleRates = array(); if (kohana::config('mediafile.hide_rate_folders')) { $this->view->sample_rates = $this->mediafile->get_resampled(); } else { $this->view->sample_rates = array($this->mediafile); } parent::prepareUpdateView($baseModel); }
public function prepareUpdateView() { if (!empty($this->create_class_type)) { $number_type = Doctrine::getTable('NumberType')->findOneByClass($this->create_class_type); if (!empty($number_type['number_type_id'])) { $this->view->create_class_type = $this->create_class_type; $this->view->create_number_type = $number_type['number_type_id']; } } return parent::prepareUpdateView(); }
public function prepareUpdateView() { $this->view->behind_nat = FALSE; if (!empty($this->sipinterface['nat_type'])) { $this->view->behind_nat = TRUE; } // This is not the best way to to do this but I am mimicing the // behavior that was already here if (Router::$method == 'add') { $this->sipinterface['nat_net_list_id'] = netlists::getSystemListId('nat.auto'); } parent::prepareUpdateView(); }
protected function prepareUpdateView($baseModel = NULL) { $types = array(); switch (Telephony::getDriverName()) { case 'FreeSwitch': $types = array(SimpleRoute::TYPE_SIMPLE => 'Short Hand', SimpleRoute::TYPE_REGEX => 'Regex'); break; default: $types = array(SimpleRoute::TYPE_SIMPLE => 'Short Hand'); } $patternTemplate = new View('simpleroute/pattern.mus', array('mustache_template' => FALSE)); $patternTemplate = json_encode((string) $patternTemplate); $patternTemplate = str_replace(array('\\n', ' '), '', $patternTemplate); $this->view->patternTemplate = $patternTemplate; $this->view->types = $types; parent::prepareUpdateView($baseModel); }
protected function prepareUpdateView() { $numberingOptions = array('number_pools' => array(array('value' => 0, 'text' => 'Select')), 'destinations' => array(array('value' => 0, 'text' => 'Select'))); $numberTypes = Doctrine::getTable('NumberType')->findAll(Doctrine::HYDRATE_ARRAY); foreach ($numberTypes as $numberType) { $numbers = Doctrine_Query::create()->select('n.number_id, n.number, d.name')->from('Number n, n.' . str_replace('Number', '', $numberType['class']) . ' d')->where('(n.foreign_id <> ? AND n.foreign_id IS NOT NULL)', array(0))->andWhereIn('n.class_type', array($numberType['class']))->orderBy('number')->execute(array(), Doctrine::HYDRATE_SCALAR); if (empty($numbers)) { continue; } $displayName = str_replace('Number', '', $numberType['class']); $displayName = inflector::humanizeModelName($displayName); $numberingOptions['number_pools'][] = array('value' => $numberType['class'], 'text' => $displayName); foreach ($numbers as $number) { $numberingOptions['destinations'][] = array('value' => $number['n_number_id'], 'text' => $number['d_name'] . ' (' . $number['n_number'] . ')', 'class' => $numberType['class']); } } $this->view->numberingJson = json_encode($numberingOptions); $this->view->keys = json_encode($this->autoattendant['keys']); parent::prepareUpdateView(); }
protected function prepareUpdateView() { $allowList = empty($_POST['ips']['allow']) ? array() : array_flip($_POST['ips']['allow']); $denyList = empty($_POST['ips']['deny']) ? array() : array_flip($_POST['ips']['deny']); $options = array('127.0.0.1/32' => '127.0.0.1 (Loopback)', '10.0.0.0/8' => '10.0.0.0 - 10.255.255.255 (Private Network)', '172.16.0.0/12' => '172.16.0.0 - 172.31.255.255 (Private Network)', '192.168.0.0/16' => '192.168.0.0 - 192.168.255.255 (Private Network)'); $allListItems = Doctrine::getTable('NetListItem')->findAll(); foreach ($allListItems as $item) { $cidr = $item['record']; $range = network::cidr2range($cidr); if (empty($range)) { $description = $cidr; } else { if ($range['start'] == $range['end']) { $description = $range['start']; } else { $description = $range['start'] . ' - ' . $range['end']; } } if (!empty($item['description'])) { $description .= ' (' . $item['description'] . ')'; } // all net lists go into the options list $options[$cidr] = $description; // check if it is in the selected list if ($this->netlist['net_list_id'] == $item['net_list_id']) { if (empty($item['allow'])) { $denyList[$cidr] = $description; } else { $allowList[$cidr] = $description; } } } $this->view->netListItems = array_unique($options); $this->view->netListAllow = array_keys($allowList); $this->view->netListDeny = array_keys($denyList); parent::prepareUpdateView(); }
public function prepareUpdateView() { $this->view->behind_nat = FALSE; if (!empty($this->sipinterface['nat_type'])) { $this->view->behind_nat = TRUE; } // This is not the best way to to do this but I am mimicing the // behavior that was already here if (Router::$method == 'add') { $this->sipinterface['nat_net_list_id'] = netlists::getSystemListId('nat.auto'); } $result = Doctrine::getTable('SipInterface')->findAll(Doctrine::HYDRATE_ARRAY); $options = array(); foreach ($result as $row) { if (!$row['auth']) { $options[$row['sipinterface_id']] = $row['name']; } } foreach ($result as $row) { if ($row['auth']) { $options[$row['sipinterface_id']] = $row['name']; } } $this->view->options = $options; parent::prepareUpdateView(); }
protected function prepareUpdateView($baseModel = NULL) { parent::prepareUpdateView($baseModel); $this->conference['registry'] += array('energy-level' => 20, 'comfort-noise' => true); }
protected function prepareUpdateView($baseModel = NULL) { $route_types = array(); $trunkList = array(); $interfaceList = array(); $numbers = Doctrine_Query::Create()->select("Number.number_id,Number.number,Number.foreign_id")->from("Number,NumberPool,NumberType")->where("NumberType.class='ExternalXferNumber'")->andWhere("NumberType.number_type_id=NumberPool.number_type_id")->andWhere("NumberPool.number_id=Number.number_id"); if ($this->externalxfer->external_xfer_id) { $numbers = $numbers->andWhere("(Number.class_type='' or Number.class_type IS NULL or Number.foreign_id=?)", $this->externalxfer->external_xfer_id); } else { $numbers = $numbers->andWhere("(Number.class_type='' or Number.class_type IS NULL )"); } $numbers = $numbers->orderBy('Number.number')->execute(array(), Doctrine::HYDRATE_SCALAR); $this->view->numbers = array(); $this->view->numberdefault = NULL; $matchcount = 0; foreach ($numbers as $number) { $this->view->numbers[$number['Number_number_id']] = $number['Number_number']; if ($this->externalxfer->external_xfer_id == $number['Number_foreign_id']) { $this->view->numberdefault = $number['Number_number_id']; $matchcount++; } } if ($matchcount > 1) { message::set('This record cannot be edited, due to having multiple numbers'); $this->returnQtipAjaxForm(NULL); url::redirect(Router_Core::$controller); } if (class_exists('Trunk')) { $trunks = Doctrine::getTable('Trunk')->findAll(Doctrine::HYDRATE_ARRAY); foreach ($trunks as $trunk) { $trunkList[$trunk['trunk_id']] = $trunk['name']; } if (!empty($trunkList)) { $route_types[ExternalXfer::TYPE_TRUNK] = 'via Trunk'; } } if (class_exists('SipInterface')) { $interfaces = Doctrine::getTable('SipInterface')->findAll(Doctrine::HYDRATE_ARRAY); foreach ($interfaces as $interface) { $interfaceList[$interface['sipinterface_id']] = $interface['name']; } if (!empty($interfaceList)) { $route_types[ExternalXfer::TYPE_SIP] = 'via SIP URI'; } } if (empty($route_types)) { message::set('No Trunk or Sip Interfaces avaliable to route external destinations through!'); $this->returnQtipAjaxForm(NULL); url::redirect(Router_Core::$controller); } if (empty($numbers)) { message::set('No extensions available!'); $this->returnQtipAjaxForm(NULL); url::redirect(Router_Core::$controller); } $this->view->trunks = $trunkList; $this->view->interfaces = $interfaceList; $this->view->route_types = $route_types; parent::prepareUpdateView($baseModel); }
protected function prepareUpdateView($baseModel = NULL) { if (!empty($_POST['pdnsdomain']['soa']['primary'])) { $this->view->primary = $_POST['pdnsdomain']['soa']['primary']; } else { $this->view->primary = ''; } if (!empty($_POST['pdnsdomain']['soa']['hostmaster'])) { $this->view->hostmaster = $_POST['pdnsdomain']['soa']['hostmaster']; } else { $this->view->hostmaster = ''; } // populate the keys $records = array(); foreach ($this->pdnsdomain->PdnsRecord as $record) { $record = $record->toArray(); $record['name'] = str_replace('.' . $this->pdnsdomain['name'], '', $record['name']); $records[$record['id']] = $record; } $this->view->records = $records; $this->view->recordTypes = $this->recordTypes; parent::prepareUpdateView($baseModel); }
protected function prepareUpdateView($baseModel = NULL) { parent::prepareUpdateView($baseModel); if ($baseModel != 'Endpoint' && !is_null($baseModel)) { return; } $brandandmodel = $this->endpoint['brand'] . "|" . $this->endpoint['model']; $prov = $this->_getprovisioningdata(); $models = array(); $brandname = "<select id='brand_select' name='endpoint[brand]' onchange='update_models(this.value)'>"; if (is_null($this->endpoint['brand'])) { $brandname .= "<option value=''>Select</option>"; } foreach ($prov['phones'] as $brand => $branddata) { if ($brand == '') { continue; } // special "global" settings. foreach ($branddata as $family) { $modeldata = array_values($family['models']); } if ($this->endpoint['brand'] == $brand) { $selected = "selected"; } else { $selected = ""; } $brandname .= "\t<option value='{$brand}' {$selected}>" . $modeldata[0]["brandname"] . "</option>\n"; $models[$brand] = ''; foreach ($branddata as $family) { foreach (array_keys($family['models']) as $model) { if ($this->endpoint['model'] == $model) { $models[$brand] .= "<option selected>{$model}</option>"; } else { $models[$brand] .= "<option>{$model}</option>"; } } } } $this->view->brandnameselect = $brandname . "</select>"; $this->view->oui_json = json_encode($prov['oui']); $this->view->models_json = json_encode($models); if (is_null($this->endpoint['brand'])) { $this->view->modelselect = "<option value=''>Select</select>"; } else { $this->view->modelselect = $models[$this->endpoint['brand']]; } $linedata = unserialize($this->endpoint['lines']); if (!is_array($linedata)) { $linedata = array(); } $brand = $this->endpoint['brand']; $model = $this->endpoint['model']; if ($brand != '' && $model != '') { foreach ($prov['phones'][$brand] as $familyname => $familyarray) { if (array_key_exists($model, $familyarray['models'])) { $family = $familyname; } } $linelist = ""; $this->view->models = $prov['phones'][$brand][$family]['models'][$model]; $devices = array(); foreach (Doctrine::getTable("Device")->findAll(Doctrine::HYDRATE_ARRAY) as $device) { $devices[$device["device_id"]] = $device["plugins"]["callerid"]["internal_number"] . ": " . $device["name"]; } $speeddials = array(); foreach (Doctrine::getTable("ExternalXfer")->findAll(Doctrine::HYDRATE_ARRAY) as $speeddial) { $speeddials[$speeddial["external_xfer_id"]] = $speeddial["name"]; } // This puts the "Select" option at the top, with everything else sorted. $devices[""] = ""; $speeddials[""] = ""; asort($devices); asort($speeddials); $devices[""] = "Select:"; $speeddials[""] = "Select:"; $this->view->tabs = ""; $this->view->buttontabs = ""; $this->view->buttonlist = ""; $linedropdown = array(); for ($line = 1; $line <= $this->view->models['lines']; $line++) { $linedropdown[$line] = "Line " . $line; $this->view->tabs .= "<li><a href='#line_{$line}'><span style='font-size: 90%'>Line {$line}</span></a></li>\n"; $view = new View('endpointmanager/line.mus'); $view->speeddials = $speeddials; $view->devices = $devices; $view->line = $line; if (!array_key_exists($line, $linedata)) { $view->linedata = array("sip" => null); } else { $view->linedata = $linedata[$line]; } $linelist .= (string) $view; } $this->view->linelist = $linelist; $phonedata = $this->_getprovisioningdata(); $phonedata = $phonedata["phones"][$brand]; foreach ($phonedata as $family) { if (array_key_exists($model, $family["models"])) { $myfamily = $family; } } $this->view->functionkeys = 0; $this->view->buttons = array(); $settings = unserialize($this->endpoint->settings); foreach ($myfamily["models"][$model]["templates"] as $template) { $queue = array(&$myfamily["templates"][$template]); $matches = array(); while (count($queue) > 0) { $item = array_pop($queue); if (is_array($item)) { foreach ($item as $subitem) { array_push($queue, $subitem); } if (array_key_exists("name", $item) && $item["name"] == "functionkeys") { for ($button = $item["item"][0]["loop_start"]; $button <= $item["item"][0]["loop_end"]; $button++) { $view = new View('endpointmanager/button-snom.mus'); $view->keyeventfunctions = $this->keyevents; $view->button = $button; if (isset($settings["buttons"][$button])) { $view->buttondata = $settings["buttons"][$button]; } else { $view->buttondata = array(); } // Special exception, defaults for snom300. $snom300defaults = array(2 => 'F_REDIAL', 3 => 'F_ADR_BOOK', 4 => 'F_TRANSFER', 5 => 'F_MUTE'); if ($model == 300 && array_key_exists($button, $snom300defaults) && !array_key_exists("type", $view->buttondata)) { $view->buttondata["type"] = "keyevent"; $view->buttondata["keyevent"] = $snom300defaults[$button]; } // Set defaults for function keys - button X is set to line (X+1). if ($button + 1 <= $this->view->models["lines"]) { if (!array_key_exists("type", $view->buttondata)) { $view->buttondata["type"] = "sipaccount"; } if (!array_key_exists("sipaccount", $view->buttondata)) { $view->buttondata["sipaccount"] = $button + 1; } } foreach (array("type", "sipaccount", "speeddial", "blf", "internal_dial", "internal_dial_label", "external_dial", "external_dial_label", "keyevent") as $field) { if (!array_key_exists($field, $view->buttondata)) { $view->buttondata[$field] = null; } } $view->devices = $devices; $view->speeddials = $speeddials; $view->linedropdown = $linedropdown; $this->view->buttontabs .= "\n<li><a href='#button_{$button}'><span style='font-size: 90%'>Button " . ($button + 1) . "</span></a></li>"; $this->view->buttonlist .= "\n" . (string) $view; } } } } } } else { $this->view->models = null; $this->view->linelist = ""; } }
protected function prepareUpdateView($baseModel = NULL) { $route_types = array(); $trunkList = array(); $interfaceList = array(); $xmppList = array(); if (class_exists('Trunk')) { $trunks = Doctrine::getTable('Trunk')->findAll(Doctrine::HYDRATE_ARRAY); foreach($trunks as $trunk) { $trunkList[$trunk['trunk_id']] = $trunk['name']; } if (!empty($trunkList)) { $route_types[ExternalXfer::TYPE_TRUNK] = 'via Trunk'; } } if (class_exists('SipInterface')) { $interfaces = Doctrine::getTable('SipInterface')->findAll(Doctrine::HYDRATE_ARRAY); foreach($interfaces as $interface) { $interfaceList[$interface['sipinterface_id']] = $interface['name']; } if (!empty($interfaceList)) { $route_types[ExternalXfer::TYPE_SIP] = 'via SIP URI'; } } if (class_exists('Xmpp')) { $xmpp = Package_Catalog::getPackageByName('xmpp'); if(isset($xmpp['installed']) && !empty($xmpp['installed']))// == Package_Manager::STATUS_INSTALLED) { $xmpps = Doctrine::getTable('Xmpp')->findAll(Doctrine::HYDRATE_ARRAY); foreach($xmpps as $xmpp) { $xmppList[$xmpp['xmpp_id']] = $xmpp['name']; } if(!empty($xmppList)) { $route_types[ExternalXfer::TYPE_XMPP] = 'via XMPP'; } } } if (empty($route_types)) { message::set('No Trunk, XMPP or Sip Interfaces avaliable to route external destinations through!'); $this->returnQtipAjaxForm(NULL); url::redirect(Router_Core::$controller); } $this->view->trunks = $trunkList; $this->view->interfaces = $interfaceList; $this->view->xmpps = $xmppList; $this->view->route_types = $route_types; parent::prepareUpdateView($baseModel); }
public function prepareUpdateView() { parent::prepareUpdateView(); $this->view->outboundPatterns = Doctrine::getTable('SimpleRoute')->findAll(Doctrine::HYDRATE_ARRAY); $this->view->contexts = Doctrine::getTable('Context')->findAll(Doctrine::HYDRATE_ARRAY); }
protected function prepareUpdateView($baseModel = NULL) { $this->view->password = isset($_POST['user']['create_password']) ? $_POST['user']['create_password'] : ''; $this->view->confirm_password = isset($_POST['user']['confirm_password']) ? $_POST['user']['confirm_password'] : ''; parent::prepareUpdateView($baseModel); }