Ejemplo n.º 1
0
 public function init()
 {
     parent::init();
     $this->idLanguage = Manager::getConf('options.language');
     $msgDir = Manager::getAppPath('conf/report');
     Manager::$msg->file = 'messages.' . $this->idLanguage . '.php';
     Manager::$msg->addMessages($msgDir);
 }
Ejemplo n.º 2
0
 public function init()
 {
     Manager::checkLogin(false);
     $this->idLanguage = Manager::getConf('fnbr20.lang');
     $msgDir = Manager::getAppPath('conf/report');
     Manager::$msg->file = 'messages.' . $this->idLanguage . '.php';
     Manager::$msg->addMessages($msgDir);
 }
Ejemplo n.º 3
0
 public function generateInner()
 {
     $css = Manager::getAbsolutePath('core/classes/extensions/geshi/geshi.css');
     Manager::getPage()->addStyleSheet($css);
     $cssCustom = Manager::getAppPath('public/css/geshiCustom.css');
     if (file_exists($cssCustom)) {
         Manager::getPage()->addStyleSheet($cssCustom);
     }
     $source = $this->getText();
     $language = $this->getLanguage();
     $geshi = new GeSHi($source, $language);
     $this->setText($geshi->parse_code());
     $this->inner = $this->render();
 }
Ejemplo n.º 4
0
 public function createScript()
 {
     $fileName = $this->data->script;
     $fileScript = Manager::getAppPath('public/files/scripts/') . $fileName;
     if (!file_exists($fileScript)) {
         $fileScript .= ".txt";
         if (!file_exists($fileScript)) {
             throw new Exception("Arquivo Script inexistente");
         }
     }
     $script = new MWizardScript();
     $baseDir = Manager::getOptions('basePath');
     $script->setBaseDir($baseDir);
     $script->setFile($fileScript);
     $script->generate();
     if (count($script->errors)) {
         $this->renderPrompt('error', $script->errors);
     } else {
         $this->renderPrompt('information', 'Arquivos gerados com sucesso em ' . $baseDir);
     }
 }
Ejemplo n.º 5
0
 public function show()
 {
     $file = Manager::getAppPath('public/files/controles.txt');
     $this->data->ini = parse_ini_file($file, true);
     $this->data->class = $this->data->lookupControl;
     $this->data->description = $this->data->ini[$this->data->class]['description'];
     $this->data->extends = $this->data->ini[$this->data->class]['extends'];
     $this->data->attributes = array();
     $attributes = $this->data->ini[$this->data->class]['attributes'];
     if (is_array($attributes)) {
         foreach ($attributes as $name => $description) {
             $this->data->attributes[$name]['name'] = $name;
             $this->data->attributes[$name]['class'] = $this->data->class;
             $this->data->attributes[$name]['description'] = $description;
         }
     }
     $header = $this->data->ini[$this->data->class];
     $extends = $header['extends'];
     while ($extends) {
         $parent = $this->data->ini[$extends];
         $attributes = $parent['attributes'];
         if (is_array($attributes)) {
             foreach ($attributes as $name => $description) {
                 $this->data->attributes[$name]['name'] = $name;
                 $this->data->attributes[$name]['class'] = $extends;
                 $this->data->attributes[$name]['description'] = $description;
             }
         }
         $extends = $parent['extends'];
     }
     ksort($this->data->attributes);
     $codeXML = Manager::getAppPath('public/files/code/' . strtolower($this->data->class) . '.xml');
     $this->data->code = highlight_file($codeXML, true);
     //htmlentities(file_get_contents($codeXML));
     mdump($codeXML);
     mdump($this->data->code);
     $this->render();
 }
Ejemplo n.º 6
0
 public function file($type, $fileName)
 {
     if ($type == 'file') {
         $file = $this->path . '/' . $fileName;
     } elseif ($type == 'component') {
         $file = Manager::getAppPath('components/' . $fileName);
     }
     return $file;
 }
