Exemple #1
0
 public function actionCatalog($alias, $p = 1)
 {
     $this->columns = 1;
     if ($page = Stre::model()->findByAttributes(array('view' => 1, 'alias' => $alias))) {
         $this->setPageTitle($page->title);
         $this->metakeys = $page->keywords;
         $this->metadescr = $page->description;
         $this->render('catalog', array('page' => $page, 'p' => $p));
     } else {
         throw new CHttpException(404);
     }
 }
 public function actionUpdate($pid, $id, $Stre_page = 1)
 {
     $cs = Yii::app()->clientScript;
     $cs->registerScriptFile("/js/admin/url.js");
     $model = Stre::model()->findByPk($id);
     $root = Stre::model()->roots()->findByPk($pid);
     if (empty($model) || empty($root)) {
         $this->redirect($this->createUrl('default/viewcatalog', array('id' => $pid, 'Stre_page' => $Stre_page, 'msg' => '[!] Не существует такого элемента!', 'msgtype' => 'error')));
     }
     $this->performAjaxValidation($model);
     if (!empty($_POST['Stre']['name'])) {
         $model->name = $_POST['Stre']['name'];
         $model->alias = $_POST['Stre']['alias'];
         $old_view = $model->view;
         $new_view = $_POST['Stre']['view'];
         $model->view = $_POST['Stre']['view'];
         $model->title = $_POST['Stre']['title'];
         $model->keywords = $_POST['Stre']['keywords'];
         $model->description = $_POST['Stre']['description'];
         try {
             $model->saveNode();
             if ($old_view != $new_view) {
                 foreach ($model->descendants()->findAll() as $des) {
                     $des->view = $new_view;
                     $des->saveNode();
                 }
             }
             foreach ($model->type->attrs as $attr) {
                 unset($attr_val);
                 $attr_val = AttrVal::model()->findByPk(array('id_attr' => $attr->id, 'id_elem' => $model->id));
                 if (empty($attr_val)) {
                     $attr_val = new AttrVal();
                     $attr_val->id_attr = $attr->id;
                     $attr_val->id_elem = $model->id;
                 }
                 $old_value = $attr_val->value;
                 $new_value = $_POST['AttrVal'][$attr->id];
                 if ($attr->mytype->mytype == 'photo') {
                     if ($old_value != '' && $old_value != $new_value) {
                         @unlink($_SERVER['DOCUMENT_ROOT'] . '/userfiles/original/' . $old_value);
                         @unlink($_SERVER['DOCUMENT_ROOT'] . '/userfiles/large/' . $old_value);
                         @unlink($_SERVER['DOCUMENT_ROOT'] . '/userfiles/medium/' . $old_value);
                         @unlink($_SERVER['DOCUMENT_ROOT'] . '/userfiles/small/' . $old_value);
                     }
                     if ($new_value != '' && $old_value != $new_value) {
                         $photo = $_POST['AttrVal'][$attr->id];
                         $img = Yii::app()->image->load($_SERVER['DOCUMENT_ROOT'] . '/userfiles/editor/images/' . $photo);
                         $pname = 'catalog_' . $model->id . '_' . $photo;
                         $img->save($_SERVER['DOCUMENT_ROOT'] . '/userfiles/original/' . $pname);
                         $img->resize(600, 600);
                         $img->save($_SERVER['DOCUMENT_ROOT'] . '/userfiles/large/' . $pname);
                         $img->resize(200, 200);
                         $img->save($_SERVER['DOCUMENT_ROOT'] . '/userfiles/medium/' . $pname);
                         $img->resize(100, 100);
                         $img->save($_SERVER['DOCUMENT_ROOT'] . '/userfiles/small/' . $pname);
                         $attr_val->value = $pname;
                     } else {
                         $attr_val->value = $new_value;
                     }
                 } else {
                     $attr_val->value = $_POST['AttrVal'][$attr->id];
                     if ($attr->fk > 0) {
                         if (!empty($attr_val->value)) {
                             $attr_val->value = implode(',', $_POST['AttrVal'][$attr->id]);
                         } else {
                             $attr_val->value = '';
                         }
                     }
                 }
                 if ($attr_val->isNewRecord) {
                     $attr_val->insert();
                 } else {
                     $attr_val->update();
                 }
             }
         } catch (CDbException $e) {
             $this->redirect($this->createUrl('default/viewcatalog', array('id' => $pid, 'Stre_page' => $Stre_page, 'msg' => $e->getMessage(), 'msgtype' => 'error')));
         }
         if (isset($_POST['savebutton'])) {
             $this->redirect($this->createUrl('default/viewcatalog', array('id' => $pid, 'Stre_page' => $Stre_page, 'msg' => '[!] Элемент успешно обновлен', 'msgtype' => 'success')));
         } else {
             $this->redirect($this->createUrl('default/update', array('id' => $model->id, 'pid' => $pid, 'Stre_page' => $Stre_page, 'msg' => '[!] Элемент успешно обновлен', 'msgtype' => 'success')));
         }
     }
     $this->render('update', array('root' => $root, 'model' => $model, 'pid' => $pid, 'Stre_page' => $Stre_page));
 }
