Example #1
0
 public function onAfterCreate()
 {
     mtracestack();
     $this->addControl(new MLabel($this->getMessage()));
     $this->addControl(new MTextField('componentPessoa[idPessoa]', '', 'IdPessoa'));
     $this->addControl(new MTextField('componentPessoa[nome]', '', 'Nome'));
     $this->addControl(new MCalendarField('component[dataNascimento]', '', 'Nascimento'));
     $this->backgroundColor = '#EEE';
 }
Example #2
0
 public function __construct($id, $basePath)
 {
     $this->id = $id;
     $this->basePath = $basePath;
     mdump('basepath = ' . $basePath);
     mtracestack();
     //$this->loadModules();
     $this->loadControllers();
     $this->loadServices();
     $this->loadComponents();
     $this->loadFilters();
     $this->loadModels();
     //$this->loadMaps();
 }
Example #3
0
 public function __set($name, $value)
 {
     if ($name == '') {
         mtracestack();
     }
     switch ($name) {
         case 'color':
         case 'font':
         case 'border':
         case 'overflow':
         case 'cursor':
             $this->addStyle($name, $value);
             break;
         case 'padding':
         case 'margin':
         case 'width':
         case 'height':
         case 'float':
         case 'clear':
         case 'visibility':
             $this->addStyle($name, $value);
             //$this->addStyle('display', 'block');
             break;
         case 'top':
         case 'left':
         case 'position':
             $this->addStyle($name, $value);
             $this->cssp = true;
             break;
         case 'fontSize':
             $this->addStyle('font-size', $value);
             break;
         case 'fontStyle':
             $this->addStyle('font-style', $value);
             break;
         case 'fontFamily':
             $this->addStyle('font-family', $value);
             break;
         case 'fontWeight':
             $this->addStyle('font-weight', $value);
             break;
         case 'textAlign':
             $this->addStyle('text-align', $value);
             break;
         case 'textIndent':
             $this->addStyle('text-indent', $value);
             break;
         case 'lineHeight':
             $this->addStyle('line-height', $value);
             break;
         case 'zIndex':
             $this->addStyle('z-index', $value);
             break;
         case 'backgroundColor':
             $this->addStyle('background-color', $value);
             break;
         case 'verticalAlign':
             $this->addStyle('vertical-align', $value);
             break;
         case 'borderCollapse':
             $this->addStyle('border-collapse', $value);
             break;
         case 'borderWidth':
             $this->addStyle('border-width', $value);
             break;
         case 'borderSpacing':
             $this->addStyle('border-spacing', $value);
             break;
         case 'borderTop':
             $this->addStyle('border-top', $value);
             break;
         case 'borderRight':
             $this->addStyle('border-right', $value);
             break;
         case 'borderBottom':
             $this->addStyle('border-bottom', $value);
             break;
         case 'borderLeft':
             $this->addStyle('border-left', $value);
             break;
         case 'emptyCells':
             $this->addStyle('empty-cells', $value);
             break;
         default:
             //mdump($name . ' - ' . $value);
             break;
     }
 }
Example #4
0
 public function getClassMap($className)
 {
     if ($className == '') {
         mtracestack();
     }
     //$className = strtolower(trim($className));
     $classIndex = strtolower(trim($className));
     if ($className[0] == '\\') {
         $className = substr($className, 1);
     }
     if ($className == '') {
         return;
     }
     if (isset($this->classMaps[$classIndex])) {
         return $this->classMaps[$classIndex];
     }
     $map = $this->getMap($className);
     //var_dump($map);
     $database = $map['database'];
     $classMap = new \Maestro\Persistence\Map\ClassMap($className, $database);
     $classMap->setDatabaseName($database);
     $classMap->setTableName($map['table']);
     if (isset($map['extends'])) {
         $classMap->setSuperClassName($map['extends']);
     }
     $config = $className::config();
     $attributes = $map['attributes'];
     foreach ($attributes as $attributeName => $attr) {
         $attributeMap = new \Maestro\Persistence\Map\AttributeMap($attributeName, $classMap);
         if (isset($attr['index'])) {
             $attributeMap->setIndex($attr['index']);
         }
         $type = isset($attr['type']) ? strtolower($attr['type']) : 'string';
         $attributeMap->setType($type);
         $plataformTypedAttributes = $classMap->getDb()->getPlatform()->getTypedAttributes();
         $attributeMap->setHandled(strpos($plataformTypedAttributes, $type) !== false);
         if ($config['converters'][$attributeName]) {
             $attributeMap->setConverter($config['converters'][$attributeName]);
         }
         $attributeMap->setColumnName($attr['column'] ?: $attributeName);
         $attributeMap->setAlias($attr['alias'] ?: $attributeName);
         $attributeMap->setKeyType($attr['key'] ?: 'none');
         $attributeMap->setIdGenerator($attr['idgenerator']);
         if ($attr['key'] == 'reference' && $classMap->getSuperClassMap() != NULL) {
             $referenceAttribute = $classMap->getSuperClassMap()->getAttributeMap($attributeName);
             if ($referenceAttribute) {
                 $attributeMap->setReference($referenceAttribute);
             }
         }
         $classMap->addAttributeMap($attributeMap);
     }
     $this->classMaps[$classIndex] = $classMap;
     if ($referenceAttribute) {
         // set superAssociationMap
         $attributeName = $referenceAttribute->getName();
         $superClassName = $classMap->getSuperClassMap()->getName();
         $superAssociationMap = new \Maestro\Persistence\Map\AssociationMap($classMap, $superClassName);
         $superAssociationMap->setToClassName($superClassName);
         $superAssociationMap->setToClassMap($classMap->getSuperClassMap());
         $superAssociationMap->setCardinality('oneToOne');
         $superAssociationMap->addKeys($attributeName, $attributeName);
         $superAssociationMap->setKeysAttributes();
         $classMap->setSuperAssociationMap($superAssociationMap);
     }
     $associations = $map['associations'];
     if (isset($associations)) {
         $fromClassMap = $classMap;
         foreach ($associations as $associationName => $association) {
             $toClass = $association['toClass'];
             $associationMap = new \Maestro\Persistence\Map\AssociationMap($classMap, $associationName);
             $associationMap->setToClassName($toClass);
             //$associationMap->setTargetAttributeName($associationName);
             $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['index'])) {
                 $associationMap->setIndexAttribute($association['index']);
             }
             $associationMap->setCardinality($association['cardinality']);
             if ($association['cardinality'] == 'manyToMany') {
                 $associationMap->setAssociativeTable($association['associative']);
             } else {
                 $arrayKeys = explode(',', $association['keys']);
                 foreach ($arrayKeys as $keys) {
                     $key = explode(':', $keys);
                     $associationMap->addKeys($key[0], $key[1]);
                 }
             }
             if (isset($association['order'])) {
                 $order = array();
                 $orderAttributes = explode(',', $association['order']);
                 foreach ($orderAttributes as $orderAttr) {
                     $o = explode(' ', $orderAttr);
                     $ascend = substr($o[1], 0, 3) == 'asc';
                     $order[] = array($o[0], $ascend);
                 }
                 if (count($order)) {
                     $associationMap->setOrder($order);
                 }
             }
             $fromClassMap->putAssociationMap($associationMap);
         }
     }
     return $classMap;
 }
Example #5
0
 public function __construct($msg = null, $code = 0)
 {
     parent::__construct($msg, $code);
     $this->message = $msg;
     $this->trace = mtracestack();
 }