Ejemplo n.º 1
0
function getMdValues($recno, $mds, $micka_lang, $type_id = NULL, $id = NULL)
{
    if ($recno == '' || $mds == '' || $micka_lang == '') {
        return FALSE;
    }
    $rs = array();
    $sql = array();
    $mds_tmp = $mds;
    if ($mds == 10) {
        $mds_tmp = 0;
    }
    array_push($sql, "\n\t\tSELECT " . setNtext2Text('md_values.', 'md_value') . ",\n\t\t\t\t\tmd_values.md_id,\n\t\t\t\t\tmd_values.md_path,\n\t\t\t\t\tmd_values.lang,\n\t\t\t\t\telements.form_code,\n\t\t\t\t\telements.el_id,\n\t\t\t\t\telements.from_codelist\n\t\tFROM (elements RIGHT JOIN tree ON elements.el_id = tree.el_id) RIGHT JOIN md_values ON tree.md_id = md_values.md_id\n\t\tWHERE md_values.recno=%i AND tree.md_id=md_values.md_id AND tree.md_standard=%i\n\t", $recno, $mds_tmp);
    if ($micka_lang != 'xxx') {
        array_push($sql, "AND (md_values.lang='xxx' OR md_values.lang=%s)", $micka_lang);
    }
    if ($type_id == 'profil' && $id > 0) {
        array_push($sql, "AND md_id IN (SELECT md_id FROM profil WHERE profil_id=%i)", $id);
    }
    if ($type_id == 'package' && $id > 0) {
        array_push($sql, "AND md_values.package_id=%i)", $id);
    }
    array_push($sql, 'ORDER BY md_values.md_path, md_values.lang');
    $result = _executeSql('select', $sql, array('all'));
    if ($result !== FALSE) {
        if (count($result) > 0) {
            foreach ($result as $n => $row) {
                $value = $row['MD_VALUE'];
                if ($row['FORM_CODE'] == 'D' && $micka_lang == 'cze') {
                    $value = dateIso2Cz($value);
                }
                $md_path = getMdPath($row['MD_PATH']);
                if ($type_id == 'no_lang') {
                    $eval_text = '$rs' . $md_path . "=\"" . $value . "\";";
                } else {
                    $eval_text = '$rs' . $md_path . "['" . $row['LANG'] . "']" . "=\"" . $value . "\";";
                }
                eval($eval_text);
            }
        }
    }
    return $rs;
}
Ejemplo n.º 2
0
 private function getMdValuesMdId($recno, $mds, $lang_data)
 {
     $rs = FALSE;
     $sql = array();
     $value = '';
     if ($mds == 10) {
         $mds = 0;
     }
     array_push($sql, "\n\t\t\tSELECT " . setNtext2Text('md_values.', 'md_value') . ", md_values.md_path, md_values.lang, md_values.md_id, md_values.package_id, elements.form_code, elements.from_codelist\n\t\t\tFROM md INNER JOIN md_values ON (md.recno=md_values.recno) AND (md_values.recno=md.recno)\n\t\t\t\tINNER JOIN tree ON (md_values.md_id=tree.md_id)\n\t\t\t\tINNER JOIN elements ON (tree.el_id=elements.el_id)\n\t\t\tWHERE md_values.md_id>-1 AND tree.md_standard=%i AND md_values.recno=%i\n\t\t\t\tAND (md_values.lang='xxx' OR md_values.lang=%s)\n\t\t\tORDER BY md_values.md_path, md_values.lang\n\t\t", $mds, $recno, $lang_data);
     $result = _executeSql('select', $sql, array('all'));
     foreach ($result as $row) {
         $md_id = $row['MD_ID'];
         $value = $row['MD_VALUE'];
         switch ($row['FORM_CODE']) {
             case 'D':
                 if (MICKA_LANG == 'cze') {
                     $value = dateIso2Cz($value);
                 }
                 break;
             case 'C':
                 if (!$row['FROM_CODELIST'] == '') {
                     $el_id = $row['FROM_CODELIST'];
                 } else {
                     $el_id = $row['EL_ID'];
                 }
                 // hierarchy
                 if ($mds == 0 && $md_id == 623) {
                     $this->hierarchy = $value;
                 }
                 $value = getLabelCodeList($value, $el_id);
                 break;
             default:
         }
         if ($row['PACKAGE_ID'] == 7) {
             $label = '$rs' . getMdPath($row['MD_PATH']) . "='" . $value . "';";
             eval($label);
         }
         $rs[$md_id][] = $value;
     }
     return $rs;
 }
Ejemplo n.º 3
0
 private function getIsData($md_path)
 {
     $rs = FALSE;
     $path = getMdPath($md_path);
     $eval_label = '$rs=isset($this->form_values' . $path . ') ? TRUE : FALSE;';
     eval($eval_label);
     return $rs;
 }