Ejemplo n.º 1
0
// Assign vars to template
$t->assign('objects', $objects);
/**********************************
Get Frontpage sets
**********************************/
$sql = "SELECT featured_sets.set_id, name, owner_name owner, img_path, aspectR img_ar, tTotal_objects.total_objects\n\t\t\t\tFROM featured_sets\n\t\t\t\t\n\t\t\t\tJOIN \n\t\t\t\t(SELECT set_id, count(*) total_objects\n\t\t\t\tFROM set_objs\n\t\t\t\tGROUP BY set_id) tTotal_objects\n\t\t\t\tON tTotal_objects.set_id = featured_sets.set_id\n\t\t\t\t\n\t\t\t\tORDER BY porder\n\t\t\t\t";
$res =& $db->query($sql);
if (PEAR::isError($res)) {
    die($res->getMessage());
}
// If nothing is found, send to object not found.
if ($res->numRows() < 1) {
    $t->assign('heading', "Error");
    $t->assign('message', "There are no featured sets!");
    $t->display('error.tpl');
    die;
}
$sets = array();
while ($row = $res->fetchRow()) {
    $imageOptions = array('img_path' => $row['img_path'], 'size' => 118, 'img_ar' => $row['img_ar'], 'linkURL' => $CFG->shortbase . "/set/" . $row['set_id'], 'vAlign' => "center", 'hAlign' => "left");
    $set = array('set_id' => $row['set_id'], 'set_name' => $row['name'], 'total_objects' => $row['total_objects'], 'thumb' => outputSimpleImage($imageOptions));
    array_push($sets, $set);
}
// Free the result
$res->free();
// Display template
$t->assign('sets', $sets);
// Display template
$t->display('frontpage/frontpage.tpl');
//Die here or additional PHP lines will be excecuted.
die;
Ejemplo n.º 2
0
$res =& $db->query($sql);
if (PEAR::isError($res)) {
    die($res->getMessage());
}
// If nothing is found...
if ($res->numRows() < 1) {
    $t->assign('setHasObjects', false);
    $t->assign('objectCount', null);
    $t->assign('objects', null);
    $t->assign('firstObjectID', null);
} else {
    $t->assign('setHasObjects', true);
    $objects = array();
    while ($row = $res->fetchRow()) {
        $imageOptions = array('img_path' => $row['img_path'], 'size' => 50, 'img_ar' => $row['img_ar'], 'vAlign' => "center", 'hAlign' => "left");
        $object = array('id' => $row['id'], 'name' => $row['name'], 'description' => $row['description'], 'thumb' => outputSimpleImage($imageOptions));
        array_push($objects, $object);
    }
    $t->assign('objectCount', $res->numRows());
    $t->assign('objects', $objects);
    $t->assign('firstObjectID', $objects[0]['id']);
}
$res->free();
/**********************************
DISPLAY TEMPLATE
***********************************/
$t->assign("templateVarsJSON", json_encode($t->_tpl_vars));
$t->display('viewset.tpl');
?>

Ejemplo n.º 3
0
// Query objects
$objResults = queryObjects($catIDs, $kwds, $tag, $user, $page - 1, $pageSize, $images);
// Get object thumbs
$objects = array();
if (empty($objResults['objects'])) {
    $t->assign('pager', "");
    $t->assign('results_total', 0);
    $t->assign('results_start', 0);
    $t->assign('results_end', 0);
    //if( $images )
    $t->assign('toggleImages', $images);
} else {
    foreach ($objResults['objects'] as $obj) {
        $obj['img_path'] ? $img_path = $obj['img_path'] : ($obj['img_path'] = "noObjectImage");
        $imageOptions = array('img_path' => $obj['img_path'], 'size' => 90, 'img_ar' => $obj['aspectRatio'], 'linkURL' => $CFG->shortbase . "/object/" . $obj['id'], 'vAlign' => "center", 'hAlign' => "center");
        $obj['thumb'] = outputSimpleImage($imageOptions);
        $objects[] = $obj;
    }
    $t->assign('pager', themePager($page, $objResults['nPages'], "cats=10004"));
    $t->assign('results_total', $objResults['nObjs']);
    $t->assign('results_start', $page * $objResults['pageSize'] - $objResults['pageSize'] + 1);
    $t->assign('results_end', $page * $objResults['pageSize'] <= $objResults['nObjs'] ? $page * $objResults['pageSize'] : $objResults['nObjs']);
    $t->assign('facets', queryResultsCategories($catIDs, $kwds, $tag, $user, $images, "HTML_UL_ATAG", "id_"));
    $t->assign('toggleImages', $images);
}
// print_r($objects);
$t->assign('objects', $objects);
$rawfilters = getFilters($kwds, $catIDs);
$tagname = $tag ? getTagNameByID($tag) : false;
$t->assign('filters', themeFilters($rawfilters, $tagname, $user));
$t->assign('page_title', filtersToNameList($rawfilters, $tagname) . ' - PAHMA Delphi Search Results');
Ejemplo n.º 4
0
     // If there are no more objects in the set, show the "no objects" image
     $imageOptions = array('img_path' => "noSetObjects", 'size' => 50, 'img_ar' => "1.065", 'linkURL' => $CFG->shortbase . "/set/" . $set_id, 'vAlign' => "center", 'hAlign' => "center");
     $response['updateThumb'] = true;
     $response['thumbDiv'] = outputSimpleImage($imageOptions);
     $response['set_id'] = $set_id;
 } elseif ($order == 1) {
     // If the removed object was first in the set, get the new set thumb
     $sql = "\tSELECT order_num, set_objs.set_id, objects.id, objects.img_path, objects.img_ar FROM set_objs\n\t\t\t\t\t\tJOIN objects\n\t\t\t\t\t\tON objects.id = set_objs.obj_id\n\t\t\t\t\t\tWHERE set_objs.order_num= 2 AND set_objs.set_id = {$set_id}\n\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t";
     $res =& $db->query($sql);
     if (PEAR::isError($res)) {
         die($res->getMessage());
     }
     while ($row = $res->fetchRow()) {
         $imageOptions = array('img_path' => $row['img_path'], 'size' => 50, 'img_ar' => $row['img_ar'], 'linkURL' => $CFG->shortbase . "/set/" . $row['set_id'], 'vAlign' => "center", 'hAlign' => "center");
         $response['updateThumb'] = true;
         $response['thumbDiv'] = outputSimpleImage($imageOptions);
         $response['set_id'] = $set_id;
     }
 } else {
     $response['updateThumb'] = false;
 }
 // If the order of the deleted object is less than the current number of objects in the set (plus 1)
 // then we need to update the order column for all the objects in the set between the object
 // ordered just after the deleted object through to the last object.
 if ($order < $count + 1) {
     // Get all the objects that need new orders
     $sql = "\tSELECT * FROM set_objs\n\t\t\t\t\t\tWHERE set_id = {$set_id} AND order_num > {$order}\n\t\t\t\t\t\tORDER BY order_num ASC\n\t\t\t\t\t";
     $res =& $db->query($sql);
     if (PEAR::isError($res)) {
         die($res->getMessage());
     }