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'); }
/** * Create the form module in order to create a record * @return unknown_type */ public function doAction() { $request = $this->getRequest(); $q = $request->getParam('q'); $results = array(); $q = strtolower($q); if (empty($q)) { die(json_encode(array($this->translator->translate('No Records')))); } $cms = CmsPages::getList(); foreach ($cms as $key => $value) { if (strpos(strtolower($value), $q) !== false) { $results[] = array('icon' => 'glyphicon-file', 'section' => $this->translator->translate('Cms'), 'value' => $value, 'url' => "/admin/cmspages/edit/id/{$key}", 'tokens' => explode(' ', $value)); } } $customers = Customers::getList(); if (!empty($customers)) { foreach ($customers as $key => $value) { if (strpos(strtolower($value), $q) !== false) { $results[] = array('icon' => 'glyphicon-user', 'section' => $this->translator->translate('Customer'), 'value' => $value, 'url' => "/admin/customers/edit/id/{$key}", 'tokens' => explode(' ', $value)); } } } $domains = Domains::getList(); if (!empty($domains)) { foreach ($domains as $key => $value) { if (strpos(strtolower($value), $q) !== false) { $results[] = array('icon' => 'glyphicon-globe', 'section' => $this->translator->translate('Domain'), 'value' => $value, 'url' => "/admin/domains/edit/id/{$key}", 'tokens' => explode(' ', $value)); } } } $products = Products::getList(); if (!empty($products)) { foreach ($products as $key => $value) { if (strpos(strtolower($value), $q) !== false) { $results[] = array('icon' => 'glyphicon-barcode', 'section' => $this->translator->translate('Product'), 'value' => $value, 'url' => "/admin/products/edit/id/{$key}", 'tokens' => explode(' ', $value)); } } } $orders = Orders::getList(); if (!empty($orders)) { foreach ($orders as $key => $value) { if (strpos(strtolower($value), $q) !== false) { $results[] = array('icon' => 'glyphicon-briefcase', 'section' => $this->translator->translate('Order'), 'value' => $value, 'url' => "/admin/orders/edit/id/{$key}", 'tokens' => explode(' ', $value)); } } } $ordersitems = OrdersItems::getItemsListbyDescription($q); if (!empty($ordersitems)) { foreach ($ordersitems as $key => $value) { $results[] = array('icon' => 'glyphicon-briefcase', 'section' => $this->translator->translate('Order Item'), 'value' => $value, 'url' => "/admin/ordersitems/edit/id/{$key}", 'tokens' => explode(' ', $value)); } } $tickets = Tickets::getList(); if (!empty($tickets)) { foreach ($tickets as $key => $value) { if (strpos(strtolower($value), $q) !== false) { $results[] = array('icon' => 'glyphicon-check', 'section' => $this->translator->translate('Ticket'), 'value' => $value, 'url' => "/admin/tickets/edit/id/{$key}", 'tokens' => explode(' ', $value)); } } } $wiki = Wiki::getList(); if (!empty($wiki)) { foreach ($wiki as $key => $value) { if (strpos(strtolower($value), $q) !== false) { $results[] = array('icon' => 'glyphicon-question-sign', 'section' => $this->translator->translate('Wiki'), 'value' => $value, 'url' => "/admin/wiki/edit/id/{$key}", 'tokens' => explode(' ', $value)); } } } $ticket = TicketsNotes::getItemsNote($q); foreach ($ticket as $key => $value) { $results[] = array('icon' => 'glyphicon-question-sign', 'section' => $this->translator->translate('Ticket Notes'), 'value' => $value, 'url' => "/admin/wiki/tickets/id/{$key}", 'tokens' => explode(' ', $value)); } die(json_encode($results)); }