Пример #1
0
 public function registerTemplate($idTemplate)
 {
     $template = new Template($idTemplate);
     $fes = $template->listFEforNewFrame()->asQuery()->getResult();
     Base::createEntityRelation($this->getIdEntity(), 'rel_hastemplate', $template->getIdEntity());
     $frameElement = new FrameElement();
     foreach ($fes as $fe) {
         $newFE = new \StdClass();
         $newFE->entry = $this->getEntry() . '_' . $fe['entry'] . '_' . $template->getEntry();
         $newFE->idCoreType = $fe['idCoreType'];
         $newFE->idColor = $fe['idColor'];
         $newFE->idEntity = $fe['idEntity'];
         $newFE->idFrame = $this->getId();
         $frameElement->setPersistent(false);
         $frameElement->setData($newFE);
         $frameElement->save($newFE);
         Base::createEntityRelation($frameElement->getIdEntity(), 'rel_hastemplate', $newFE->idEntity);
     }
 }
Пример #2
0
 public function formFESemanticType()
 {
     $model = new FrameElement($this->data->id);
     $this->data->object = $model->getData();
     $this->data->idEntity = $model->getIdEntity();
     $this->data->form = "formFESemanticType";
     //$this->data->save = "@fnbr20/structure/frame/feSemanticType|formFESemanticType";
     $this->data->close = "!\$('#formFESemanticType_dialog').dialog('close');";
     $this->data->title = 'FrameElement: ' . $model->getEntry() . '  [' . $model->getName() . ']';
     $this->render();
 }
 public function createRelationsFromData($fe)
 {
     if ($fe->idFrame) {
         $frame = new Frame($fe->idFrame);
         Base::createEntityRelation($this->getIdEntity(), 'rel_elementof', $frame->getIdEntity());
     }
     $feRelated = new FrameElement();
     if ($fe->coreset) {
         foreach ($fe->coreset as $coreset) {
             $feRelated->getByEntry($coreset->entry);
             Base::createEntityRelation($this->getIdEntity(), 'rel_coreset', $feRelated->getIdEntity());
         }
     }
     if ($fe->excludes) {
         foreach ($fe->excludes as $excludes) {
             $feRelated->getByEntry($excludes->entry);
             Base::createEntityRelation($this->getIdEntity(), 'rel_excludes', $feRelated->getIdEntity());
         }
     }
     if ($fe->requires) {
         foreach ($fe->requires as $requires) {
             $feRelated->getByEntry($requires->entry);
             Base::createEntityRelation($this->getIdEntity(), 'rel_requires', $feRelated->getIdEntity());
         }
     }
 }