Ejemplo n.º 1
0
 public function main()
 {
     $this->data->isMaster = Manager::checkAccess('MASTER', A_EXECUTE) ? 'true' : 'false';
     $editor = MApp::getService('fnbr20', '', 'visualeditor');
     $this->data->relationData = $editor->getRelationData();
     $this->data->relationEntry = json_encode($this->data->relationData);
     $this->render();
 }
Ejemplo n.º 2
0
 public function saveCERelation()
 {
     $isMaster = Manager::checkAccess('MASTER', A_EXECUTE);
     $editor = MApp::getService('fnbr20', '', 'visualeditor');
     if ($isMaster) {
         $editor->updateCERelation($this->data->graphceJson);
         $editor->deleteCERelation($this->data->linksceRemoved);
         $this->renderPrompt('info', 'Ok');
     } else {
         $this->renderPrompt('error', 'Error');
     }
 }
    public function getLayersData($idSentence)
    {
        if (!\Manager::checkAccess('MASTER', A_EXECUTE)) {
            $condition = "AND (AnnotationSet.idAnnotationSet = {$this->getId()})";
        }
        $idLanguage = \Manager::getSession()->idLanguage;
        $cmd = <<<HERE

        SELECT AnnotationSet.idAnnotationSet,
            l.idLayerType,
            l.idLayer,
            entry_lt.name AS layer,
            ifnull(lb.startChar,-1) AS startChar,
            ifnull(lb.endChar,-1) AS endChar,
            ifnull(gl.idEntity, ifnull(fe.idEntity, ce.idEntity)) AS idLabelType,
            lb.idLabel,
            lt.entry as layerTypeEntry
        FROM AnnotationSet
            INNER JOIN Layer l
                ON (AnnotationSet.idAnnotationSet = l.idAnnotationSet)
            LEFT JOIN Label lb
                ON (l.idLayer=lb.idLayer)
            LEFT JOIN GenericLabel gl
                ON (lb.idLabelType=gl.idEntity)
            LEFT JOIN FrameElement fe
                ON (lb.idLabelType=fe.idEntity)
            LEFT JOIN Entry entry_fe
                ON (fe.entry = entry_fe.entry)
            LEFT JOIN ConstructionElement ce
                ON (lb.idLabelType=ce.idEntity)
            LEFT JOIN Entry entry_ce
                ON (ce.entry = entry_ce.entry)
            INNER JOIN LayerType lt
                ON (l.idLayerType=lt.idLayerType)
            INNER JOIN Entry entry_lt
                ON (lt.entry = entry_lt.entry)
        WHERE ((entry_lt.idLanguage = {$idLanguage} )
            AND ((gl.idLanguage = {$idLanguage}) or (gl.idLanguage is null))
            AND ((entry_fe.idLanguage = {$idLanguage}) or (entry_fe.idLanguage is null))
            {$condition} AND (AnnotationSet.idSentence       = {$idSentence} ))
        ORDER BY AnnotationSet.idAnnotationSet, lt.order, entry_lt.name, l.idLayer, ifnull(lb.startChar,-1)
    
HERE;
        $query = $this->getDb()->getQueryCommand($cmd);
        return $query;
    }
Ejemplo n.º 4
0
 public function main()
 {
     $this->data->isMaster = Manager::checkAccess('MASTER', A_EXECUTE) ? 'true' : 'false';
     $this->render();
 }
Ejemplo n.º 5
0
 public function checkAccess()
 {
     $result = true;
     $access = $this->getAccess();
     if ($access && Manager::isLogged()) {
         $perms = explode(':', $access);
         $right = Manager::getPerms()->getRight($perms[1]);
         $result = Manager::checkAccess($perms[0], $right);
     }
     return $result;
 }
Ejemplo n.º 6
0
 public function addGroupActions($transaction, $access, $label, $actions)
 {
     if (Manager::checkAccess($transaction, $access)) {
         $this->addBreak();
         $this->addControl(new MLabel($label, '', true));
         $this->addBreak();
         $this->addControl(new MSeparator());
         $this->addActions($actions);
     }
 }
Ejemplo n.º 7
0
 public function formCorpusAnnotation()
 {
     $annotation = MApp::getService('fnbr20', '', 'annotation');
     $this->data->isMaster = Manager::checkAccess('MASTER', A_EXECUTE) ? 'true' : 'false';
     $this->data->isSenior = Manager::checkAccess('SENIOR', A_EXECUTE) ? 'true' : 'false';
     $this->data->colors = $annotation->getColor();
     $this->data->layerType = $annotation->getLayerType();
     $it = $annotation->getInstantiationType();
     $this->data->instantiationType = $it['array'];
     $this->data->instantiationTypeObj = $it['obj'];
     $this->render();
 }
