当前位置: 首页>>代码示例>>PHP>>正文


PHP AttributeGroup::model方法代码示例

本文整理汇总了PHP中AttributeGroup::model方法的典型用法代码示例。如果您正苦于以下问题:PHP AttributeGroup::model方法的具体用法?PHP AttributeGroup::model怎么用?PHP AttributeGroup::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AttributeGroup的用法示例。


在下文中一共展示了AttributeGroup::model方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionDelete

 public function actionDelete($ids)
 {
     $ids = explode(',', $ids);
     if (count($ids) > 0) {
         foreach ($ids as $id) {
             $attributeGroup = AttributeGroup::model()->findByPk($id);
             $attributeGroup->delete();
         }
     }
     $this->redirect(array('index'));
 }
开发者ID:damnpoet,项目名称:yiicart,代码行数:11,代码来源:AttributeGroupsController.php

示例2: actionSort

 public function actionSort()
 {
     if (isset($_POST['items']) && is_array($_POST['items'])) {
         $i = 0;
         foreach ($_POST['items'] as $item) {
             $project = AttributeGroup::model()->findByPk($item);
             $project->sort_order = $i;
             $project->save();
             $i++;
         }
     }
 }
开发者ID:Rudianasaja,项目名称:cycommerce,代码行数:12,代码来源:AttributeGroupController.php

示例3: save

 public function save()
 {
     $attributeGroup = AttributeGroup::model()->findByPk($this->id);
     if (is_null($attributeGroup)) {
         // is insert
         $attributeGroup = new AttributeGroup();
         $attributeGroup->sort_order = $this->sortOrder;
         $attributeGroup->save();
         $attributeDescription = new AttributeGroupDescription();
         $attributeDescription->attribute_group_id = $attributeGroup->attribute_group_id;
         $attributeDescription->language_id = 1;
         // TODO: read locale
         $attributeDescription->name = $this->name;
         $attributeDescription->save();
     } else {
         $attributeGroup->sort_order = $this->sortOrder;
         $attributeGroup->save();
         $attributeGroup->description->name = $this->name;
         $attributeGroup->description->save();
     }
 }
开发者ID:damnpoet,项目名称:yiicart,代码行数:21,代码来源:AttributeGroupForm.php

示例4: foreach

        <?php 
echo $form->textFieldGroup($model, 'name');
?>
    </div>
</div>


<div class="row">
    <?php 
$tree = [];
$selectedAttributes = [];
$model->refresh();
foreach ($model->typeAttributes as $attribute) {
    $selectedAttributes[] = $attribute->id;
}
foreach ((array) AttributeGroup::model()->findAll() as $group) {
    $items = [];
    $groupHasNotSelectedAttribute = false;
    $groupItems = (array) $group->groupAttributes;
    foreach ($groupItems as $item) {
        $selected = in_array($item->id, $selectedAttributes);
        if (!$selected) {
            $groupHasNotSelectedAttribute = true;
        }
        $items[] = ['text' => CHtml::tag('div', ['class' => 'checkbox'], CHtml::label(CHtml::checkBox('attributes[]', $selected, ['value' => $item->id]) . $item->title, null))];
    }
    $tree[] = ['text' => CHtml::tag('div', ['class' => 'checkbox'], CHtml::label(CHtml::checkBox('', count($groupItems) && !$groupHasNotSelectedAttribute, ['class' => 'group-checkbox']) . $group->name, null)), 'children' => $items];
}
foreach ((array) Attribute::model()->findAllByAttributes(['group_id' => null]) as $attribute) {
    $tree[] = ['text' => CHtml::tag('div', ['class' => 'checkbox'], CHtml::label(CHtml::checkBox('attributes[]', in_array($attribute->id, $selectedAttributes), ['value' => $attribute->id]) . $attribute->title, null))];
}
开发者ID:alextravin,项目名称:yupe,代码行数:31,代码来源:_form.php

示例5:

</div>

<?php 
echo $form->errorSummary($model);
?>

<div class='row'>
    <div class="col-sm-4">
        <?php 
echo $form->dropDownListGroup($model, 'type', ['widgetOptions' => ['data' => $model->getTypesList(), 'htmlOptions' => ['empty' => '---', 'id' => 'attribute-type']]]);
?>
    </div>

    <div class="col-sm-4">
        <?php 
echo $form->dropDownListGroup($model, 'group_id', ['widgetOptions' => ['data' => AttributeGroup::model()->getFormattedList(), 'htmlOptions' => ['empty' => '---']]]);
?>
    </div>
</div>


<div class='row'>
    <div class="col-sm-4">
        <?php 
echo $form->textFieldGroup($model, 'title');
?>
    </div>
    <div class="col-sm-4">
        <?php 
echo $form->slugFieldGroup($model, 'name', ['sourceAttribute' => 'title']);
?>
开发者ID:yupe,项目名称:yupe,代码行数:31,代码来源:_form.php

