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();
 }
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();
 }
 public function skipItem()
 {
     $key = false;
     switch ($this->object->getCategory()) {
         case 'collection':
             $key = CollectionKey::getByHandle($this->object->getHandle());
             break;
         case 'file':
             $key = FileKey::getByHandle($this->object->getHandle());
             break;
         case 'user':
             $key = UserKey::getByHandle($this->object->getHandle());
             break;
     }
     return is_object($key);
 }
Example #4
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();
 }
 public function publish(AttributeKey $ak, Package $pkg = null)
 {
     $key = FileKey::add($ak->getType(), array('akHandle' => $ak->getHandle(), 'akName' => $ak->getName(), 'akIsInternal' => $ak->getIsInternal(), 'akIsSearchableIndexed' => $ak->getIsIndexed(), 'akIsSearchable' => $ak->getIsSearchable()), $pkg);
     return $key;
 }
Example #6
0
 /**
  * Necessary because getAttribute() returns the Value Value object, and this returns the
  * File Attribute Value object.
  *
  * @param $ak
  * @param $createIfNotExists bool
  *
  * @return mixed
  */
 public function getAttributeValueObject($ak, $createIfNotExists = false)
 {
     if (!is_object($ak)) {
         $ak = FileKey::getByHandle($ak);
     }
     $value = false;
     if (is_object($ak)) {
         $value = $this->getObjectAttributeCategory()->getAttributeValue($ak, $this);
     }
     if ($value) {
         return $value;
     } elseif ($createIfNotExists) {
         if (!is_object($ak)) {
             $ak = FileKey::getByHandle($ak);
         }
         $attributeValue = new FileValue();
         $attributeValue->setVersion($this);
         $attributeValue->setAttributeKey($ak);
         return $attributeValue;
     }
 }
Example #7
0
 public function setPropertiesFromArray($arr)
 {
     return parent::setPropertiesFromArray($arr);
 }
 private function addFileAttributeKeys($pkg)
 {
     $att = FileAttributeKey::getByHandle("db_table_demo");
     if (!$att) {
         FileAttributeKey::add('db_table_demo', array('akHandle' => 'db_table_demo', 'akName' => t('Database Table Tutorial Demo'), 'akIsSearchable' => true), $pkg);
     }
 }
Example #9
0
 public function delete($akID = null)
 {
     $key = FileKey::getByID($akID);
     $this->executeDelete($key, \URL::to('/dashboard/files/attributes', 'view'));
 }