Exemple #1
0
 /**
  * This method is used to process the data into the view and than return it to the main method that will handle what to do.
  * It also uses buffer to handle that content.
  *
  * @author Klederson Bueno <*****@*****.**>
  * @version 0.1a
  *
  * @param String $___phpBurnFilePath
  * @param Array $__phpBurnData
  * @return String
  */
 public function processViewData($___phpBurnFilePath, $__phpBurnData)
 {
     $tpl = new PHPTAL($___phpBurnFilePath);
     $tpl->setOutputMode(PHPTAL::HTML5);
     $tr = new PHPTAL_GetTextTranslator();
     // set language to use for this session (first valid language will
     // be used)
     $tr->setLanguage('pt_BR.utf8', 'pt_BR');
     // register gettext domain to use
     $tr->addDomain('system', SYS_BASE_PATH . 'locale');
     // specify current domain
     $tr->useDomain('system');
     // tell PHPTAL to use our translator
     $tpl->setTranslator($tr);
     foreach ($__phpBurnData as $index => $value) {
         if (is_string($value)) {
             $value = PhpBURN_Views::lazyTranslate($value, $_SESSION['lang']);
         }
         $tpl->{$index} = $value;
     }
     ob_start();
     try {
         echo $tpl->execute();
     } catch (Exception $e) {
         echo $e;
     }
     $___phpBurnBufferStored = ob_get_contents();
     //
     //        //Cleaning the buffer for new sessions
     ob_clean();
     return $___phpBurnBufferStored;
 }
Exemple #2
0
 /**
  * This method is used to process the data into the view and than return it to the main method that will handle what to do.
  * It also uses buffer to handle that content.
  *
  * @author Klederson Bueno <*****@*****.**>
  * @version 0.1a
  *
  * @param String $___phpBurnFilePath
  * @param Array $__phpBurnData
  * @return String
  */
 public function processViewData($___phpBurnFilePath, $__phpBurnData)
 {
     //Starting a new buffer
     ob_start();
     //Parsing Array data to Variables
     foreach ($__phpBurnData as $__index => $__value) {
         if (is_string($value)) {
             $value = PhpBURN_Views::lazyTranslate($value);
         }
         ${$__index} = $__value;
     }
     include $___phpBurnFilePath;
     //Storing buffer result to a var
     $___phpBurnBufferStored = ob_get_contents();
     //Cleaning the buffer for new sessions
     ob_clean();
     return $___phpBurnBufferStored;
 }
Exemple #3
0
 /**
  * This method is used to process the data into the view and than return it to the main method that will handle what to do.
  * It also uses buffer to handle that content.
  *
  * @author Klederson Bueno <*****@*****.**>
  * @version 0.1a
  *
  * @param String $___phpBurnFilePath
  * @param Array $__phpBurnData
  * @return String
  */
 public function processViewData($___phpBurnFilePath, $__phpBurnData)
 {
     $tpl = new PHPTAL($___phpBurnFilePath);
     $tpl->setOutputMode(PHPTAL::HTML5);
     foreach ($__phpBurnData as $index => $value) {
         if (is_string($value)) {
             $value = PhpBURN_Views::lazyTranslate($value, PhpBURN_Views::getLang());
         }
         $tpl->{$index} = $value;
     }
     ob_start();
     try {
         echo $tpl->execute();
     } catch (Exception $e) {
         echo $e;
     }
     $___phpBurnBufferStored = ob_get_contents();
     //
     //        //Cleaning the buffer for new sessions
     ob_clean();
     return PhpBURN_Views::lazyTranslate($___phpBurnBufferStored, PhpBURN_Views::getLang());
 }
Exemple #4
0
 /**
  * Loads a view, process data and print/store it.
  *
  * @param String $view
  * @param Array $data
  * @param Boolean $toVar
  *
  * @return String
  */
 public function loadView($view, array $data, $toVar = false, $statusCode = NULL)
 {
     return PhpBURN_Views::loadView($view, $data, $toVar, $statusCode);
 }
Exemple #5
0
 /**
  * Loads a view, process data and print/store it.
  *
  * @param String $view
  * @param Array $data
  * @param Boolean $toVar
  *
  * @return String
  */
 public function loadView($view, array $data, $toVar = false)
 {
     return PhpBURN_Views::loadView($view, $data, $toVar);
 }
Exemple #6
0
 public function constructModelFiles($package = null, $tableName = null)
 {
     if (is_writable(SYS_MODEL_PATH)) {
         foreach (self::$rawFields as $fullName => $arrContent) {
             preg_match_all("((([a-z,A-Z,0-9,_]+)\\.)?([a-z,A-Z,0-9\\.,_]+))", $fullName, $separation);
             PhpBURN_Views::setViewMethod('default');
             $viewData['package'] = $separation[2][0];
             $viewData['tableName'] = $separation[3][0];
             $viewData['className'] = ucwords(str_replace('.', '_', $separation[3][0]));
             $viewData['rawFields'] = $arrContent;
             $viewData['fields'] = self::$fields[$fullName];
             $viewData['rawFks'] = isset(self::$rawFks[strtolower($separation[3][0])]) ? self::$rawFks[strtolower($separation[3][0])] : self::$rawFks[$separation[3][0]];
             $viewData['fks'] = isset(self::$fks[strtolower($separation[3][0])]) ? self::$fks[strtolower($separation[3][0])] : self::$fks[$separation[3][0]];
             $content = "<?php\r\n";
             $content .= PhpBURN_Views::loadViewFile(self::$thisPath . DS . 'modelTemplate.html', $viewData, true);
             $content .= "\r\n?>\r\n";
             if (!is_dir(SYS_MODEL_PATH . $viewData['package'])) {
                 SYS_MODEL_PATH . $viewData['package'];
                 mkdir(SYS_MODEL_PATH . $viewData['package'], 0777, true);
             }
             $file = $viewData['className'];
             $fileName = sprintf("%s%s", $file, SYS_MODEL_EXT);
             $filePath = SYS_MODEL_PATH . $viewData['package'];
             $file = fopen($filePath . DS . $fileName, 'w+');
             fwrite($file, $content);
             fclose($file);
             $outputMessage = sprintf("[!Creating Model!]: %s", $filePath . DS . $fileName);
             PhpBURN_Message::output($outputMessage);
             unset($content);
         }
     } else {
         $outputMessage = sprintf("%s [!is not writable!]", SYS_MODEL_PATH);
         PhpBURN_Message::output($outputMessage);
     }
 }
Exemple #7
0
 public static function setViewMethod($method)
 {
     self::$viewMethod = $method;
 }