示例6: changeGroupFilter

                                        $.fn.yiiGridView.update('attribute-group-grid');
                                    }
                                    else {
                                        console.log(data.data);
                                    }
                                }
                            });
                        }
                    });
                });

                function changeGroupFilter() {
                    if (!$('#attribute-group-grid').find('a.editable-open')[0]) {
                        $("#Attribute_group_id").val($.fn.yiiGridView.getSelection('attribute-group-grid')).trigger("change");
                    }
                }
            </script>
        </fieldset>
        <?php 
$attributeGroup = new AttributeGroup('search');
$attributeGroup->unsetAttributes();
$this->widget('yupe\\widgets\\CustomGridView', ['id' => 'attribute-group-grid', 'type' => 'condensed', 'dataProvider' => $attributeGroup->search(), 'template' => "{items}\n{multiaction}", 'hideHeader' => true, 'selectableRows' => 1, 'sortableRows' => true, 'sortableAjaxSave' => true, 'sortableAttribute' => 'position', 'sortableAction' => '/store/attributeBackend/sortable', 'actionsButtons' => ['clear' => CHtml::link(Yii::t("StoreModule.store", "Without a group"), '#', ['id' => 'clear-attribute-group-filter', 'class' => 'btn btn-sm btn-default']), 'add' => CHtml::link(Yii::t('YupeModule.yupe', 'Add'), '#', ['id' => 'add-attribute-group', 'class' => 'btn btn-sm btn-success pull-right'])], 'afterAjaxUpdate' => 'js:function(id, data){ changeGroupFilter(); }', 'columns' => [['name' => 'name', 'class' => 'bootstrap.widgets.TbEditableColumn', 'headerHtmlOptions' => ['style' => 'width:500px'], 'editable' => ['type' => 'text', 'url' => ['/store/attributeBackend/inlineEditGroup'], 'title' => Yii::t('StoreModule.store', 'Enter {field}', ['{field}' => mb_strtolower($attributeGroup->getAttributeLabel('name'))]), 'params' => [Yii::app()->request->csrfTokenName => Yii::app()->request->csrfToken], 'placement' => 'right']]]]);
?>
    </div>
    <div class="col-sm-8">
        <?php 
$this->widget('yupe\\widgets\\CustomGridView', ['id' => 'attribute-grid', 'type' => 'condensed', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => [['name' => 'group_id', 'value' => '$data->getGroupTitle()', 'filter' => CHtml::activeDropDownList($model, 'group_id', AttributeGroup::model()->getFormattedList(), ['empty' => '', 'class' => 'form-control'])], ['name' => 'name', 'type' => 'raw', 'value' => 'CHtml::link($data->name, array("/store/attributeBackend/update", "id" => $data->id))'], ['name' => 'title', 'type' => 'raw', 'value' => 'CHtml::link($data->title, array("/store/attributeBackend/update", "id" => $data->id))'], ['name' => 'type', 'type' => 'text', 'value' => '$data->getTypeTitle($data->type)', 'filter' => $model->getTypesList()], ['class' => 'yupe\\widgets\\CustomButtonColumn']]]);
?>
    </div>
</div>
开发者ID:alextravin,项目名称:yupe,代码行数:30,代码来源:index.php

示例7: mb_strtolower

        </fieldset>
        <?php 
$this->widget('yupe\\widgets\\CustomGridView', ['id' => 'attributes-groups-grid', 'type' => 'condensed', 'dataProvider' => $attributeGroup->search(), 'template' => "{items}\n{multiaction}\n{pager}", 'hideHeader' => true, 'selectableRows' => 1, 'sortableRows' => true, 'sortableAjaxSave' => true, 'sortableAttribute' => 'position', 'sortableAction' => '/store/attributeBackend/sortable', 'actionsButtons' => ['add' => CHtml::link(Yii::t('YupeModule.yupe', 'Add'), '#', ['id' => 'add-attribute-group', 'class' => 'btn btn-sm btn-success pull-right'])], 'columns' => [['name' => 'name', 'class' => 'bootstrap.widgets.TbEditableColumn', 'headerHtmlOptions' => ['style' => 'width:500px'], 'editable' => ['type' => 'text', 'url' => ['/store/attributeBackend/inlineEditGroup'], 'title' => Yii::t('StoreModule.store', 'Enter {field}', ['{field}' => mb_strtolower($attributeGroup->getAttributeLabel('name'))]), 'params' => [Yii::app()->request->csrfTokenName => Yii::app()->request->csrfToken], 'placement' => 'right']]]]);
?>
    </div>
    <div class="col-sm-9">
        <?php 
