Пример #1
0
 function _post($response)
 {
     include_once "../main.php";
     // ищем группы меню и проверяем на СуперАдмина
     if (general::sadmin()) {
         $_sql = "select * from menu where id_parent=0 and status=1 order by zindex";
     } else {
         $_sql = "select * from menu where id_parent=0 and status=1 and adm!=1 order by zindex";
     }
     $result = mysql::query($_sql, 0);
     $this->menu = system::show_tpl(array('result' => $result), 'mainmenu/menu.php');
     $this->center_block = $response;
     echo system::show_tpl((array) $this, $this->layout);
 }
Пример #2
0
 /**
  * получаем все id таблицы menu в виде массива
  */
 static function menu_get_id()
 {
     // только для СуперАдмина
     if (!general::sadmin()) {
         return general::messages(0, v::getI18n('backend_orror_access'));
     }
     // строим запрос
     $_sql = "SELECT id FROM menu order by zindex";
     $result = mysql::query_only($_sql, 0);
     $a = array();
     while ($obj = mysql_fetch_array($result)) {
         $a[] = $obj['id'];
     }
     return $a;
 }
Пример #3
0
 /**
  * отображаем весь список материалов
  */
 function indexAction()
 {
     // только для СуперАдмина
     if (!general::sadmin()) {
         return general::messages(0, v::getI18n('backend_orror_access'));
     }
     if ($_POST) {
         // проверяем на checkbox
         forms::check_box(dbh::menu_get_id());
         // записываем в базу
         forms::multy_update_form_all_records($this->tablename, 'status', 0);
         $this->msg = general::messages(1, v::getI18n('backend_after_save'));
     }
     // строим запрос
     $_sql = 'SELECT * FROM ' . $this->tablename . ' where id_parent=0 order by zindex';
     // выполняем запрос + при необходимости выводим сам запрос
     $result = mysql::query($_sql, 0);
     return system::show_tpl(array('result' => $result, 'msg' => $this->msg), $this->tpl_folder . '/index.php');
 }
Пример #4
0
 function add_sadminAction()
 {
     // только для СуперАдмина
     if (!general::sadmin()) {
         return general::messages(0, v::getI18n('backend_orror_access'));
     }
     $this->tpl = $this->tpl_folder . '/add' . general::sadmin_tpl() . '.php';
     if ($_POST) {
         // проверяем на checkbox
         forms::check_box(array('status', 'has_podrasdel', 'is_map'));
         // проверяем на существование такого action, если есть - добавляем несколько символов
         $_sql = 'SELECT count(*) as count FROM ' . $this->tablename . ' where action="' . $_POST['FORM']['action'] . '"';
         // выполняем запрос + при необходимости выводим сам запрос
         if (mysql::query_findpole($_sql, 'count', 0) > 0) {
             $_POST['FORM']['action'] .= '_new';
         }
         // записываем в базу
         forms::multy_insert_form($this->tablename, 0);
         $this->msg = general::messages(1, v::getI18n('backend_after_save'));
     }
     // выбираем разделы у которых могут быть подразделы
     $_sql = 'SELECT * FROM ' . $this->tablename . ' where has_podrasdel=1 order by name';
     $select = mysql::query($_sql, 0);
     return system::show_tpl(array('select' => $select, 'msg' => $this->msg, 'tpl_folder' => $this->tpl_folder), $this->tpl);
 }
Пример #5
0
<ul class="menu">

<?php 
foreach ($result as $obj) {
    ?>

	<!-- ищем меню данной группы -->
	
	<?php 
    // ищем группы меню и проверяем на СуперАдмина
    if (general::sadmin()) {
        $_sql1 = "select * from menu where id_parent=" . $obj->id . " and status=1 order by zindex";
    } else {
        $_sql1 = "select * from menu where id_parent=" . $obj->id . " and status=1 and adm!=1 order by zindex";
    }
    $result1 = mysql::query($_sql1, 0);
    ?>
	
	<?php 
    if (count($result1) > 0) {
        ?>
		<li><a href="#"><?php 
        echo $obj->name_menu;
        ?>
</a>
        	<ul>
		<?php 
        foreach ($result1 as $obj1) {
            ?>
			<li><?php 
            echo general::link_to($obj1->link_menu . '/menu/' . $obj1->id, $obj1->name_menu, $obj1->id == $_SESSION['id_menu'] ? 'class="cur"' : '');
Пример #6
0
    echo $obj->id;
    ?>
" class="setStatus"><?php 
    echo $obj->status == 1 ? '<span style="color:#39C;">Да</span>' : '<span style="color:red;">Нет</span>';
    ?>
</a></span>
					<span class="ps_coll"><a href="#" data-id="<?php 
    echo $obj->id;
    ?>
" class="setStatus"><?php 
    echo general::link_to($tpl_folder . '/new/id/' . $obj->id, 'Редактировать');
    ?>
</a></span>					
					<?if($obj->has_podrasdel == 0 or $obj->has_podrasdel == ''):?>
                        <span class="ps_coll"><?php 
    echo dbh::content_count_child($obj->id) == 0 && general::sadmin() || $obj->id_parent != 0 ? general::link_to($tpl_folder . '/delete/id/' . $obj->id, 'Удалить?', 'onclick="return confirm(\'Вы уверены?\')"') : '<a href=""></a>';
    ?>
</span>
				    <?else:?>
                        <span class="ps_coll"></span>
                    <?endif?>
                </span>
                <span class="name"><?php 
    echo $obj->name_ru;
    ?>
				<br />
				<!--<strong>URL страницы</strong>: <input  value="<?php 
    // echo $obj->action;
    ?>
" class="red"></input>-->
				</span>