Esempio n. 1
0
 public function testDeleteContent()
 {
     // Delete
     $cl = new \ACD\Model\ContentLoader();
     $cl->setId('programa_tv');
     $content = new \ACD\Model\ContentDo();
     $content->setIdStructure($cl->getId());
     $content->setId('id-demo');
     $content->setData('Título', 'El campo Título');
     $cl->saveContent($content);
     $colContent = $cl->loadContents('id', 'id-demo');
     $cl->deleteContent('id-demo');
     $colContent = $cl->loadContents('id', 'id-demo');
     $this->assertNull($colContent);
 }
Esempio n. 2
0
             @($normalizedvalue['size'] = $fields[$key]['size'] ?: '');
             // If get a new upload file
             if ($_FILES['field']['error'][$key]['file'] === UPLOAD_ERR_OK) {
                 $normalizedvalue['original_name'] = $_FILES['field']['name'][$key]['file'];
                 $normalizedvalue['tmp_name'] = $_FILES['field']['tmp_name'][$key]['file'];
                 $finfo = new \finfo(FILEINFO_MIME_TYPE);
                 $normalizedvalue['type'] = $finfo->file($_FILES['field']['tmp_name'][$key]['file']);
                 $normalizedvalue['size'] = $_FILES['field']['size'][$key]['file'];
             }
         } else {
             $normalizedvalue = $formater->decode($fields[$key]['value'], $fieldType, $formater::FORMAT_EDITOR);
             //d($key, $normalizedvalue, $fieldType);
         }
         $modified_content->setFieldValue($fieldId, $normalizedvalue);
     }
     $modified_content = $contentLoader->saveContent($modified_content);
     $id = $modified_content->getId();
     $returnUrl = 'content.php?a=edit&r=ok&id=' . urlencode($id) . '&idt=' . urlencode($idStructure);
     /* TODO ERROR
     			$returnUrl = 'content.php?a='.$accion.'&r=ko&id='.urlencode($id).'&idt='.urlencode($idt).'&title='.urlencode($title);
     		*/
     break;
 case 'clone':
     $returnUrl = 'content.php?a=clone&id=' . urlencode($id) . '&idt=' . urlencode($idStructure);
     break;
 case 'delete':
     try {
         $contentLoader->deleteContent($id);
         $returnUrl = 'content.php?a=' . $accion . '&r=ok&id=' . urlencode($idStructure);
     } catch (\Exception $e) {
         $returnUrl = 'content.php?a=edit&r=ko_delete&id=' . urlencode($id) . '&idt=' . urlencode($idStructure);