$this->widget('yupe\\widgets\\CustomGridView', ['id' => 'attributes-grid', 'sortableRows' => true, 'sortableAjaxSave' => true, 'sortableAttribute' => 'sort', 'sortableAction' => '/store/attributeBackend/sortattr', 'type' => 'condensed', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => [['name' => 'title', 'type' => 'raw', 'value' => function ($data) {
    return CHtml::link($data->title, array("/store/attributeBackend/update", "id" => $data->id));
}], ['name' => 'name', 'type' => 'raw', 'value' => function ($data) {
    return CHtml::link($data->name, array("/store/attributeBackend/update", "id" => $data->id));
}], ['name' => 'type', 'type' => 'text', 'value' => function ($data) {
    return $data->getTypeTitle($data->type);
}, 'filter' => $model->getTypesList()], ['name' => 'group_id', 'value' => function ($data) {
    return $data->getGroupTitle();
}, 'filter' => CHtml::activeDropDownList($model, 'group_id', AttributeGroup::model()->getFormattedList(), ['empty' => '', 'class' => 'form-control'])], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'required', 'url' => $this->createUrl('/store/attributeBackend/inlineattr'), 'source' => $model->getYesNoList(), 'options' => [['class' => 'label-default'], ['class' => 'label-success']]], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'is_filter', 'url' => $this->createUrl('/store/attributeBackend/inlineattr'), 'source' => $model->getYesNoList(), 'options' => [['class' => 'label-default'], ['class' => 'label-success']]], ['class' => 'yupe\\widgets\\CustomButtonColumn', 'template' => '{update}{delete}']]]);
?>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function () {
        var $container = $('body');
        $container.on('click', '#add-attribute-group', function (e) {
            e.preventDefault();
            var name = prompt('<?php 
echo Yii::t("StoreModule.store", "Title");
?>
');
            if (name) {
                var data = {name: name};
开发者ID:yupe,项目名称:yupe,代码行数:31,代码来源:index.php

示例8: mb_strtolower

</legend>

        </fieldset>
        <?php 
$this->widget('yupe\\widgets\\CustomGridView', ['id' => 'attributes-groups-grid', 'type' => 'condensed', 'dataProvider' => $attributeGroup->search(), 'template' => "{items}\n{multiaction}\n{pager}", 'hideHeader' => true, 'selectableRows' => 1, 'sortableRows' => true, 'sortableAjaxSave' => true, 'sortableAttribute' => 'position', 'sortableAction' => '/store/attributeBackend/sortable', 'actionsButtons' => ['add' => CHtml::link(Yii::t('YupeModule.yupe', 'Add'), '#', ['id' => 'add-attribute-group', 'class' => 'btn btn-sm btn-success pull-right'])], 'columns' => [['name' => 'name', 'class' => 'bootstrap.widgets.TbEditableColumn', 'headerHtmlOptions' => ['style' => 'width:500px'], 'editable' => ['type' => 'text', 'url' => ['/store/attributeBackend/inlineEditGroup'], 'title' => Yii::t('StoreModule.store', 'Enter {field}', ['{field}' => mb_strtolower($attributeGroup->getAttributeLabel('name'))]), 'params' => [Yii::app()->request->csrfTokenName => Yii::app()->request->csrfToken], 'placement' => 'right']]]]);
?>
    </div>
    <div class="col-sm-9">
        <?php 
$this->widget('yupe\\widgets\\CustomGridView', ['id' => 'attributes-grid', 'sortableRows' => true, 'sortableAjaxSave' => true, 'sortableAttribute' => 'sort', 'sortableAction' => '/store/attributeBackend/sortattr', 'type' => 'condensed', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => [['name' => 'title', 'type' => 'raw', 'value' => function ($data) {
    return CHtml::link($data->title, array("/store/attributeBackend/update", "id" => $data->id));
}], ['name' => 'name', 'type' => 'raw', 'value' => function ($data) {
    return CHtml::link($data->name, array("/store/attributeBackend/update", "id" => $data->id));
}], ['name' => 'group_id', 'value' => function ($data) {
    return $data->getGroupTitle();
}, 'filter' => CHtml::activeDropDownList($model, 'group_id', AttributeGroup::model()->getFormattedList(), ['empty' => '', 'class' => 'form-control'])], ['name' => 'type', 'type' => 'text', 'value' => function ($data) {
    return $data->getTypeTitle($data->type);
}, 'filter' => $model->getTypesList()], ['class' => 'yupe\\widgets\\CustomButtonColumn', 'template' => '{update}{delete}']]]);
?>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function () {
        var $container = $('body');
        $container.on('click', '#add-attribute-group', function (e) {
            e.preventDefault();
            var name = prompt('<?php 
echo Yii::t("StoreModule.store", "Title");
?>
');
开发者ID:syrexby,项目名称:domovoishop.by,代码行数:31,代码来源:index.php

示例9: array

echo $form->labelEx($description, 'name');
?>
		<?php 
echo $form->textField($description, 'name', array('size' => 60, 'maxlength' => 64));
?>
		<?php 
echo $form->error($description, 'name');
?>
	</div>
	
	<div class="row">
		<?php 
echo $form->labelEx($model, 'attribute_group_id');
?>
		<?php 
echo TbHtml::activeDropDownList($model, 'attribute_group_id', TbHtml::listData(AttributeGroup::model()->findAll(), 'id', function ($data) {
    return $data->getName();
}));
?>
		<?php 
echo $form->error($model, 'attribute_group_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'sort_order');
?>
		<?php 
echo $form->textField($model, 'sort_order');
?>
开发者ID:Rudianasaja,项目名称:cycommerce,代码行数:31,代码来源:_form.php


注:本文中的AttributeGroup::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。