Пример #1
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('select', 'isp_id', array('label' => $translate->_('Isp'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('isp_id')->setAllowEmpty(false)->setMultiOptions(Isp::getList())->setRequired(true);
     $this->addElement('select', 'type_id', array('label' => $translate->_('Server Type'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('type_id')->setAllowEmpty(false)->setMultiOptions(Servers_Types::getList())->setRequired(true);
     $this->addElement('select', 'status_id', array('label' => $translate->_('Status'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('status_id')->setAllowEmpty(false)->setMultiOptions(Statuses::getList('servers'))->setRequired(true);
     $this->addElement('text', 'name', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Server Name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'ip', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('IP'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'netmask', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Netmask'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'host', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Host'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'domain', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Domain'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('textarea', 'description', array('required' => true, 'label' => $translate->_('Description'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control'));
     $this->addElement('select', 'panel_id', array('filters' => array('StringTrim'), 'label' => $translate->_('Control Panel'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('panel_id')->setAllowEmpty(false)->setMultiOptions(Panels::getListInstalled(true));
     $this->addElement('text', 'datacenter', array('filters' => array('StringTrim'), 'required' => false, 'label' => $translate->_('Datacenter'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'cost', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Server cost'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'max_accounts', array('filters' => array('StringTrim'), 'required' => false, 'label' => $translate->_('Max accounts'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'buy_date', array('filters' => array('StringTrim'), 'label' => $translate->_('Buy Date'), 'description' => $translate->_('Purchase date of this server'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date'));
     $this->addElement('checkbox', 'is_default', array('filters' => array('StringTrim'), 'required' => false, 'label' => $translate->_('Default server'), 'description' => $translate->_('Default server for the group'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('hidden', 'server_id');
 }
Пример #2
0
 /**
  * Update the database item translation using the poedit!
  * This method creates a temporary file that helps you to parse the 
  * database table common contents.  
  */
 public function updatetranslationAction()
 {
     $content = "<?php\n ";
     $content .= "# WARNING: This file has been created only for the POEDIT software.\n";
     $content .= "#          You can delete it, if you don't use it! \n\n";
     // Setting Parameters
     $data = SettingsParameters::getAllInfo();
     foreach ($data as $item) {
         $content .= "echo _('" . $item['name'] . "');\n";
         $content .= "echo _('" . $item['description'] . "');\n";
     }
     // Server Types
     $data = Servers_Types::getList();
     foreach ($data as $id => $item) {
         $content .= "echo _('" . $item . "');\n";
     }
     // Contact types
     $data = ContactsTypes::getList();
     foreach ($data as $id => $item) {
         $content .= "echo _('" . $item . "');\n";
     }
     // Legal form
     $data = Legalforms::getList();
     foreach ($data as $id => $item) {
         $content .= "echo _('" . $item . "');\n";
     }
     // Get the default navigation items
     $config = new Zend_Config_Xml(APPLICATION_PATH . '/modules/default/navigation.xml', 'nav');
     $navigation = new Zend_Navigation($config);
     // Iterate recursively using RecursiveIteratorIterator
     $pages = new RecursiveIteratorIterator($navigation, RecursiveIteratorIterator::SELF_FIRST);
     foreach ($pages as $page) {
         $label = (string) $page->label;
         $content .= "echo _('{$label}');\n";
     }
     // Get the administration navigation items
     $config = new Zend_Config_Xml(APPLICATION_PATH . '/modules/admin/navigation.xml', 'nav');
     $navigation = new Zend_Navigation($config);
     // Iterate recursively using RecursiveIteratorIterator
     $pages = new RecursiveIteratorIterator($navigation, RecursiveIteratorIterator::SELF_FIRST);
     foreach ($pages as $page) {
         $label = $page->getLabel();
         $content .= "echo _('{$label}');\n";
     }
     $content .= "?>";
     Shineisp_Commons_Utilities::writefile($content, "tmp", "translations.php");
     die('Ok! Now update the default.po file by the poedit software');
 }