当前位置: 首页>>代码示例>>PHP>>正文


PHP FileSet::getByName方法代码示例

本文整理汇总了PHP中FileSet::getByName方法的典型用法代码示例。如果您正苦于以下问题:PHP FileSet::getByName方法的具体用法?PHP FileSet::getByName怎么用?PHP FileSet::getByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileSet的用法示例。


在下文中一共展示了FileSet::getByName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: on_start

 public function on_start()
 {
     Events::extend('on_file_add', function ($f, $fv) {
         $setless_fs = FileSet::getByName('Setless');
         $setless_fs->addFileToSet($f);
     });
     Events::extend('on_file_added_to_set', function ($fID, $fv) {
         $setless_fs = FileSet::getByName('Setless');
         $file = File::getByID($fID);
         $file_sets = $file->getFileSets();
         $file_set_ids = array();
         foreach ($file_sets as $file_set) {
             $file_set_ids[] = $file_set->fsID;
         }
         // If file is in multiple sets and setless is one of them, remove from setless
         if (count($file_set_ids) >= 2 && in_array($setless_fs->fsID, $file_set_ids)) {
             $setless_fs->removeFileFromSet($file);
         }
     });
     Events::extend('on_file_removed_from_set', function ($fID, $fv) {
         $setless_fs = FileSet::getByName('Setless');
         $file = File::getByID($fID);
         $file_sets = $file->getFileSets();
         // If file is no longer in any sets, add to setless
         if (count($file_sets) == 0) {
             $setless_fs->addFileToSet($file);
         }
     });
 }
开发者ID:bluefractals,项目名称:mr_setless_files,代码行数:29,代码来源:controller.php

示例2: addFilesForProduct

 public static function addFilesForProduct(array $files, StoreProduct $product)
 {
     self::removeFilesForProduct($product);
     //add new ones.
     if (!empty($files['dffID'])) {
         foreach ($files['dffID'] as $fileID) {
             if (!empty($fileID) && $fileID > 0) {
                 self::add($product->getProductID(), $fileID);
                 $fileObj = \File::getByID($fileID);
                 $fs = \FileSet::getByName("Digital Downloads");
                 $fs->addFileToSet($fileObj);
                 $fileObj->resetPermissions(1);
                 $pk = \Concrete\Core\Permission\Key\FileKey::getByHandle('view_file');
                 $pk->setPermissionObject($fileObj);
                 $pao = $pk->getPermissionAssignmentObject();
                 $groupEntity = \Concrete\Core\Permission\Access\Entity\GroupEntity::getOrCreate(\Group::getByID(GUEST_GROUP_ID));
                 $pa = $pk->getPermissionAccessObject();
                 if ($pa) {
                     $pa->removeListItem($groupEntity);
                     $pao->assignPermissionAccess($pa);
                 }
             }
         }
     }
 }
开发者ID:vividweb,项目名称:vivid_store,代码行数:25,代码来源:ProductFile.php

示例3: defined

<?php

defined('C5_EXECUTE') or die("Access Denied.");
$ih = Loader::helper('concrete/interface');
$cap = Loader::helper('concrete/dashboard');
$valt = Loader::helper('validation/token');
$form = Loader::helper('form');
$u = new User();
Loader::model('file_set');
$pageTypeIconsFS = FileSet::getByName("Page Type Icons");
?>
	
    <!-- START: Add Page Type pane -->
    
    <?php 
echo Loader::helper('concrete/dashboard')->getDashboardPaneHeaderWrapper(t('Add Page Type'), false, false, false);
?>
	
    <form method="post" class="form-horizontal" id="add_page_type" action="<?php 
echo $this->url('/dashboard/pages/types/add', 'do_add');
?>
">
	<?php 
echo $valt->output('add_page_type');
?>
    <?php 
echo $form->hidden('task', 'add');
?>
	
    <div class="ccm-pane-body">
    
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:30,代码来源:add.php

