Ejemplo n.º 1
0
 /**
  * Cria os arquivos do CRUD
  * 
  * @param type $profile
  * @param type $table
  * @param type $adapter
  * @param type $module
  * @param type $overwrite
  * @throws Zend_Tool_Project_Provider_Exception 
  */
 private function _create($profile, $table, $adapter, $module, $overwrite)
 {
     $this->_registry->getRequest()->isPretend();
     $this->_print(' Criando CRUD ');
     $this->_print(' table: ' . $table . ' | adapter : ' . $adapter . ' | module: ' . $module);
     $table = strtolower($table);
     $module = strtolower($module);
     $path = $profile->getAttribute('projectDirectory');
     $dirModules = $path . '/application/configs/modules';
     if (!is_dir($dirModules)) {
         mkdir($dirModules);
     }
     $dirModule = $dirModules . '/' . $module;
     if (!is_dir($dirModule)) {
         mkdir($dirModule);
     }
     $fileName = $dirModule . '/' . $table . '.php';
     if (!file_exists($fileName)) {
         throw new Zend_Tool_Project_Provider_Exception('Para executar essa ação é necessário criar o arquivo ' . $fileName);
     }
     $config = (require $fileName);
     $this->_print(' Criando Tables ');
     ZendT_Tool_Crud_Table::create($path, $config);
     $this->_print(' Criando Mappers ');
     ZendT_Tool_Crud_Mapper::create($path, $config);
     $this->_print(' Criando MapperView ');
     ZendT_Tool_Crud_MapperView::create($path, $config);
     $this->_print(' Criando Element ');
     ZendT_Tool_Crud_Element::create($path, $config);
     $this->_print(' Criando Form ');
     ZendT_Tool_Crud_Form::create($path, $config);
     $this->_print(' Criando Controller ');
     ZendT_Tool_Crud_Controller::create($path, $config, $overwrite);
     $this->_print(' Criando Service ');
     ZendT_Tool_Crud_Service::create($path, $config);
     $this->_print(' Criando Language ');
     ZendT_Tool_Crud_Language::create($path, $config);
     $this->_print(' Criando Bootstrap ');
     ZendT_Tool_Crud_Bootstrap::create($path, $config);
     $this->_print(' Criando View ');
     ZendT_Tool_Crud_View::create($path, $config);
 }
Ejemplo n.º 2
0
 /**
  * check if this date has any date qualifiers. Return true if no date qualifiers are found.
  * 
  * @param type $fact
  * @return boolean
  */
 private function isDateDMY($fact)
 {
     if ($fact && !preg_match('/^(FROM|BET|TO|AND|BEF|AFT|CAL|EST|INT|ABT) (.+)/', $fact->getAttribute('DATE'))) {
         return true;
     }
 }
Ejemplo n.º 3
0
 /**
  * TODO: Create this description
  * 
  * @param type $model
  * @return string 
  */
 public function render($model)
 {
     //$array = $model->getAttributes($this->_modelFormatType);
     /**
      * The extract function makes the array keys available as variables in the current function scope.
      * we need this for the eval functoion.
      * 
      * example $array = array('name'=>'Pete'); becomes $name='Pete';
      * 
      * In the column definition we can supply a format like this:
      * 
      * 'format'=>'$name'
      */
     //extract($array);
     extract($this->_extraVars);
     if (isset($this->_format)) {
         $result = '';
         if ($this->_format != '') {
             eval('$result=' . $this->_format . ';');
         }
         return $result;
     } elseif (isset($model->{$this->_dataindex})) {
         if ($model instanceof \GO\Base\Db\ActiveRecord) {
             return $model->getAttribute($this->_dataindex, $this->_modelFormatType);
         }
         return $model->{$this->_dataindex};
     } else {
         return "";
     }
 }
Ejemplo n.º 4
0
 /**
  * 
  * @param type $component
  * @param type $content
  * @return type
  */
 static function getElementComponentContent($component, $type, $content)
 {
     if ($component->getAttribute('bearcms-internal-attribute-container') === 'none') {
         return $content;
     }
     $attributes = '';
     if ($component->editable === 'true') {
         $htmlElementID = 'brelc' . md5($component->id);
         ElementsHelper::$editorData[] = ['element', $component->id, self::getComponentContextData($component), $type];
         $attributes .= ' id="' . $htmlElementID . '"';
     }
     return '<div' . $attributes . '>' . $content . '</div>';
 }
 /**
  * Returns option value with associated disabled flag
  *
  * @param type $node
  *
  * @return array
  */
 private function buildOptionValue($node)
 {
     $option = array();
     $defaultValue = isset($node->nodeValue) && !empty($node->nodeValue) ? $node->nodeValue : '1';
     $option['value'] = $node->hasAttribute('value') ? $node->getAttribute('value') : $defaultValue;
     $option['disabled'] = $node->hasAttribute('disabled') && $node->getAttribute('disabled') == 'disabled';
     return $option;
 }
Ejemplo n.º 6
0
 /**
  * Retrieves classes for element
  *
  * @param type $element NodeElement
  *
  * @return array without t_ already
  */
 private function retrieveClassesForElement($element)
 {
     $classes = $element->getAttribute('class');
     $matches = array();
     preg_match_all('/t_([a-zA-Z0-9\\_]+)/', $classes, $matches);
     return $matches[1];
 }