示例#1
0
 /**
  *
  *
  * @param type $values
  * @param type $view
  * @param type $code
  * @return type
  */
 public function htmlView($values = null, $view = null, $code = null)
 {
     // pass $data values to $this ($app)
     if (is_array($values)) {
         foreach ($values as $field => $value) {
             $this->{$field} = $value;
         }
     }
     // get code for related view
     $currentCode = $code ? $code : $this->request->code;
     // get
     $currentView = $view ? $view : $this->request->view;
     //
     if ($this->_module) {
         $viewFile = $this->_module->path . "/view/{$currentCode}/{$currentView}.phtml";
     } else {
         if ($this->_modules['common']) {
             $viewFile = $this->_modules['common']->path . "/view/{$currentCode}/{$currentView}.phtml";
         } else {
             Runtime::error('required common module', 99303);
         }
     }
     //
     if (!file_exists($viewFile)) {
         Runtime::error("file not found: {$viewFile}", 99102);
     }
     //
     return $this->outputBufferInclude($viewFile);
 }
示例#2
0
 /**
  * 
  * @param type $acl
  */
 public function accessDenied($acl)
 {
     //
     //$this->error("Access denied for resource: '{$acl}'",403);
     //
     $app = Liberty\Runtime::getApp();
     //
     $app->redirect('auth');
 }
示例#3
0
 /**
  *
  *
  */
 public function resourceNotFound()
 {
     //
     //$this->error("Access denied for resource: '{$acl}'",403);
     //
     $app = Runtime::getApp();
     //
     $app->redirect('auth');
 }
示例#4
0
 /**
  *
  *
  */
 public function requireOnceModuleFile($moduleName, $moduleVersion)
 {
     //
     $moduleCode = ucfirst($moduleName);
     //
     $modulePath = __BASE__ . '/module/' . $moduleName . '/' . intval($moduleVersion);
     //
     $moduleClass = '\\Module\\' . $moduleCode . '\\' . $moduleCode . 'Module';
     //
     if (!class_exists($moduleClass)) {
         Runtime::error("class not found (for module): {$moduleClass}", 99204);
     }
     //
     $moduleObject = new $moduleClass();
     //
     $this->_modules[$moduleName] = (object) array('name' => $moduleName, 'path' => $modulePath, 'class' => $moduleClass, 'object' => $moduleObject, 'version' => $moduleVersion, 'namespace' => 'Module\\' . $moduleCode);
     //
     $this->loadModuleTextFile($moduleName, $modulePath);
 }
示例#5
0
 /**
  * 
  * @param type $path
  * @param type $args
  */
 public function redirect($path, $args = array())
 {
     //
     $url = !Urlman::isUrl($path) ? __HOME__ . '/' . trim($path, '/') : $path;
     //
     Runtime::redirect($url, $args);
 }
示例#6
0
 /**
  * Handle errors
  * 
  * @param type $message
  * @param type $code
  */
 public function error($message, $code = 0)
 {
     //
     Runtime::error($message, $code);
     //
     exit;
 }
示例#7
0
文件: Form.php 项目: javanile/liberty
 /**
  * 
  * @param type $label
  */
 public function drawFormCell($label, $size = 12)
 {
     //
     if (!$this->_formCurrentPanel) {
         Runtime::error('Call drawFromField() outside of drawFormPanels methods', 99101);
     }
     //
     $this->_formCellCounting += $size;
     //
     echo $this->_formOutputBuffer;
     //
     if ($this->_formCellCounting > 12) {
         //
         echo '</div><div class="row">';
         //
         $this->_formCellCounting = $size;
     }
     //
     echo '<div class="col-xs-' . $size . '">';
     //
     if ($label) {
         echo '<label>' . $label . '</label>';
     }
     //
     $this->_formOutputBuffer = '</div>';
 }