本文整理汇总了PHP中Shineisp_Commons_Utilities::formatSizeUnits方法的典型用法代码示例。如果您正苦于以下问题:PHP Shineisp_Commons_Utilities::formatSizeUnits方法的具体用法?PHP Shineisp_Commons_Utilities::formatSizeUnits怎么用?PHP Shineisp_Commons_Utilities::formatSizeUnits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shineisp_Commons_Utilities
的用法示例。
在下文中一共展示了Shineisp_Commons_Utilities::formatSizeUnits方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
// Set the custom decorator
$this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
$translate = Shineisp_Registry::get('Zend_Translate');
$this->addElement('text', 'creationdate', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Date'), 'title' => $translate->_('eg: 01/11/2010'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
$this->addElement('text', 'expiringdate', array('filters' => array('StringTrim'), 'label' => $translate->_('Expiry Date'), 'title' => $translate->_('eg: 01/11/2011'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
$this->addElement('text', 'paymentdate', array('filters' => array('StringTrim'), 'label' => $translate->_('Payment Date'), 'title' => $translate->_('eg: 01/11/2010'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
$this->addElement('select', 'category_id', array('label' => $translate->_('Category'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('category_id')->setAllowEmpty(false)->setMultiOptions(PurchaseCategories::getList());
$this->addElement('select', 'method_id', array('label' => $translate->_('Payment Method'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('method_id')->setAllowEmpty(false)->setMultiOptions(PaymentsMethods::getList());
$this->addElement('text', 'number', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'company', array('filters' => array('StringTrim'), 'label' => $translate->_('Company'), 'required' => true, 'title' => $translate->_('eg: Google inc.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'total_net', array('filters' => array('StringTrim'), 'label' => $translate->_('Total Net'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'total_vat', array('filters' => array('StringTrim'), 'label' => $translate->_('Total VAT'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'total', array('filters' => array('StringTrim'), 'label' => $translate->_('Total'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'label' => $translate->_('Note'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control'));
// 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', 'document', array('label' => $translate->_('Document'), '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'));
$file->addValidator('Extension', false, $filetypes)->addValidator('Size', false, $Byteslimit)->addValidator('Count', false, 1);
$file->setValueDisabled(true);
$file->setRequired(false);
$this->addElement($file);
}
$this->addElement('select', 'status_id', array('label' => $translate->_('Status'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('status_id')->setAllowEmpty(false)->setMultiOptions(Statuses::getList('orders'));
$this->addElement('hidden', 'purchase_id');
}
示例2: init
public function init()
{
$NS = new Zend_Session_Namespace('Default');
$translate = Shineisp_Registry::get('Zend_Translate');
// Set the custom decorator
$this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
$this->addElement('select', 'domain_id', array('decorators' => array('Bootstrap'), 'required' => false, 'label' => $translate->_('Domain'), 'description' => $translate->_('Choose the domain name reference'), 'class' => 'form-control large-input'));
$this->getElement('domain_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Domains::getList(true, $NS->customer['customer_id']));
$this->addElement('text', 'subject', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'title' => $translate->_('Write here a subject of the issue.'), 'label' => $translate->_('Subject'), 'description' => $translate->_('Write here the domain name or a simple description of the problem.'), 'class' => 'form-control large-input'));
$this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'label' => $translate->_('Body Message'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Write here all the information.'), 'rows' => '8', 'class' => 'form-control wysiwyg-simple'));
$this->addElement('select', 'status', array('filters' => array('StringTrim'), 'label' => $translate->_('Set the issue status'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input', 'multioptions' => array('' => '', Statuses::id("solved", "tickets") => $translate->_('Solved'), Statuses::id("closed", "tickets") => $translate->_('Closed'))));
$this->addElement('select', 'category_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Category'), 'description' => 'Select a category.', 'class' => 'form-control large-input'));
$this->getElement('category_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(TicketsCategories::getList(true));
if (false == Shineisp_Commons_Utilities::isAppleClient()) {
$MBlimit = Settings::findbyParam('useruploadlimit');
$Types = Settings::findbyParam('useruploadfiletypes');
if (empty($MBlimit)) {
$MBlimit = 1;
}
if (empty($Types)) {
$Types = "zip,jpg";
}
$Byteslimit = Shineisp_Commons_Utilities::MB2Bytes($MBlimit);
$file = $this->createElement('file', 'attachments', array('label' => $translate->_('Attachment'), 'description' => $translate->_('Select the document to upload. Files allowed are (%s) - Max %s', $Types, Shineisp_Commons_Utilities::formatSizeUnits($Byteslimit))));
$file->addValidator('Extension', false, $Types)->addValidator('Size', false, $Byteslimit)->addValidator('Count', false, 1);
$this->addElement($file);
} else {
$this->addElement('hidden', 'attachments');
}
$this->addElement('submit', 'submit', array('label' => $translate->_('Send help request'), 'decorators' => array('Bootstrap'), 'class' => 'btn btn-primary btn-lg'));
$this->addElement('hidden', 'ticket_id');
}
示例3: init
public function init()
{
// Set the custom decorator
$this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
$translate = Shineisp_Registry::get('Zend_Translate');
$this->addElement('text', 'subject', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Subject'), 'class' => 'form-control'));
$this->addElement('text', 'datetime', array('filters' => array('StringTrim'), 'label' => $translate->_('Date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'class' => 'col-lg-12 form-control wysiwyg'));
$this->addElement('select', 'sendemail', array('label' => $translate->_('Send Email'), 'description' => $translate->_('Send an email to the customer.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('1' => $translate->_('Yes'), '0' => $translate->_('No'))));
$this->addElement('select', 'category_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Category'), 'class' => 'form-control'));
$this->getElement('category_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(TicketsCategories::getList());
$this->addElement('select', 'customer_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Customer'), 'class' => 'form-control'));
$this->getElement('customer_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Customers::getList());
$this->addElement('select', 'category', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Category'), 'class' => 'form-control'));
$this->getElement('category')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(TicketsCategories::getList());
$this->addElement('select', 'order_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Order reference'), 'class' => 'form-control'));
$this->getElement('order_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Orders::getList(true));
$this->addElement('select', 'sibling_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Relationships'), 'class' => 'form-control'));
$this->getElement('sibling_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false);
$this->addElement('select', 'user_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Operator'), 'class' => 'form-control'));
$this->getElement('user_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(AdminUser::getList());
#->setMultiOptions(AdminUser::getUserbyRoleID(AdminRoles::getIdRoleByName('operator')));
$this->addElement('select', 'status_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Status'), 'class' => 'form-control'));
$this->getElement('status_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Statuses::getList('tickets'));
// If the browser client is an Apple client hide the file upload html object
if (false == Shineisp_Commons_Utilities::isAppleClient()) {
$MBlimit = Settings::findbyParam('adminuploadlimit');
$Types = Settings::findbyParam('adminuploadfiletypes', 'Admin');
if (empty($MBlimit)) {
$MBlimit = 1;
}
if (empty($Types)) {
$Types = "zip,jpg";
}
$Byteslimit = Shineisp_Commons_Utilities::MB2Bytes($MBlimit);
$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', $Types, Shineisp_Commons_Utilities::formatSizeUnits($Byteslimit)), 'data-classButton' => 'btn btn-primary', 'data-input' => 'false', 'class' => 'filestyle'));
$file->addValidator('Extension', false, $Types)->addValidator('Size', false, $Byteslimit)->addValidator('Count', false, 1);
$this->addElement($file);
} else {
$this->addElement('hidden', 'attachments');
}
$this->addElement('hidden', 'ticket_id');
}
示例4: init
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');
}
示例5: init
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, 'label' => $translate->_('Product name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'nickname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Product Nickname'), 'description' => $translate->_('This is the short name of the product'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'uri', array('filters' => array('StringTrim'), 'label' => $translate->_('URI'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'sku', array('filters' => array('StringTrim'), 'label' => $translate->_('SKU'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('textarea', 'shortdescription', array('filters' => array('StringTrim'), 'label' => $translate->_('Short Description'), 'id' => 'shortdescription', 'class' => 'col-lg-12 form-control wysiwyg'));
$this->addElement('textarea', 'metakeywords', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Keywords'), 'rows' => 5, 'class' => 'col-lg-12 form-control'));
$this->addElement('textarea', 'metadescription', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Meta Description'), 'rows' => 5, 'class' => 'col-lg-12 form-control'));
$this->addElement('textarea', 'description', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'id' => 'description', 'class' => 'col-lg-12 form-control wysiwyg'));
$this->addElement('select', 'category_id', array('label' => $translate->_('Category'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('category_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(ProductsCategories::getList());
$this->addElement('select', 'welcome_mail_id', array('label' => $translate->_('Welcome E-Mail'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('welcome_mail_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(EmailsTemplates::getList());
$this->addElement('select', 'server_group_id', array('label' => $translate->_('Server group'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('server_group_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(ServersGroups::getList(true));
$this->addElement('select', 'autosetup', array('label' => $translate->_('Automatic setup'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('autosetup')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('0' => 'Do not automatically setup this product', '1' => 'Automatically setup the product as soon as an order is placed', '2' => 'Automatically setup the product as soon as the first payment is received', '3' => 'Automatically setup the product when you manually accept a pending order', '4' => 'Automatically setup the product as soon as the payment is complete'));
$this->addElement('multiselect', 'related', array('label' => $translate->_('Related Products'), 'decorators' => array('Bootstrap'), 'size' => '20x', 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 2', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4'));
$this->addElement('multiselect', 'upgrade', array('label' => $translate->_('Product Upgrades'), 'decorators' => array('Bootstrap'), 'size' => '20x', 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 2', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4'));
$this->getElement('related')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Products::getList());
$this->getElement('upgrade')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Products::getList());
$this->addElement('select', 'tax_id', array('label' => 'Tax', 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('tax_id')->setAllowEmpty(false)->setMultiOptions(Taxes::getList(true));
$this->addElement('text', 'cost', array('filters' => array('StringTrim'), 'label' => $translate->_('Cost'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'price_1', array('filters' => array('StringTrim'), 'label' => $translate->_('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('textarea', 'setup', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('XML Setup Configuration. See the manual'), 'class' => 'col-lg-12 form-control'));
$this->addElement('select', 'enabled', array('label' => $translate->_('Enabled'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'Disabled', '1' => 'Active')));
$this->addElement('select', 'ishighlighted', array('label' => $translate->_('Is Highlighted'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
$this->addElement('select', 'isrefundable', array('label' => $translate->_('Is Refundable'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
$this->addElement('select', 'default', array('label' => $translate->_('Default Image'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
$this->addElement('select', 'iscomparable', array('label' => $translate->_('Is Comparable'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
$this->addElement('select', 'showonrss', array('label' => $translate->_('Publish on RSS Feed'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
$this->addElement('select', 'downgradable', array('label' => $translate->_('Allow downgrades'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
$this->addElement('select', 'type', array('label' => $translate->_('Product Type'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('generic' => $translate->_('Generic'), 'domain' => $translate->_('Domain'), 'hosting' => $translate->_('Hosting'))));
// If the browser client is an Apple client hide the file upload html object
if (false == Shineisp_Commons_Utilities::isAppleClient()) {
$this->addElement('text', 'filedescription', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$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'));
$file->addValidator('Extension', false, $filetypes)->addValidator('Size', false, $Byteslimit)->addValidator('Count', false, 1);
$this->addElement($file);
}
$this->addElement('multiselect', 'wikipages', array('label' => $translate->_('Wiki Pages'), 'decorators' => array('Bootstrap'), 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 2', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4'));
$this->getElement('wikipages')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Wiki::getList());
$this->addElement('select', 'tranche_billing_cycle_id', array('label' => $translate->_('Billing Cycle'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('tranche_billing_cycle_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(BillingCycle::getList());
$this->addElement('text', 'tranche_qty', array('filters' => array('StringTrim'), 'label' => $translate->_('Quantity'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'tranche_measure', array('filters' => array('StringTrim'), 'label' => $translate->_('Measurement label'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'tranche_setupfee', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup fee'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'tranche_price', array('filters' => array('StringTrim'), 'label' => $translate->_('Unit Price'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('multiselect', 'tranche_includes_domains', array('isArray' => true, 'label' => $translate->_('Domain included'), 'decorators' => array('Bootstrap'), 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 2', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4'));
$this->getElement('tranche_includes_domains')->setAllowEmpty(true)->setRegisterInArrayValidator(false)->setMultiOptions(DomainsTlds::getList());
$this->addElement('select', 'group_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Attribute Group'), 'required' => true, 'class' => 'form-control'));
$this->getElement('group_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(ProductsAttributesGroups::getList());
$this->addElement('text', 'position', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Position'), 'class' => 'form-control'));
$this->addElement('textarea', 'blocks', array('filters' => array('StringTrim'), 'label' => $translate->_('Blocks'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control'));
$this->addElement('hidden', 'product_id');
}
示例6: init
public function init()
{
// 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'));
$this->addElement('select', 'gender', array('label' => $translate->_('Gender'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('gender')->setAllowEmpty(true)->setMultiOptions(array('M' => 'Man', 'F' => 'Female'));
$this->addElement('select', 'taxfree', array('label' => $translate->_('Tax free'), 'description' => $translate->_('If it is set as Yes all the taxes will be not added in the orders'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('taxfree')->setAllowEmpty(true)->setMultiOptions(array('0' => 'No', '1' => 'Yes'));
$this->addElement('select', 'ignore_latefee', array('label' => $translate->_('Ignore late fee'), 'description' => $translate->_('If it is set as Yes this customers is not subject to late fee'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('ignore_latefee')->setAllowEmpty(true)->setMultiOptions(array('0' => 'No', '1' => 'Yes'));
$this->addElement('select', 'language_id', array('label' => $translate->_('Default Language'), 'description' => $translate->_('All the messages sent to the customer will be send using the default language selected'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('language_id')->setAllowEmpty(true)->setMultiOptions(Languages::getList());
$this->addElement('select', 'issubscriber', array('label' => $translate->_('Newsletter Subscription'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('issubscriber')->setAllowEmpty(true)->setMultiOptions(array('0' => 'No', '1' => 'Yes'));
$this->addElement('select', 'isreseller', array('label' => $translate->_('Is Reseller'), 'description' => 'Set the user as reseller', 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('isreseller')->setAllowEmpty(true)->setMultiOptions(array('0' => 'No', '1' => 'Yes'));
$this->addElement('text', 'birthdate', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date'));
$this->addElement('text', 'birthplace', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth place'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'birthdistrict', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth district'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'birthcountry', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth country'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'birthnationality', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth nationality'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('select', 'group_id', array('label' => $translate->_('Group'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('group_id')->setAllowEmpty(true)->setMultiOptions(CustomersGroups::getList());
$this->addElement('select', 'type_id', array('label' => $translate->_('Company Type'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('type_id')->setAllowEmpty(true)->setMultiOptions(CompanyTypes::getList(true));
$this->addElement('select', 'legalform_id', array('label' => 'Legal form', 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('legalform_id')->setAllowEmpty(true)->setMultiOptions(Legalforms::getList());
$this->addElement('text', 'company', array('filters' => array('StringTrim'), 'label' => $translate->_('Company Name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('button', 'customerupdate', array('label' => 'Customer Update', 'description' => 'Update the customer information retrieving the data from the registrar database.', 'decorators' => array('Bootstrap'), 'class' => 'button red customerupdate'));
$this->addElement('text', 'vat', array('filters' => array('StringTrim'), 'label' => $translate->_('VAT Number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'taxpayernumber', array('filters' => array('StringTrim'), 'label' => $translate->_('Taxpayer Number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
// If the browser client is an Apple client hide the file upload html object
if (false == Shineisp_Commons_Utilities::isAppleClient()) {
$MBlimit = Settings::findbyParam('adminuploadlimit', 'admin', Isp::getActiveISPID());
$filetypes = Settings::findbyParam('adminuploadfiletypes', 'Admin');
$Byteslimit = Shineisp_Commons_Utilities::MB2Bytes($MBlimit);
$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 ($filetypes) {
$file->addValidator('Extension', false, $filetypes);
}
if ($Byteslimit) {
$file->addValidator('Size', false, $Byteslimit);
}
$file->addValidator('Count', false, 1);
$this->addElement($file);
$this->addElement('select', 'filecategory', array('label' => $translate->_('File Category'), 'decorators' => array('Bootstrap'), 'class' => 'text-input'));
$this->getElement('filecategory')->setAllowEmpty(true)->setMultiOptions(FilesCategories::getList());
}
$this->addElement('text', 'address', array('filters' => array('StringTrim'), 'label' => $translate->_('Address'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'code', array('filters' => array('StringTrim'), 'label' => $translate->_('Zip code'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'area', array('filters' => array('StringTrim'), 'label' => $translate->_('Area'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'city', array('filters' => array('StringTrim'), 'label' => $translate->_('City'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('select', 'country_id', array('label' => $translate->_('Country'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'onchange' => 'onChangeCountry( this );'));
$this->getElement('country_id')->setAllowEmpty(false)->setMultiOptions(Countries::getList(true));
$this->addElement('select', 'region_id', array('label' => $translate->_('Region'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'onchange' => 'onChangeRegions( this );'));
$this->getElement('region_id')->setRegisterInArrayValidator(false)->addValidator(new Shineisp_Validate_Regions());
$this->addElement('select', 'contacttypes', array('label' => $translate->_('Contact Types'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('contacttypes')->setAllowEmpty(false)->setMultiOptions(ContactsTypes::getList());
$this->addElement('text', 'contact', array('filters' => array('StringTrim'), 'label' => $translate->_('Contact'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'email', array('filters' => array('StringTrim', 'StringToLower'), 'decorators' => array('Bootstrap'), 'validators' => array('EmailAddress'), 'required' => true, 'label' => $translate->_('Email'), 'class' => 'form-control'));
$this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'label' => $translate->_('Private Notes'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control wysiwyg'));
$this->addElement('password', 'password', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'validators' => array(array('regex', false, '/^[a-zA-Z0-9\\-\\_\\.\\%\\!\\$]{6,20}$/')), 'description' => 'Write here at least 6 characters.', 'label' => $translate->_('Password'), 'class' => 'form-control'));
$this->addElement('select', 'status_id', array('label' => $translate->_('Status'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('status_id')->setAllowEmpty(false)->setMultiOptions(Statuses::getList('customers'));
$this->addElement('select', 'parent_id', array('label' => 'Reseller', 'decorators' => array('Bootstrap'), 'description' => 'Select the client who you want to join with the selected customer.', 'class' => 'form-control'));
$criterias = array(array('where' => 'isreseller = ?', 'params' => '1'));
$this->getElement('parent_id')->setAllowEmpty(true)->setMultiOptions(Customers::getList(true, $criterias));
$this->addElement('submit', 'save', array('label' => $translate->_('Save'), 'decorators' => array('Bootstrap'), 'class' => 'btn'));
$this->addElement('hidden', 'customer_id');
}