public function preStmtExecute(Doctrine_Event $event) { // Check if the administrator has enabled the query logging feature if (Settings::findbyParam('debug_queries')) { $breadcrumps = array(); $query = $event->getQuery(); $params = $event->getParams(); $callers = array_reverse(debug_backtrace(), true); $callers = array_slice($callers, 4, count($callers) - 10); foreach ($callers as $caller) { $class = !empty($caller['class']) ? $caller['class'] : null; $breadcrumps[] = $class . "->" . $caller['function']; } $strBreadcrump = "System: " . implode(" / ", $breadcrumps); //the below makes some naive assumptions about the queries being logged while (sizeof($params) > 0) { $param = array_shift($params); if (!is_numeric($param)) { $param = sprintf("'%s'", $param); } $query = substr_replace($query, $param, strpos($query, '?'), 1); } Shineisp_Commons_Utilities::log($query, "queries.log"); Shineisp_Commons_Utilities::log($strBreadcrump, "debug.log", Zend_Log::DEBUG); // Increase query counter $queryCount = Shineisp_Registry::isRegistered('querycount') ? Shineisp_Registry::get('querycount') : 0; $queryCount = $queryCount + 1; Shineisp_Registry::set('querycount', $queryCount); } }
private function eu_check() { $isp = Shineisp_Registry::get('ISP'); $VIES = new SoapClient($this->vies_soap_url); if ($VIES) { try { $r = $VIES->checkVat(array('countryCode' => $this->countryCode, 'vatNumber' => $this->vat)); foreach ($r as $chiave => $valore) { $this->viesOutput[$chiave] = $valore; } return $r->valid; } catch (SoapFault $e) { $ret = $e->faultstring; $regex = '/\\{ \'([A-Z_]*)\' \\}/'; $n = preg_match($regex, $ret, $matches); $ret = !empty($matches[1]) ? $matches[1] : $ret; $faults = array('INVALID_INPUT' => 'The provided CountryCode is invalid or the VAT number is empty', 'SERVICE_UNAVAILABLE' => 'The SOAP service is unavailable, try again later', 'MS_UNAVAILABLE' => 'The Member State service is unavailable, try again later or with another Member State', 'TIMEOUT' => 'The Member State service could not be reached in time, try again later or with another Member State', 'SERVER_BUSY' => 'The service cannot process your request. Try again later.'); $ret = $faults[$ret]; // adding a log message Shineisp_Commons_Utilities::log("Response from VIES: " . $ret); $subject = 'Invalid VAT code'; $body = "Response from VIES: " . $ret; Shineisp_Commons_Utilities::SendEmail($isp->email, $isp->email, null, $subject, $body); return false; } } else { $subject = 'Connect to VIES'; $body = "Impossible to connect with VIES"; Shineisp_Commons_Utilities::SendEmail($isp->email, $isp->email, null, $subject, $body); // adding a log message Shineisp_Commons_Utilities::log("Response from VIES: " . $ret); return false; } return true; }
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->_('TLD Name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('textarea', 'description', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Description'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control wysiwyg')); $this->addElement('text', 'tags', array('filters' => array('StringTrim'), 'label' => $translate->_('Tags/Type'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $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('text', 'resultcontrol', array('filters' => array('StringTrim'), 'label' => $translate->_('Result String Control'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'registration_price', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Registration Price'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'renewal_price', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Renewal Price'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'transfer_price', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Transfer Price'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('select', 'server_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('TLD Server'), 'class' => 'form-control')); $this->getElement('server_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(WhoisServers::getList()); $this->addElement('select', 'tax_id', array('label' => $translate->_('Tax'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('tax_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Taxes::getList())->setRequired(true); $this->addElement('text', 'registration_cost', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Registration Cost'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'renewal_cost', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Renewal Cost'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'transfer_cost', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Transfer Cost'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('select', 'registrars_id', array('label' => $translate->_('Registrars'), 'decorators' => array('Bootstrap'), 'class' => 'form-control updatechkdomain')); $this->getElement('registrars_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Registrars::getList(false))->setRequired(true); $this->addElement('submit', 'save', array('required' => false, 'label' => $translate->_('Save'), 'decorators' => array('Bootstrap'), 'class' => 'btn')); $this->addElement('hidden', 'tld_id'); }
public function tldSummaryPerMonth() { $NS = new Zend_Session_Namespace('Default'); $registry = Shineisp_Registry::getInstance(); $translation = $registry->Zend_Translate; $domains = array(); if (!empty($NS->customer)) { $this->view->uri = ""; $data = $NS->customer; // Get the data information $all_domains = Domains::getSummaryPerMonth($data['customer_id']); $autorenew_domains = Domains::getAutorenewSummaryPerMonth($data['customer_id']); for ($i = 1; $i <= 12; $i++) { $domains['months'][$i] = date('M', strtotime(date('Y/m/01/', strtotime("2012/12/1")) . " {$i} month")); $domains['autorenew'][$i] = 0; $domains['norenew'][$i] = 0; foreach ($autorenew_domains as $domain) { if ($domain['monthid'] == $i) { $domains['autorenew'][$i] = $domain['total']; } } foreach ($all_domains as $domain) { if ($domain['month_number'] == $i) { $domains['norenew'][$i] = $domain['total'] - $domains['autorenew'][$i]; } } } $norenew = implode(",", $domains['norenew']); $autorenew = implode(",", $domains['autorenew']); $months = implode("|", $domains['months']); $max = max($domains['autorenew']); $this->view->uri = "http://chart.apis.google.com/chart?cht=bvg\n\t\t\t&chdlp=t\n\t\t\t&chtt=" . $translation->translate('Domain Summary per Month') . "\n\t\t\t&chdl=" . $translation->translate('Automatic Renewal') . "|" . $translation->translate('No Auto Renew') . "\n\t\t\t&chts=4d89f9,18\n\t\t\t&chs=550x300\n\t\t\t&chd=t:" . $autorenew . "|" . $norenew . "\n\t\t\t&chxt=x\n\t\t\t&chxl=0:|" . $months . "\n\t\t\t&chco=4d89f9,FF1F1F\n\t\t\t&chds=0," . $max . "\n\t\t\t&chm=N,000000,-1,,11|N,000000,0,,11\n\t\t\t&chbh=a"; } return $this->view->render('partials/graph.phtml'); }
public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $translate = Shineisp_Registry::get('Zend_Translate'); $this->addElement('text', 'title', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Title'), 'class' => 'form-control')); $this->addElement('textarea', 'body', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Body'), 'class' => 'form-control col-lg-12')); $this->addElement('text', 'var', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('URL-Key'), 'description' => $translate->_('This is the name of the page. For multilanguages website you can create more page with the same Url-key with different languages.'), 'rows' => 5, 'class' => 'form-control')); $this->addElement('textarea', 'keywords', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Keywords'), 'rows' => 5, 'description' => $translate->_('separate each keyword by a comma'), 'class' => 'col-lg-12 form-control')); $this->addElement('textarea', 'blocks', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Blocks'), 'class' => 'form-control')); $this->addElement('textarea', 'xmllayout', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('XML Layout'), 'class' => 'form-control')); $this->addElement('checkbox', 'blog', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('is Blog post'), 'class' => 'form-control')); $this->addElement('select', 'parent_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Parent'), 'class' => 'form-control')); $this->getElement('parent_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(CmsPages::getList(true)); $this->addElement('select', 'layout', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Content layouts'), 'class' => 'form-control')); $this->getElement('layout')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(CmsPages::getLayouts()); $this->addElement('select', 'pagelayout', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Page layouts'), 'class' => 'form-control')); $this->getElement('pagelayout')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(CmsPages::getPageLayouts()); $this->addElement('multiselect', 'language_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Language'), 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 3', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4 col-sm-4')); $this->getElement('language_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Languages::getList()); $this->addElement('checkbox', 'showinmenu', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Show in the navigation menu'), 'class' => 'form-control')); $this->addElement('checkbox', 'showonrss', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Publish on RSS Feed'), 'class' => 'form-control')); $this->addElement('checkbox', 'active', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Active'), 'class' => 'form-control')); $this->addElement('hidden', 'page_id'); }
/** * List of the last messages attached within the orders, domains, customers detail page * * * @param string $attachedto [orders, domains] * @param integer $limit * @return ArrayObject */ public static function Last($attachedto = "orders", $limit = 5, $delIspReplies = true) { $translator = Shineisp_Registry::getInstance()->Zend_Translate; $dq = Doctrine_Query::create()->from('Messages m'); // Adding first the main ID index field if ($attachedto == "orders") { $dq->select("order_id as id"); $dq->where("order_id IS NOT NULL"); } elseif ($attachedto == "domains") { $dq->select("domain_id as id"); $dq->where("domain_id IS NOT NULL"); } // now we can add more fields $dq->addSelect("DATE_FORMAT(m.dateposted, '" . Settings::getMySQLDateFormat('dateformat') . " %H:%i:%s') as date, m.message as message"); if ($delIspReplies) { $dq->andWhere("customer_id IS NOT NULL"); } // Sort the items $dq->orderBy('m.dateposted desc')->limit($limit); $records['data'] = $dq->execute(null, Doctrine::HYDRATE_ARRAY); // Strip the html and trucate the message for ($i = 0; $i < count($records['data']); $i++) { $records['data'][$i]['message'] = Shineisp_Commons_Utilities::truncate(strip_tags($records['data'][$i]['message']), 50, "...", false, true); } // adding the index reference $records['index'] = "id"; // Create the header table columns $records['fields'] = array('date' => array('label' => $translator->translate('Date')), 'message' => array('label' => $translator->translate('Message'))); return $records; }
/** * create the configuration of the grid */ public static function grid($rowNum = 10) { $translator = Shineisp_Registry::getInstance()->Zend_Translate; $config['datagrid']['columns'][] = array('label' => null, 'field' => 'dp.profile_id', 'alias' => 'profile_id', 'type' => 'selectall'); $config['datagrid']['columns'][] = array('label' => $translator->translate('ID'), 'field' => 'dp.profile_id', 'alias' => 'profile_id', 'sortable' => true, 'searchable' => true, 'type' => 'string'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Owner'), 'field' => "CONCAT(c.lastname, ' ', c.firstname)", 'alias' => 'owner', 'sortable' => true, 'searchable' => true, 'type' => 'link', 'link' => array('idx' => 'customer_id', 'href' => '/admin/customers/edit/id/%s')); $config['datagrid']['columns'][] = array('label' => $translator->translate('Company'), 'field' => 'dp.company', 'alias' => 'company', 'sortable' => true, 'searchable' => true, 'type' => 'string'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Full name'), 'field' => 'CONCAT(dp.firstname, " ", dp.lastname)', 'alias' => 'fullname', 'sortable' => true, 'searchable' => true, 'type' => 'string', 'attributes' => array('class' => 'visible-lg visible-md hidden-xs')); $config['datagrid']['columns'][] = array('label' => $translator->translate('Email'), 'field' => 'dp.email', 'alias' => 'email', 'sortable' => true, 'searchable' => true, 'type' => 'string', 'attributes' => array('class' => 'visible-lg visible-md hidden-xs')); $config['datagrid']['columns'][] = array('label' => $translator->translate('Statuses'), 'field' => 's.status', 'alias' => 'status', 'sortable' => true, 'type' => 'index', 'searchable' => true, 'filterdata' => Statuses::getList('customers'), 'attributes' => array('class' => 'visible-lg visible-md hidden-xs')); $config['datagrid']['fields'] = "dp.profile_id,\n\t\t\t\t\t\t\t\t\t\t dp.company as company,\n\t\t\t\t\t\t\t\t\t\t CONCAT(c.lastname, ' ', c.firstname) as owner,\n\t\t\t\t\t\t\t\t\t\t c.customer_id as customer_id,\n\t\t\t\t\t\t\t\t\t\t CONCAT(dp.firstname, ' ', dp.lastname) as fullname,\n\t\t\t\t\t\t\t\t\t\t dp.email as email,\n\t\t\t\t\t\t\t\t\t\t s.status as status"; $config['datagrid']['rownum'] = $rowNum; $dq = Doctrine_Query::create()->select($config['datagrid']['fields'])->from('DomainsProfiles dp')->leftJoin('dp.Statuses s')->leftJoin('dp.Customers c'); $config['datagrid']['dqrecordset'] = $dq; $config['datagrid']['basepath'] = "/admin/domainsprofiles/"; $config['datagrid']['index'] = "profile_id"; $config['datagrid']['rowlist'] = array('10', '50', '100', '1000'); $config['datagrid']['buttons']['edit']['label'] = $translator->translate('Edit'); $config['datagrid']['buttons']['edit']['cssicon'] = "edit"; $config['datagrid']['buttons']['edit']['action'] = "/admin/domainsprofiles/edit/id/%d"; $config['datagrid']['buttons']['delete']['label'] = $translator->translate('Delete'); $config['datagrid']['buttons']['delete']['cssicon'] = "delete"; $config['datagrid']['buttons']['delete']['action'] = "/admin/domainsprofiles/confirm/id/%d"; $config['datagrid']['massactions']['common'] = array(); return $config; }
public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $this->addElementPrefixPath('Default', APPLICATION_PATH . '/modules/default/forms/validate/', 'validate'); $translate = Shineisp_Registry::get('Zend_Translate'); $this->addElement('text', 'fullname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Fullname'), 'title' => $translate->_('Write here your firstname and lastname.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input')); $this->addElement('text', 'company', array('filters' => array('StringTrim'), 'label' => $translate->_('Company'), 'title' => $translate->_('Write here your company name.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input')); $email = $this->createElement('text', 'email', array('filters' => array('StringTrim', 'StringToLower'), 'decorators' => array('Bootstrap'), 'validators' => array('EmailAddress'), 'required' => true, 'label' => $translate->_('Email'), 'title' => $translate->_('Write here your email'), 'class' => 'form-control large-input')); $this->addElement($email); $status = $this->addElement('select', 'subject', array('label' => $translate->_('Subject'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input')); $status = $this->getElement('subject')->setAllowEmpty(false)->setMultiOptions(array('Sales Question' => 'Sales Question', 'Billing Question' => 'Billing Question', 'Partnership Inquiry' => 'Partnership Inquiry', 'Website Feedback' => 'Website Feedback')); $this->addElement('textarea', 'message', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'required' => true, 'rows' => 5, 'description' => $translate->_('Write here your message.'), 'label' => $translate->_('Message'), 'class' => 'form-control')); $privKey = Settings::findbyParam('recaptcha_private_key'); $pubKey = Settings::findbyParam('recaptcha_public_key'); if (!empty($pubKey) && !empty($privKey)) { $recaptcha = new Zend_Service_ReCaptcha($pubKey, $privKey); $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $translate->_('Captcha Check'), 'description' => $translate->_('Type the characters you see in the picture below.'), 'captcha' => 'ReCaptcha', 'captchaOptions' => array('captcha' => 'ReCaptcha', 'service' => $recaptcha))); $this->addElement($captcha); } else { $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $translate->_('Write the chars to the field'), 'captcha' => array('captcha' => 'Image', 'wordLen' => 6, 'timeout' => 300, 'font' => PUBLIC_PATH . '/resources/fonts/arial.ttf', 'imgDir' => PUBLIC_PATH . '/tmp', 'imgUrl' => '/tmp/'))); $this->addElement($captcha); } $this->addElement('submit', 'submit', array('required' => false, 'label' => $translate->_('Submit your request'), 'decorators' => array('Bootstrap'), 'class' => 'btn btn-primary bigbtn')); }
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'), 'description' => $translate->_('Write here your firstname.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input')); $this->addElement('text', 'lastname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Lastname'), 'description' => $translate->_('Write here your lastname.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input')); $this->addElement('select', 'company_type_id', array('label' => $translate->_('Company Type'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Select the company type'), 'class' => 'form-control large-input')); $this->getElement('company_type_id')->setAllowEmpty(false)->setMultiOptions(CompanyTypes::getList(true)); $this->addElement('select', 'legalform', array('label' => $translate->_('Legal form'), 'required' => true, 'decorators' => array('Bootstrap'), 'description' => $translate->_('Select the type of company.'), 'class' => 'form-control large-input')); $this->getElement('legalform')->setAllowEmpty(false)->setMultiOptions(Legalforms::getList()); $this->addElement('text', 'company', array('filters' => array('StringTrim'), 'label' => $translate->_('Company Name'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Write here your company name.'), 'class' => 'form-control large-input')); $this->addElement('text', 'vat', array('filters' => array('StringTrim'), 'label' => $translate->_('VAT'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input', 'description' => $translate->_('Write here the VAT number.'))); $this->addElement('text', 'area', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Area'), 'decorators' => array('Bootstrap'), 'class' => 'form-control medium-input', 'description' => $translate->_('Write the area code'))); $this->addElement('text', 'taxpayernumber', array('filters' => array('StringTrim'), 'label' => $translate->_('Tax payer number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input', 'description' => $translate->_('Write the tax payer number.'))); $this->addElement('text', 'address', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Address'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Write the address'), 'class' => 'form-control large-input')); $this->addElement('text', 'code', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Zip'), 'description' => $translate->_('Write the zip code'), 'decorators' => array('Bootstrap'), 'class' => 'form-control medium-input')); $this->addElement('text', 'city', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('City'), 'description' => $translate->_('Write here your city name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input')); $this->addElement('select', 'country_id', array('label' => $translate->_('Country'), 'required' => true, 'description' => $translate->_('Select your own country'), 'decorators' => array('Bootstrap'), 'class' => "form-control")); $this->getElement('country_id')->setAllowEmpty(false)->setMultiOptions(Countries::getList())->setRequired(true); $this->addElement('text', 'email', array('filters' => array('StringTrim', 'StringToLower'), 'required' => true, 'decorators' => array('Bootstrap'), 'validators' => array('EmailAddress'), 'required' => true, 'label' => $translate->_('Email'), 'description' => $translate->_('Write here your email'), 'class' => 'form-control large-input')); $this->addElement('password', 'password', array('filters' => array('StringTrim'), 'required' => true, 'decorators' => array('Bootstrap'), 'validators' => array(array('regex', false, '/^[a-zA-Z0-9\\-\\_\\.\\%\\!\\$]{6,20}$/')), 'description' => $translate->_('Write here your password. (min.6 chars - max.20 chars)'), 'label' => $translate->_('Password'), 'class' => 'form-control large-input')); $this->addElement('submit', 'save', array('required' => false, 'label' => $translate->_('Save'), 'decorators' => array('Bootstrap'), 'class' => 'btn btn-primary')); $this->addElement('hidden', 'customer_id'); }
/** * preDispatch * Starting of the module * (non-PHPdoc) * @see library/Zend/Controller/Shineisp_Controller_Default#preDispatch() */ public function preDispatch() { $auth = Zend_Auth::getInstance(); $registry = Shineisp_Registry::getInstance(); $this->categories = new ProductsCategories(); $this->translator = $registry->Zend_Translate; }
public static function time_since($original) { $translator = Shineisp_Registry::getInstance()->Zend_Translate; $original = strtotime($original); // array of time period chunks $chunks = array(array(60 * 60 * 24 * 365, $translator->translate('years')), array(60 * 60 * 24 * 30, $translator->translate('months')), array(60 * 60 * 24 * 7, $translator->translate('weeks')), array(60 * 60 * 24, $translator->translate('days')), array(60 * 60, $translator->translate('hours')), array(60, $translator->translate('minutes'))); $today = time(); /* Current unix time */ $since = $today - $original; // $j saves performing the count function each time around the loop for ($i = 0, $j = count($chunks); $i < $j; $i++) { $seconds = $chunks[$i][0]; $name = $chunks[$i][1]; // finding the biggest chunk (if the chunk fits, break) if (($count = floor($since / $seconds)) != 0) { // DEBUG print "<!-- It's $name -->\n"; break; } } $print = $count == 1 ? '1 ' . $name : "{$count} {$name}"; if ($i + 1 < $j) { // now getting the second item $seconds2 = $chunks[$i + 1][0]; $name2 = $chunks[$i + 1][1]; // add second item if it's greater than 0 if (($count2 = floor(($since - $seconds * $count) / $seconds2)) != 0) { $print .= $count2 == 1 ? ', 1 ' . $name2 : ", {$count2} {$name2}"; } } return $print; }
/** * grid * create the configuration of the grid */ public static function grid($rowNum = 10) { $translator = Shineisp_Registry::getInstance()->Zend_Translate; $config['datagrid']['columns'][] = array('label' => null, 'field' => 's.subscriber_id', 'alias' => 'subscriber_id', 'type' => 'selectall'); $config['datagrid']['columns'][] = array('label' => $translator->translate('ID'), 'field' => 's.subscriber_id', 'alias' => 'subscriber_id', 'sortable' => true, 'searchable' => true, 'type' => 'string'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Email'), 'field' => 's.email', 'alias' => 'email', 'sortable' => true, 'searchable' => true, 'type' => 'string'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Subscription Date'), 'field' => 's.subscriptiondate', 'alias' => 'subscriptiondate', 'sortable' => true, 'searchable' => true, 'type' => 'date'); $config['datagrid']['fields'] = "s.subscriber_id, s.email as email, DATE_FORMAT(s.subscriptiondate, '" . Settings::getMySQLDateFormat('dateformat') . " %H:%i:%s') as subscriptiondate"; $config['datagrid']['rownum'] = $rowNum; $config['datagrid']['dqrecordset'] = Doctrine_Query::create()->select($config['datagrid']['fields'])->from('NewslettersSubscribers s'); $config['datagrid']['basepath'] = "/admin/subscribers/"; $config['datagrid']['index'] = "subscriber_id"; $config['datagrid']['rowlist'] = array('10', '50', '100', '1000'); $config['datagrid']['buttons']['edit']['label'] = $translator->translate('Edit'); $config['datagrid']['buttons']['edit']['cssicon'] = "edit"; $config['datagrid']['buttons']['edit']['action'] = "/admin/subscribers/edit/id/%d"; $config['datagrid']['buttons']['delete']['label'] = $translator->translate('Delete'); $config['datagrid']['buttons']['delete']['cssicon'] = "delete"; $config['datagrid']['buttons']['delete']['action'] = "/admin/subscribers/delete/id/%d"; $config['datagrid']['massactions'] = array('massdelete' => 'Mass Delete', 'bulkexport' => 'Export'); $bulkmailinglist = array(); $mailchimplists = Newsletters::get_mailchimp_list(); if (!empty($mailchimplists)) { foreach ($mailchimplists as $id => $name) { $bulkmailinglist['bulk_mailchimp_optin&list=' . $id] = "Add to ({$name})"; $bulkmailinglist['bulk_mailchimp_optout&list=' . $id] = "Remove from ({$name})"; } } $config['datagrid']['massactions']['commons'] = array_merge($config['datagrid']['massactions'], $bulkmailinglist); return $config; }
public function Show($parameters) { $output = ""; $ns = new Zend_Session_Namespace(); $languageID = Languages::get_language_id($ns->lang); $mainviewhelper = new Zend_View(); $mainviewhelper->addBasePath(APPLICATION_PATH . '/modules/default/views/'); $view = new Zend_View(); $view->addScriptPath('../library/Shineisp/Custom/views'); $translator = Shineisp_Registry::getInstance()->Zend_Translate; if (!empty($parameters['code'])) { $code = $parameters['code']; } else { return ""; } // Get the products $data = Products::GetProductsByGroupCode($code, $languageID); // Check the existence of the mandatories attributes if (!empty($data['attributes'][0])) { $view->attributes = $data['attributes']; } // Check if there are values set for the group of the product selected if (!empty($data['attributes_values'][0])) { $view->values = $data['attributes_values']; } // Get the products if (!empty($data['products'][0])) { $view->products = $data['products']; } $view->mainviewhelper = $mainviewhelper; // Path of the template return $view->render('productsattributes.phtml'); }
public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $translate = Shineisp_Registry::get('Zend_Translate'); $this->addElement('text', 'code', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Attribute Code'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('select', 'is_visible_on_front', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Visible on Product page'), 'class' => 'form-control')); $this->getElement('is_visible_on_front')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('0' => 'No', '1' => 'Yes')); $this->addElement('select', 'is_required', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Is Required'), 'class' => 'form-control')); $this->getElement('is_required')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('0' => 'No', '1' => 'Yes')); $this->addElement('select', 'is_comparable', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Is Comparable'), 'class' => 'form-control')); $this->getElement('is_comparable')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('0' => 'No', '1' => 'Yes')); $this->addElement('select', 'on_product_listing', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Use on Product Listing'), 'class' => 'form-control')); $this->getElement('on_product_listing')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('0' => 'No', '1' => 'Yes')); $this->addElement('select', 'active', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Active'), 'class' => 'form-control')); $this->getElement('active')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('0' => 'No', '1' => 'Yes')); $this->addElement('select', 'system', array('decorators' => array('Bootstrap'), 'label' => $translate->_('System'), 'class' => 'form-control')); $this->getElement('system')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('0' => 'No', '1' => 'Yes')); $this->addElement('text', 'position', array('filters' => array('StringTrim'), 'label' => $translate->_('Position'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('select', 'system_var', array('label' => $translate->_('System Variable'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('system_var')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Panels::getOptionsXmlFields(Isp::getPanel())); $this->addElement('text', 'defaultvalue', array('filters' => array('StringTrim'), 'label' => $translate->_('Default Value'), 'description' => $translate->_('When the type of the object is a selectbox you have to use the Json code. eg: {"1": "True", "0": "False"}'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('hidden', 'language_id', array('decorators' => array('Bootstrap'))); $this->addElement('text', 'label', array('filters' => array('StringTrim'), 'label' => $translate->_('Label'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'description', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'prefix', array('filters' => array('StringTrim'), 'label' => $translate->_('Prefix'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'suffix', array('filters' => array('StringTrim'), 'label' => $translate->_('Suffix'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('select', 'type', array('filters' => array('StringTrim'), 'label' => $translate->_('Type'), 'description' => $translate->_('If the type is a dropdown selector you have to set the options using the Json structure in the default value textbox.'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('type')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('text' => 'Textbox', 'select' => 'Dropdown Select', 'checkbox' => 'Checkbox')); $this->addElement('hidden', 'attribute_id'); }
public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $translate = Shineisp_Registry::get('Zend_Translate'); $this->addElement('text', 'date_start', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Creation date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat())); $this->addElement('text', 'date_end', array('filters' => array('StringTrim'), 'label' => $translate->_('Expiry Date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat())); $this->addElement('text', 'quantity', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Quantity'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('textarea', 'message', array('filters' => array('StringTrim'), 'label' => $translate->_('Message'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control wysiwyg')); $this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'label' => $translate->_('Note'), 'description' => $translate->_('Write here a note. An email will be sent to the ISP staff.'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control wysiwyg')); $this->addElement('textarea', 'setup', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup Configuration'), 'description' => $translate->_('Here you can read the service configuration written by the ISP modules. These information are read-only.'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12')); $this->addElement('select', 'order_id', array('label' => $translate->_('Orders'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('order_id')->setAllowEmpty(false)->setMultiOptions(Orders::getList(true)); $this->addElement('multiselect', 'domains', array('label' => $translate->_('Available domains'), 'decorators' => array('Bootstrap'), 'class' => 'form-control col-lg-12 tmpitems')); $this->getElement('domains')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Domains::getList()); $this->addElement('multiselect', 'domains_selected', array('label' => $translate->_('Selected domains'), 'decorators' => array('Bootstrap'), 'class' => 'form-control col-lg-12 items')); $this->getElement('domains_selected')->setRegisterInArrayValidator(false); // Disable the Validator in order to manage a dynamic list. $this->addElement('select', 'product_id', array('label' => $translate->_('Products'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('product_id')->setAllowEmpty(false)->setMultiOptions(Products::getList(true)); $this->addElement('select', 'billing_cycle_id', array('label' => $translate->_('Billing Cycle'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('billing_cycle_id')->setAllowEmpty(false)->setMultiOptions(BillingCycle::getList(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('orders', false, true)); $this->addElement('select', 'autorenew', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Auto Renewal'), 'description' => $translate->_('Enable or disable the automatic renewal of the service'), 'class' => 'form-control')); $this->getElement('autorenew')->setAllowEmpty(false)->setMultiOptions(array('1' => $translate->_('Yes, I would like to renew the service at the expiration date.'), '0' => $translate->_('No, I am not interested in the service renew.'))); $this->addElement('hidden', 'detail_id'); }
public function __construct($config = array()) { parent::__construct($config); $this->setScriptPath(realpath(APPLICATION_PATH . '/../public') . '/skins/commons/invoices/'); $this->assign('translator', Shineisp_Registry::getInstance()->Zend_Translate); require_once PROJECT_PATH . '/library/html2pdf/html2pdf.class.php'; }
public function preDispatch() { $registry = Shineisp_Registry::getInstance(); $this->translations = $registry->Zend_Translate; $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); }
public function customers() { $registry = Shineisp_Registry::getInstance(); $translator = $registry->Zend_Translate; $this->view->customers = Customers::getList($translator->translate('Select the customer ...'), array(array('where' => 'u.status_id = ?', 'params' => Statuses::id('active', 'customers')))); return $this->view->render('partials/customers.phtml'); }
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'); }
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'); }
/** * grid * create the configuration of the grid */ public static function grid($rowNum = 10, $locale = null) { $translator = Shineisp_Registry::getInstance()->Zend_Translate; if ($locale === null) { $Session = new Zend_Session_Namespace('Admin'); $locale = $Session->langid; } $config['datagrid']['columns'][] = array('label' => null, 'field' => 'pa.attribute_id', 'alias' => 'attribute_id', 'type' => 'selectall'); $config['datagrid']['columns'][] = array('label' => $translator->translate('ID'), 'field' => 'pa.attribute_id', 'alias' => 'attribute_id', 'sortable' => true, 'searchable' => true, 'type' => 'string'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Code'), 'field' => 'code', 'alias' => 'code', 'sortable' => true, 'searchable' => true, 'type' => 'string'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Label'), 'field' => 'pad.label', 'alias' => 'label', 'sortable' => true, 'searchable' => true, 'type' => 'string'); $config['datagrid']['columns'][] = array('label' => Isp::getPanel() . " " . $translator->translate('System Attributes'), 'field' => 'pa.system_var', 'alias' => 'system_var', 'sortable' => true, 'searchable' => true, 'type' => 'string'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Default'), 'field' => 'pa.defaultvalue', 'alias' => 'default', 'sortable' => true, 'searchable' => true, 'type' => 'string'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Position'), 'field' => 'pa.position', 'alias' => 'position', 'sortable' => true, 'searchable' => true, 'type' => 'index'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Visible on Frontend'), 'field' => 'pa.is_visible_on_front', 'alias' => 'visible', 'sortable' => true, 'searchable' => true, 'type' => 'boolean'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Groups'), 'type' => 'arraydata', 'index' => 'attribute_id', 'alias' => 'dummy', 'run' => array('ProductsAttributes' => 'getGroups')); $config['datagrid']['fields'] = "attribute_id, code, pad.label as label, pa.system_var as system_var, pa.is_visible_on_front as visible, pa.position as position, pa.defaultvalue as default"; $config['datagrid']['dqrecordset'] = Doctrine_Query::create()->select($config['datagrid']['fields'])->from('ProductsAttributes pa')->leftJoin('pa.ProductsAttributesData pad WITH pad.language_id = ' . $locale); $config['datagrid']['rownum'] = $rowNum; $config['datagrid']['basepath'] = "/admin/productsattributes/"; $config['datagrid']['index'] = "attribute_id"; $config['datagrid']['rowlist'] = array('10', '50', '100', '1000'); $config['datagrid']['buttons']['edit']['label'] = $translator->translate('Edit'); $config['datagrid']['buttons']['edit']['cssicon'] = "edit"; $config['datagrid']['buttons']['edit']['action'] = "/admin/productsattributes/edit/id/%d"; $config['datagrid']['buttons']['delete']['label'] = $translator->translate('Delete'); $config['datagrid']['buttons']['delete']['cssicon'] = "delete"; $config['datagrid']['buttons']['delete']['action'] = "/admin/productsattributes/delete/id/%d"; $config['datagrid']['massactions']['common'] = array('massdelete' => 'Mass Delete'); return $config; }
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'); }
/** * grid * create the configuration of the grid */ public static function grid($rowNum = 10) { $translator = Shineisp_Registry::getInstance()->Zend_Translate; // Return usage/max_services or usage/infinity if max_services is 0 or null $sqlIF = "\r\n\t\t\t(IF ( s.max_services \r\n \t\t\t ,CONCAT(s.services,'/',s.max_services,' (',ROUND(s.services*100/s.max_services),'%)')\r\n \t\t\t ,CONCAT(s.services,'/∞') \r\n\t\t\t))\r\n\t\t"; $config['datagrid']['columns'][] = array('label' => null, 'field' => 's.server_id', 'alias' => 'server_id', 'type' => 'selectall'); $config['datagrid']['columns'][] = array('label' => $translator->translate('ID'), 'field' => 's.server_id', 'alias' => 'server_id', 'sortable' => true, 'searchable' => true, 'type' => 'string'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Name'), 'field' => 'r.subject', 'alias' => 'servername', 'sortable' => true, 'searchable' => true, 'type' => 'string'); $config['datagrid']['columns'][] = array('label' => $translator->translate('IP'), 'field' => 's.ip', 'alias' => 'ip', 'sortable' => true, 'searchable' => true, 'attributes' => array('class' => "visible-lg visible-md hidden-xs")); $config['datagrid']['columns'][] = array('label' => $translator->translate('Status'), 'field' => 'stat.status', 'alias' => 'status', 'sortable' => true, 'searchable' => true, 'attributes' => array('class' => "visible-lg visible-md hidden-xs")); $config['datagrid']['columns'][] = array('label' => $translator->translate('Usage'), 'field' => 's.usage', 'alias' => 'usage', 'sortable' => false, 'searchable' => false, 'attributes' => array('class' => "visible-lg visible-md hidden-xs")); $config['datagrid']['columns'][] = array('label' => $translator->translate('Panel'), 'field' => 'panel.name', 'alias' => 'panel_name', 'sortable' => true, 'searchable' => true, 'attributes' => array('class' => "visible-lg visible-md hidden-xs")); $config['datagrid']['fields'] = "s.server_id, s.name as servername, " . $sqlIF . " AS usage, s.max_services AS max_services, s.ip as ip, stat.status as status, panel.name as panel_name"; $config['datagrid']['dqrecordset'] = Doctrine_Query::create()->select($config['datagrid']['fields'])->from('Servers s')->leftJoin('s.Isp i')->leftJoin('s.Servers_Types st')->leftJoin('s.Statuses stat')->leftJoin('s.Panels panel'); $config['datagrid']['rownum'] = $rowNum; $config['datagrid']['basepath'] = "/admin/servers/"; $config['datagrid']['index'] = "server_id"; $config['datagrid']['rowlist'] = array('10', '50', '100', '1000'); $config['datagrid']['buttons']['edit']['label'] = $translator->translate('Edit'); $config['datagrid']['buttons']['edit']['cssicon'] = "edit"; $config['datagrid']['buttons']['edit']['action'] = "/admin/servers/edit/id/%d"; $config['datagrid']['buttons']['delete']['label'] = $translator->translate('Delete'); $config['datagrid']['buttons']['delete']['cssicon'] = "delete"; $config['datagrid']['buttons']['delete']['action'] = "/admin/servers/delete/id/%d"; $config['datagrid']['massactions'] = array('massdelete' => 'Mass Delete'); return $config; }
public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $translate = Shineisp_Registry::get('Zend_Translate'); $this->addElement('text', 'quantity', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Quantity'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'setupfee', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup fees'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'discount', array('filters' => array('StringTrim'), 'label' => $translate->_('Discount'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'cost', array('filters' => array('StringTrim'), 'label' => $translate->_('Cost'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('select', 'product_id', array('filters' => array('StringTrim'), 'required' => false, 'label' => $translate->_('Products'), 'class' => 'form-control')); $this->getElement('product_id')->setAllowEmpty(false)->setMultiOptions(Products::getList(true)); $this->addElement('text', 'price', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Price'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('select', 'billing_cycle_id', array('label' => $translate->_('Billing Cycle'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('billing_cycle_id')->setAllowEmpty(false)->setMultiOptions(BillingCycle::getList(true)); $this->addElement('text', 'date_start', array('filters' => array('StringTrim'), 'label' => $translate->_('Start Date'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat())); $this->addElement('text', 'date_end', array('filters' => array('StringTrim'), 'label' => $translate->_('Expiry Date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat())); $this->addElement('textarea', 'description', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'decorators' => array('Bootstrap'), 'rows' => 5, 'class' => 'form-control')); $this->addElement('textarea', 'parameters', array('filters' => array('StringTrim'), 'label' => $translate->_('Service Panel Configuration'), 'decorators' => array('Bootstrap'), 'rows' => 5, 'description' => $translate->_('Parameters model accepted: {"domain":{"name":"domain.com","tld":"2","action":"renewDomain","authcode":null}}'), 'class' => 'form-control')); $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('select', 'autorenew', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Auto Renewal'), 'class' => 'form-control', 'multioptions' => array(0 => 'NO', 1 => 'YES'))); $this->addElement('multiselect', 'domains', array('label' => $translate->_('Available Domains'), 'decorators' => array('Bootstrap'), 'class' => 'form-control tmpitems')); $this->getElement('domains')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Domains::getList()); $this->addElement('multiselect', 'domains_selected', array('label' => $translate->_('Selected domains'), 'decorators' => array('Bootstrap'), 'class' => 'form-control items')); $this->getElement('domains_selected')->setRegisterInArrayValidator(false); // Disable the Validator in order to manage a dynamic list. $this->addElement('hidden', 'detail_id'); }
/** * preDispatch * Starting of the module * (non-PHPdoc) * @see library/Zend/Controller/Shineisp_Controller_Default#preDispatch() */ public function preDispatch() { $registry = Shineisp_Registry::getInstance(); $this->wiki = new Wiki(); $this->translator = $registry->Zend_Translate; $this->getHelper('layout')->setLayout('1column'); }
public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $translate = Shineisp_Registry::get('Zend_Translate'); $this->addElement('text', 'company', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Company'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'vatnumber', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('VAT Number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'address', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Address'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'zip', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('ZIP Code'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'city', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('City'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'country', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Country'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'telephone', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Telephone'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'fax', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Fax'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'bankname', array('filters' => array('StringTrim'), 'label' => $translate->_('Bank name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'iban', array('filters' => array('StringTrim'), 'label' => $translate->_('IBAN'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'bic', array('filters' => array('StringTrim'), 'label' => $translate->_('BIC'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'slogan', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Slogan'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'manager', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Manager'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'custom1', array('filters' => array('StringTrim'), 'label' => $translate->_('Custom 1'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'custom2', array('filters' => array('StringTrim'), 'label' => $translate->_('Custom 2'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'custom3', array('filters' => array('StringTrim'), 'label' => $translate->_('Custom 3'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'website', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Website'), '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('file', 'logo', array('label' => $translate->_('Logo'))); $this->addElement('file', 'logo_email', array('label' => $translate->_('Logo Email'))); $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('select', 'isppanel', array('filters' => array('StringTrim'), 'label' => $translate->_('ISP Panel'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('isppanel')->setAllowEmpty(false)->setMultiOptions(Panels::getPanelInstalled()); $this->addElement('hidden', 'isp_id'); }
/** * grid * create the configuration of the grid */ public static function grid($rowNum = 10) { $Session = new Zend_Session_Namespace('Default'); $translator = Shineisp_Registry::getInstance()->Zend_Translate; $config['datagrid']['columns'][] = array('label' => null, 'field' => 'cms.page_id', 'alias' => 'page_id', 'type' => 'selectall'); $config['datagrid']['columns'][] = array('label' => $translator->translate('ID'), 'field' => 'cms.page_id', 'alias' => 'page_id', 'sortable' => true, 'searchable' => true, 'type' => 'string'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Title'), 'field' => 'title', 'alias' => 'title', 'sortable' => true, 'searchable' => true, 'type' => 'string'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Variable'), 'field' => 'var', 'alias' => 'var', 'sortable' => true, 'searchable' => true, 'type' => 'string'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Date'), 'field' => 'cms.publishedat', 'alias' => 'date', 'sortable' => true, 'searchable' => true, 'type' => 'date'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Language'), 'type' => 'arraydata', 'index' => 'page_id', 'alias' => 'dummy', 'run' => array('CmsPagesData' => 'getTranslations')); $config['datagrid']['fields'] = "cms.page_id, DATE_FORMAT(cms.publishedat, '" . Settings::getMySQLDateFormat('dateformat') . "') as date, cms.title, cms.var"; $config['datagrid']['rownum'] = $rowNum; $config['datagrid']['dqrecordset'] = Doctrine_Query::create()->select($config['datagrid']['fields'])->from('CmsPages cms'); $config['datagrid']['basepath'] = "/admin/cmspages/"; $config['datagrid']['index'] = "page_id"; $config['datagrid']['rowlist'] = array('10', '50', '100', '1000'); $config['datagrid']['buttons']['edit']['label'] = $translator->translate('Edit'); $config['datagrid']['buttons']['edit']['cssicon'] = "edit"; $config['datagrid']['buttons']['edit']['action'] = "/admin/cmspages/edit/id/%d"; $config['datagrid']['buttons']['delete']['label'] = $translator->translate('Delete'); $config['datagrid']['buttons']['delete']['cssicon'] = "delete"; $config['datagrid']['buttons']['delete']['action'] = "/admin/cmspages/delete/id/%d"; $config['datagrid']['massactions']['common'] = array('massdelete' => 'Mass Delete'); return $config; }
public function init() { // Get all settings Shineisp_Registry::set('Settings', Settings::getAll()); // Statuses are used everywhere in system, so we need to make just one query Shineisp_Registry::set('Status', Statuses::getAll()); }
public function Status($items) { $translation = Shineisp_Registry::getInstance()->Zend_Translate; $this->view->data = $items; // Path of the template return $this->view->render('partials/status.phtml'); }
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'); }