protected function getForm() { if ($this->form === Null) { $form_xml = new Zend_Config_Xml(Zend_Registry::get("config")->system->path->base . "/modules/default/forms/expression_alias.xml"); $form = new Snep_Form($form_xml); $exprField = new Snep_Form_Element_Html("expression-alias/elements/expr.phtml", "expr", false); $exprField->setLabel($this->view->translate("Expressions")); $exprField->setOrder(1); $form->addElement($exprField); $this->form = $form; } return $this->form; }
/** * Generate the form for routes * * @return Zend_Form */ protected function getForm() { if ($this->form === Null) { $form_xml = new Zend_Config_Xml(Zend_Registry::get("config")->system->path->base . "/modules/default/forms/route.xml"); $form = new Snep_Form($form_xml); $actions = PBX_Rule_Actions::getInstance(); $installed_actions = array(); foreach ($actions->getInstalledActions() as $action) { $action_instance = new $action(); $installed_actions[$action] = $action_instance->getName(); } asort($installed_actions); $this->view->actions = $installed_actions; $src = new Snep_Form_Element_Html("route/elements/src.phtml", "src", false); $src->setLabel($this->view->translate("Source")); $src->setOrder(1); $form->addElement($src); $dst = new Snep_Form_Element_Html("route/elements/dst.phtml", "dst", false); $dst->setLabel($this->view->translate("Destiny")); $dst->setOrder(2); $form->addElement($dst); $time = new Snep_Form_Element_Html("route/elements/time.phtml", "time", false); $time->setOrder(4); $time->setLabel($this->view->translate("Valid times")); $form->addElement($time); $form->addElement(new Snep_Form_Element_Html("route/elements/actions.phtml", "actions")); $this->form = $form; $groups = new Snep_GruposRamais(); $groups = $groups->getAll(); $group_list = ""; foreach ($groups as $group) { $group_list .= "[\"{$group['name']}\", \"{$group['name']}\"],"; } $group_list = "[" . trim($group_list, ",") . "]"; $this->view->group_list = $group_list; $alias_list = ""; foreach (PBX_ExpressionAliases::getInstance()->getAll() as $alias) { $alias_list .= "[\"{$alias['id']}\", \"{$alias['name']}\"],"; } $alias_list = "[" . trim($alias_list, ",") . "]"; $this->view->alias_list = $alias_list; $trunks = ""; foreach (PBX_Trunks::getAll() as $trunk) { $trunks .= "[\"{$trunk->getId()}\", \"{$trunk->getName()}\"],"; } $trunks = "[" . trim($trunks, ",") . "]"; $this->view->trunk_list = $trunks; $cgroup_list = ""; $cgroup_manager = new Snep_ContactGroups_Manager(); foreach ($cgroup_manager->getAll() as $cgroup) { $cgroup_list .= "[\"{$cgroup['id']}\", \"{$cgroup['name']}\"],"; } $cgroup_list = "[" . trim($cgroup_list, ",") . "]"; $this->view->contact_groups_list = $cgroup_list; } return $this->form; }