public function authenticate() { if ($this->data->datasource == '') { $this->data->datasource = 'fnapolo'; //$this->renderPrompt('error', 'Inform database name.'); } Manager::setConf('fnbr20.db', $this->data->datasource); Manager::getSession()->fnbr20db = $this->data->datasource; $auth = Manager::getAuth(); $this->data->result = $auth->authenticate($this->data->user, $this->data->challenge, $this->data->response); if ($this->data->result) { $user = Manager::getLogin()->getUser(); $this->data->idLanguage = $user->getConfigData('fnbr20IdLanguage'); if ($this->data->idLanguage == '') { $this->data->idLanguage = 1; $user->setConfigData('fnbr20IdLanguage', $this->data->idLanguage); } if ($this->data->ifLanguage == '') { $this->data->ifLanguage = 'en'; //$this->renderPrompt('error', 'Inform language.'); } Manager::getSession()->idLanguage = $this->data->idLanguage; Manager::getSession()->lang = $this->data->ifLanguage; Manager::getSession()->fnbr20Level = $user->getUserLevel(); $this->redirect(Manager::getURL('fnbr20/main')); } else { $this->renderPrompt('error', 'Login or password not valid.'); } }
public function save() { $layers = $this->data->gridManager->data->checked; Manager::getSession()->fnbr20Layers = $layers; $user = Manager::getLogin()->getUser(); $user->setConfigData('fnbr20Layers', $layers); $this->renderPrompt('information', 'OK'); }
public function listForConstraint($array) { $idLanguage = \Manager::getSession()->idLanguage; $criteria = $this->getCriteria()->select("idLU as del, idLU, concat(frame.entries.name,'.',name) as fullname")->orderBy('frame.entries.name,name'); $criteria->where("idLU", "IN", $array); Base::relation($criteria, 'lu', 'frame', 'rel_evokes'); Base::entryLanguage($criteria, 'frame'); $criteria->where("lemma.idLanguage = {$idLanguage}"); return $criteria; }
public function listLabelType($filter) { $idLanguage = \Manager::getSession()->idLanguage; $criteria = $this->getCriteria()->select('idLayerType, entry, genericlabel.name as labelType, genericlabel.idEntity as idLabelType')->orderBy('entry, genericlabel.name'); Base::relation($criteria, 'layertype', 'genericlabel', 'rel_haslabeltype'); $criteria->where("genericlabel.idLanguage = {$idLanguage}"); if ($filter->entry) { $criteria->where("entry = '{$filter->entry}'"); } return $criteria; }
public function preProcess() { $frontController = $this->frontController; // exemplo de alteração da configuração dependendo do controller sendo executado $context = $frontController->getContext(); $controller = $context->getController(); if ($controller == 'controls') { Manager::setConf('session.check', false); } // é necessário validar a sessão? if (Manager::getConf('login.check') || Manager::getConf('session.check')) { $timeout = Manager::getSession()->checkTimeout(Manager::getConf('session.exception')); } if ($timeout) { $frontController->canCallHandler(false); $url = Manager::getURL(Manager::getApp() . '/main'); $frontController->setResult(new MRedirect(NULL, $url)); } }
public function formSession() { // O gerenciamento de sessão do Maestro utiliza o Zend // Usando o container global do Maestro $teste = Manager::getSession()->teste + 1; Manager::getSession()->teste = $teste; $this->data->teste = "Contador (refresh na página para incrementar): " . $teste; // Usando containers $container = Manager::getSession()->container('exemplo'); $container->integer = $container->integer + 1; $container->string = "String"; $object = new StdClass(); $object->name = 'name'; $object->value = 10; $container->object = $object; $this->data->integer = "Contador em container (refresh na página para incrementar): " . $container->integer; // Usando containers expiration $limited = Manager::getSession()->container('limited'); $limited->setExpirationSeconds(15); $limited->contador = $limited->contador + 1; $this->data->limited = "Contador com prazo de expiração (15 seg): " . $limited->contador; $this->render(); }
public function logout($forced = '') { if (Manager::getOptions('dbsession')) { //$session = $this->manager->getBusinessMAD('session'); //$session->registerOut($this->getLogin()); } $this->setLogin(NULL); Manager::getSession()->destroy(); }
public function getTokenId() { Manager::getSession()->set('__MAESTROTOKENID', md5(uniqid())); $tokenId = Manager::useToken ? Manager::getSession()->get('__MAESTROTOKENID') : ''; //mdump('getting token id = ' . $tokenId); return "manager.page.tokenId = '{$tokenId}';"; }
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; }
public function generate() { $this->errors = array(); $this->ini = parse_ini_file($this->fileScript, true); $tab = ' '; $dbName = $this->ini['globals']['database']; $appName = $this->ini['globals']['app']; $moduleName = $this->ini['globals']['module'] ?: $appName; $actions[] = $tab . "'{$moduleName}' => array('{$moduleName}', '{$moduleName}/main/main', '{$moduleName}IconForm', '', A_ACCESS, array("; foreach ($this->ini as $className => $node) { $originalClassName = $className; $className = strtolower($className); if ($className == 'globals') { continue; } $properties = $methods = $validators = ''; mdump('handleClass = ' . $className); $extends = $node['extends']; $log = $node['log']; if ($node['type'] == 'enumeration') { $consts = $modelName = $tableName = $properties = ''; $attributes = $node['attributes']; foreach ($attributes as $attributeName => $attributeData) { if ($attributeName == 'model') { $modelName = $attributeData; } if ($attributeName == 'table') { $tableName = $attributeData; } if ($attributeName == 'model' || $attributeName == 'table') { $attributeData = "\"{$attributeData}\""; } $properties .= "\n protected static \$" . $attributeName . " = " . $attributeData . ";"; } if ($tableName) { $sessionId = Manager::getSession()->getId(); $url = Manager::getAppURL($appName, $moduleName . '/tabelageral/getenumeration/' . $tableName . "?ajaxResponseType=JSON", true); //mdump($url); if ($stream = fopen($url, 'r')) { $result = MJSON::decode(stream_get_contents($stream)); $constants = $result['data']['result']['items']; //mdump($constants); foreach ($constants as $value) { $consts .= "\n const " . str_replace(' ', '_', $value['name']) . " = " . $value['idTable'] . ";"; } fclose($stream); } } else { $constants = $node['constants']; foreach ($constants as $constantName => $constantData) { $consts .= "\n const " . $constantName . " = " . $constantData . ";"; } } $var = array(); $var['class'] = $originalClassName; $var['model'] = $originalClassName; $var['module'] = $moduleName ?: $appName; $var['moduleName'] = $moduleName; $var['default'] = $node['default'] ?: 'DEFAULT'; $var['constants'] = $consts; $var['properties'] = $properties; $var['comment'] = $comment; $var['package'] = $appName; $var['extends'] = $extends ?: '\\MEnumBase'; $var['description'] = $description; $this->generateEnumeration($className, $var); continue; } $document = $ormmap = $docassoc = $docattr = $attributes = array(); $document[] = ''; $document[] = $tab . 'public static function ORMMap() {'; $document[] = ''; $ormmap[] = $tab . $tab . 'return array('; $ormmap[] = $tab . $tab . $tab . "'class' => \\get_called_class(),"; $ormmap[] = $tab . $tab . $tab . "'database' => " . (substr($dbName, 0, 1) == "\\" ? $dbName . ',' : "'{$dbName}',"); $tableName = $node['table']; $ormmap[] = $tab . $tab . $tab . "'table' => '{$tableName}',"; if ($extends) { $ormmap[] = $tab . $tab . $tab . "'extends' => '{$extends}',"; } $pk = ''; $getterSetter = "\n\n /**\n * Getters/Setters\n */"; $attributes = $node['attributes']; foreach ($attributes as $attributeName => $attributeData) { $isPK = false; $at = explode(',', $attributeData); // atData: // 0 - column // 1 - type // 2 - null or not null // 3 - key type // 4 - generator $attribute = $tab . $tab . $tab . "'{$attributeName}' => array("; $attribute .= "'column' => '{$at[0]}'"; if ($at[3]) { $attribute .= ",'key' => '{$at[3]}'"; $isPK = $at[3] == 'primary'; if ($isPK) { $pk = $attributeName; if ($at[4]) { $attribute .= ",'idgenerator' => '{$at[4]}'"; } else { $attribute .= ",'idgenerator' => 'identity'"; } } } if ($at[2] == 'not null' && !$isPK) { $validators .= "\n " . $tab . $tab . $tab . "'{$attributeName}' => array('notnull'),"; } $attrType = $at[1]; $attribute .= ",'type' => '{$attrType}'),"; $properties .= "\n /**\n * {$attrComment}\n * @var {$attrType} \n */"; $properties .= "\n protected " . "\$" . $attributeName . ";"; $getterSetter .= "\n public function get" . ucfirst($attributeName) . "() {\n return \$this->{$attributeName};\n }\n"; $setterBody = ''; $lowerAttrType = strtolower($attrType); if ($lowerAttrType == 'currency') { $setterBody = "if (!(\$value instanceof \\MCurrency)) {\n \$value = new \\MCurrency((float) \$value);\n }\n "; } elseif ($lowerAttrType == 'date') { $setterBody = "if (!(\$value instanceof \\MDate)) {\n \$value = new \\MDate(\$value);\n }\n "; } elseif ($lowerAttrType == 'timestamp') { $setterBody = "if (!(\$value instanceof \\MTimeStamp)) {\n \$value = new \\MTimeStamp(\$value);\n }\n "; } elseif ($lowerAttrType == 'cpf') { $setterBody = "if (!(\$value instanceof \\MCPF)) {\n \$value = new \\MCPF(\$value);\n }\n "; } elseif ($lowerAttrType == 'cnpj') { $setterBody = "if (!(\$value instanceof \\MCNPJ)) {\n \$value = new \\MCNPJ(\$value);\n }\n "; } elseif ($lowerAttrType == 'boolean') { $setterBody = "\$value = ((\$value != '0') && (\$value != 0) && (\$value != '')) ? '1' : '0';\n "; } elseif (strpos($lowerAttrType, 'enum') !== false) { $setterBody = "\$valid = false;\n" . " if (empty(\$value)) {\n" . " \$config = \$this->config();\n" . " \$valid = !array_search('notnull',\$config['validators']['{$attributeName}']);\n" . " }\n" . " if (!(\$valid || {$attrType}Map::isValid(\$value))) {\n" . " throw new \\EModelException('Valor inválido para a Enumeração {$attrType}');\n" . " }\n "; } if ($isPK) { //$setterBody .= "\$this->{$attributeName} = (\$value ? : NULL);"; $setterBody .= "\$this->{$attributeName} = \$value;"; } else { $setterBody .= "\$this->{$attributeName} = \$value;"; } $getterSetter .= "\n public function set" . ucfirst($attributeName) . "(\$value) {\n {$setterBody}\n }\n"; $docattr[] = $tab . $attribute; } $description = $node['description'] ?: $pk; $properties .= "\n\n /**\n * Associations\n */"; $docassoc = array(); $associations = $node['associations']; if (is_array($associations)) { foreach ($associations as $associationName => $associationData) { $assoc = explode(',', $associationData); // assoc: // 0 - toClass // 1 - cardinality // 2 - keys or associative $association = $tab . $tab . $tab . "'{$associationName}' => array("; $association .= "'toClass' => '{$assoc[0]}'"; $association .= ", 'cardinality' => '{$assoc[1]}' "; if ($assoc[1] == 'manyToMany') { $association .= ", 'associative' => '{$assoc[2]}'), "; } else { $association .= ", 'keys' => '{$assoc[2]}'), "; } $properties .= "\n protected " . "\$" . $associationName . ";"; $type = $params['cardinality'] == 'oneToOne' ? $params['toClass'] : 'Association'; $methods .= " /**\n *\n * @return {$type}\n */\n public function get" . ucfirst($associationName) . "() {\n if (is_null(\$this->{$associationName})){\n \$this->retrieveAssociation(\"{$associationName}\");\n }\n return \$this->{$associationName};\n }\n"; $methods .= " /**\n *\n * @param {$type} \$value\n */\n public function set" . ucfirst($associationName) . "(\$value) {\n \$this->{$associationName} = \$value;\n }\n"; $methods .= " /**\n *\n * @return {$type}\n */\n public function getAssociation" . ucfirst($associationName) . "() {\n \$this->retrieveAssociation(\"{$associationName}\");\n }\n"; $docassoc[] = $tab . $association; } } $ormmap[] = $tab . $tab . $tab . "'attributes' => array("; foreach ($docattr as $attr) { $ormmap[] = $attr; } $ormmap[] = $tab . $tab . $tab . "),"; $ormmap[] = $tab . $tab . $tab . "'associations' => array("; foreach ($docassoc as $assoc) { $ormmap[] = $assoc; } $ormmap[] = $tab . $tab . $tab . ")"; $ormmap[] = $tab . $tab . ");"; $ormmapdef = implode("\n", $ormmap); $document[] = $ormmapdef; $document[] = $tab . "}"; $map = implode("\n", $document); $configLog = "array( " . $log . " ),"; $configValidators = "array(" . $validators . "\n ),"; $configConverters = "array()"; // generate PHP class $var = array(); $var['class'] = $className; $var['model'] = $className; $var['module'] = $moduleName ?: $appName; $var['properties'] = $properties; $var['methods'] = $getterSetter . $methods; $var['comment'] = $comment; $var['package'] = $appName; $var['ormmap'] = $map; $var['extends'] = $extends; $var['description'] = $description; $var['lookup'] = $description; $var['configLog'] = $configLog; $var['configValidators'] = $configValidators; $var['configConverters'] = $configConverters; // Create Model & Map $template = new MWizardTemplate(); $template->setVar($var); $template->setTemplate('/public/files/templates/map.php'); $template->applyClass(); $template->saveResult("{$moduleName}/models/map/{$className}map.php", $this->baseDir); $template = new MWizardTemplate(); $template->setVar($var); $template->setTemplate('/public/files/templates/model.php'); $template->applyClass(); $template->saveResult("{$moduleName}/models/{$className}.php", $this->baseDir); // Create CRUD $fileName = array(); $fileName[] = array('public/files/templates/formBase.xml', "{$moduleName}/views/{$className}/formBase.xml"); $fileName[] = array('public/files/templates/formFind.xml', "{$moduleName}/views/{$className}/formFind.xml"); $fileName[] = array('public/files/templates/formNew.xml', "{$moduleName}/views/{$className}/formNew.xml"); $fileName[] = array('public/files/templates/formObject.xml', "{$moduleName}/views/{$className}/formObject.xml"); $fileName[] = array('public/files/templates/formUpdate.xml', "{$moduleName}/views/{$className}/formUpdate.xml"); $fileName[] = array('public/files/templates/lookup.xml', "{$moduleName}/views/{$className}/lookup.xml"); $fileName[] = array('public/files/templates/fields.xml', "{$moduleName}/views/{$className}/fields.xml"); $fileName[] = array('public/files/templates/controller.php', "{$moduleName}/controllers/{$className}Controller.php"); $template = new MWizardTemplate(); $var = array(); $var['model'] = $className; $var['lookup'] = $description; $var['module'] = $moduleName ?: $appName; $template->setVar($var); $template->setFields(eval(stripslashes($ormmapdef))); foreach ($fileName as $f) { $template->setTemplate($f[0]); $template->apply(); $template->saveResult($f[1], $this->baseDir); } // define actions $upperClass = ucFirst($className); $actions[] = $tab . $tab . "'{$className}' => array('{$upperClass}', '{$moduleName}/{$className}/main', '{$moduleName}IconForm', '', A_ACCESS, array()),"; } $actions[] = $tab . "))\n"; $var['module'] = $moduleName ?: $appName; // create Actions $var['actions'] = implode("\n", $actions); $template = new MWizardTemplate(); $template->setVar($var); $template->setTemplate('/public/files/templates/actions.php'); $template->applyClass(); $template->saveResult("{$moduleName}/conf/actions.php", $this->baseDir); // create Conf $template = new MWizardTemplate(); $template->setTemplate('/public/files/templates/conf.php'); $template->applyClass(); $template->saveResult("{$moduleName}/conf/conf.php", $this->baseDir); // create Main $template = new MWizardTemplate(); $template->setVar($var); $template->setTemplate('/public/files/templates/main.xml'); $template->applyClass(); $template->saveResult("{$moduleName}/views/main/main.xml", $this->baseDir); $template->setTemplate('/public/files/templates/mainController.php'); $template->applyClass(); $template->saveResult("{$moduleName}/controllers/mainController.php", $this->baseDir); }
public function init() { parent::init(); $this->idLanguage = Manager::getSession()->idLanguage; }
public function listCEFERelations($idEntityCxn, $idEntityFrame, $relationEntry) { $idLanguage = \Manager::getSession()->idLanguage; $cxnElement = new ConstructionElement(); $criteria1 = $cxnElement->getCriteria()->select('idEntity'); Base::relation($criteria1, 'constructionelement', 'construction', 'rel_elementof'); $criteria1->where("construction.idEntity = {$idEntityCxn}"); $ce = $criteria1->asQuery()->chunkResult('idEntity', 'idEntity'); $frameElement = new FrameElement(); $criteria2 = $frameElement->getCriteria()->select('idEntity'); Base::relation($criteria2, 'frameelement', 'frame', 'rel_elementof'); $criteria2->where("frame.idEntity = {$idEntityFrame}"); $fe = $criteria2->asQuery()->chunkResult('idEntity', 'idEntity'); $criteria = $this->getCriteria()->select('idEntity1, relationtype.entry as idType, idEntity2'); $criteria->where("relationtype.entry = '{$relationEntry}'"); $criteria->where("idEntity1", "in", $ce); $criteria->where("idEntity2", "in", $fe); return $criteria; }
public function invokeHandler($m, $handler) { global $context, $module, $action, $item, $session, $page, $auth, $perms, $navbar, $theme, $history, $self, $url; if ($handler == '') { return false; } //$this->data = $data; $this->action = $handler; $app = Manager::getApp(); if ($m == '' || $m == $app) { $module = $app; $path = Manager::getAppPath() . '/controllers/'; } else { $module = $m; $path = Manager::getModulePath($module, 'controllers/'); } //mdump("Handler:invokeHandler: [$module][$handler]"); $context = Manager::getContext(); $action = $context->getAction(); $self = $context->getAction(); $item = mrequest('item'); $session = Manager::getSession(); $navbar = new MNavigationBar(); //$view = Manager::getView($module, 'handler', $action); $page = $this->theme; $url = Manager::getCurrentURL(); $auth = Manager::getAuth(); $perms = Manager::getPerms(); $theme = $this->theme; $file = $path . $handler . '.inc.php'; //mdump('Handler:invokeHandler: file : ' . $file); if ($return = file_exists($file)) { include $file; } return $return; }
public function listEvokesRelations() { $idLanguage = \Manager::getSession()->idLanguage; $cmd = <<<HERE SELECT RelationType.entry, entry_relatedFrame.name, relatedFrame.idEntity, relatedFrame.idFrame FROM Construction INNER JOIN Entity entity1 ON (Construction.idEntity = entity1.idEntity) INNER JOIN EntityRelation ON (entity1.idEntity = EntityRelation.idEntity1) INNER JOIN RelationType ON (EntityRelation.idRelationType = RelationType.idRelationType) INNER JOIN Entity entity2 ON (EntityRelation.idEntity2 = entity2.idEntity) INNER JOIN Frame relatedFrame ON (entity2.idEntity = relatedFrame.idEntity) INNER JOIN Entry entry_relatedFrame ON (relatedFrame.entry = entry_relatedFrame.entry) WHERE (Construction.idConstruction = {$this->getId()}) AND (RelationType.entry in ( 'rel_evokes')) AND (entry_relatedFrame.idLanguage = {$idLanguage} ) ORDER BY RelationType.entry, entry_relatedFrame.name HERE; $result = $this->getDb()->getQueryCommand($cmd)->treeResult('entry', 'name,idEntity,idFrame'); return $result; }
public function handlerResponse($return = false) { Manager::getSession()->freeze(); return $this->response->sendResponse($this->result, $return); }
public function listInverseRelations() { $idLanguage = \Manager::getSession()->idLanguage; $cmd = <<<HERE SELECT RelationType.entry, entry_relatedFrame.name, relatedFrame.idEntity, relatedFrame.idFrame FROM Frame INNER JOIN Entity entity2 ON (Frame.idEntity = entity2.idEntity) INNER JOIN EntityRelation ON (entity2.idEntity = EntityRelation.idEntity2) INNER JOIN RelationType ON (EntityRelation.idRelationType = RelationType.idRelationType) INNER JOIN Entity entity1 ON (EntityRelation.idEntity1 = entity1.idEntity) INNER JOIN Frame relatedFrame ON (entity1.idEntity = relatedFrame.idEntity) INNER JOIN Entry entry_relatedFrame ON (relatedFrame.entry = entry_relatedFrame.entry) WHERE (Frame.idFrame = {$this->getId()}) AND (RelationType.entry in ( 'rel_causative_of', 'rel_inchoative_of', 'rel_inheritance', 'rel_perspective_on', 'rel_precedes', 'rel_see_also', 'rel_subframe', 'rel_using')) AND (entry_relatedFrame.idLanguage = {$idLanguage} ) ORDER BY RelationType.entry, entry_relatedFrame.name HERE; $result = $this->getDb()->getQueryCommand($cmd)->treeResult('entry', 'name,idEntity,idFrame'); return $result; }
public function listElement2ElementRelation($elements1, $elements2, $type) { mdump('--' . $type); $idLanguage = \Manager::getSession()->idLanguage; $el1 = implode(',', $elements1); $el2 = implode(',', $elements2); $cmd = <<<HERE SELECT entry1.name as name1, er.idEntity1, model1.type as model1, entry2.name as name2, er.idEntity2, model2.type as model2 FROM EntityRelation er INNER JOIN Entity e1 ON (er.idEntity1 = e1.idEntity) INNER JOIN RelationType ON (er.idRelationType = RelationType.idRelationType) INNER JOIN Entity e2 ON (er.idEntity2 = e2.idEntity) INNER JOIN ( \t\t select entry, idEntity, 'fe' as type from FrameElement \t\t UNION select entry, idEntity, 'ce' as type from ConstructionElement \t\t) model1 on (e1.idEntity = model1.idEntity) INNER JOIN ( \t\t select entry, idEntity, 'fe' as type from FrameElement \t\t UNION select entry, idEntity, 'ce' as type from ConstructionElement \t\t) model2 on (e2.idEntity = model2.idEntity) INNER JOIN Entry entry1 ON (model1.entry = entry1.entry) INNER JOIN Entry entry2 ON (model2.entry = entry2.entry) WHERE (e1.idEntity IN ({$el1})) AND (e2.idEntity IN ({$el2})) AND (RelationType.entry = '{$type}') AND (entry1.idLanguage = {$idLanguage} ) AND (entry2.idLanguage = {$idLanguage} ) ORDER BY er.idEntity1, er.idEntity2 HERE; $result = $this->getDb()->getQueryCommand($cmd)->getResult(); return $result; }
public static function getAnnotationStatus($approvement = false, $validation = '1') { $level = \Manager::getSession()->fnbr20Level; if ($approvement) { if ($validation == '1') { $entries = ['SENIOR' => 'ast_sr_app', 'MASTER' => 'ast_ms_app']; } else { if ($validation == '0') { $entries = ['SENIOR' => 'ast_disapp', 'MASTER' => 'ast_disapp']; } else { if ($validation == '-1') { $entries = ['BEGINNER' => 'ast_doubt', 'JUNIOR' => 'ast_doubt']; } else { if ($validation == '-2') { $entries = ['BEGINNER' => 'ast_ignore', 'JUNIOR' => 'ast_ignore', 'SENIOR' => 'ast_ignore', 'MASTER' => 'ast_ignore']; } else { if ($validation == '-3') { $entries = ['BEGINNER' => 'ast_rel', 'JUNIOR' => 'ast_rel', 'SENIOR' => 'ast_rel', 'MASTER' => 'ast_rel']; } } } } } } else { $entries = ['BEGINNER' => 'ast_bg_ann', 'JUNIOR' => 'ast_jr_ann', 'SENIOR' => 'ast_sr_ann', 'MASTER' => 'ast_ms_app', 'ADMIN' => 'ast_ms_app']; } $entry = $entries[$level]; return $entry; }