Ejemplo n.º 8
0
 private function handleChildren($control, $node, $addMethod = 'addControl')
 {
     $context = $this->localContext;
     foreach ($node->children() as $i => $n) {
         if ($this->ignoreElement($n)) {
             continue;
         }
         $e = array();
         if ($i == 'event') {
             foreach ($n->attributes() as $property => $value) {
                 $e[$property] = trim(utf8_decode((string) $value));
             }
             $control->addEvent($e['event'], $e['handler'], $e['preventDefault'] === 'true');
         } elseif ($i == 'ajax') {
             foreach ($n->attributes() as $property => $value) {
                 $e[$property] = trim(utf8_decode((string) $value));
             }
             $url = $this->processValue($e['url']);
             $control->ajax($e['type'], $e['event'], $url, $e['load'], $e['preventDefault'] === 'true');
         } elseif ($i == 'data') {
             foreach ($n->attributes() as $property => $value) {
                 $e[$property] = trim(utf8_decode((string) $value));
             }
             if ($e['load']) {
                 $value = str_replace("\$this", "\$context", $e['load']);
                 $control->setData(eval('return ' . $value . ';'));
             }
             if ($e['id']) {
                 $id = $e['id'];
                 $control->data->{$id} = $this->processValue($e['value']);
             }
         } elseif ($i == 'property') {
             foreach ($n->attributes() as $property => $value) {
                 $control->{$property} = $this->processValue($value);
             }
         } elseif ($i == 'attribute') {
             foreach ($n->attributes() as $property => $value) {
                 $control->addAttribute($property, $this->processValue($value));
             }
         } elseif ($i == 'include') {
             $this->getControlsFromInclude($n, $control, true);
         } elseif ($i == 'fields') {
             $fields = $this->getControlsFromDOM($n);
             $control->addFields($fields);
         } elseif ($i == 'buttons') {
             $buttons = $this->getControlsFromDOM($n);
             $control->addButtons($buttons);
         } elseif ($i == 'auth') {
             foreach ($n->attributes() as $property => $value) {
                 $e[$property] = trim(utf8_decode((string) $value));
             }
             $perms = explode(':', $e['access']);
             $right = Manager::getPerms()->getRight($perms[1]);
             $ok = Manager::checkAccess($perms[0], $right);
             if ($ok) {
                 $this->handleChildren($control, $n, $addMethod);
             }
         } elseif ($i == 'help') {
             $fields = $this->getControlsFromDOM($n);
             $control->addFields($fields);
         } elseif ($i == 'validators') {
             $validators = $this->getControlsFromDOM($n);
             $control->setValidators($validators);
         } elseif ($i == 'controls') {
             $controls = $this->getControlsFromDOM($n);
             $control->setControls($controls);
         } elseif ($i == 'actions') {
             $controls = $this->getControlsFromDOM($n);
             $control->addAction($controls);
         } elseif ($i == 'action') {
             foreach ($n->attributes() as $property => $value) {
                 $e[$property] = $this->processValue($value);
             }
             $control->addAction($e['action'], $e['label'], $e['transaction'], $e['access']);
         } elseif ($i == 'tool') {
             foreach ($n->attributes() as $property => $value) {
                 $e[$property] = $this->processValue(trim(utf8_decode((string) $value)));
             }
             $control->addTool($e['title'], $e['action'], $e['icon']);
         } elseif ($i == 'method') {
             foreach ($n->attributes() as $property => $value) {
                 $e[$property] = trim(utf8_decode((string) $value));
             }
             $func = create_function($e['args'], trim(utf8_decode((string) $n[0])));
             $name = $e['name'];
             $control->{$name} = $func;
         } elseif ($i == 'css') {
             $this->handleNodeCSS($n);
         } elseif ($i == 'javascript') {
             $this->handleNodeJavascript($n);
         } else {
             $obj = $control->instance($i);
             if ($obj instanceof MValidator) {
                 $control->setValidator($obj);
             } else {
                 $obj->context = $control->context;
                 $this->getControlFromDOM($obj, $n);
                 $control->{$addMethod}($obj);
             }
         }
     }
 }
Ejemplo n.º 9
0
 public function addUserAction($transaction, $access, $label, $action = '')
 {
     if (Manager::checkAccess($transaction, $access)) {
         $this->actions[$action] = $label;
     }
 }