Ejemplo n.º 7
0
 public function getClassMap($className, $module = '', $class = '')
 {
     $className = str_replace('\\', '', $className);
     if (isset($this->classMaps[$className])) {
         return $this->classMaps[$className];
     }
     if ($module == '') {
         $module = $this->location[$className]['module'];
         $class = $this->location[$className]['class'];
     } else {
         $this->location[$className]['module'] = $module;
         $this->location[$className]['class'] = $class;
     }
     $xml = $this->getMap($module, $class, $className);
     $database = (string) $xml->databaseName;
     $classMap = new ClassMap($className, $database);
     $classMap->setDatabaseName($database);
     $classMap->setTableName((string) $xml->tableName);
     if (isset($xml->extends)) {
         $classMap->setSuperClassName((string) $xml->extends);
     }
     //$config = $className::config();
     $attributes = $this->getAsArray($xml->attribute);
     foreach ($attributes as $attr) {
         $attributeMap = new AttributeMap((string) $attr->attributeName, $classMap);
         //     $converter = $this->getConverter($attr);
         if (isset($attr->attributeIndex)) {
             $attributeMap->setIndex($attr->attributeIndex);
         }
         $type = isset($attr->columnType) ? strtolower($attr->columnType) : 'string';
         if (($converterName = strtolower($attr->converter->converterName)) != '') {
             if ($converterName == 'timestampconverter') {
                 $type = 'timestamp';
             }
         }
         $attributeMap->setType($type);
         $plataformTypedAttributes = $classMap->getDb()->getPlatform()->getTypedAttributes();
         $attributeMap->setHandled(strpos($plataformTypedAttributes, $type));
         $attributeMap->setColumnName($attr->columnName ?: $attributeName);
         $attributeMap->setAlias($attr->aliasName ?: $attributeName);
         $attributeMap->setKeyType($attr->key ?: 'none');
         $attributeMap->setIdGenerator($attr->idgenerator);
         if (isset($attr->reference) && $classMap->getSuperClassMap() != NULL) {
             $referenceAttribute = $classMap->getSuperClassMap()->getAttributeMap($attributeName);
             if ($referenceAttribute) {
                 $attributeMap->setReference($referenceAttribute);
             }
         }
         $classMap->addAttributeMap($attributeMap);
     }
     $this->classMaps[$className] = $classMap;
     if (isset($xml->association)) {
         $associations = $this->getAsArray($xml->association);
         $fromClassMap = $classMap;
         foreach ($associations as $association) {
             $associationName = (string) $association->target;
             $toClass = 'business' . $association->toClassModule . $association->toClassName;
             $this->location[$toClass]['module'] = $association->toClassModule;
             $this->location[$toClass]['class'] = $association->toClassName;
             $classPath = Manager::getAppPath("modules/" . $association->toClassModule . '/models/' . $association->toClassName . '.class.php');
             Manager::addAutoloadClass($toClass, $classPath);
             $associationMap = new AssociationMap($classMap, $associationName);
             $associationMap->setToClassName($toClass);
             $associationMap->setDeleteAutomatic($association->deleteAutomatic);
             $associationMap->setSaveAutomatic($association->saveAutomatic);
             $associationMap->setRetrieveAutomatic($association->retrieveAutomatic);
             //$associationMap->setJoinAutomatic($association['joinAutomatic']);
             $autoAssociation = strtolower($className) == strtolower($toClass);
             if (!$autoAssociation) {
                 $autoAssociation = strtolower($className) == strtolower(substr($toClass, 1));
             }
             $associationMap->setAutoAssociation($autoAssociation);
             if (isset($association->indexAttribute)) {
                 $associationMap->setIndexAttribute($association->indexAttribute->indexAttributeName);
             }
             $associationMap->setCardinality($association->cardinality);
             if ($association->cardinality == 'manyToMany') {
                 $associativeClassName = 'business' . $association->associativeClassModule . $association->associativeClassName;
                 $associativeXML = $this->getMap($association->associativeClassModule, $association->associativeClassName, $associativeClassName);
                 $associationMap->setAssociativeTable((string) $associativeXML->tableName);
             } else {
                 $entries = $this->getAsArray($association->entry);
                 $inverse = $association->inverse == 'true';
                 foreach ($entries as $entry) {
                     $fromAttribute = $inverse ? $entry->toAttribute : $entry->fromAttribute;
                     $toAttribute = $inverse ? $entry->fromAttribute : $entry->toAttribute;
                     $associationMap->addKeys($fromAttribute, $toAttribute);
                 }
             }
             if (isset($association->orderAttribute)) {
                 $order = array();
                 $orderAttributes = $this->getAsArray($association->orderAttribute);
                 foreach ($orderAttributes as $orderAttr) {
                     $ascend = $orderAttr->orderAttributeDirection == 'ascend';
                     $order[] = array($orderAttr->orderAttributeName, $ascend);
                 }
                 if (count($order)) {
                     $associationMap->setOrder($order);
                 }
             }
             $fromClassMap->putAssociationMap($associationMap);
         }
     }
     return $classMap;
 }
Ejemplo n.º 8
0
 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;
 }
Ejemplo n.º 9
0
<?php

