public function actionElement($param)
 {
     //разбираем URL
     $paramArr = explode("/", $param);
     $url = array_pop($paramArr);
     if ($model = CatalogRubrics::model()->find('url LIKE ("' . $url . '")')) {
         //Это раздел - выводим список
         $this->actionIndex($model);
         exit;
     }
     //Это карточка товара
     if (!($model = CatalogElements::model()->find('url LIKE "' . $url . '" OR id = ' . (int) $url))) {
         throw new CHttpException(404, 'The page can not be found.');
     }
     $this->setSEOData($model);
     //$modelRubric = CatalogRubrics::model()->findByPk($model->parent_id);
     if (!$model) {
         throw new CHttpException(404, 'The page can not be found.');
     }
     $modelChars = CatalogChars::model()->findAll('parent_id=' . $model->id . ' AND status = 1');
     $data['modelChars'] = $modelChars;
     $data['model'] = $model;
     $data['modelImages'] = CatalogElementsImages::model()->findAll('elements_id = ' . $model->id);
     $this->render('show', $data);
 }
 public function loadModelChars($id)
 {
     $model = CatalogChars::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Beispiel #3
0
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Отмена</button>
        <?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'htmlOptions' => array('class' => 'applyBtn', 'style' => 'margin-right: 20px'), 'label' => 'Сохранить'));
?>
    </div>

    <?php 
$this->endWidget();
?>
</div>


<?php 
$this->widget('bootstrap.widgets.TbExtendedGridView', array('id' => 'chars-grid', 'template' => "{items}\n{pager}", 'enableHistory' => true, 'htmlOptions' => array('class' => 'content_table'), 'dataProvider' => $provider, 'filter' => $model, 'columns' => array('name', array('header' => $labels["type_scale"], 'name' => "type_scale", 'type' => 'raw', 'value' => function ($data) {
    return CatalogChars::model()->getTypeScale($data->type_scale);
}, 'filter' => ''), array('header' => 'Назначено', 'type' => 'raw', 'value' => function ($data) {
}, 'filter' => ''), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{delete_chars}', 'buttons' => array('delete_chars' => array('label' => 'Удалить', 'imageUrl' => '/images/admin/ico_delete.gif', 'url' => 'Yii::app()->createUrl("' . Yii::app()->controller->module->id . '/' . Yii::app()->controller->id . '/deletechars", array("id"=>$data->id))')), 'htmlOptions' => array('style' => 'white-space: nowrap')))));
?>
<div id="ajax_loader" style="display: none;"><img width="40px;" style="position:absolute; margin-top:10px; margin-left:-40px;" src="/images/admin/ajaxloader.gif"></div>
<div class="buttons">
    <a class="btn btn-primary" style="margin-top:14px; float:left; margin-left:15px" href="#" onclick="$('#addcharsModal').modal('show');return false;"> Добавить новое свойство</a>
    <a class="btn btn-success" style="float:left; margin-left:15px; margin-top:14px" href="javascript: saveForm();">Сохранить изменения</a>
</div>

<script>
    //Меняем статус
    $(document).on('click', '.on-off-product', function(){
        $.ajax({
            type: 'POST',
            url: '/admin/<?php 
Beispiel #4
0
?>
</legend>
<style>
    .content_table td {
        border-bottom: 1px solid #e6edec;
        border-left-style: hidden;
        border-right-style: hidden;
        padding: 6px;
        vertical-align: middle;
    }
</style>


<?php 
$assetsDir = Yii::app()->basePath;
$labels = CatalogChars::model()->attributeLabels();
$this->widget('bootstrap.widgets.TbExtendedGridView', array('id' => 'chars-grid', 'template' => "{items}\n{pager}", 'enableHistory' => true, 'htmlOptions' => array('class' => 'content_table'), 'dataProvider' => $provider, 'filter' => $model, 'columns' => array('name', array('header' => $labels["scale"], 'name' => "scale", 'type' => 'raw', 'value' => function ($data) {
    $val = $data->scale;
    $scale_val = array();
    //разбираем значение в scale если type_scale == 2 или 3
    $tmp_scale_val = explode("|", $val);
    if (is_array($tmp_scale_val)) {
        $scale_val = array_filter($tmp_scale_val);
        if ($data->type_scale == 3) {
            $val = '';
            foreach ($scale_val as $v) {
                $val .= '<div style="float:left; margin-left:10px; width: 30px; height: 30px; background: ' . $v . '"></div>';
            }
        }
        if ($data->type_scale == 2) {
            $val = '<ul>';
Beispiel #5
0
/* @var $form CActiveForm */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'chars-form', 'enableAjaxValidation' => false, 'enableClientValidation' => false, 'type' => 'horizontal', 'htmlOptions' => array('enctype' => 'multipart/form-data')));
echo $form->errorSummary($model);
?>


<div onclick="$('#main_block').slideToggle(); return false;" class="main_block_url" style="width: 100%; background-color: #3689d8; margin-bottom: 5px; cursor: pointer;">
    <a href="#"><span style="color: #fff; margin-left: 10px; font-weight: bold;">Основное</span></a>
</div>
<div id="main_block" style="margin-top: 10px; padding: 10px;">
    <?php 
echo $form->textFieldRow($model, 'name', array('class' => 'span5', 'maxlength' => 150));
?>

    <?php 
echo $form->dropDownListRow($model, 'type_scale', CatalogChars::model()->getTypeScale(), array('class' => 'span5'));
?>

    <div id="scale_row" style="display:none;">
        <?php 
echo $form->textFieldRow($model, 'scale', array('class' => 'span5', 'maxlength' => 150));
?>
    </div>

    <div id="group_selector" style="display: none;">
        <?php 
if (!empty($scale_val) && $model->type_scale == 2) {
    $i = 0;
    ?>
            <?php 
    foreach ($scale_val as $val) {
Beispiel #6
0
 /**
  * @param $model
  * @param $param
  * Добавляет наследование для категории
  */
 public function addInherits($model, $param)
 {
     if ($model->type_parent == 1 || $model->type_parent == 3) {
         //Для категорий
         $modelcatalog = CatalogRubrics::model()->findByPk($model->parent_id);
         foreach ($modelcatalog->descendants()->findAll() as $data) {
             $model_chars = new CatalogChars();
             $model_chars->attributes = $param;
             $model_chars->parent_id = $data->id;
             $model_chars->type_parent = 1;
             $model_chars->save();
         }
     }
     return true;
 }