Exemplo n.º 1
0
 private function _content_setCategoryRoot()
 {
     // load necessary classes
     $rootcat = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules/Global');
     if ($rootcat) {
         // create an entry in the categories registry
         $registry = new Categories_DBObject_Registry();
         $registry->setDataField('modname', 'Content');
         $registry->setDataField('table', 'content_page');
         $registry->setDataField('property', 'Main');
         $registry->setDataField('category_id', $rootcat['id']);
         $registry->insert();
     }
     return true;
 }
Exemplo n.º 2
0
 private function _createdefaultcategory($regpath = '/__SYSTEM__/Modules/Global')
 {
     // get the language
     $lang = ZLanguage::getLanguageCode();
     // get the category path for which we're going to insert our place holder category
     $rootcat = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules');
     $qCat = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules/Ephemerides');
     if (!$qCat) {
         // create placeholder for all our migrated categories
         $cat = new Categories_DBObject_Category();
         $cat->setDataField('parent_id', $rootcat['id']);
         $cat->setDataField('name', 'Ephemerides');
         $cat->setDataField('display_name', array($lang => $this->__('Ephemerides')));
         $cat->setDataField('display_desc', array($lang => $this->__('Ephemerides')));
         if (!$cat->validate('admin')) {
             return false;
         }
         $cat->insert();
         $cat->update();
     }
     // get the category path for which we're going to insert our upgraded categories
     $rootcat = CategoryUtil::getCategoryByPath($regpath);
     if ($rootcat) {
         // create an entry in the categories registry
         $registry = new Categories_DBObject_Registry();
         $registry->setDataField('modname', 'Ephemerides');
         $registry->setDataField('table', 'ephem');
         $registry->setDataField('property', 'Main');
         $registry->setDataField('category_id', $rootcat['id']);
         $registry->insert();
     } else {
         return false;
     }
     return true;
 }
Exemplo n.º 3
0
 function _addressbook_createdefaultcategory()
 {
     $dom = ZLanguage::getModuleDomain('AddressBook');
     // get the language file
     $lang = ZLanguage::getLanguageCode();
     // get the category path for which we're going to insert our place holder category
     $rootcat = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules');
     $adrCat = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules/AddressBook');
     if (!$adrCat) {
         $cat = new Categories_DBObject_Category();
         $cat->setDataField('parent_id', $rootcat['id']);
         $cat->setDataField('name', 'AddressBook');
         $cat->setDataField('display_name', array($lang => $this->__('AddressBook')));
         $cat->setDataField('display_desc', array($lang => $this->__('Adress administration.')));
         if (!$cat->validate('admin')) {
             return false;
         }
         $cat->insert();
         $cat->update();
     }
     // create the first 2 categories
     $adrCat = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules/AddressBook');
     $adrCat1 = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules/AddressBook/Business');
     if (!$adrCat1) {
         $cat = new Categories_DBObject_Category();
         $cat->setDataField('parent_id', $adrCat['id']);
         $cat->setDataField('name', 'Business');
         $cat->setDataField('is_leaf', 1);
         $cat->setDataField('display_name', array($lang => $this->__('Business')));
         $cat->setDataField('display_desc', array($lang => $this->__('Business')));
         if (!$cat->validate('admin')) {
             return false;
         }
         $cat->insert();
         $cat->update();
     }
     $adrCat2 = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules/AddressBook/Personal');
     if (!$adrCat2) {
         $cat = new Categories_DBObject_Category();
         $cat->setDataField('parent_id', $adrCat['id']);
         $cat->setDataField('name', 'Personal');
         $cat->setDataField('is_leaf', 1);
         $cat->setDataField('display_name', array($lang => $this->__('Personal')));
         $cat->setDataField('display_desc', array($lang => $this->__('Personal')));
         if (!$cat->validate('admin')) {
             return false;
         }
         $cat->insert();
         $cat->update();
     }
     if ($adrCat) {
         // place category registry entry for products (key == Products)
         $registry = new Categories_DBObject_Registry();
         $registry->setDataField('modname', 'AddressBook');
         $registry->setDataField('table', 'addressbook_address');
         $registry->setDataField('property', 'AddressBook');
         $registry->setDataField('category_id', $adrCat['id']);
         $registry->insert();
     }
     // now the old prefix field
     // get the category path for which we're going to insert our place holder form of address
     $rootcat = CategoryUtil::getCategoryByPath('/__SYSTEM__/General');
     $foaCat = CategoryUtil::getCategoryByPath('/__SYSTEM__/General/Form of address');
     if (!$foaCat) {
         $cat = new Categories_DBObject_Category();
         $cat->setDataField('parent_id', $rootcat['id']);
         $cat->setDataField('name', 'Form of address');
         $cat->setDataField('display_name', array($lang => $this->__('Form of address')));
         $cat->setDataField('display_desc', array($lang => $this->__('Form of address')));
         if (!$cat->validate('admin')) {
             return false;
         }
         $cat->insert();
         $cat->update();
     }
     // create the first 2 categories
     $foaCat = CategoryUtil::getCategoryByPath('/__SYSTEM__/General/Form of address');
     $foaCat1 = CategoryUtil::getCategoryByPath('/__SYSTEM__/General/Form of address/Mr');
     if (!$foaCat1) {
         $cat = new Categories_DBObject_Category();
         $cat->setDataField('parent_id', $foaCat['id']);
         $cat->setDataField('name', 'Mr');
         $cat->setDataField('is_leaf', 1);
         $cat->setDataField('display_name', array($lang => $this->__('Mr.')));
         $cat->setDataField('display_desc', array($lang => $this->__('Mr.')));
         if (!$cat->validate('admin')) {
             return false;
         }
         $cat->insert();
         $cat->update();
     }
     $foaCat2 = CategoryUtil::getCategoryByPath('/__SYSTEM__/General/Form of address/Mrs');
     if (!$foaCat2) {
         $cat = new Categories_DBObject_Category();
         $cat->setDataField('parent_id', $foaCat['id']);
         $cat->setDataField('name', 'Mrs');
         $cat->setDataField('is_leaf', 1);
         $cat->setDataField('display_name', array($lang => $this->__('Mrs.')));
         $cat->setDataField('display_desc', array($lang => $this->__('Mrs.')));
         if (!$cat->validate('admin')) {
             return false;
         }
         $cat->insert();
         $cat->update();
     }
     return true;
 }
