public function __construct($tableName, $fieldset, $whereCondition, $method = 'post', $debug = false)
 {
     parent::rex_form($tableName, $fieldset, $whereCondition, $method, $debug);
     if (OOAddon::isAvailable('metainfo')) {
         require_once rex_path::addon('metainfo', 'extensions/extension_art_metainfo.inc.php');
         $this->sqlFields = _rex_a62_metainfo_sqlfields(global_settings_metainfo::PREFIX, '');
     }
 }
Beispiel #2
0
 public function __construct($tableName, $fieldset, $whereCondition, $method = 'post', $debug = false)
 {
     parent::rex_form($tableName, $fieldset, $whereCondition, $method, $debug);
     if (OOAddon::isAvailable('metainfo')) {
         require_once rex_path::addon('metainfo', 'extensions/extension_art_metainfo.inc.php');
         $sqlCols = rex_asd_news_config::getConfig('sql');
         $this->sqlFields = _rex_a62_metainfo_sqlfields('asd_', 'AND (`p`.`restrictions` = "" OR p.`restrictions` LIKE "%|' . $this->getValue($sqlCols['category']) . '|%") ');
     }
 }
function rex_a62_metainfo_button($params)
{
    global $REX, $I18N;
    $s = '';
    $restrictionsCondition = '';
    if (isset($params['id']) && $params['id'] != '') {
        $OOCat = OOCategory::getCategoryById($params['id']);
        // Alle Metafelder des Pfades sind erlaubt
        foreach (explode('|', $OOCat->getPath()) as $pathElement) {
            if ($pathElement != '') {
                $s .= ' OR `p`.`restrictions` LIKE "%|' . $pathElement . '|%"';
            }
        }
        // Auch die Kategorie selbst kann Metafelder haben
        $s .= ' OR `p`.`restrictions` LIKE "%|' . $params['id'] . '|%"';
    }
    $restrictionsCondition = 'AND (`p`.`restrictions` = ""' . $s . ')';
    $fields = _rex_a62_metainfo_sqlfields('cat_', $restrictionsCondition);
    if ($fields->getRows() >= 1) {
        $return = '<p class="rex-button-add"><script type="text/javascript"><!--

    function rex_metainfo_toggle()
    {
        jQuery("#rex-form-structure-category .rex-metainfo-cat").toggle();
        metacat = jQuery("#rex-i-meta-category");
        if(metacat.hasClass("rex-i-generic-open"))
        {
            metacat.removeClass("rex-i-generic-open");
            metacat.addClass("rex-i-generic-close");
        }
        else
        {
            metacat.removeClass("rex-i-generic-close");
            metacat.addClass("rex-i-generic-open");
        }
    }

    //--></script><a id="rex-i-meta-category" class="rex-i-generic-open" href="javascript:rex_metainfo_toggle();">' . $I18N->msg('minfo_edit_metadata') . '</a></p>';
        return $params['subject'] . $return;
    }
    return $params['subject'];
}
/**
 * Erweitert das Meta-Formular um die neuen Meta-Felder
 *
 * @param string   $prefix       Feldprefix
 * @param string   $params       EP Params
 * @param callback $saveCallback Callback, dass die Daten speichert
 */
function _rex_a62_metainfo_form($prefix, $params, $saveCallback)
{
    // Beim ADD gibts noch kein activeItem
    $activeItem = null;
    if (isset($params['activeItem'])) {
        $activeItem = $params['activeItem'];
    }
    $restrictionsCondition = '';
    if ($prefix == 'art_') {
        if ($params['id'] != '') {
            $s = '';
            $OOArt = OOArticle::getArticleById($params['id'], $params['clang']);
            // Alle Metafelder des Pfades sind erlaubt
            foreach (explode('|', $OOArt->getPath()) as $pathElement) {
                if ($pathElement != '') {
                    $s .= ' OR `p`.`restrictions` LIKE "%|' . $pathElement . '|%"';
                }
            }
            $restrictionsCondition = 'AND (`p`.`restrictions` = ""' . $s . ')';
        }
    } elseif ($prefix == 'cat_') {
        $s = '';
        if ($params['id'] != '') {
            $OOCat = OOCategory::getCategoryById($params['id'], $params['clang']);
            // Alle Metafelder des Pfades sind erlaubt
            foreach (explode('|', $OOCat->getPath()) as $pathElement) {
                if ($pathElement != '') {
                    $s .= ' OR `p`.`restrictions` LIKE "%|' . $pathElement . '|%"';
                }
            }
            // Auch die Kategorie selbst kann Metafelder haben
            $s .= ' OR `p`.`restrictions` LIKE "%|' . $params['id'] . '|%"';
        }
        $restrictionsCondition = 'AND (`p`.`restrictions` = ""' . $s . ')';
    } elseif ($prefix == 'med_') {
        $catId = rex_session('media[rex_file_category]', 'int');
        if ($activeItem) {
            $catId = $activeItem->getValue('category_id');
        }
        if ($catId !== '') {
            $s = '';
            if ($catId != 0) {
                $OOCat = OOMediaCategory::getCategoryById($catId);
                // Alle Metafelder des Pfades sind erlaubt
                foreach (explode('|', $OOCat->getPath()) as $pathElement) {
                    if ($pathElement != '') {
                        $s .= ' OR `p`.`restrictions` LIKE "%|' . $pathElement . '|%"';
                    }
                }
            }
            // Auch die Kategorie selbst kann Metafelder haben
            $s .= ' OR `p`.`restrictions` LIKE "%|' . $catId . '|%"';
            $restrictionsCondition = 'AND (`p`.`restrictions` = ""' . $s . ')';
        }
    }
    $sqlFields = _rex_a62_metainfo_sqlfields($prefix, $restrictionsCondition);
    $params = rex_call_func($saveCallback, array($params, $sqlFields), false);
    return rex_a62_metaFields($sqlFields, $activeItem, 'rex_a62_metainfo_form_item', $params);
}