Example #1
0
 protected function setUp()
 {
     parent::setUp();
     Category::add('collection');
     Page::addHomePage();
     PageTemplate::add('full', 'Full');
     PageType::add(array('handle' => 'basic', 'name' => 'Basic'));
 }
Example #2
0
 protected function setUp()
 {
     $this->tables = array_merge($this->tables, array('Files', 'FileVersions', 'Users', 'PermissionAccessEntityTypes', 'FileAttributeValues', 'FileImageThumbnailTypes', 'FilePermissionAssignments', 'AttributeKeyCategories', 'AttributeTypes', 'ConfigStore', 'AttributeKeys', 'AttributeValues', 'atNumber', 'Logs', 'FileVersionLog'));
     parent::setUp();
     Config::set('concrete.upload.extensions', '*.txt;*.jpg;*.jpeg;*.png');
     $category = Category::add('file');
     $number = AttributeType::add('number', 'Number');
     FileKey::add($number, array('akHandle' => 'width', 'akName' => 'Width'));
     FileKey::add($number, array('akHandle' => 'height', 'akName' => 'Height'));
     CacheLocal::flush();
 }
 protected function setUp()
 {
     $this->tables = array_merge($this->tables, array('Files', 'FileVersions', 'Users', 'PermissionAccessEntityTypes', 'FileAttributeValues', 'FileImageThumbnailTypes', 'FilePermissionAssignments', 'AttributeKeyCategories', 'AttributeTypes', 'ConfigStore', 'AttributeKeys', 'SystemContentEditorSnippets', 'AttributeValues', 'atNumber', 'FileVersionLog'));
     parent::setUp();
     define('UPLOAD_FILE_EXTENSIONS_ALLOWED', '*.txt;*.jpg;*.jpeg;*.png');
     Category::add('file');
     $number = AttributeType::add('number', 'Number');
     FileKey::add($number, array('akHandle' => 'width', 'akName' => 'Width'));
     FileKey::add($number, array('akHandle' => 'height', 'akName' => 'Height'));
     CacheLocal::flush();
 }
 public function import(\SimpleXMLElement $sx)
 {
     if (isset($sx->attributecategories)) {
         foreach ($sx->attributecategories->category as $akc) {
             $pkg = static::getPackageObject($akc['package']);
             $akx = \Concrete\Core\Attribute\Key\Category::getByHandle($akc['handle']);
             if (!is_object($akx)) {
                 $akx = \Concrete\Core\Attribute\Key\Category::add((string) $akc['handle'], (string) $akc['allow-sets'], $pkg);
             }
         }
     }
 }
 public function execute(Batch $batch)
 {
     $categories = $batch->getObjectCollection('attribute_key_category');
     if (!$categories) {
         return;
     }
     foreach ($categories->getCategories() as $category) {
         if (!$category->getPublisherValidator()->skipItem()) {
             $pkg = null;
             if ($category->getPackage()) {
                 $pkg = \Package::getByHandle($category->getPackage());
             }
             Category::add($category->getHandle(), $category->getAllowSets(), $pkg);
         }
     }
 }
Example #6
0
 protected function setUp()
 {
     $this->tables = array_merge($this->tables, array('Files', 'FileVersions', 'Users', 'PermissionAccessEntityTypes', 'FileAttributeValues', 'AttributeKeyCategories', 'AttributeSetKeys', 'Packages', 'AttributeSets', 'FileImageThumbnailTypes', 'AttributeTypes', 'ConfigStore', 'AttributeKeys', 'AttributeValues', 'FileSets', 'atNumber', 'FileVersionLog', 'FileSetFiles'));
     parent::setUp();
     \Config::set('concrete.upload.extensions', '*.txt;*.jpg;*.jpeg;*.png');
     Category::add('file');
     \Concrete\Core\Permission\Access\Entity\Type::add('file_uploader', 'File Uploader');
     $number = AttributeType::add('number', 'Number');
     FileKey::add($number, array('akHandle' => 'width', 'akName' => 'Width'));
     FileKey::add($number, array('akHandle' => 'height', 'akName' => 'Height'));
     mkdir($this->getStorageDirectory());
     $this->getStorageLocation();
     $sample = dirname(__FILE__) . '/StorageLocation/fixtures/sample.txt';
     $image = DIR_BASE . '/concrete/images/logo.png';
     $fi = new Importer();
     $files = array('sample1.txt' => $sample, 'sample2.txt' => $sample, 'sample4.txt' => $sample, 'sample5.txt' => $sample, 'awesome.txt' => $sample, 'testing.txt' => $sample, 'logo1.png' => $image, 'logo2.png' => $image, 'logo3.png' => $image, 'foobley.png' => $image, 'test.png' => $image);
     foreach ($files as $filename => $pointer) {
         $fi->import($pointer, $filename);
     }
     $this->list = new \Concrete\Core\File\FileList();
     $this->list->ignorePermissions();
 }
 protected function installAttributeCategoryAndObject()
 {
     $this->category = Category::add('collection');
     $this->object = Page::addHomePage();
 }
