Exemplo n.º 1
0
 public function init()
 {
     $registry = Shineisp_Registry::getInstance();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $logged_user = $auth->getIdentity();
     }
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'firstname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Firstname'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'lastname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Lastname'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     // Check if the user is an administrator, if not the select role object will become an hidden field
     if (AdminRoles::isAdministrator($logged_user['user_id'])) {
         $this->addElement('select', 'role_id', array('required' => true, 'label' => $translate->_('Role'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
         $this->getElement('role_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(AdminRoles::getList());
         $this->addElement('select', 'isp_id', array('required' => true, 'label' => $translate->_('Isp Company'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
         $this->getElement('isp_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Isp::getList());
     } else {
         $this->addElement('hidden', 'role_id');
         $this->addElement('hidden', 'isp_id');
     }
     $this->addElement('text', 'email', array('filters' => array('StringTrim', 'StringToLower'), 'decorators' => array('Bootstrap'), 'validators' => array(array('validator' => 'EmailAddress')), 'required' => true, 'label' => $translate->_('Email'), 'class' => 'form-control'));
     $this->addElement('password', 'password', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'validators' => array(array('regex', false, '/^[a-zA-Z0-9\\-\\_\\.\\%\\!\\$]{6,20}$/')), 'label' => $translate->_('Password'), 'class' => 'form-control'));
     $this->addElement('hidden', 'user_id');
 }
Exemplo n.º 2
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');
 }
Exemplo n.º 3
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'name', array('filters' => array('StringTrim'), 'required' => true, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Name'), 'class' => 'form-control'));
     $this->addElement('select', 'isp_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('ISP Profile'), 'class' => 'form-control'));
     $this->getElement('isp_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Isp::getList());
     $this->addElement('select', 'active', array('label' => $translate->_('Active'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
     $this->addElement('hidden', 'panel_id');
 }
Exemplo n.º 4
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('select', 'parameter_id', array('filters' => array('StringTrim'), 'label' => $translate->_('parameter'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('parameter_id')->setAllowEmpty(false)->setMultiOptions(SettingsParameters::getList('admin'));
     $this->addElement('textarea', 'value', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('value'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'isp_id', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Isp'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('isp_id')->setAllowEmpty(false)->setMultiOptions(Isp::getList());
     $this->addElement('hidden', 'setting_id');
 }
Exemplo n.º 5
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     /*
      * This hidden form field will be converted in a advanced select object
      * the JQuery Select2 object is loaded automatically by the css class select2
      */
     $this->addElement('hidden', 'customer_id', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Customer'), 'decorators' => array('Bootstrap'), 'field-id' => "customer_id", 'fields-data' => "lastname firstname ( company )", 'url-search' => "/admin/customers/search", 'class' => 'select2'));
     /*
      * This hidden form field will be converted in a advanced select object
      * the JQuery Select2 object is loaded automatically by the css class select2
      */
     $this->addElement('hidden', 'customer_parent_id', array('label' => $translate->_('Invoice destination'), 'decorators' => array('Bootstrap'), 'field-id' => "customer_id", 'fields-data' => "firstname lastname", 'url-search' => "/admin/customers/search", 'class' => 'select2', 'disable' => 'true'));
     $this->addElement('select', 'isp_id', array('required' => true, 'label' => $translate->_('ISP'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('isp_id')->setAllowEmpty(false)->setMultiOptions(Isp::getList());
     /*
      * This hidden form field will be converted in a advanced select object
      * the JQuery Select2 object is loaded automatically by the css class select2
      */
     $this->addElement('hidden', 'categories', array('label' => $translate->_('Filter by categories'), 'decorators' => array('Bootstrap'), 'id' => 'productcategories', 'field-id' => "category_id", 'fields-data' => "name", 'url-search' => "/admin/productscategories/search", 'class' => 'select2', 'rel' => 'tree_select'));
     /*
      * This hidden form field will be converted in a advanced select object
      * the JQuery Select2 object is loaded automatically by the css class select2
      */
     $this->addElement('hidden', 'referdomain', array('filters' => array('StringTrim'), 'label' => $translate->_('Reference Domain'), 'description' => $translate->_('Assign a domain in order to identify the service/product'), 'decorators' => array('Bootstrap'), 'field-id' => "domain_id", 'fields-data' => "domain", 'url-search' => "/admin/domains/search", 'class' => 'select2'));
     /* 
      * This hidden form field will be converted in a advanced select object
      * the JQuery Select2 object is loaded automatically by the css class select2
      */
     $this->addElement('hidden', 'products', array('id' => "products", 'required' => false, 'label' => $translate->_('Products'), 'field-id' => "product_id", 'fields-data' => "name", 'url-search' => "/admin/products/search", 'class' => 'select2'));
     /*
      * This hidden form field will be converted in a advanced select object
      * the JQuery Select2 object is loaded automatically by the css class select2
      */
     $this->addElement('hidden', 'billingcycle_id', array('id' => 'billingid', 'label' => $translate->_('Billing Cycle'), 'decorators' => array('Bootstrap'), 'field-id' => "billing_cycle_id", 'fields-data' => "name ( price /  setupfee )", 'url-search' => "/admin/orders/getbillingcycles", 'class' => 'select2'));
     /*
      * This hidden form field will be converted in a advanced select object
      * the JQuery Select2 object is loaded automatically by the css class select2
      */
     $this->addElement('hidden', 'domains_selected', array('filters' => array('StringTrim'), 'label' => $translate->_('Add Domains'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('If you do not find a domain name from this list, you have to create it by the domain admministration page.'), 'multiple' => true, 'field-id' => "domain_id", 'fields-data' => "domain", 'url-search' => "/admin/domains/search", 'class' => 'select2'));
     $this->addElement('checkbox', 'is_renewal', array('label' => $translate->_('Is a Renewal?'), 'description' => "If this order is a renewal, it will be checked by ShineISP and it cannot be deleted by the customer in the customer order frontend panel.", 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     /*
      * This hidden form field will be converted in a advanced select object
      * the JQuery Select2 object is loaded automatically by the css class select2
      */
     $this->addElement('hidden', 'invoice_id', array('label' => $translate->_('Invoice No.'), 'decorators' => array('Bootstrap'), 'field-id' => "invoice_id", 'fields-data' => "formatted_number ( number )", 'url-search' => "/admin/invoices/search", 'class' => 'select2'));
     $this->addElement('text', 'order_date', array('filters' => array('StringTrim'), 'label' => $translate->_('Order Date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
     $this->addElement('text', 'expiring_date', array('filters' => array('StringTrim'), 'label' => $translate->_('Expiry Date'), 'description' => $translate->_('If this date is set ShineISP will suspend the order at the specified date.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
     $this->addElement('text', 'date_start', array('filters' => array('StringTrim'), 'label' => $translate->_('Date Start'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
     $this->addElement('text', 'quantity', array('filters' => array('StringTrim'), 'label' => $translate->_('Quantity'), 'decorators' => array('Bootstrap'), 'value' => '1', 'class' => 'form-control'));
     $this->addElement('text', 'profit', array('filters' => array('StringTrim'), 'label' => $translate->_('Profit'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('textarea', 'description', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'id' => 'description', 'rows' => '3', 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control'));
     $this->addElement('text', 'cost', array('filters' => array('StringTrim'), 'label' => $translate->_('Cost'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'price', array('filters' => array('StringTrim'), 'label' => $translate->_('Price'), 'id' => 'price', 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'setupfee', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup fee'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'vat', array('filters' => array('StringTrim'), 'label' => $translate->_('VAT'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'total', array('filters' => array('StringTrim'), 'label' => $translate->_('Total'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'grandtotal', array('filters' => array('StringTrim'), 'label' => $translate->_('Grand Total'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Save again in order to update the totals.'), 'class' => 'form-control bold'));
     $this->addElement('text', 'received_income', array('readonly' => 1, 'filters' => array('StringTrim'), 'label' => $translate->_('Income'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'missing_income', array('readonly' => 1, 'filters' => array('StringTrim'), 'label' => $translate->_('Missing income'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'fastlink', array('filters' => array('StringTrim'), 'id' => 'fastlink', 'label' => $translate->_('Fastlink Code'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Here you can read a unique code for redirect a user in the order page using the fastlink.'), 'class' => 'form-control readonly'));
     $this->addElement('text', 'visits', array('filters' => array('StringTrim'), 'label' => $translate->_('Visits'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Here you can read how many times the order has been viewed by the customer.'), 'class' => 'form-control readonly'));
     // If the browser client is an Apple client hide the file upload html object
     if (false == Shineisp_Commons_Utilities::isAppleClient()) {
         $MBlimit = Settings::findbyParam('adminuploadlimit');
         $Byteslimit = Shineisp_Commons_Utilities::MB2Bytes($MBlimit);
         $filetypes = Settings::findbyParam('adminuploadfiletypes', 'Admin');
         $file = $this->createElement('file', 'attachments', array('label' => $translate->_('Attachment'), 'decorators' => array('File', array('ViewScript', array('viewScript' => 'partials/file.phtml', 'placement' => false))), 'description' => $translate->_('Select the document to upload. Files allowed are (%s) - Max %s', $filetypes, Shineisp_Commons_Utilities::formatSizeUnits($Byteslimit)), 'data-classButton' => 'btn btn-primary', 'data-input' => 'false', 'class' => 'filestyle'));
         if (!empty($filetypes)) {
             $file->addValidator('Extension', false, $filetypes);
         }
         $file->addValidator('Size', false, $Byteslimit)->addValidator('Count', false, 1);
         $this->addElement($file);
         $this->addElement('select', 'filecategory', array('label' => $translate->_('Category'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
         $this->getElement('filecategory')->setAllowEmpty(false)->setMultiOptions(FilesCategories::getList())->setRegisterInArrayValidator(false)->setRequired(false);
     }
     $this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'label' => $translate->_('Private Notes'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control wysiwyg'));
     $this->addElement('textarea', 'message', array('filters' => array('StringTrim'), 'label' => $translate->_('Post a comment'), 'decorators' => array('Bootstrap'), 'class' => 'form-control wysiwyg'));
     $this->addElement('select', 'status_id', array('label' => 'Status', 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('status_id')->setAllowEmpty(false)->setMultiOptions(Statuses::getList('orders'));
     $this->addElement('text', 'paymentdate', array('filters' => array('StringTrim'), 'label' => $translate->_('Payment date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date'));
     $this->addElement('text', 'reference', array('filters' => array('StringTrim'), 'label' => $translate->_('Payment Reference'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'bank_id', array('id' => 'paymentmethods', 'label' => $translate->_('Bank name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('bank_id')->setAllowEmpty(false)->setMultiOptions(Banks::getList(true));
     $this->addElement('text', 'income', array('filters' => array('StringTrim'), 'label' => $translate->_('Income'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'payment_description', array('filters' => array('StringTrim'), 'label' => $translate->_('Notes'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'confirmed', array('filters' => array('StringTrim'), 'label' => $translate->_('Has the Transaction been confirmed?'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('confirmed')->setAllowEmpty(false)->setMultiOptions(array('0' => "No, not yet", '1' => "Yes, it has been"));
     $this->addElement('hidden', 'order_id');
 }