Exemplo n.º 4
0
    /**
     * create placeholder for categories
     */
    private function _feeds_createdefaultcategory($regpath = '/__SYSTEM__/Modules/Global')
    {
        // load necessary classes
        Loader::loadClass('CategoryUtil');
        Loader::loadClassFromModule('Categories', 'Category');
        Loader::loadClassFromModule('Categories', 'CategoryRegistry');

        // get the language code
        $lang = ZLanguage::getLanguageCode();
        $dom  = ZLanguage::getModuleDomain('Feeds');

        // get the category path for which we're going to insert our place holder category
        $rootcat = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules');
        $fCat    = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules/Feeds');

        if (!$fCat) {
            // create placeholder for all the module categories
            $cat = new Categories_DBObject_Category();
            $cat->setDataField('parent_id', $rootcat['id']);
            $cat->setDataField('name', 'Feeds');
            $cat->setDataField('display_name', array($lang => __('Feeds', $dom)));
            $cat->setDataField('display_desc', array($lang => __('Feed Reader.', $dom)));
            if (!$cat->validate('admin')) {
                return false;
            }
            $cat->insert();
            $cat->update();
        }

        // get the category path for which the feeds will be classified
        $rootcat = CategoryUtil::getCategoryByPath($regpath);
        if ($rootcat) {
            // create an entry in the categories registry
            $registry = new Categories_DBObject_Registry();
            $registry->setDataField('modname', 'Feeds');
            $registry->setDataField('table', 'feeds');
            $registry->setDataField('property', 'Main');
            $registry->setDataField('category_id', $rootcat['id']);
            $registry->insert();
        } else {
            return false;
        }

        return true;
    }
Exemplo n.º 5
0
    /**
     * create the Topics category tree
     */
    private function _createtopicscategory($regpath = '/__SYSTEM__/Modules/Topics')
    {
        // get the language file
        $lang = ZLanguage::getLanguageCode();

        // get the category path for which we're going to insert our place holder category
        $rootcat = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules');

        // create placeholder for all the migrated topics
        $tCat    = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules/Topics');

        if (!$tCat) {
            // create placeholder for all our migrated categories
            $cat = new Categories_DBObject_Category();
            $cat->setDataField('parent_id', $rootcat['id']);
            $cat->setDataField('name', 'Topics');
            // pnModLangLoad doesn't handle type 1 modules
            //pnModLangLoad('Topics', 'version');
            $cat->setDataField('display_name', array($lang => $this->__('Topics')));
            $cat->setDataField('display_desc', array($lang => $this->__('Display and manage topics')));
            if (!$cat->validate('admin')) {
                return false;
            }
            $cat->insert();
            $cat->update();
        }

        // get the category path for which we're going to insert our upgraded News categories
        $rootcat = CategoryUtil::getCategoryByPath($regpath);
        if ($rootcat) {
            // create an entry in the categories registry to the Topic property
            $registry = new Categories_DBObject_Registry();
            $registry->setDataField('modname', 'News');
            $registry->setDataField('table', 'stories');
            $registry->setDataField('property', 'Topic');
            $registry->setDataField('category_id', $rootcat['id']);
            $registry->insert();
        } else {
            return false;
        }

        return true;
    }