nesting CGridView within Bootstrap Tabs - yii

I'm using Yii-Booster TbTabs. I'd love to be able to nest CGridView in one of the tabs. I'm trying the following but getting the error "Object of class CGridView could not be converted to string".
$this->widget(
'bootstrap.widgets.TbTabs',
array(
'type' => 'tabs',
'tabs' => array(
array(
'label' => 'Tab 1',
'content' => '',
),
array(
'label' => 'Tab with grid view',
'content' =>$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'entry-subject-grid',
'dataProvider'=>$relatives->search(),
'filter'=>$relatives,
'columns'=>array(
'id',
'subject',
array('class'=>'CButtonColumn',),),)),),
array(
'label' => 'Tab 3',
'content' =>'description content',
),
),
)
);
This there any way that I can pass this object into a tab view (of example Im able to pass ckEditor quiate happily into a tab with the following
array(
'label' => 'Entry',
'content' => $form->ckEditorRow($model,'entry',array('options' => array('id'=>'new title'))),
),
thanks

The last parameter for Controller::widget() is captureOutput which when set to true returns the widget as a string instead of displaying it.

Related

Prestashop checkbox helperform not submitting to database

I am using Prestashop 1.7 and am creating a module. I am using the helperform to generate it.
I am trying to have checkboxes so the customer can select multiple options.
The code I am using (under "protected function getConfigForm()") is:
array(
'type' => 'checkbox',
'label' => $this->l('Manufacturers'),
'name' => 'SERVICES_SELECTED',
'values' => array(
'query' => array(
array('key' => '1', 'name' => 'option 1'),
array('key' => '2', 'name' => 'option 2'),
array('key' => '3', 'name' => 'option 3'),
),
'id' => 'key',
'name' => 'name'
)
),
This shows up correctly in my admin>module config page.
However, when I select some values and click save, no data is submitted to the database.
Under
protected function getConfigFormValues()
I have
return array(
'SERVICES_SELECTED' => Configuration::get('SERVICES_SELECTED'),
);
I can get this to work for any other type of form e.g. text, select etc but checkbox just doesn't seem to save to the database.
Anyone got any ideas what I've missed?

Prestashop 1.6 HelperForm add class fixed-width-x1 to form selector [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I am creating a Prestashops 1.6 module. After added input in HelperForm select, then in html the script added class fixed-width-x1.
$fields_form[0]['form'] = array(
'tinymce' => true,
'legend' => array(
'title' => $this->l('Add rule'),
),
'submit' => array(
'name' => 'add',
'title' => $this->l('Add'),
'class' => 'btn btn-default pull-right'
),
'input' => array(
array(
'type' => 'select',
'label' => $this->l('Category'),
'name' => 'category',
'required' => true
),
)
);
Screen Firebug
Why it works wrong?
I want add own class to select, but fixed-width-x1 override property width.
This class is automatically added by the HelperForm class in the proccess of rendering the select.
But, in my opinion, that you can do is add a class to the select and then change the style in this new class.
To add a new class to the select, only add this at the end of the options array:
'class' => 'name-of-custom-class'
Be sure that the comma after the last option exist.
In summary, should be like this:
$fields_form[0]['form'] = array(
'tinymce' => true,
'legend' => array(
'title' => $this->l('Add rule'),
),
'submit' => array(
'name' => 'add',
'title' => $this->l('Add'),
'class' => 'btn btn-default pull-right'
),
'input' => array(
array(
'type' => 'select',
'label' => $this->l('Category'),
'name' => 'category',
'required' => true,
'class' => 'name-of-custom-class'
),
)
);
Hope it helps you.
[EDIT]
The HelperForm class uses a template to make this inputs. This template is:
/[admin-folder]/themes/default/template/helpers/form/form.tpl
In this file around the line 341, you can find this code:
{elseif $input.type == 'select'}
{if isset($input.options.query) && !$input.options.query && isset($input.empty_message)}
{$input.empty_message}
{$input.required = false}
{$input.desc = null}
{else}
<select name="{$input.name|escape:'html':'utf-8'}"
class="{if isset($input.class)}{$input.class|escape:'html':'utf-8'}{/if} fixed-width-xl"
In the last line you can see the place that is assigned this class with any control "fixed-width-xl".
The solution:
You can delete directly the class from the tpl, but this will affect
to all the inputs that are in the admin panel. And, in case of you want to update the prestashop version, is probably that you lost this change.
You can edit the admin css file deleting the "!important". This file is:
/[admin-folder]/themes/default/css/admin-theme.css

yii how to put link to another form in cgridview

how to put link in the classcode to proceed to another form
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'classlist-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
**'classCode'**,
'classDesc',
array(
'class'=>'CButtonColumn',
),
),
)); ?>
You can use a clink column
'columns'=>array(
.....
array(
'class'=>'CLinkColumn',
'label'=>'your_attribute',
'url'=>'your_controller/your_action&id='.$model->your_attribute,
'header'=>'your_column_header'
),
Hii you can also use this
array(
'name' => 'you_field',
'header' => 'label',
'type' => 'raw',
'value' => 'CHtml::link($data->you_field,Yii::app()->createUrl("controller/action",array("param"=>$data->you_field)),array("target"=>"_blank"))',
),
Hi use this code,
array(
'header' =>Your Header Name,
'value' => '$data->subject->subject_name." - ".$data->subject->subject_code',
'url' => 'Yii::app()->createUrl("core/subject/deleteelective", array("id"=>$data->electivesubjectid))',
'htmlOptions' => array('width' => '45%'),
),

CJuiDatePicker in yii is not working

In my web application, I want to implement a date field. For this i am using CJuiDatePicker. But for me it not showing calendar.
My code is,
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name' => 'Employee[employee_joiningdate]',
'id' => 'Employee_employee_joiningdate',
'value' => Yii::app()->dateFormatter->format("d-M-y", strtotime($model->employee_joiningdate)),
'options' => array(`
'showAnim' => 'slide', //'slide','fold','slideDown','fadeIn','blind','bounce','clip','drop'
'showOtherMonths' => true, // Show Other month in jquery
'selectOtherMonths' => true, // Select Other month in jquery
),
'htmlOptions' => array(
'class' => 'form-control'
),
));`
What i am doing wrong?
Please help me....
Thanks in advance.

Where can i find a full list of InputeFilters Zend2 properties?

Where i can find a complit list of validator construction properties (factory). For exmple we got 1 inputeFilter 'email':
$this->add(array(
'name' => 'email',
'required' => true,
'validators' => array(
array(
'name' => 'EmailAddress',
'options' => array(
'domain' => true,
),
),
),
));
May be some documentation with all properties ('name', 'requiered. e.t.c.) and their structure.
they are all well documented just not in the array notation http://framework.zend.com/manual/current/en/modules/zend.validator.set.html
also you can view the invokables in the vendor code the variable is called $invokableClasses.
..\vendor\zendframework\zendframework\library\Zend\Validator\ValidatorPluginManager.php
For options you may still look at the documentation since they obviously vary from validator to validator.
Edit: In some cases building the validator out of the array notation is helpful. You'll just have to add them into the inputfilter notation like so:
...
$eanValidator = new Zend\Validator\Barcode(array(
'adapter' => 'EAN13',
'checksum' => false,
));
...
$this->add(array(
'name' => 'ean-test',
'required' => true,
'validators' => array(
array(
$eanValidator,
$someOtherValidator,
...
),
),
));