本文整理汇总了PHP中jApp::pushCurrentModule方法的典型用法代码示例。如果您正苦于以下问题:PHP jApp::pushCurrentModule方法的具体用法?PHP jApp::pushCurrentModule怎么用?PHP jApp::pushCurrentModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jApp
的用法示例。
在下文中一共展示了jApp::pushCurrentModule方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compile
/**
* Launch the compilation of a template
*
* Store the result (a php content) into a cache file given by the selector.
* @param jSelectorTpl $selector the template selector
* @return boolean true if ok
*/
public function compile($selector)
{
$this->_sourceFile = $selector->getPath();
$this->outputType = $selector->outputType;
$this->trusted = $selector->trusted;
$md5 = md5($selector->module . '_' . $selector->resource . '_' . $this->outputType . ($this->trusted ? '_t' : ''));
jApp::pushCurrentModule($selector->module);
if (!file_exists($this->_sourceFile)) {
$this->doError0('errors.tpl.not.found');
}
$header = "if (jApp::config()->compilation['checkCacheFiletime'] &&\n";
$header .= "filemtime('" . $this->_sourceFile . '\') > ' . filemtime($this->_sourceFile) . "){ return false;\n} else {\n";
$footer = "return true;}\n";
$this->compileString(file_get_contents($this->_sourceFile), $selector->getCompiledFilePath(), $selector->userModifiers, $selector->userFunctions, $md5, $header, $footer);
jApp::popCurrentModule();
return true;
}
示例2: single
function single()
{
$rep = $this->_prepareResponse();
$module = $this->param('mod');
$testname = $this->param('test');
$category = $this->category ? ' ' . $this->category : '';
if (isset($this->testsList[$module])) {
$reporter = jClasses::create($this->responseType);
jClasses::inc('junittests~junittestcase');
jClasses::inc('junittests~junittestcasedb');
$reporter->setResponse($rep);
foreach ($this->testsList[$module] as $test) {
if ($test[1] == $testname) {
$group = new TestSuite('"' . $module . '" module , ' . $test[2]);
$group->addFile(jApp::config()->_modulesPathList[$module] . 'tests/' . $test[0]);
jApp::pushCurrentModule($module);
$result = $group->run($reporter);
if (!$result) {
$rep->setExitCode(jResponseCmdline::EXIT_CODE_ERROR);
}
jApp::popCurrentModule();
break;
}
}
} else {
$this->output("\n" . 'no' . $category . ' tests for "' . $module . '" module.' . "\n");
}
return $this->_finishResponse($rep);
}
示例3: setUp
protected function setUp()
{
parent::setUp();
jApp::pushCurrentModule($this->module);
}
示例4: parseRecord
protected function parseRecord($xml, $tools)
{
//add the record properties
if (isset($xml->record)) {
if (isset($xml->record[0]['extends'])) {
jApp::pushCurrentModule($this->selector->module);
$this->_userRecord = new jSelectorDaoRecord((string) $xml->record[0]['extends']);
jApp::popCurrentModule();
}
if (isset($xml->record[0]->property)) {
// don't append directly new properties into _properties,
// so we can see the differences between imported properties
// and readed properties
$properties = array();
foreach ($xml->record[0]->property as $prop) {
$p = new jDaoProperty($prop->attributes(), $this, $tools);
if (isset($properties[$p->name])) {
throw new jDaoXmlException($this->selector, 'property.already.defined', $p->name);
}
if (!in_array($p->name, $this->_tables[$p->table]['fields'])) {
// if this property does not redefined an imported property
$this->_tables[$p->table]['fields'][] = $p->name;
}
$properties[$p->name] = $p;
}
$this->_properties = array_merge($this->_properties, $properties);
}
}
// in the case when there is no defined property and no imported dao
if (count($this->_properties) == 0) {
throw new jDaoXmlException($this->selector, 'properties.missing');
}
// check that properties are attached to a known table. It can be
// wrong if the datasource has been redefined with other table names
$countprop = 0;
foreach ($this->_properties as $p) {
if (!isset($this->_tables[$p->table])) {
throw new jDaoXmlException($this->selector, 'property.imported.unknown.table', $p->name);
}
if ($p->ofPrimaryTable && !$p->isPK) {
$countprop++;
}
}
$this->hasOnlyPrimaryKeys = $countprop == 0;
}
示例5: single
function single()
{
$conf = jApp::config();
if (!isset($conf->enableTests) || !$conf->enableTests) {
// security
$rep = $this->getResponse('html', true);
$rep->title = 'Error';
$rep->setHttpStatus('404', 'Not found');
$rep->addContent('<p>404 Not Found</p>');
return $rep;
}
$rep = $this->_prepareResponse();
$module = $this->param('mod');
$testname = $this->param('test');
if (isset($this->testsList[$module])) {
$reporter = jClasses::create("junittests~jhtmlrespreporter");
jClasses::inc('junittests~junittestcase');
jClasses::inc('junittests~junittestcasedb');
$reporter->setResponse($rep);
foreach ($this->testsList[$module] as $test) {
if ($test[1] == $testname) {
$group = new TestSuite('"' . $module . '" module , ' . $test[2]);
$group->addFile($conf->_modulesPathList[$module] . 'tests/' . $test[0]);
jApp::pushCurrentModule($module);
$group->run($reporter);
jApp::popCurrentModule();
break;
}
}
} else {
$rep->body->assign('MAIN', '<p>no tests for "' . $module . '" module.</p>');
}
return $this->_finishResponse($rep);
}
示例6: process
/**
* main method : launch the execution of the action.
*
* This method should be called in a entry point.
*
* @param jRequest $request the request object. It is required if a descendant of jCoordinator did not called setRequest before
*/
public function process($request = null)
{
try {
if ($request) {
$this->setRequest($request);
}
jSession::start();
$ctrl = $this->getController($this->action);
} catch (jException $e) {
$config = jApp::config();
if ($config->urlengine['notfoundAct'] == '') {
throw $e;
}
if (!jSession::isStarted()) {
jSession::start();
}
try {
$this->action = new jSelectorAct($config->urlengine['notfoundAct']);
$ctrl = $this->getController($this->action);
} catch (jException $e2) {
throw $e;
}
}
jApp::pushCurrentModule($this->moduleName);
if (count($this->plugins)) {
$pluginparams = array();
if (isset($ctrl->pluginParams['*'])) {
$pluginparams = $ctrl->pluginParams['*'];
}
if (isset($ctrl->pluginParams[$this->action->method])) {
$pluginparams = array_merge($pluginparams, $ctrl->pluginParams[$this->action->method]);
}
foreach ($this->plugins as $name => $obj) {
$result = $this->plugins[$name]->beforeAction($pluginparams);
if ($result) {
$this->action = $result;
jApp::popCurrentModule();
jApp::pushCurrentModule($result->module);
$this->moduleName = $result->module;
$this->actionName = $result->resource;
$ctrl = $this->getController($this->action);
break;
}
}
}
$this->response = $ctrl->{$this->action->method}();
if ($this->response == null) {
throw new jException('jelix~errors.response.missing', $this->action->toString());
}
foreach ($this->plugins as $name => $obj) {
$this->plugins[$name]->beforeOutput();
}
$this->response->output();
foreach ($this->plugins as $name => $obj) {
$this->plugins[$name]->afterProcess();
}
jApp::popCurrentModule();
jSession::end();
}
示例7: run
public function run()
{
$this->loadAppConfig();
require_once JELIX_LIB_PATH . 'dao/jDaoParser.class.php';
$path = $this->getModulePath($this->_parameters['module']);
$formdir = $path . 'forms/';
$this->createDir($formdir);
$formfile = strtolower($this->_parameters['form']) . '.form.xml';
if ($this->getOption('-createlocales')) {
$locale_content = '';
$locale_base = $this->_parameters['module'] . '~' . strtolower($this->_parameters['form']) . '.form.';
$locale_filename_fr = 'locales/fr_FR/';
$this->createDir($path . $locale_filename_fr);
$locale_filename_fr .= strtolower($this->_parameters['form']) . '.UTF-8.properties';
$locale_filename_en = 'locales/en_US/';
$this->createDir($path . $locale_filename_en);
$locale_filename_en .= strtolower($this->_parameters['form']) . '.UTF-8.properties';
$submit = "\n\n<submit ref=\"_submit\">\n\t<label locale='" . $locale_base . "ok' />\n</submit>";
} else {
$submit = "\n\n<submit ref=\"_submit\">\n\t<label>ok</label>\n</submit>";
}
$dao = $this->getParam('dao');
if ($dao === null) {
if ($this->getOption('-createlocales')) {
$locale_content = "form.ok=OK\n";
$this->createFile($path . $locale_filename_fr, 'locales.tpl', array('content' => $locale_content), "Locales file");
$this->createFile($path . $locale_filename_en, 'locales.tpl', array('content' => $locale_content), "Locales file");
}
$this->createFile($formdir . $formfile, 'module/form.xml.tpl', array('content' => '<!-- add control declaration here -->' . $submit), "Form");
return;
}
jApp::config()->startModule = $this->_parameters['module'];
jApp::pushCurrentModule($this->_parameters['module']);
$tools = jDb::getConnection()->tools();
// we're going to parse the dao
$selector = new jSelectorDao($dao, '');
$doc = new DOMDocument();
$daoPath = $selector->getPath();
if (!$doc->load($daoPath)) {
throw new jException('jelix~daoxml.file.unknown', $daoPath);
}
if ($doc->documentElement->namespaceURI != JELIX_NAMESPACE_BASE . 'dao/1.0') {
throw new jException('jelix~daoxml.namespace.wrong', array($daoPath, $doc->namespaceURI));
}
$parser = new jDaoParser($selector);
$parser->parse(simplexml_import_dom($doc), $tools);
// now we generate the form file
$properties = $parser->GetProperties();
$table = $parser->GetPrimaryTable();
$content = '';
foreach ($properties as $name => $property) {
if (!$property->ofPrimaryTable) {
continue;
}
if ($property->isPK && $property->autoIncrement) {
continue;
}
$attr = '';
if ($property->required) {
$attr .= ' required="true"';
}
if ($property->defaultValue !== null) {
$attr .= ' defaultvalue="' . htmlspecialchars($property->defaultValue) . '"';
}
if ($property->maxlength !== null) {
$attr .= ' maxlength="' . $property->maxlength . '"';
}
if ($property->minlength !== null) {
$attr .= ' minlength="' . $property->minlength . '"';
}
$datatype = '';
$tag = 'input';
switch ($property->unifiedType) {
case 'integer':
case 'numeric':
$datatype = 'integer';
break;
case 'datetime':
$datatype = 'datetime';
break;
case 'time':
$datatype = 'time';
break;
case 'date':
$datatype = 'date';
break;
case 'double':
case 'float':
$datatype = 'decimal';
break;
case 'text':
case 'blob':
$tag = 'textarea';
break;
case 'boolean':
$tag = 'checkbox';
break;
}
if ($datatype != '') {
$attr .= ' type="' . $datatype . '"';
//.........这里部分代码省略.........
示例8: _callZone
/**
* instancy a zone object, and call one of its methods
* @param string $name zone selector
* @param string $method method name
* @param array $params arguments for the method
* @return mixed the result returned by the method
*/
private static function _callZone($name, $method, &$params)
{
$sel = new jSelectorZone($name);
jApp::pushCurrentModule($sel->module);
$fileName = $sel->getPath();
require_once $fileName;
$className = $sel->resource . 'Zone';
$zone = new $className($params);
$toReturn = $zone->{$method}();
jApp::popCurrentModule();
return $toReturn;
}