Esempio n. 1
0
 public static function saveBlock($block)
 {
     $id = type::post('id', 'int');
     $sql = sql::factory();
     $sql->setTable('structure_area');
     $sql->getPosts(['online' => 'int', 'modul' => 'int', 'structure_id' => 'int', 'sort' => 'int']);
     if ($block) {
         $sql->addPost('block', 1);
     }
     foreach (pageArea::$types as $class) {
         $class = new $class();
         $sql = $class->addSaveValues($sql);
     }
     pageMisc::updateTime($sql->getPost('structure_id'));
     if ($id) {
         $sql->setWhere('id=' . $id);
         $sql->update();
     } else {
         $sql->save();
     }
     self::saveSortUp($sql->getPost('structure_id'), $sql->getPost('sort'), $block);
 }
Esempio n. 2
0
    if ($action == 'online' && dyn::get('user')->hasPerm('page[edit]')) {
        $sql = sql::factory();
        $sql->query('SELECT online FROM ' . sql::table('structure') . ' WHERE id=' . $id)->result();
        $online = $sql->get('online') ? 0 : 1;
        $sql->setTable('structure');
        $sql->setWhere('id=' . $id);
        $sql->addPost('online', $online);
        $sql->update();
        echo message::success(lang::get('save_status'));
        $action = '';
    }
    if ($action == '') {
        if (ajax::is()) {
            echo pageMisc::getTreeStructurePage();
            exit;
        }
        $button = [];
        if (dyn::get('user')->hasPerm('page[edit]')) {
            $button = ['<a class="btn btn-sm btn-default" href="' . url::backend('structure', ['subpage' => 'pages', 'action' => 'add']) . '">' . lang::get('add') . '</a>'];
        }
        ?>
	<div class="row" id="structure-body"><?php 
        echo bootstrap::panel(lang::get('pages'), $button, pageMisc::getTreeStructurePage());
        ?>
</div>
	<?php 
        if (dyn::get('user')->hasPerm('page[edit]')) {
            layout::addJs("layout/js/structureSort.js");
        }
    }
}
Esempio n. 3
0
        if (dyn::get('user')->hasPerm('page[edit]')) {
            ?>
					<div class="btn-group pull-right">
						<a class="btn btn-sm btn-default" href="<?php 
            echo url::backend('structure', ['subpage' => 'pages', 'action' => 'add']);
            ?>
"><?php 
            echo lang::get('add');
            ?>
</a>
					</div>
                    <?php 
        }
        ?>
					<div class="clearfix"></div>
				</div>
				<div class="panel-body">
				<?php 
        echo pageMisc::getTreeStructurePage();
        ?>
				</div>
			</div>
		</div>
	</div>
	
	<?php 
        if (dyn::get('user')->hasPerm('page[edit]')) {
            layout::addJs("layout/js/structureSort.js");
        }
    }
}
Esempio n. 4
0
     $action = '';
 }
 if ($action == 'add' || $action == 'edit' && dyn::get('user')->hasPerm('page[edit]')) {
     layout::addJsCode("\n\tvar button = \$('#allcat-button');\n\tvar content = \$('#allcat-content');\n\t\n\tbutton.change(function() {\n\t\t\tif(button.is(':checked')) {\n\t\t\t\tcontent.stop().slideUp(300);\n\t\t\t} else {\n\t\t\t\tcontent.stop().slideDown(300);\n\t\t\t}\n\t});");
     $form = form::factory('slots', 'id=' . $id, 'index.php');
     $field = $form->addTextField('name', $form->get('name'));
     $field->fieldName(lang::get('name'));
     $field->autofocus();
     $field = $form->addTextField('description', $form->get('description'));
     $field->fieldName(lang::get('description'));
     $field = $form->addRawField('<select name="modul" class="form-control">' . pageAreaHtml::moduleList($form->get('modul')) . '</select>');
     $field->fieldName(lang::get('module'));
     $field = $form->addCheckboxField('is-structure', $form->get('is-structure'));
     $field->fieldName(lang::get('slots_show'));
     $field->add('1', lang::get('all_categories'), ['id' => 'allcat-button']);
     $select = pageMisc::getTreeStructure(true, $form->get('structure'));
     if ($form->get('is-structure') == 1) {
         $select->addAttribute('style', 'display:none;');
     }
     $select->setMultiple();
     $select->setSize(10);
     $select->setId('allcat-content');
     $form->addElement('pages', $select);
     if ($action == 'edit') {
         $form->addHiddenField('id', $id);
     }
     if ($form->isSubmit()) {
         $form->addPost('modul', $form->get('modul'));
         $form->addPost('template', dyn::get('template'));
     }
     ?>
Esempio n. 5
0
<?php

ajax::addReturn(pageMisc::getTreeStructurePagePopup());