Exemplo n.º 1
0
 function getEntityPicture($entityTypeId, $entityId, $size = 'thumb')
 {
     $config = getEntityGalleryConfig($entityTypeId);
     $pictures = $this->selectEntityFiles($entityTypeId, $entityId);
     if (!empty($pictures)) {
         return base_url($config['sizes'][$size]['folder'] . $pictures[0]['fileName']);
     }
 }
Exemplo n.º 2
0
 function deletePicture($entityTypeId, $fileId)
 {
     $config = getEntityGalleryConfig($entityTypeId);
     if (!$this->safety->allowByControllerName($config['controller'])) {
         return errorForbidden();
     }
     if ($this->Files_Model->hasFileIdInEntityTypeId($entityTypeId, $fileId) == false) {
         return errorForbidden();
     }
     $this->Files_Model->deleteEntityFile($entityTypeId, $fileId);
     return loadViewAjax(true, array());
 }
Exemplo n.º 3
0
function getCrFormFieldGallery($entityTypeId, $entityId, $label)
{
    $config = getEntityGalleryConfig($entityTypeId);
    return array('type' => 'gallery', 'label' => $label, 'urlGallery' => base_url(str_replace(array('$entityTypeId', '$entityId'), array($entityTypeId, $entityId), $config['urlGallery'])), 'urlSave' => base_url($config['urlSave']), 'urlDelete' => base_url($config['urlDelete']), 'entityTypeId' => $entityTypeId, 'entityId' => $entityId);
}