Esempio n. 1
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'subject', array('filters' => array('StringTrim'), 'required' => true, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Subject'), 'class' => 'form-control'));
     $this->addElement('text', 'uri', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('URI'), 'class' => 'form-control'));
     $this->addElement('select', 'language_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Language'), 'class' => 'form-control'));
     $this->getElement('language_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Languages::getList());
     $this->addElement('select', 'active', array('label' => $translate->_('Active'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
     $this->addElement('textarea', 'metadescription', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Meta Description'), 'rows' => 5, 'class' => 'col-lg-12'));
     $this->addElement('textarea', 'metakeywords', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Meta Keywords'), 'rows' => 5, 'class' => 'col-lg-12'));
     $this->addElement('textarea', 'content', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Body'), 'id' => 'body', 'class' => 'col-lg-12 form-control wysiwyg'));
     $this->addElement('select', 'category_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Category'), 'class' => 'form-control'));
     $this->getElement('category_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(WikiCategories::getList());
     $this->addElement('hidden', 'wiki_id');
 }
Esempio n. 2
0
 /**
  * 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' => 'w.wiki_id', 'alias' => 'wiki_id', 'type' => 'selectall');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('ID'), 'field' => 'w.wiki_id', 'alias' => 'wiki_id', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Subject'), 'field' => 'w.subject', 'alias' => 'subject', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Creation Date'), 'field' => 'w.creationdate', 'alias' => 'creation_date', 'sortable' => true, 'searchable' => true, 'type' => 'date', 'attributes' => array('class' => 'span2'));
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Category'), 'field' => 'wc.category_id', 'alias' => 'category', 'sortable' => true, 'type' => 'index', 'searchable' => true, 'filterdata' => WikiCategories::getList(), 'attributes' => array('class' => 'span2'));
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Visits'), 'field' => 'w.views', 'alias' => 'visits', 'sortable' => true, 'type' => 'index');
     $config['datagrid']['fields'] = "w.wiki_id, w.subject as subject, DATE_FORMAT(w.creationdate, '" . Settings::getMySQLDateFormat('dateformat') . "') as creation_date, wc.category as category, w.views as visits";
     $config['datagrid']['dqrecordset'] = Doctrine_Query::create()->select($config['datagrid']['fields'])->from('Wiki w')->leftJoin('w.WikiCategories wc');
     $config['datagrid']['rownum'] = $rowNum;
     $config['datagrid']['basepath'] = "/admin/wiki/";
     $config['datagrid']['index'] = "wiki_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/wiki/edit/id/%d";
     $config['datagrid']['buttons']['delete']['label'] = $translator->translate('Delete');
     $config['datagrid']['buttons']['delete']['cssicon'] = "delete";
     $config['datagrid']['buttons']['delete']['action'] = "/admin/wiki/delete/id/%d";
     $config['datagrid']['massactions'] = array('massdelete' => 'Mass Delete', 'bulkexport' => 'Export');
     return $config;
 }