本文整理汇总了PHP中Shineisp_Registry类的典型用法代码示例。如果您正苦于以下问题:PHP Shineisp_Registry类的具体用法?PHP Shineisp_Registry怎么用?PHP Shineisp_Registry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Shineisp_Registry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preStmtExecute
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);
}
}
示例2: eu_check
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;
}
示例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', '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');
}
示例4: tldSummaryPerMonth
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');
}
示例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', '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');
}
示例6: Last
/**
* 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;
}
示例7: 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' => '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;
}
示例8: init
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'));
}
示例9: 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'), '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');
}
示例10: preDispatch
/**
* 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;
}
示例11: time_since
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;
}
示例12: grid
/**
* 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;
}
示例13: Show
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');
}
示例14: init
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');
}
示例15: init
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');
}