Beispiel #1
0
 private function delete()
 {
     $export = new MdExport($usr);
     $data = $export->getData(array($this->params['QSTR']));
     //TODO zaznamy apod ...
     $c = new MdImport();
     $result = $c->dataToMd($data, 'delete');
     if ($this->params['DEBUG'] == 1) {
         var_dump($result);
     }
     return $result;
 }
Beispiel #2
0
/**
 * Funkce pro hledání a obsluhu $_SESSION['micka']['search']
 * starý způsob, používá už pouze ak=md_search
 *
 * @link       http://www.bnhelp.cz
 * @package    Micka
 * @category   Metadata
 * @version    20140530
 * @authors		 DZ
 */
function getFoundsRecords($post, $user)
{
    // ošetření vstupu XSS
    if (is_array($post)) {
        foreach ($post as $key => $value) {
            $post[$key] = htmlspecialchars($value);
        }
    }
    $rs = array();
    $rs['paginator']['records'] = 0;
    $restore = FALSE;
    // zjišťuje současný stav	hledání podle session a jeho zobrazení
    $exist_where = FALSE;
    $page_number = '';
    $form_view = -1;
    $export = FALSE;
    // řazení výsledku
    if (isset($post['sort0']) && isset($post['sort1'])) {
        setSortBy(trim($post['sort0']) . ',' . trim($post['sort1']));
    }
    // kontrola módů hledání
    if (isset($post['mode']) && ($post['mode'] == 'normal' || $post['mode'] == 'myrecords')) {
        $_SESSION['micka']['search']['mode'] = $post['mode'];
    } elseif (isset($post['mode']) && $post['mode'] == 'master') {
        $_SESSION['micka']['search']['mode'] = $post['mode'];
    } else {
        // nepodporovaný mód, vrátí nenalezeno
        if ($_SESSION['micka']['search']['mode'] == '') {
            return $rs;
        } else {
            $restore = TRUE;
        }
    }
    if (isset($_SESSION['micka']['search']['where']) && $_SESSION['micka']['search']['where'] != '') {
        $exist_where = true;
    }
    if ($_SESSION['micka']['search']['mode'] == 'master') {
        $fc = isset($post['fc']) ? $post['fc'] : '';
        // feature katalog
        $form_view = isset($post['fv']) ? $post['fv'] : '';
        // prvotní zobrazení, pokud nezadáno tak se hledá, jinak se jen zobrazí formulář
        if ($form_view == '') {
            $form_view = -1;
        } else {
            $form_view = 1;
        }
    }
    if ($restore) {
        if ($_SESSION['micka']['search']['mode'] == 'master') {
            $page_number = isset($_SESSION['micka']['search_m']['page']) ? $_SESSION['micka']['search_m']['page'] : 1;
        } else {
            $page_number = isset($_SESSION['micka']['search']['page']) ? $_SESSION['micka']['search']['page'] : 1;
        }
    } else {
        if (isset($post['pg'])) {
            $page_number = $post['pg'];
        }
    }
    if ($page_number == '') {
        $page_number = 1;
        setSessionMickaSearch($post);
    }
    // sestaveni dotazu pro hledani
    if ($_SESSION['micka']['search']['mode'] == 'myrecords') {
        $select_all = getSearchUser($user);
        $export = TRUE;
    } else {
        if ($_SESSION['micka']['search']['mode'] == 'normal' && $exist_where == FALSE) {
            $select_all = getSearchArrayNormal();
        } elseif ($form_view == -1 && $_SESSION['micka']['search']['mode'] == 'master') {
            $select_all = getSearchArrayMaster($fc);
        }
        if ($_SESSION['micka']['search']['mode'] == 'normal' && $exist_where === TRUE) {
            $select_all = $_SESSION['micka']['search']['where'];
            $page_number = 1;
            $export = TRUE;
        } elseif ($form_view == -1 && $_SESSION['micka']['search']['mode'] == 'master' || $_SESSION['micka']['search']['mode'] == 'normal') {
            $export = TRUE;
        }
    }
    if ($export) {
        // získání dat
        require_once PHPPRG_DIR . '/MdExport.php';
        $ofs = ($page_number - 1) * MAXRECORDS;
        if ($ofs > 0) {
            $ofs++;
        }
        $data = new MdExport(MICKA_USER, $ofs, MAXRECORDS, getSortBy($in = '', $ret = 'string'));
        $data->page_number = $page_number;
        $data->only_public = FALSE;
        $data->xml_from = 'summary';
        $rs = $data->getData($select_all);
        if ($rs['paginator']['records'] > 0) {
            // ulozeni stranky pro navrat pri editaci
            if (isset($_SESSION['micka']['search']['mode']) && $_SESSION['micka']['search']['mode'] == 'master') {
                $_SESSION['micka']['search_m']['page'] = $page_number;
            } else {
                $_SESSION['micka']['search']['page'] = $page_number;
            }
        }
    }
    //$rs['data']
    //$rs['paginator']
    //$rs['akce']
    return $rs;
}