Example #1
0
    } else {
        //подчиненная категория - вывожу со смещением относительно родительской
        $repeat_prefix = $data->level == 3 ? $data->level : $data->level + 1;
        $return = '<a href="/admin/photo/photo/index?PhotoElements[parent_id]=' . $data->id . '"><b>' . str_repeat('&nbsp&nbsp', $repeat_prefix) . $data->name . '</b></a>';
    }
    return $return;
}, 'filter' => ''), array('header' => 'url', 'name' => "url", 'type' => 'raw', 'value' => function ($data) {
    return $data->url;
    /*return '
                      <a href="'.SITE_NAME_FULL.'/'.$data->url.'" target="_blank">
                          '.$data->url.'
                      </a>
                  ';
    		*/
}, 'filter' => ''), array('header' => 'Альбомов', 'type' => 'raw', 'value' => function ($data) {
    $count = PhotoRubrics::getCountTree($data->left_key, $data->right_key);
    return '
                    <a href="/admin/photo/photorubrics/index?id=' . $data->id . '">
                        <b>' . $count . '</b>
                    </a>
                ';
}, 'filter' => ''), array('header' => 'Статус', 'name' => "status", 'type' => 'raw', 'value' => function ($data) {
    return '
                    <a href="#" class="on-off-product" data-id="' . $data->id . '" data-status="' . $data->status . '">
                        <div style="margin-left:20px; width: 13px; height: 13px; border-radius: 3px; background:' . ($data->status == 1 ? 'green' : 'red') . '"></div>
                    </a>
                ';
}, 'filter' => ''), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{move_up}  {move_down}  {update}  {delete}', 'buttons' => array('move_up' => array('label' => '', 'visible' => '($row==0)?false:true', 'url' => '"/admin/photo/photorubrics/move?id=$data->id&move=1"', 'options' => array('class' => 'icon-arrow-up', 'data-original-title' => 'Переместить выше')), 'move_down' => array('label' => '', 'visible' => '(($row+1)==PhotoRubrics::model()->count("level=$data->level"))?false:true', 'url' => '"/admin/photo/photorubrics/move?id=$data->id&move=2"', 'options' => array('class' => 'icon-arrow-down', 'data-original-title' => 'Переместить ниже')), 'update' => array('label' => yii::t('Bootstrap', 'PHRASE.UPDATE'), 'url' => 'CHtml::normalizeUrl(array("update", "id" => $data->id))', 'options' => array()), 'delete' => array('label' => yii::t('Bootstrap', 'PHRASE.DELETE'), 'options' => array())), 'htmlOptions' => array('style' => 'white-space: nowrap')))));
?>