Exemple #1
0
 public static function getInstance()
 {
     if (responseLib::$instance == null) {
         responseLib::$instance = new highlightresponse();
     }
     return responseLib::$instance;
 }
 public function loaddatepicker()
 {
     $response = responseLib::getInstance();
     if ($this->time) {
         $response->script("setTimeout(\"my_datepicker_time.attach();\",500);");
     } else {
         $response->script("setTimeout(\"my_datepicker.attach();\",500);");
     }
 }
Exemple #3
0
 public function controller($self)
 {
     $this->self = $self;
     if ($this->self == '') {
         $trace = debug_backtrace();
         if ($trace[1]['object'] instanceof controller) {
             $this->self = $trace[1]['object']->getSelf();
         }
     }
     $this->response = responseLib::getInstance();
 }
Exemple #4
0
 public function __construct($id)
 {
     $this->id = $id;
     $this->namespace = $this->id;
     $this->conditions = '';
     $this->defaultpagesize = 10;
     $this->page = 1;
     $old = myviewstate::rebuild($this, $this->id);
     if ($this->modelname != '') {
         $this->model = new $this->modelname();
     }
     $response = responseLib::getInstance();
 }
Exemple #5
0
 function validate($value, $form = null)
 {
     $this->form = $form;
     $valid = true;
     foreach ($this->validator as $req) {
         list($function, $param) = explode(':', $req, 2);
         $function = 'validate_' . $function;
         if (!call_user_func(array($this, $function), $param, $value)) {
             $valid = false;
         }
     }
     $response = responseLib::getInstance();
     if (!$valid) {
         $template = new ui($this);
         $template->assign('validateerror', $this->validateerror);
         //$response->assign($this->id . '_error' , 'innerHTML' , $template->fetch('validateerror.tpl'),true);
         $response->assign($this->id, 'title', $template->fetch('validateerror.tpl'));
         $response->script("highlightformfielderror('{$this->id}')");
     } else {
         $response->assign($this->id, 'title', '');
         $response->script("removehighlightformfielderror('{$this->id}')");
     }
     return $valid;
 }
 public function loaddatepicker()
 {
     $response = responseLib::getInstance();
     $response->script("setTimeout(\"my_timepicker.attach();\",500);");
 }
Exemple #7
0
 public function run()
 {
     require FRAMEWORK . DS . 'conf' . DS . 'dispatcher.php';
     require FRAMEWORK . DS . 'conf' . DS . 'auth.php';
     $pageid = isset($_GET['pageid']) ? $_GET['pageid'] : $defaultPageid;
     $page = $this->resolvePage($pageid);
     $pageid = $page->getId();
     $module_pageModel = new modulepageModel();
     //	-1 equals all pages
     $req = array();
     $req['pageid'] = array('mode' => 'IN', 'value' => array('-1', $pageid));
     $order = array('fields' => array('areaid', 'order'), 'type' => 'ASC');
     try {
         $modulesForPage = $module_pageModel->get($req, $order);
     } catch (Exception $e) {
         //error
         echo $e->getMessage();
     }
     $pageview = new ui();
     $xajaxJs = $this->xajax->getJavascript();
     global $debugajax;
     if ($debugajax) {
         $debugJs = '<script type="text/javascript" src="xajax_js/xajax_debug.js" charset="UTF-8"></script>';
         $pageview->assign('xajax_javascript', $xajaxJs . "\n" . $debugJs);
     } else {
         $pageview->assign('xajax_javascript', $xajaxJs);
     }
     $output = array();
     $moduleModel = new moduleModel();
     foreach ($modulesForPage as $moduleForPage) {
         try {
             $areaModel = new areaModel();
             $area = $areaModel->getfromId($moduleForPage->getAreaid());
             $meh = 1;
             if (count($area) == 1) {
                 $area = $area[0];
             } else {
                 throw new Exception('Area could not be loaded');
             }
             $module = $moduleModel->getfromId($moduleForPage->getModuleid());
             if (count($module) == 1) {
                 $module = $module[0];
             } else {
                 throw new Exception('Module could not be loaded');
             }
             $controllerName = $module->getName() . 'Controller';
             $actionName = $module->getAction();
             $controller = new $controllerName($module->getPrefix() . '_' . $module->getName());
             foreach ($controller->getAllowedget() as $allowedGetVar) {
                 if (isset($_GET[$allowedGetVar])) {
                     $module->addArguments(array($allowedGetVar => $_GET[$allowedGetVar]));
                 }
             }
             $output[$area->getName()] .= '<div id="' . $module->getPrefix() . '_' . $module->getName() . '" class="module">' . $controller->{$actionName}($module->getArguments()) . '</div>';
         } catch (Exception $e) {
             //	Ok, that didn't work
             $result = createErrorView($e);
             if ($area instanceof areaObject) {
                 $output[$area->getName()] .= '<div class="module">' . $result . '</div>';
             }
         }
     }
     //	Add the popup div
     $output['popup'] = '<div id="popupcontainer" style="visibility: hidden; position: absolute;"></div>';
     foreach ($output as $area => $content) {
         $pageview->assign($area, $content);
     }
     //	Add the RTE
     $myrte = new myrte();
     $pageview->assign('rteheader', $myrte->getHeader());
     $pageview->display($page->getTemplate());
     //	Init the responses
     $response = responseLib::getInstance();
     $_SESSION['initpageresponse'] = $response;
     //echo '<script type="text/javascript" charset="UTF-8">xajax_initpage();</script>';
 }
Exemple #8
0
 public function getFocus()
 {
     $fieldname = '';
     if ($this->focusfield != '') {
         $fieldname = $this->focusfield;
     } else {
         foreach ($this->field as $name => $field) {
             if (get_class($field) != 'hiddenField') {
                 $fieldname = $name;
                 break;
             }
         }
     }
     if ($fieldname != '' && !$this->nofocus) {
         if (get_class($this->field[$fieldname]) == 'suggestselectField') {
             $fieldname .= '_text';
         }
         $response = responseLib::getInstance();
         $response->script('setTimeout("$(\'' . $this->id . '_' . $fieldname . '\').focus()",500)');
     }
 }
Exemple #9
0
 public function loadrte()
 {
     $response = responseLib::getInstance();
     $response->script("setTimeout(\"tinyMCE.execCommand('mceAddControl', false, '{$this->id}')\",500);");
 }