Exemplo n.º 1
0
 public function delete($fsID, $token = '')
 {
     $u = new User();
     Loader::model('file_set');
     $fs = FileSet::getByID($fsID);
     $valt = Loader::helper('validation/token');
     if (!$valt->validate('delete_file_set', $token)) {
         throw new Exception($valt->getErrorMessage());
     }
     $fsp = new Permissions($fs);
     if ($fsp->canDeleteFileSet()) {
         $fs->delete();
         $this->redirect('/dashboard/files/sets', 'file_set_deleted');
     } else {
         throw new Exception(t('You do not have permission to delete this file set.'));
     }
 }
Exemplo n.º 2
0
			<p><?php 
        echo t('There are no files in this set.');
        ?>
</p>
		<?php 
    }
    ?>
	</div>
	</div>
	<div class="ccm-pane-footer">
		<input type="submit" value="<?php 
    echo t('Save');
    ?>
" class="btn primary ccm-button-v2-right" />
		<?php 
    if ($fsp->canDeleteFileSet()) {
        ?>
			<?php 
        print $ih->button_js(t('Delete'), "deleteFileSet()", 'right', 'error');
        ?>
		<?php 
    }
    ?>
	</div>

	<?php 
    echo Loader::helper('concrete/dashboard')->getDashboardPaneFooterWrapper(false);
    ?>

	</form>
	
Exemplo n.º 3
0
		</td>
	</tr>
	</table>
	</div>
	
		
	<div class="ccm-file-search-advanced-sets-results">
	<ul id="ccm-file-search-advanced-sets-list">
	<?php  foreach($s1 as $fs) { 
		$pfs = new Permissions($fs);
		
		?>
		<li class="ccm-<?php echo $searchInstance?>-search-advanced-sets-cb">
		<div class="ccm-file-search-advanced-set-controls">
			<a href="<?php echo View::url('/dashboard/files/sets', 'view_detail', $fs->getFileSetID())?>"><?php echo $html->image('icons/wrench.png')?></a>
			<?php  if ($pfs->canDeleteFileSet()) { ?>
				<a href="<?php echo REL_DIR_FILES_TOOLS_REQUIRED?>/files/delete_set?fsID=<?php echo $fs->getFileSetID()?>&searchInstance=<?php echo $searchInstance?>" class="ccm-file-set-delete-window" dialog-title="<?php echo t('Delete File Set')?>" dialog-width="320" dialog-height="200" dialog-modal="false"><?php echo $html->image('icons/delete_small.png')?></a>
			<?php  } ?>
		</div>
		<?php echo $form->checkbox('fsID[' . $fs->getFileSetID() . ']', $fs->getFileSetID(), (is_array($searchRequest['fsID']) && in_array($fs->getFileSetID(), $searchRequest['fsID'])))?> <?php echo $form->label('fsID[' . $fs->getFileSetID() . ']', $fs->getFileSetName())?></li>
	<?php  } ?>
	</ul>
	</div>

	<div style="padding-left: 6px; padding-top: 6px" class="ccm-note"><?php echo $form->checkbox('fsIDNone', '1', $searchRequest['fsIDNone'] == 1, array('instance' => $searchInstance))?> <?php echo $form->label('fsIDNone', t('Display files in no sets.'))?></div>
	
</div>

	<script type="text/javascript">
	$(function() {
		$('a.ccm-file-set-delete-window').dialog();
        $pfs = new Permissions($fs);
        ?>
		<li class="ccm-<?php 
        echo $searchInstance;
        ?>
-search-advanced-sets-cb">
		<div class="ccm-file-search-advanced-set-controls">
			<a href="<?php 
        echo View::url('/dashboard/files/sets', 'view_detail', $fs->getFileSetID());
        ?>
"><?php 
        echo $html->image('icons/wrench.png');
        ?>
</a>
			<?php 
        if ($pfs->canDeleteFileSet()) {
            ?>
				<a href="<?php 
            echo REL_DIR_FILES_TOOLS_REQUIRED;
            ?>
/files/delete_set?fsID=<?php 
            echo $fs->getFileSetID();
            ?>
&searchInstance=<?php 
            echo $searchInstance;
            ?>
" dialog-append-buttons="true" class="ccm-file-set-delete-window" dialog-title="<?php 
            echo t('Delete File Set');
            ?>
" dialog-width="320" dialog-height="110" dialog-modal="false"><?php 
            echo $html->image('icons/delete_small.png');
Exemplo n.º 5
0
 public function delete_files()
 {
     if (!$this->token->validate('delete_files')) {
         $this->error->add($this->token->getErrorMessage());
     }
     if (!$this->error->has()) {
         $r = $this->entityManager->getRepository('\\PortlandLabs\\Concrete5\\MigrationTool\\Entity\\Import\\Batch');
         $batch = $r->findOneById($this->request->request->get('id'));
         if (is_object($batch)) {
             foreach ($batch->getFiles() as $f) {
                 $fp = new \Permissions($f);
                 if ($fp->canDeleteFile()) {
                     $f->delete();
                 }
             }
             $fs = $batch->getFileSet();
             if (is_object($fs)) {
                 $fsp = new \Permissions($fs);
                 if ($fsp->canDeleteFileSet()) {
                     $fs->delete();
                 }
             }
             $this->flash('success', t('Batch files deleted successfully.'));
             $this->redirect('/dashboard/system/migration/import', 'batch_files', $batch->getId());
         }
     }
     $this->view();
 }