示例4: getIcons

 public function getIcons()
 {
     $f = Loader::helper('file');
     Loader::model('file_list');
     Loader::model('file_set');
     $fileList = new FileList();
     $fs = FileSet::getByName('Page Type Icons');
     if (!$fs) {
         return $f->getDirectoryContents(DIR_FILES_COLLECTION_TYPE_ICONS);
     } else {
         $fileList->filterBySet($fs);
         $icons = $fileList->get(100);
         if (!count($icons)) {
             $icons = $f->getDirectoryContents(DIR_FILES_COLLECTION_TYPE_ICONS);
         }
         return $icons;
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:18,代码来源:collection_types.php

示例5: save


//.........这里部分代码省略.........
         if ($count > 0) {
             for ($i = 0; $i < $count; $i++) {
                 $vals = array($data['pID'], $data['pogName'][$i], $data['pogSort'][$i]);
                 $db->Execute("INSERT INTO VividStoreProductOptionGroups (pID,pogName,pogSort) VALUES (?,?,?)", $vals);
                 //add option items
                 $pogID = $db->lastInsertId();
                 $itemsInGroup = count($data['optGroup' . $i]);
                 if ($itemsInGroup > 0) {
                     for ($gi = 0; $gi < $itemsInGroup; $gi++, $ii++) {
                         $vals = array($data['pID'], $pogID, $data['poiName'][$ii], $data['poiSort'][$ii]);
                         $db->Execute("INSERT INTO VividStoreProductOptionItems (pID,pogID,poiName,poiSort) VALUES (?,?,?,?)", $vals);
                     }
                 }
             }
         }
     } else {
         //else, we don't know it, so we're adding
         $dt = Core::make('helper/date');
         $now = $dt->getLocalDateTime();
         //add product details
         $vals = array($data['gID'], $data['pName'], $data['pDesc'], $data['pDetail'], $data['pPrice'], $data['pFeatured'], $data['pQty'], $data['pTaxable'], $data['pfID'], $data['pActive'], $data['pShippable'], $data['pWidth'], $data['pHeight'], $data['pLength'], $data['pWeight'], $now);
         $db->Execute("INSERT INTO VividStoreProducts (gID,pName,pDesc,pDetail,pPrice,pFeatured,pQty,pTaxable,pfID,pActive,pShippable,pWidth,pHeight,pLength,pWeight,pDateAdded) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", $vals);
         //add additional images
         $pID = $db->lastInsertId();
         $count = count($data['pifID']);
         if ($count > 0) {
             for ($i = 0; $i < $count; $i++) {
                 $vals = array($pID, $data['pifID'][$i], $data['piSort'][$i]);
                 $db->Execute("INSERT INTO VividStoreProductImages (pID,pifID,piSort) VALUES (?,?,?)", $vals);
             }
         }
         //insert user groups
         if (!empty($data['pUserGroups'])) {
             foreach ($data['pUserGroups'] as $gID) {
                 $vals = array($pID, $gID);
                 $db->Execute("INSERT INTO VividStoreProductUserGroups (pID,gID) VALUES (?,?)", $vals);
             }
         }
         //insert product groups
         if (!empty($data['pProductGroups'])) {
             foreach ($data['pProductGroups'] as $gID) {
                 $vals = array($pID, $gID);
                 $db->Execute("INSERT INTO VividStoreProductGroups (pID,gID) VALUES (?,?)", $vals);
             }
         }
         //add option groups
         $count = count($data['pogSort']);
         $ii = 0;
         //set counter for items
         if ($count > 0) {
             for ($i = 0; $i < $count; $i++) {
                 $vals = array($pID, $data['pogName'][$i], $data['pogSort'][$i]);
                 $db->Execute("INSERT INTO VividStoreProductOptionGroups (pID,pogName,pogSort) VALUES (?,?,?)", $vals);
                 //add option items
                 $pogID = $db->lastInsertId();
                 $itemsInGroup = count($data['optGroup' . $i]);
                 if ($itemsInGroup > 0) {
                     for ($gi = 0; $gi < $itemsInGroup; $gi++, $ii++) {
                         $vals = array($pID, $pogID, $data['poiName'][$ii], $data['poiSort'][$ii]);
                         $db->Execute("INSERT INTO VividStoreProductOptionItems (pID,pogID,poiName,poiSort) VALUES (?,?,?,?)", $vals);
                     }
                 }
             }
         }
         $product = Product::getByID($pID);
         $product->generatePage($data['selectPageTemplate']);
     }
     //save files
     $db->Execute("DELETE FROM VividStoreDigitalFiles WHERE pID=?", $pID);
     $u = User::getByUserID(1);
     $ui = \UserInfo::getByID($u->getUserID());
     if ($data['dffID']) {
         foreach ($data['dffID'] as $dffID) {
             if ($dffID) {
                 $db->Execute("INSERT INTO VividStoreDigitalFiles(dffID,pID) VALUES (?,?)", array($dffID, $pID));
                 $fileObj = File::getByID($dffID);
                 $fs = \FileSet::getByName("Digital Downloads");
                 $fs->addFileToSet($fileObj);
                 $fileObj->resetPermissions(1);
                 $pk = \Concrete\Core\Permission\Key\FileKey::getByHandle('view_file');
                 $pk->setPermissionObject($fileObj);
                 $pao = $pk->getPermissionAssignmentObject();
                 $groupEntity = \Concrete\Core\Permission\Access\Entity\GroupEntity::getOrCreate(\Group::getByID(GUEST_GROUP_ID));
                 $pa = $pk->getPermissionAccessObject();
                 if ($pa) {
                     $pa->removeListItem($groupEntity);
                     $pao->assignPermissionAccess($pa);
                 }
             }
         }
     }
     $db->Execute("DELETE FROM VividStoreProductLocations where pID = ?", array($pID));
     foreach ($data['cID'] as $cID) {
         if ($cID > 0) {
             $db->Execute("REPLACE INTO VividStoreProductLocations(pID,cID) VALUES (?,?)", array($pID, (int) $cID));
         }
     }
     $product = Product::getByID($pID);
     return $product;
 }
