function deleteMdValues($recno, $user, $params = array(), $harvest = FALSE) { if ($harvest === FALSE) { return TRUE; } $rs = FALSE; $sql = array(); $record = getMdHeader('recno', $recno, '', array('all', '=')); /* if (isset($record[0]['RECNO']) && $record[0]['RECNO'] > -1) { if (!getMdRight('view', $user, $record[0]['DATA_TYPE'], $record[0]['CREATE_USER'], $record[0]['EDIT_GROUP'], $record[0]['VIEW_GROUP'])) { return $rs; } } * */ array_push($sql, 'DELETE FROM md_values WHERE recno=%i', $recno); if (isset($params['lang']) && count($params['lang']) > 0) { array_push($sql, 'AND lang IN %in', $params['lang']); } $rs = _executeSql('delete', $sql, array()); return $rs; }
function getMdRecord($user, $uuid, $akce) { setMickaLog("user={$user}, uuid={$uuid}, akce={$akce}", 'DEBUG', 'MdDetail.getMdRecord.start'); $rs = array(); $rs['data'] = FALSE; $col = 'recno, uuid, md_standard, lang, data_type, create_user, edit_group, view_group, x1 ,x2, y1, y2, title, valid'; $record = getMdHeader('uuid', $uuid, $col, array('all', '=')); if (isset($record[0]['RECNO']) && $record[0]['RECNO'] > -1) { // autorizace if (!getMdRight('view', $user, $record[0]['DATA_TYPE'], $record[0]['CREATE_USER'], $record[0]['EDIT_GROUP'], $record[0]['VIEW_GROUP'])) { setMickaLog("Not right", 'ERROR', 'MdDetail.php (getMdRecord)'); return $rs; } $rs['head']['edit'] = 0; if (getMdRight('edit', $user, $record[0]['DATA_TYPE'], $record[0]['CREATE_USER'], $record[0]['EDIT_GROUP'], $record[0]['VIEW_GROUP']) === TRUE) { $rs['head']['edit'] = 1; } $this->mds = $record[0]['MD_STANDARD']; $rs['head']['recno'] = $record[0]['RECNO']; $rs['head']['mds'] = $record[0]['MD_STANDARD']; $rs['head']['uuid'] = $record[0]['UUID']; $rs['head']['title'] = $record[0]['TITLE']; $rs['head']['valid'] = $record[0]['VALID'] != '' ? $record[0]['VALID'] : ''; $rs['head']['x1'] = array_key_exists('X1', $record[0]) ? (string) str_replace(",", ".", $record[0]['X1']) : ''; $rs['head']['y1'] = array_key_exists('Y1', $record[0]) ? (string) str_replace(",", ".", $record[0]['Y1']) : ''; $rs['head']['x2'] = array_key_exists('X2', $record[0]) ? (string) str_replace(",", ".", $record[0]['X2']) : ''; $rs['head']['y2'] = array_key_exists('Y2', $record[0]) ? (string) str_replace(",", ".", $record[0]['Y2']) : ''; $rs['head']['hierarchy'] = ''; if ($akce == 'detail') { if ($record[0]['MD_STANDARD'] == 0 || $record[0]['MD_STANDARD'] == 10) { $rs['data'] = $this->getMdValuesMdId($record[0]['RECNO'], $record[0]['MD_STANDARD'], $this->getLangValue($record[0]['LANG'])); // Rodicovske zaznamy $master = isset($rs['data'][121][0]) ? $rs['data'][121][0] : ''; $rs['head']['master'] = $this->getMdMaster($master); // Je rodicem pro zaznamy $rs['head']['slave'] = $this->getMdSlave($record[0]['UUID']); $rs['head']['repre'] = $this->getSpatialRep($record[0]['RECNO']); } elseif ($record[0]['MD_STANDARD'] == 1) { $rs['data'] = $this->getMdValuesMdId($record[0]['RECNO'], $record[0]['MD_STANDARD'], $this->getLangValue($record[0]['LANG'])); } elseif ($record[0]['MD_STANDARD'] == 2) { //$pom = $this->getMdValuesMdId($record[0]['RECNO'], $record[0]['MD_STANDARD'], $this->getLangValue($record[0]['LANG']), 'no_lang'); $pom = getMdValues($record[0]['RECNO'], $record[0]['MD_STANDARD'], $this->getLangValue($record[0]['LANG']), 'no_lang'); if (isset($pom[0][0])) { $rs['data'] = $pom[0][0]; } } } elseif ($akce == 'detailall') { $rs['data'] = $this->getMdDetailView($record[0]['RECNO'], $record[0]['MD_STANDARD']); if ($record[0]['MD_STANDARD'] == 0 || $record[0]['MD_STANDARD'] == 10) { foreach ($rs['data'] as $value) { if ($value['id'] == 11 || $value['id'] == 5063) { $rs['head']['title'] = $value['hodnota']; break; } } } } } $rs['head']['hierarchy'] = $this->hierarchy; setMickaLog($rs, 'DEBUG', 'MdDetail.getMdRecord.return'); return $rs; }
function updateXml($user, $type, $value) { $rs = FALSE; $xsltemplate = 'micka2one19139.xsl'; $recno = -1; $uuid = ''; if ($type == 'uuid' && $value != '') { $uuid = $value; } elseif ($type == 'recno' && $value > -1) { $recno = $value; $uuid = getMdHeader($type, $value, 'uuid', array('single')); $type = 'uuid'; } if ($type == 'uuid' && $uuid != '') { $xml = getXml($user, $uuid, $xsltemplate, 'data'); if ($xml === FALSE || $xml == '') { setMickaLog('$xml === FALSE', 'ERROR', 'micka_lib_xml.php (updateXml)'); } else { $sql = array(); array_push($sql, "UPDATE md SET pxml=%s WHERE uuid=%s", $xml, $uuid); $rs = _executeSql('update', $sql, array('all')); } } return $rs; }