<?php

include_once '../includes/nocache.php';
include_once '../includes/config.php';
include_once '../includes/sanitize.php';
include_once '../includes/helpers.php';
include 'includes/valida-login.php';
include 'includes/meta.php';
require_once 'sllists/SLLists.class.php';
$sortableLists = new SLLists('scriptaculous');
$sortableLists->addList('imageFloatContainer', 'imageFloatOrder', 'div', "overlap:'vertical',constraint:false");
$sortableLists->debug = false;
$id_seccion = 'PUBLICIDAD_GARAGE_VERT';
if (isset($_POST['sortableListsSubmitted'])) {
    $orderArray = SLLists::getOrderArray($_POST['imageFloatOrder'], 'imageFloatContainer');
    include_once '../includes/config.php';
    foreach ($orderArray as $item) {
        $campos = array('orden' => $item['order']);
        $db->update('publicidad', $campos, 'id=' . $item['element']);
    }
    redirige_pagina("publicidad_garage.php?err=2&opc=ordenar");
}
?>
<link href='http://fonts.googleapis.com/css?family=Ubuntu:300,400,700' rel='stylesheet' type='text/css'>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<?
$sortableLists->printTopJS();
?>
</head>
<body class="bcolor">
	<div id="fondo">
示例#2
0
// $sortableTag = 'div';
// $listFormat = '<div id="sortableList">%s</div>';	// argument is the contents of the list
// $listItemFormat = '<div id="item_%s">%s</div>';  // two arguments are the idField and the displayField

// formatting for the list - using a div as the container and images as the list items
// $sortableTag = 'img';
// $listFormat = '<div id="sortableList">%s</div>';	// argument is the contents of the list
// $listItemFormat = '<img id="item_%s" src="images/%s">';  // two arguments are the idField and the displayField


//
// No need to change any of the sections below
//


$sortableLists->addList('sortableList','sortableListOrder',$sortableTag);
$sortableLists->debug = false;

if (isset($_POST['sortableListsSubmitted'])) {
	$orderArray = SLLists::getOrderArray($_POST['sortableListOrder'],'sortableList');
	foreach($orderArray as $item) {
		$sql = "UPDATE $dbTable set $orderField=".$item['order']." WHERE $idField=".$item['element'];
		mysql_query($sql);
	}
}

$sql = "SELECT $idField, $displayField, $orderField from $dbTable order by $orderField";
$recordSet = mysql_query($sql);
$listArray = array();
while ($record = mysql_fetch_assoc($recordSet)) {
	$listArray[] = sprintf($listItemFormat,$record[$idField],$record[$displayField]);
示例#3
0
function reorder_process($get)
{
    $userid = get_userid();
    $objResponse = new xajaxResponse();
    if (check_permission($userid, 'Manage All Content')) {
        global $gCms;
        $config =& $gCms->GetConfig();
        $db =& $gCms->GetDb();
        $contentops =& $gCms->GetContentOperations();
        $hm = $contentops->GetAllContentAsHierarchy(false);
        $hierarchy =& $hm->getRootNode();
        require cms_join_path(dirname(dirname(__FILE__)), 'lib', 'sllists', 'SLLists.class.php');
        $sortableLists = new SLLists($config["root_url"] . '/lib/scriptaculous');
        $listArray = array();
        $output = '';
        $sortableLists->addList('parent0', 'parent0ListOrder');
        $listArray[0] = 'parent0ListOrder';
        $output .= '<ul id="parent0" class="sortableList">' . "\n";
        foreach ($hierarchy->getChildren(false, true) as $child) {
            show_h($child, $sortableLists, $listArray, $output);
        }
        $output .= '</ul>';
        $order_changed = FALSE;
        foreach ($listArray as $parent_id => $order) {
            $orderArray = SLLists::getOrderArray($get[$order], 'parent' . $parent_id);
            foreach ($orderArray as $item) {
                $node =& $hm->sureGetNodeById($item['element']);
                if ($node != NULL) {
                    $one =& $node->getContent();
                    // Only update if order has changed.
                    if ($one->ItemOrder() != $item['order']) {
                        $order_changed = TRUE;
                        $query = 'UPDATE ' . cms_db_prefix() . 'content SET item_order = ? WHERE content_id = ?';
                        $db->Execute($query, array($item['order'], $item['element']));
                    }
                }
            }
        }
        if (TRUE == $order_changed) {
            global $gCms;
            $contentops =& $gCms->GetContentOperations();
            $contentops->SetAllHierarchyPositions();
            $contentops->ClearCache();
        }
    }
    $objResponse->assign("contentlist", "innerHTML", display_content_list());
    return $objResponse;
}
示例#4
0
<?
require_once('SLLists.class.php');
$sortableLists = new SLLists('scriptaculous');
$sortableLists->addList('categories','categoriesListOrder');
$sortableLists->addList('divContainer','divOrder','div');
$sortableLists->addList('imageContainer','imageOrder','img');
$sortableLists->addList('imageFloatContainer','imageFloatOrder','img',"overlap:'horizontal',constraint:false");
$sortableLists->debug = true;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Scriptaculous Lists with PHP</title>
<link rel="stylesheet" type="text/css" href="css/lists.css"/>
<?
$sortableLists->printTopJS();
?>

</head>
<body>
<a href="http://www.gregphoto.net">Back to Graphics by Greg</a>

<h1>Scriptaculous Lists with PHP</h1>
by Greg Neustaetter
<h2>Scriptaculous Sortables</h2>

<p><a href="http://script.aculo.us">Scriptaculous</a> is one of many great new JavaScript libraries created to answer the call for well
written 'Web 2.0' JavaScript libraries.  Written by Thomas Fuchs, scriptaculous has many features that can be used in AJAX-ified applications,
drag-and-drop effects, and a whole slew of visual effects.  The drag-and-drop effects, most notably the sortables, caught my eye because
the look great, they are so easy to implement, and they're just so much nicer than the standard listbox with up/down arrows that we see in
most of today's applications and administration tools.</p>