开发者ID:Janoinen,项目名称:vivid_store,代码行数:101,代码来源:Product.php

示例6: importUploadedFiles

 private function importUploadedFiles()
 {
     foreach ($this->field_defs as $name => $field_def) {
         if (!empty($field_def['fileset'])) {
             if (!empty($this->field_values[$name])) {
                 //Okay! Now that we've established that this field is a file upload
                 // and that something was uploaded, we want to do some sanity checks
                 // and if all is well, import the uploaded file to the file manager,
                 // add it to the desired file set, and then put the file ID into this object's
                 // values array (so the file ID is what gets saved to the database record).
                 $file_info = $this->field_values[$name];
                 $this->field_values[$name] = null;
                 //do this now in case one of our sanity checks below fails
                 if (!is_array($file_info) || empty($file_info['tmp_name']) || empty($file_info['name'])) {
                     continue;
                 }
                 $fs = FileSet::getByName($field_def['fileset']);
                 if (empty($fs)) {
                     continue;
                 }
                 $fi = new FileImporter();
                 $f = $fi->import($file_info['tmp_name'], $file_info['name']);
                 if (!$f instanceof FileVersion) {
                     continue;
                 }
                 $fs->addFileToSet($f);
                 $this->field_values[$name] = $f->getFileID();
             }
         }
     }
 }
开发者ID:robchenski,项目名称:ids,代码行数:31,代码来源:custom_contact_form.php

示例7: t

    }
    if (!$validExtension) {
        $error[] = t('Invalid File Extension');
    }
}
if (count($error) > 0) {
    // send in the errors
    $errorStr = implode(', ', $error);
    $file->error = $errorStr . '.';
    echo Loader::helper('json')->encode($file);
    exit;
}
// -- end intitial validation -- //
// begin file import
$fi = new FileImporter();
$fv = $fi->import($_FILES["file"]["tmp_name"], $_FILES["file"]["name"]);
if (!$fv instanceof \Concrete\Core\Entity\File\Version) {
    $file->error = $fi->getErrorMessage($fv);
    $file->timestamp = $_POST['timestamp'];
} else {
    $file_set = Config::get('conversations.attachments_pending_file_set');
    $fs = FileSet::getByName($file_set);
    if (!is_object($fs)) {
        $fs = FileSet::createAndGetSet($file_set, FileSet::TYPE_PUBLIC, USER_SUPER_ID);
    }
    $fs->addFileToSet($fv);
    $file->id = $fv->getFileID();
    $file->tag = $_POST['tag'];
    $file->timestamp = $_POST['timestamp'];
}
echo Loader::helper('json')->encode($file);
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:31,代码来源:add_file.php

示例8: FileList

    }
}
?>
                </div>
            </div>

            <section class="container-fluid padded-vertical padded-horizontal download-section" id="download">
                <div class="container">
                    <div class="titled">
                        <h2>Documents utiles</h2>
                        <span class="subtitle orange">Téléchargez ici les documents relatifs au tournoi.</span>
                        <hr>
                    </div>
                   <div class="col-sm-10 col-sm-offset-1 col-xs-12 col-xs-offset-0">
                       <?php 
$fileset = FileSet::getByName('download');
$fileslist = new FileList();
$fileslist->filterBySet($fileset);
$fileslist->sortBy('fsDisplayOrder', 'asc');
$documents = $fileslist->getResults();
foreach ($documents as $doc) {
    if ($doc->getAttribute('inactive') == 1) {
        $icon = '<i class="fa fa-chain-broken"></i>';
        $link = '';
        $class = 'not-active';
        $sup = '<br><small class="inactive">indiponible pour le moment</small>';
    } else {
        $icon = '<i class="fa fa-file-pdf-o"></i>';
        $link = $doc->getDownloadURL();
        $class = '';
        $sup = "";
开发者ID:bobzepplin,项目名称:dodgeball,代码行数:31,代码来源:home.php


注:本文中的FileSet::getByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。