示例#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);
 }
示例#2
0
文件: Summary.php 项目: stripTM/acd
 public function load()
 {
     $contentLoader = new \ACD\Model\ContentLoader();
     $contentLoader->setId($this->getIdStructure());
     $this->contentDo = $contentLoader->loadContents('id-deep', ['id' => $this->getIdContent(), 'depth' => 20]);
     $this->contentDo = $this->contentDo->one();
     return $this->contentDo;
 }
示例#3
0
$accion = strtolower($_POST['a']);
$id = $_POST['id'];
if ($accion == 'save' && $id == '') {
    $accion = 'new';
}
$idStructure = $_POST['ids'];
$title = isset($_POST['title']) ? $_POST['title'] : null;
$periodOfValidity = array(\Acd\Model\ContentDo::PERIOD_OF_VALIDITY_START => isset($_POST['validityPeriod']['start']) ? $_POST['validityPeriod']['start'] : null, \Acd\Model\ContentDo::PERIOD_OF_VALIDITY_END => isset($_POST['validityPeriod']['end']) ? $_POST['validityPeriod']['end'] : null);
$periodOfValidity = \Acd\Model\ValueFormater::decode($periodOfValidity, \Acd\Model\ValueFormater::TYPE_DATE_TIME_RANGE, \Acd\Model\ValueFormater::FORMAT_EDITOR);
$aliasId = isset($_POST['aliasId']) ? $_POST['aliasId'] : null;
$tags = isset($_POST['tags']) ? \Acd\Model\ValueFormater::decode($_POST['tags'], \Acd\Model\ValueFormater::TYPE_TAGS, \Acd\Model\ValueFormater::FORMAT_EDITOR) : array();
$fields = isset($_POST['field']) ? $_POST['field'] : array();
$contentLoader = new \ACD\Model\ContentLoader();
$contentLoader->setId($idStructure);
//$contents = $contentLoader->loadContents('id', $id);
$content = $contentLoader->loadContents('id', $id);
//TODO Resolver mejor
try {
    //if (is_null($contents) || $contents->length() === 0) {
    if (is_null($content)) {
        $structureFound = false;
        $structure = new Model\StructureDo();
        $structure->setId($idStructure);
        $structure->loadFromFile();
        $modified_content = new Model\ContentDo();
        $modified_content->buildSkeleton($structure);
    } else {
        $structureFound = true;
        //$modified_content = $contents->one();
        $modified_content = $content;
    }