/** * @param string $query * @param null $params * * @return $this */ public function load($query, $params = null) { if (method_exists($this, $query)) { $this->querySqlToExec = org_glizy_helpers_PhpScript::callMethodWithParams($this, $query, $params); } else { // TODO errore } $this->lastQuery = $query; $this->lastParams = null; return $this; }
public function load($query, $params = null) { $driverName = $this->ar->getDriverName(); if (method_exists($this->ar, 'query_' . $query)) { // NOTE: verificare se i parametri nel caso di query di tipo function // vengono passati nell'array params o come array diretto // così da pulire questa parte di codice $params = is_array($params) ? isset($params['params']) ? $params['params'] : $params : array($params); $params['iterator'] = $this; org_glizy_helpers_PhpScript::callMethodWithParams($this->ar, 'query_' . $query, $params); unset($params['iterator']); } else { if (method_exists($this->ar, 'querysql_' . $driverName . '_' . $query)) { $this->querySqlToExec = org_glizy_helpers_PhpScript::callMethodWithParams($this->ar, 'querysql_' . $driverName . '_' . $query); } else { if (method_exists($this->ar, 'querysql_' . $query)) { $this->querySqlToExec = org_glizy_helpers_PhpScript::callMethodWithParams($this->ar, 'querysql_' . $query); } } } $this->lastQuery = $query; $this->lastParams = $params; return $this; }
/** * @param bool $later * * @return bool|mixed|null */ function callController($later = false) { if (!$this->controller) { $controllerName = $this->getAttribute('controllerName'); if ($controllerName) { if (substr($controllerName, -1) == '*') { $controllerName = substr($controllerName, 0, -1); $actionAdditionalPath = explode('.', __Request::get($this->getAttribute('actionName'))); $actionName = ucfirst(array_pop($actionAdditionalPath)); if (!$actionName) { return null; } $controllerName .= count($actionAdditionalPath) ? implode('.', $actionAdditionalPath) . '.' : ''; if ($this->_application->_ajaxMode) { $controllerName .= 'ajax.'; } $controllerName .= $actionName; } try { $evt = array('type' => GLZ_EVT_CALL_CONTROLLER, 'data' => $controllerName); $this->dispatchEvent($evt); $this->controller =& org_glizy_ObjectFactory::createObject($controllerName, $this); } catch (Exception $e) { } } } if ($this->controller) { return org_glizy_helpers_PhpScript::callMethodWithParams($this->controller, $later ? 'executeLater' : 'execute'); } return null; }
function _startProcess($readPageId = true) { $this->log("startProcess", GLZ_LOG_SYSTEM); $this->checkSwitchLanguage(); $controller = __Request::get('controller', '', GLZ_REQUEST_ROUTING); if ($controller) { $controllerClass = org_glizy_ObjectFactory::createObject($controller, null, $this); org_glizy_helpers_PhpScript::callMethodWithParams($controllerClass, 'execute'); } $this->readSiteProperties(); $this->setTemplateFolder(); if ($readPageId) { $evt = array('type' => GLZ_EVT_BEFORE_CREATE_PAGE); $this->dispatchEvent($evt); $this->_readPageId(); } if ($this->siteMapMenu->isVisible === false) { while (true) { $parentMenu =& $this->siteMapMenu->parentNode(); if (is_null($parentMenu)) { // ERROR $e = new org_glizy_Exception(array('[%s] %s', $this->getClassName(), __T(GLZ_ERR_EMPTY_APP_PATH))); } $this->siteMapMenu =& $parentMenu; if ($parentMenu->isVisible === true) { $this->_pageId = $this->siteMapMenu->id; break; } } } // TODO da risolvare in modo migliore // creando un nuovo menu_type if ($this->siteMapMenu->pageType == 'Empty') { $currentPage =& $this->siteMapMenu; while (true) { $childNodes = $currentPage->childNodes(); if (!count($childNodes)) { org_glizy_helpers_Navigation::gotoUrl(GLZ_HOST); break; } $tempPage =& $childNodes[0]; $currentPage =& $tempPage; if ($currentPage->pageType != 'Empty') { $this->siteMapMenu =& $currentPage; $this->_pageId = $currentPage->id; break; } } } parent::_startProcess(false); }