Exemple #3
0
}
?>
                </ul>
            </div>
            <div class="content">
                <?php 
if ($this->columns > 1) {
    ?>
                <div class="right-column">
                    <div class="curs">
                        <!--  START: курс2.рф Widget HTML 1.0--><style>table td:hover {background: none;};table td {vertical-align:middel;}table tbody td tr:hover td{background:none}</style><table cellpadding="0" cellspacing="0" style=" border-collapse: inherit;border: 1px solid #444444; width: 270px;text-shadow: none;font-family: Helvetica, Arial, sans-serif ;font-size: 14px;line-height: 1.5; background-color: #ffffff; border-radius: 2px"><thead style="text-align: center; background-color: #444444; color: #ffffff;text-shadow: 0px 0px 0px #B4B4B4;"><tr><td colspan="7" style="padding: 7px 8px 7px 8px; width: inherit; text-align: left;border-top-left-radius:2px;border-top-right-radius: 2px;"><a href="http://xn--2-stbsei.xn--p1ai/" style="text-decoration: none; font-size:19px; color: inherit; font-weight: 500">Курс валют</a><span  style="float:right; height: 23px"><a href="http://xn--2-stbsei.xn--p1ai/" rel="nofollow" style="  margin-top: 2px;display: none" target="_blank"><img title="цб рф на сегодня" style="width: 104px;height: 25px; text-align: left" src="http://xn--2-stbsei.xn--p1ai/images/logo_west.png"></a></span></td></tr></thead><tbody><tr><td colspan="7" style="visibility: visible ;font-size:13px;padding:0 0 10px 0; color: #016A06;text-align:center" id="curentData">20.07.2015</td></tr><tr ><td colspan="2" style="vertical-align: middle; padding: 0 0 7px 0;"><table cellpadding="0" cellspacing="0" style="width: inherit;margin: 0 auto; font-size: 14px; "><tr><td style="vertical-align: middle;width: 40px; display: inline-block"><a title="Курс Доллара"  href="http://курс2.рф/dollar-moscow" target="_blank" style="color:#444444;text-decoration: initial; margin-right: 10px">USD</a></td><td style="vertical-align: middle;width: 29px; display: inline-block""><a title="Курс Доллара"  href="http://курс2.рф/dollar-moscow" target="_blank"><img alt="Курс Доллара к рублю на сегодня" style=" width: 19px;margin-right: 10px" src="http://xn--2-stbsei.xn--p1ai/images/flag2/usd.png"></a></td><td colspan="1" style="vertical-align: middle; width: 50px; padding: 0;color:#444444; " id="USD_td">00.000</td><td colspan="1" style="vertical-align: middle;width:15px;"><span>руб</span><img src="http://xn--2-stbsei.xn--p1ai/images/arr_red.png" id="USD_src"></td></tr></table></td><tr ><td colspan="2" style="vertical-align: middle; padding: 0 0 7px 0;"><table cellpadding="0" cellspacing="0" style="width: inherit;margin: 0 auto; font-size: 14px; "><tr><td style="vertical-align: middle;width: 40px; display: inline-block"><a title="Курс Евро"  href="http://курс2.рф/euro-moscow" target="_blank" style="color:#444444;text-decoration: initial; margin-right: 10px">EUR</a></td><td style="vertical-align: middle;width: 29px; display: inline-block""><a title="Курс Евро"  href="http://курс2.рф/euro-moscow" target="_blank"><img alt="Курс Евро к рублю на сегодня" style=" width: 19px;margin-right: 10px" src="http://xn--2-stbsei.xn--p1ai/images/flag2/eur.png"></a></td><td colspan="1" style="vertical-align: middle; width: 50px; padding: 0;color:#444444; " id="EUR_td">00.000</td><td colspan="1" style="vertical-align: middle;width:15px;"><span>руб</span><img src="http://xn--2-stbsei.xn--p1ai/images/arr_red.png" id="EUR_src"></td></tr></table></td><tr ><td colspan="2" style="vertical-align: middle; padding: 0 0 7px 0;"><table cellpadding="0" cellspacing="0" style="width: inherit;margin: 0 auto; font-size: 14px; "><tr><td style="vertical-align: middle;width: 40px; display: inline-block"><a title="Курс Китайского юаня"  href="http://курс2.рф/yuan-moscow" target="_blank" style="color:#444444;text-decoration: initial; margin-right: 10px">CNY</a></td><td style="vertical-align: middle;width: 29px; display: inline-block""><a title="Курс Китайского юаня"  href="http://курс2.рф/yuan-moscow" target="_blank"><img alt="Курс Китайского юаня к рублю на сегодня" style=" width: 19px;margin-right: 10px" src="http://xn--2-stbsei.xn--p1ai/images/flag2/cny.png"></a></td><td colspan="1" style="vertical-align: middle; width: 50px; padding: 0;color:#444444; " id="CNY_td">00.000</td><td colspan="1" style="vertical-align: middle;width:15px;"><span>руб</span><img src="http://xn--2-stbsei.xn--p1ai/images/arr_red.png" id="CNY_src"></td></tr></table></td></tbody><tfoot><style> table > tfoot > td >a:hover{color: #000000}</style><tr><td colspan="7" style="vertical-align: middle; padding: 0 12px 5px 12px"><a style="display: inline-block;text-decoration: underline;color: #000000; font-size: 12px;" href="http://xn--2-stbsei.xn--p1ai/">конвертер валют</a><a style="float: right;text-decoration: none; display: none;color: #1BA712;text-shadow: 1px 0px 1px rgba(27, 167, 18, 0.37);font-size: 13px;" href="http://westbiz.ru" target="_blank">www.westbiz.ru</a></td></tr></tfoot><script type="text/javascript" src="http://xn--2-stbsei.xn--p1ai/b14/generateCode"></script></table><noscript><strong><a href="http://xn--2-stbsei.xn--p1ai/informer" title="информер курса валют"><h1>http://курс2.рф/informer</h1></a> <a href="http://xn--2-stbsei.xn--j1amh/informer" title="информер курса валют">информер курса валют курс2.укр</a> internet magazin, portal, catalog sait-uri <a href="http://topbiz.md/" target="_blank" title="Portalul TOPBIZ in Chisinau">topbiz.md</a> Bucătării moderne și clasice in Moldova <a href="http://amevita.md/bucatarii-la-comanda/" target="_blank" title="bucătării clasice Amevita">amevita.md</a> la preturi accesibile, <a href="http://paturi.md/dormitoare-moderne-la-comanda-chisinau.html" target="_blank" title="dormitoare Chisinau">dormitoare de la Paturi.md</a>, <a href="http://paturi.md/dormitoare-mobila-la-comanda-chisinau.html" target="_blank" title="mobila la comanda Paturi.md">Paturi.md</a> de la producator de bucatarii, mobilier</strong></noscript><!--  END: topbiz.md Widget HTML 1.0-->
                    </div>
                    <br>
                    <h2 class="popular">Популярное</h2>
                    <?php 
    $pages = Stre::model()->findAllByAttributes(array('view' => 1));
    foreach ($pages as $child) {
        if ($child->attr_val('Популярный')) {
            $this->renderPartial('_item', array('child' => $child));
        }
    }
    ?>
                </div>
                <div class="left-column">
                    <?php 
    echo $content;
    ?>
                </div>
                <?php 
} else {
    ?>
 public function actionDeletecatalog($id)
 {
     $root = Stre::model()->roots()->findByPk($id);
     if (!empty($root)) {
         $root->deleteNode();
         $this->redirect($this->createUrl('install/index', array('msg' => '[!] Каталог успешно удален', 'msgtype' => 'success')));
     } else {
         $this->redirect($this->createUrl('install/index', array('msg' => '[!] Ошибка: нет такого каталога', 'msgtype' => 'error')));
     }
 }
Exemple #5
0
<?php

if (!empty($_GET['msg'])) {
    echo '<br/>';
    $this->renderPartial('application.modules.admin.views.msg', array('msg' => $_GET['msg'], 'msgtype' => $_GET['msgtype']));
}
$this->breadcrumbs = array('Каталоги' => $this->createUrl('default/index'), '');
$catalog_name = Stre::model()->roots()->findByPk($id)->name;
?>
<table width="99%">
    <tr>
        <td valign="top">
            <h1 class="nomargin">
                Каталог: <?php 
echo $catalog_name;
?>
                <span title="<?php 
echo Yii::t('qtip', '#2');
?>
" class="qtipm"  ><img src="/images/admin/help.png" height="16" alt="help"></span>
            </h1>
            <?php 
Yii::import('ext.phaActiveColumn.*');
?>
            <?php 
$this->widget('ext.QTreeGridView.CQTreeGridView', array('id' => 'category-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'ajaxUpdate' => false, 'pager' => array('class' => 'CListPager'), 'cssFile' => '/css/admin/gridview/styles.css', 'columns' => array(array('name' => 'name'), array('name' => 'alias'), array('class' => 'phaCheckColumn', 'name' => 'view', 'actionUrl' => array('setisview'), 'htmlOptions' => array('width' => '6%', 'align' => 'center')), array('name' => 'type', 'value' => '$data->type->name', 'filter' => false), array('class' => 'CButtonColumn', 'template' => '{update}&nbsp;&nbsp;{delete}', 'updateButtonUrl' => 'Yii::app()->controller->createUrl("update",array("id"=>$data->primaryKey,"pid"=>$_GET["id"],"Stre_page"=>$_GET["Stre_page"]))', 'updateButtonUrl' => '$data->updateurl()', 'deleteButtonUrl' => '$data->deleteurl()', 'updateButtonImageUrl' => '/css/admin/gridview/update.png', 'deleteButtonImageUrl' => '/css/admin/gridview/delete.png')), 'template' => '{items} {pager}'));
?>
        </td>
        <td width="180" valign="top">
            <h2 class="h2">
                Доступные операции