示例#1
0
         $viewerdir = $dilpsdir . 'viewer' . DIRECTORY_SEPARATOR . 'windows' . DIRECTORY_SEPARATOR;
     }
     // copy viewer with PHP-functions
     $olddir = getcwd();
     chdir($viewerdir);
     $ret = copy_recursive('.', $exportdirlong . $user['login'] . DIRECTORY_SEPARATOR . $date . DIRECTORY_SEPARATOR);
     if (!$ret) {
         echo "Error copying viewer skeleton for current export\n<br>\n";
         echo "\n<br>\n";
         exit;
     }
     chdir($olddir);
 }
 // start reading actual data
 // $db->debug = true;
 $sql = "SELECT DISTINCT * FROM " . $db_prefix . "img, " . $db_prefix . "img_group, " . $db_prefix . "meta" . " WHERE " . $db_prefix . "img.collectionid = " . $db_prefix . "meta.collectionid" . " AND " . $db_prefix . "img.imageid = " . $db_prefix . "meta.imageid" . " AND " . $db_prefix . "img.collectionid = " . $db_prefix . "img_group.collectionid" . " AND " . $db_prefix . "img.imageid = " . $db_prefix . "img_group.imageid" . get_groupid_where_clause($groupid, $db, $db_prefix, $subgroups);
 $rs = $db->Execute($sql);
 // die ($sql);
 while (!$rs->EOF) {
     // print_r($rs->fields);
     $xmlout = "<?" . "xml version=\"1.0\" encoding=\"UTF-8\" ?" . ">\n";
     $xmlout .= "<imgdata>\n";
     $xmlout .= "<width>" . utf8_encode($rs->fields['width']) . "</width>\n";
     $xmlout .= "<height>" . utf8_encode($rs->fields['height']) . "</height>\n";
     $xmlout .= "<name>" . utf8_encode($rs->fields['name1']) . "</name>\n";
     $xmlout .= "<vorname>" . utf8_encode($rs->fields['name2']) . "</vorname>\n";
     $xmlout .= "<titel>" . utf8_encode($rs->fields['title']) . "</titel>\n";
     $xmlout .= "<datierung>" . utf8_encode($rs->fields['dating']) . "</datierung>\n";
     $xmlout .= "<material>" . utf8_encode($rs->fields['material']) . "</material>\n";
     $xmlout .= "<technik>" . utf8_encode($rs->fields['technique']) . "</technik>\n";
     $xmlout .= "<format>" . utf8_encode($rs->fields['format']) . "</format>\n";
示例#2
0
function query_local_collection_overview($query, $options, $db, $db_prefix)
{
    $querystruct = transform_query($query['querypiece']);
    $dbQuery = new dilpsQuery($db, $db_prefix);
    $fields = "1 as local, {$db_prefix}collection.collectionid, {$db_prefix}collection.name";
    $joinOn = $dbQuery->buildWhere($querystruct);
    $joinOn .= " and {$db_prefix}collection.collectionid = {$db_prefix}meta.collectionid ";
    $from = "{$db_prefix}collection left join {$db_prefix}meta  on {$joinOn}";
    $where = "{$db_prefix}collection.host = 'local'";
    if (!empty($query['groupid'])) {
        // add grouptable to query
        $fields .= ", sum(if(groupid, 1, 0)) as count";
        $from .= " LEFT JOIN {$db_prefix}img_group ON {$db_prefix}img_group.imageid = {$db_prefix}meta.imageid AND {$db_prefix}img_group.collectionid = {$db_prefix}meta.collectionid";
        $from .= get_groupid_where_clause($query, $db, $db_prefix);
    } else {
        $fields .= ", count({$db_prefix}meta.id) as count";
    }
    $sql = "SELECT DISTINCT {$fields} FROM {$from} WHERE {$where}" . " group by {$db_prefix}collection.collectionid, {$db_prefix}collection.name";
    //die($sql);
    $result = array();
    $rs = $db->GetAll($sql);
    if (!$rs) {
        if ($db->ErrorNo()) {
            $result['error'] = $db->ErrorMsg();
        } else {
            $result = array();
        }
    } else {
        $result = $rs;
    }
    return $result;
}
示例#3
0
function query_local_collection($query, $options, $db, $db_prefix)
{
    $querystruct = transform_query($query['querypiece']);
    // print_r($querystruct);
    $dbQuery = new dilpsQuery($db, $db_prefix);
    $where = $dbQuery->buildWhere($querystruct);
    $from = "{$db_prefix}meta LEFT JOIN {$db_prefix}archaeology ON {$db_prefix}archaeology.imageid = {$db_prefix}meta.imageid AND {$db_prefix}archaeology.collectionid = {$db_prefix}meta.collectionid LEFT JOIN {$db_prefix}architecture ON {$db_prefix}architecture.collectionid = {$db_prefix}meta.collectionid AND {$db_prefix}meta.imageid = {$db_prefix}architecture.imageid ";
    $fields = "{$db_prefix}meta.type as type,{$db_prefix}meta.collectionid as collectionid," . "{$db_prefix}meta.imageid as imageid,ifnull({$db_prefix}meta.name1, '') as name1,ifnull({$db_prefix}meta.name2, '') as name2," . "{$db_prefix}meta.addition as addition, {$db_prefix}meta.title as title, " . "{$db_prefix}meta.dating as dating, {$db_prefix}meta.literature as literature, " . "{$db_prefix}meta.location as location, " . "{$db_prefix}archaeology.category as category, " . "{$db_prefix}architecture.classification as classification";
    if (!empty($query['groupid'])) {
        // add grouptable to query
        $fields .= ", {$db_prefix}img_group.groupid as groupid";
        $from .= "LEFT JOIN {$db_prefix}img_group ON {$db_prefix}img_group.imageid = {$db_prefix}meta.imageid AND {$db_prefix}img_group.collectionid = {$db_prefix}meta.collectionid";
        $where .= get_groupid_where_clause($query, $db, $db_prefix);
    }
    $sql = "SELECT DISTINCT {$fields} FROM {$from} WHERE {$where}" . " ORDER BY insert_date DESC, imageid DESC";
    // die($sql);
    // $db->debug = true;
    $pagesize = $options['pagesize'];
    $page = $options['page'];
    $rs = $db->PageExecute($sql, $pagesize, $page);
    $result = array();
    if (!$rs) {
        $result['error'] = $db->ErrorMsg();
    } else {
        $result['lastpage'] = $rs->LastPageNo();
        $result['maxrecords'] = $rs->MaxRecordCount();
        $result['rs'] = array();
        while (!$rs->EOF) {
            array_walk($rs->fields, '__stripslashes');
            $result['rs'][] = $rs->fields;
            $rs->MoveNext();
        }
        $rs->Close();
        if ($page > $result['lastpage']) {
            $page = $result['lastpage'];
        }
        $result['page'] = $page;
        $result['pagesize'] = $pagesize;
    }
    return $result;
}