return array('basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..', 'name' => 'Exemplos', 'instituicao' => 'Framework Maestro', 'import' => array('models.*'), 'theme' => array('name' => 'default', 'template' => 'index'), 'ui' => array('inlineFormAction' => true), 'login' => array('module' => "", 'class' => "MAuthDbMd5", 'check' => false), 'filters' => array('session', 'profile'), 'db' => array('exemplos' => array('driver' => 'sqlite3', 'path' => Manager::getAppPath('models/sql/exemplos.db'), 'formatDate' => '%d/%m/%Y', 'formatTime' => '%H:%M:%S', 'configurationClass' => 'Doctrine\\DBAL\\Configuration')));
Ejemplo n.º 10
0
 private function getControlsFromInclude($node, &$controls, $handleChildren = false)
 {
     if ($node) {
         $attributes = $node->attributes();
         if ($attributes['file']) {
             $fileName = $attributes['file'];
             $file = $this->path . '/' . $this->processValue($fileName);
         } elseif ($attributes['component']) {
             $fileName = $attributes['component'];
             $file = Manager::getAppPath('components/' . $fileName);
         }
         $extension = pathinfo($file, PATHINFO_EXTENSION);
         if ($extension == 'xml') {
             $xmlControls = new MXMLControls();
             $xmlControls->loadFile($file, $this->context);
             if ($handleChildren) {
                 $this->handleChildren($controls, $xmlControls->root);
             } else {
                 foreach ($xmlControls->get() as $c) {
                     $this->getControlFromDOM($c, $node);
                     $controls[] = $c;
                 }
             }
         } elseif ($extension == 'php') {
             include_once $file;
             $fileName = end(explode('/', $fileName)) ?: $fileName;
             $className = str_replace('.' . $extension, '', $fileName);
             $c = new $className();
             $this->getControlFromDOM($c, $node);
             if ($handleChildren) {
                 $controls->addControl($c);
             } else {
                 $controls[] = $c;
             }
         }
     }
 }
Ejemplo n.º 11
0
 public function addApplicationActions()
 {
     $actionsFile = Manager::getAppPath('conf/actions.php');
     Manager::loadActions($actionsFile);
 }
Ejemplo n.º 12
0
 private function getContent($controller, $view, $parameters = NULL)
 {
     $path = '/views/' . $controller . '/' . $view;
     if (is_dir(Manager::getAppPath($path, $this->module))) {
         $path .= '/' . $view;
     }
     if (file_exists($file = Manager::getAppPath($path . '.php', $this->module, $this->application))) {
         // try php view
         mtrace('MController::getContent from ' . $file);
         $this->renderView($controller, $file, $parameters);
     } elseif (file_exists($file = Manager::getAppPath($path . '.xml', $this->module, $this->application))) {
         // php view not found, try xml view
         mtrace('MController::getContent from ' . $file);
         $this->renderView($controller, $file, $parameters);
     } elseif (file_exists($file = Manager::getAppPath($path . '.js', $this->module, $this->application))) {
         // xml view not found, try js view
         mtrace('MController::getContent from ' . $file);
         $this->renderView($controller, $file, $parameters);
     } elseif (file_exists($file = Manager::getAppPath($path . '.html', $this->module, $this->application))) {
         // js view not found, try html view
         mtrace('MController::getContent from ' . $file);
         $this->renderView($controller, $file, $parameters);
     } elseif (file_exists($file = Manager::getAppPath($path . '.wiki', $this->module, $this->application))) {
         // html view not found, try wiki view
         mtrace('MController::getContent from ' . $file);
         $this->renderView($controller, $file, $parameters);
     }
 }
Ejemplo n.º 13
0
 public function setFieldsFromXML($file = 'fields.xml', $fileXML = '', $data = NULL, $folder = '')
 {
     if (count(func_get_args()) > 1) {
         // compatibilidade
         $path = Manager::getAppPath('', $file . '/views/' . ($folder ? $folder . '/' : '') . $fileXML . '.xml');
         $this->data->_xmlParams = $data;
     } else {
         $path = pathinfo($this->view->viewFile, PATHINFO_DIRNAME) . '/' . $file;
     }
     $this->clearFields();
     $this->addControlsFromXML($path);
 }
Ejemplo n.º 14
0
 public function saveResult($fileName, $baseDir = '')
 {
     if ($baseDir != '') {
         $file = $baseDir;
         //Manager::getAppPath($baseDir);
         $dirs = explode('/', $fileName);
         $n = count($dirs);
         if ($n > 0) {
             $path = $file;
             for ($i = 0; $i < $n - 1; $i++) {
                 $path .= '/' . $dirs[$i];
                 if (!is_dir($path)) {
                     mkdir($path);
                     chmod($path, octdec(777));
                 }
             }
         }
         $file .= '/' . $fileName;
     } else {
         $file = Manager::getAppPath($fileName);
         $path = pathinfo($file, PATHINFO_DIRNAME);
         if (!is_dir($path)) {
             mkdir($path);
             chmod($path, octdec(777));
         }
     }
     file_put_contents($file, $this->resultFile);
     chmod($file, octdec(777));
 }