Example #8
0
 public function install()
 {
     $pkg = parent::install();
     //install our dashboard singlepages
     SinglePage::add('/dashboard/store/', $pkg);
     SinglePage::add('/dashboard/store/orders/', $pkg);
     SinglePage::add('/dashboard/store/products/', $pkg);
     SinglePage::add('/dashboard/store/products/attributes', $pkg);
     SinglePage::add('/dashboard/store/settings/', $pkg);
     //install our cart/checkout pages
     SinglePage::add('/cart/', $pkg);
     SinglePage::add('/checkout/', $pkg);
     SinglePage::add('/checkout/complete', $pkg);
     Page::getByPath('/cart/')->setAttribute('exclude_nav', 1);
     Page::getByPath('/checkout/')->setAttribute('exclude_nav', 1);
     Page::getByPath('/checkout/complete')->setAttribute('exclude_nav', 1);
     //install a default page to pushlish products under
     $productParentPage = Page::getByPath('/product-detail');
     if ($productParentPage->isError()) {
         $productParentPage = Page::getByID(1)->add(PageType::getByHandle('page'), array('cName' => t('Product Detail'), 'cHandle' => 'product-detail', 'pkgID' => $pkg->pkgID), PageTemplate::getByHandle('full'));
     }
     Page::getByPath('/product-detail')->setAttribute('exclude_nav', 1);
     $this->installStoreProductPageType($pkg);
     Config::save('vividstore.productPublishTarget', $productParentPage->getCollectionID());
     //install our blocks
     BlockTypeSet::add("vivid_store", "Store", $pkg);
     BlockType::installBlockTypeFromPackage('vivid_product_list', $pkg);
     BlockType::installBlockTypeFromPackage('vivid_utility_links', $pkg);
     BlockType::installBlockTypeFromPackage('vivid_product', $pkg);
     //install some default blocks for page type.
     $pageType = PageType::getByHandle('store_product');
     $template = $pageType->getPageTypeDefaultPageTemplateObject();
     $pageObj = $pageType->getPageTypePageTemplateDefaultPageObject($template);
     $bt = BlockType::getByHandle('vivid_product');
     $blocks = $pageObj->getBlocks('Main');
     if (count($blocks) < 1) {
         $data = array('productLocation' => 'page', 'showProductName' => 1, 'showProductDescription' => 1, 'showProductDetails' => 1, 'showProductPrice' => 1, 'showImage' => 1, 'showCartButton' => 1, 'showGroups' => 1);
         $pageObj->addBlock($bt, 'Main', $data);
     }
     //set our default currency configs
     Config::save('vividstore.symbol', '$');
     Config::save('vividstore.whole', '.');
     Config::save('vividstore.thousand', ',');
     //set defaults for shipping
     Config::save('vividstore.sizeUnit', 'in');
     Config::save('vividstore.weightUnit', 'l');
     //tax label
     $pkg->getconfig()->save('vividstore.taxName', t('Tax'));
     //user attributes for customers
     $uakc = AttributeKeyCategory::getByHandle('user');
     $uakc->setAllowAttributeSets(AttributeKeyCategory::ASET_ALLOW_MULTIPLE);
     //define attr group, and the different attribute types we'll use
     $custSet = $uakc->addSet('customer_info', t('Store Customer Info'), $pkg);
     $text = AttributeType::getByHandle('text');
     $address = AttributeType::getByHandle('address');
     //email
     $bFirstname = UserAttributeKey::getByHandle('email');
     if (!is_object($bFirstname)) {
         UserAttributeKey::add($text, array('akHandle' => 'email', 'akName' => t('Email'), 'akIsSearchable' => false, 'uakProfileEdit' => true, 'uakProfileEditRequired' => false, 'uakRegisterEdit' => false, 'uakProfileEditRequired' => false, 'akCheckedByDefault' => true, 'displayOrder' => '1'), $pkg)->setAttributeSet($custSet);
     }
     //billing first name
     $bFirstname = UserAttributeKey::getByHandle('billing_first_name');
     if (!is_object($bFirstname)) {
         UserAttributeKey::add($text, array('akHandle' => 'billing_first_name', 'akName' => t('Billing First Name'), 'akIsSearchable' => false, 'uakProfileEdit' => true, 'uakProfileEditRequired' => false, 'uakRegisterEdit' => false, 'uakProfileEditRequired' => false, 'akCheckedByDefault' => true, 'displayOrder' => '1'), $pkg)->setAttributeSet($custSet);
     }
     //billing last name
     $bLastname = UserAttributeKey::getByHandle('billing_last_name');
     if (!is_object($bLastname)) {
         UserAttributeKey::add($text, array('akHandle' => 'billing_last_name', 'akName' => t('Billing Last Name'), 'akIsSearchable' => false, 'uakProfileEdit' => true, 'uakProfileEditRequired' => false, 'uakRegisterEdit' => false, 'uakProfileEditRequired' => false, 'akCheckedByDefault' => true, 'displayOrder' => '2'), $pkg)->setAttributeSet($custSet);
     }
     //billing address
     $bAddress = UserAttributeKey::getByHandle('billing_address');
     if (!is_object($bAddress)) {
         UserAttributeKey::add($address, array('akHandle' => 'billing_address', 'akName' => t('Billing Address'), 'akIsSearchable' => false, 'uakProfileEdit' => true, 'uakProfileEditRequired' => false, 'uakRegisterEdit' => false, 'uakProfileEditRequired' => false, 'akCheckedByDefault' => true, 'displayOrder' => '3'), $pkg)->setAttributeSet($custSet);
     }
     //billing Phone
     $bPhone = UserAttributeKey::getByHandle('billing_phone');
     if (!is_object($bPhone)) {
         UserAttributeKey::add($text, array('akHandle' => 'billing_phone', 'akName' => t('Billing Phone'), 'akIsSearchable' => false, 'uakProfileEdit' => true, 'uakProfileEditRequired' => false, 'uakRegisterEdit' => false, 'uakProfileEditRequired' => false, 'akCheckedByDefault' => true, 'displayOrder' => '4'), $pkg)->setAttributeSet($custSet);
     }
     //shipping first name
     $sFirstname = UserAttributeKey::getByHandle('shipping_first_name');
     if (!is_object($sFirstname)) {
         UserAttributeKey::add($text, array('akHandle' => 'shipping_first_name', 'akName' => t('Shipping First Name'), 'akIsSearchable' => false, 'uakProfileEdit' => true, 'uakProfileEditRequired' => false, 'uakRegisterEdit' => false, 'uakProfileEditRequired' => false, 'akCheckedByDefault' => true, 'displayOrder' => '1'), $pkg)->setAttributeSet($custSet);
     }
     //shipping last name
     $bLastname = UserAttributeKey::getByHandle('shipping_last_name');
     if (!is_object($bLastname)) {
         UserAttributeKey::add($text, array('akHandle' => 'shipping_last_name', 'akName' => t('Shipping Last Name'), 'akIsSearchable' => false, 'uakProfileEdit' => true, 'uakProfileEditRequired' => false, 'uakRegisterEdit' => false, 'uakProfileEditRequired' => false, 'akCheckedByDefault' => true, 'displayOrder' => '2'), $pkg)->setAttributeSet($custSet);
     }
     //shipping address
     $sAddress = UserAttributeKey::getByHandle('shipping_address');
     if (!is_object($sAddress)) {
         UserAttributeKey::add($address, array('akHandle' => 'shipping_address', 'akName' => t('Shipping Address'), 'akIsSearchable' => false, 'uakProfileEdit' => true, 'uakProfileEditRequired' => false, 'uakRegisterEdit' => false, 'uakProfileEditRequired' => false, 'akCheckedByDefault' => true, 'displayOrder' => '3'), $pkg)->setAttributeSet($custSet);
     }
     //create user group
     $group = Group::getByName('Store Customer');
     if (!$group || $group->getGroupID() < 1) {
         $group = Group::add('Store Customer', t('Registered Customer in your store'));
     }
     //create custom attribute category for orders
     $oakc = AttributeKeyCategory::getByHandle('store_order');
     if (!is_object($oakc)) {
         $oakc = AttributeKeyCategory::add('store_order', AttributeKeyCategory::ASET_ALLOW_SINGLE, $pkg);
         $oakc->associateAttributeKeyType(AttributeType::getByHandle('text'));
         $oakc->associateAttributeKeyType(AttributeType::getByHandle('textarea'));
         $oakc->associateAttributeKeyType(AttributeType::getByHandle('number'));
         $oakc->associateAttributeKeyType(AttributeType::getByHandle('address'));
         $oakc->associateAttributeKeyType(AttributeType::getByHandle('boolean'));
         $oakc->associateAttributeKeyType(AttributeType::getByHandle('date_time'));
         $orderCustSet = $oakc->addSet('order_customer', t('Store Customer Info'), $pkg);
     }
     $email = StoreOrderKey::getByHandle('email');
     if (!is_object($email)) {
         StoreOrderKey::add($text, array('akHandle' => 'email', 'akName' => t('Email')), $pkg)->setAttributeSet($orderCustSet);
     }
     $bFirstname = StoreOrderKey::getByHandle('billing_first_name');
     if (!is_object($bFirstname)) {
         StoreOrderKey::add($text, array('akHandle' => 'billing_first_name', 'akName' => t('Billing First Name')), $pkg)->setAttributeSet($orderCustSet);
     }
     $bLastname = StoreOrderKey::getByHandle('billing_last_name');
     if (!is_object($bLastname)) {
         StoreOrderKey::add($text, array('akHandle' => 'billing_last_name', 'akName' => t('Billing Last Name')), $pkg)->setAttributeSet($orderCustSet);
     }
     $bAddress = StoreOrderKey::getByHandle('billing_address');
     if (!is_object($bAddress)) {
         StoreOrderKey::add($address, array('akHandle' => 'billing_address', 'akName' => t('Billing Address')), $pkg)->setAttributeSet($orderCustSet);
     }
     $bPhone = StoreOrderKey::getByHandle('billing_phone');
     if (!is_object($bPhone)) {
         StoreOrderKey::add($text, array('akHandle' => 'billing_phone', 'akName' => t('Billing Phone')), $pkg)->setAttributeSet($orderCustSet);
     }
     $sFirstname = StoreOrderKey::getByHandle('shipping_first_name');
     if (!is_object($sFirstname)) {
         StoreOrderKey::add($text, array('akHandle' => 'shipping_first_name', 'akName' => t('Shipping First Name')), $pkg)->setAttributeSet($orderCustSet);
     }
     $sLastname = StoreOrderKey::getByHandle('shipping_last_name');
     if (!is_object($sLastname)) {
         StoreOrderKey::add($text, array('akHandle' => 'shipping_last_name', 'akName' => t('Shipping Last Name')), $pkg)->setAttributeSet($orderCustSet);
     }
     $sAddress = StoreOrderKey::getByHandle('shipping_address');
     if (!is_object($sAddress)) {
         StoreOrderKey::add($address, array('akHandle' => 'shipping_address', 'akName' => t('Shipping Address')), $pkg)->setAttributeSet($orderCustSet);
     }
     //create custom attribute category for products
     $pakc = AttributeKeyCategory::getByHandle('store_product');
     if (!is_object($pakc)) {
         $pakc = AttributeKeyCategory::add('store_product', AttributeKeyCategory::ASET_ALLOW_SINGLE, $pkg);
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('text'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('textarea'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('number'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('address'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('boolean'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('date_time'));
     }
     //install payment gateways
     PaymentMethod::add('auth_net', 'Authorize .NET', $pkg);
     PaymentMethod::add('invoice', 'Invoice', $pkg, null, true);
     PaymentMethod::add('paypal_standard', 'PayPal', $pkg);
     //create fileset to place digital downloads
     $fs = FileSet::getByName('Digital Downloads');
     if (!is_object($fs)) {
         FileSet::add("Digital Downloads");
     }
     Installer::addOrderStatusesToDatabase($pkg);
     Config::save('vividstore.cartOverlay', false);
 }
 public function setUp()
 {
     parent::setUp();
     Category::add('user');
 }
Example #10
0
 public static function installProductAttributes(Package $pkg)
 {
     //create custom attribute category for products
     $pakc = AttributeKeyCategory::getByHandle('store_product');
     if (!is_object($pakc)) {
         $pakc = AttributeKeyCategory::add('store_product', AttributeKeyCategory::ASET_ALLOW_SINGLE, $pkg);
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('text'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('textarea'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('number'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('address'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('boolean'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('date_time'));
     }
 }
 protected function installSite()
 {
     $this->output(t('Installing Site object...'));
     /**
      * @var $service Service
      */
     $service = \Core::make('site');
     $site = $service->getDefault();
     $em = $this->connection->getEntityManager();
     $type_service = \Core::make('site/type');
     $type = $type_service->getDefault();
     if (!is_object($type)) {
         $type = $type_service->installDefault();
     }
     if (!is_object($site) || $site->getSiteID() < 1) {
         $locale = 'en_US';
         if (\Config::get('concrete.multilingual.default_locale')) {
             $locale = \Config::get('concrete.multilingual.default_locale');
         }
         $site = $service->installDefault($locale);
         // migrate name
         $site->setSiteName(\Config::get('concrete.site'));
         // migrate theme
         $c = \Page::getByID(HOME_CID);
         $site->setThemeID($c->getCollectionThemeID());
         $em->persist($site);
         $em->flush();
     }
     $site = $service->getDefault();
     $this->connection->executeQuery('update Pages set siteTreeID = ? where cIsSystemPage = 0', [$site->getSiteTreeID()]);
     $this->connection->executeQuery('update Stacks set siteTreeID = ?', [$site->getSiteTreeID()]);
     $this->connection->executeQuery('update PageTypes set siteTypeID = ? where ptIsInternal = 0', [$type->getSiteTypeID()]);
     // migrate social links
     $links = $em->getRepository('Concrete\\Core\\Entity\\Sharing\\SocialNetwork\\Link')->findAll();
     foreach ($links as $link) {
         $link->setSite($site);
         $em->persist($link);
     }
     $em->flush();
     $category = Category::getByHandle('site');
     if (!is_object($category)) {
         $category = Category::add('site');
     } else {
         $category = $category->getController();
     }
     $types = Type::getList();
     foreach ($types as $type) {
         $category->associateAttributeKeyType($type);
     }
     $siteConfig = $site->getConfigRepository();
     // migrate bookmark icons
     $favicon_fid = \Config::get('concrete.misc.favicon_fid');
     if ($favicon_fid) {
         $siteConfig->save('misc.favicon_fid', $favicon_fid);
     }
     $iphone_home_screen_thumbnail_fid = \Config::get('concrete.misc.iphone_home_screen_thumbnail_fid');
     if ($iphone_home_screen_thumbnail_fid) {
         $siteConfig->save('misc.iphone_home_screen_thumbnail_fid', $iphone_home_screen_thumbnail_fid);
     }
     $modern_tile_thumbnail_fid = \Config::get('concrete.misc.modern_tile_thumbnail_fid');
     if ($modern_tile_thumbnail_fid) {
         $siteConfig->save('misc.modern_tile_thumbnail_fid', $modern_tile_thumbnail_fid);
     }
     $modern_tile_thumbnail_bgcolor = \Config::get('concrete.misc.modern_tile_thumbnail_bgcolor');
     if ($modern_tile_thumbnail_bgcolor) {
         $siteConfig->save('misc.modern_tile_thumbnail_bgcolor', $modern_tile_thumbnail_bgcolor);
     }
     // migrate url
     $canonical_url = \Config::get('seo.canonical_url');
     if ($canonical_url) {
         $siteConfig->save('seo.canonical_url', $canonical_url);
     }
     $canonical_ssl_url = \Config::get('seo.canonical_ssl_url');
     if ($canonical_ssl_url) {
         $siteConfig->save('seo.canonical_ssl_url', $canonical_ssl_url);
     }
     // migrate tracking code
     $header = \Config::get('seo.tracking.code.header');
     if ($header) {
         $siteConfig->save('seo.tracking.code.header', $header);
     }
     $footer = \Config::get('seo.tracking.code.footer');
     if ($footer) {
         $siteConfig->save('seo.tracking.code.footer', $footer);
     }
     // migrate public profiles
     $r = \Config::get('concrete.user.profiles_enabled');
     if ($r) {
         $siteConfig->save('user.profiles_enabled', $r);
     }
     $r = \Config::get('concrete.user.gravatar.enabled');
     if ($r) {
         $siteConfig->save('user.gravatar.enabled', $r);
     }
     $r = \Config::get('concrete.user.gravatar.max_level');
     if ($r) {
         $siteConfig->save('user.gravatar.max_level', $r);
     }
     $r = \Config::get('concrete.user.gravatar.image_set');
     if ($r) {
         $siteConfig->save('user.gravatar.image_set', $r);
     }
 }
Example #12
0
 protected function importAttributeCategories(\SimpleXMLElement $sx)
 {
     if (isset($sx->attributecategories)) {
         foreach ($sx->attributecategories->category as $akc) {
             $pkg = static::getPackageObject($akc['package']);
             $akx = AttributeKeyCategory::getByHandle($akc['handle']);
             if (!is_object($akx)) {
                 $akx = AttributeKeyCategory::add($akc['handle'], $akc['allow-sets'], $pkg);
             }
         }
     }
 }
Example #13
0
 protected function setUp()
 {
     parent::setUp();
     Category::add('user');
 }