本文整理汇总了PHP中ZLanguage类的典型用法代码示例。如果您正苦于以下问题:PHP ZLanguage类的具体用法?PHP ZLanguage怎么用?PHP ZLanguage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ZLanguage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: smarty_function_mediashare_breadcrumb
function smarty_function_mediashare_breadcrumb($params, &$smarty)
{
$dom = ZLanguage::getModuleDomain('mediashare');
if (!isset($params['albumId'])) {
$smarty->trigger_error(__f('Missing [%1$s] in \'%2$s\'', array('albumId', 'mediashare_breadcrumb'), $dom));
return false;
}
$mode = isset($params['mode']) ? $params['mode'] : 'view';
$breadcrumb = pnModAPIFunc('mediashare', 'user', 'getAlbumBreadcrumb', array('albumId' => (int) $params['albumId']));
if ($breadcrumb === false) {
$smarty->trigger_error(LogUtil::getErrorMessagesText());
return false;
}
$urlType = $mode == 'edit' ? 'edit' : 'user';
$url = pnModUrl('mediashare', $urlType, 'view', array('aid' => 0));
$result = "<div class=\"mediashare-breadcrumb\">";
$first = true;
foreach ($breadcrumb as $album) {
$url = DataUtil::formatForDisplay(pnModUrl('mediashare', $urlType, 'view', array('aid' => $album['id'])));
$result .= ($first ? '' : ' » ') . "<a href=\"{$url}\">" . htmlspecialchars($album['title']) . "</a>";
$first = false;
}
$result .= "</div>";
if (isset($params['assign'])) {
$smarty->assign($params['assign'], $result);
}
return $result;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:28,代码来源:function.mediashare_breadcrumb.php
示例2: initialize
/**
* Initialize form handler.
*
* This method takes care of all necessary initialisation of our data and form states.
*
* @return boolean False in case of initialization errors, otherwise true.
*/
public function initialize(Zikula_Form_View $view)
{
$dom = ZLanguage::getModuleDomain($this->name);
// permission check
if (!SecurityUtil::checkPermission('MUBoard::', '::', ACCESS_ADMIN)) {
return $view->registerError(LogUtil::registerPermissionError());
}
// retrieve module vars
$modVars = ModUtil::getVar('MUBoard');
// initialise list entries for the 'number images' setting
$modVars['numberImagesItems'] = array(array('value' => '1', 'text' => '1'), array('value' => '2', 'text' => '2'), array('value' => '3', 'text' => '3'));
// initialise list entries for the 'number files' setting
$modVars['numberFilesItems'] = array(array('value' => '1', 'text' => '1'), array('value' => '2', 'text' => '2'), array('value' => '3', 'text' => '3'));
// initialise list entries for the 'sorting postings' setting
$modVars['sortingCategoriesItems'] = array(array('value' => 'descending', 'text' => __('Descending', $dom)), array('value' => 'ascending', 'text' => __('Ascending', $dom)));
// initialise list entries for the 'sorting postings' setting
$modVars['sortingPostingsItems'] = array(array('value' => 'descending', 'text' => __('Descending', $dom)), array('value' => 'ascending', 'text' => __('Ascending', $dom)));
// initialise list entries for the 'icon set' setting
$modVars['iconSetItems'] = array(array('value' => '1', 'text' => '1'), array('value' => '2', 'text' => '2'), array('value' => '3', 'text' => '3'));
// initialise list entries for the 'template' setting
$modVars['templateItems'] = array(array('value' => 'normal', 'text' => 'Normal'), array('value' => 'jquery', 'text' => 'jQuery'));
// assign all module vars
$this->view->assign('config', $modVars);
// custom initialisation aspects
$this->initializeAdditions();
// everything okay, no initialization errors occured
return true;
}
开发者ID:rmaiwald,项目名称:MUBoard,代码行数:35,代码来源:Config.php
示例3: __construct
public function __construct(RouterInterface $router, SecurityManager $securityManager, TranslatorInterface $translator)
{
$this->router = $router;
$this->securityManager = $securityManager;
$this->domain = \ZLanguage::getModuleDomain('CmfcmfMediaModule');
$this->translator = $translator;
}
开发者ID:shefik,项目名称:MediaModule,代码行数:7,代码来源:LinkContainer.php
示例4: smarty_function_manuallink
/**
* Zikula_View function to create manual link.
*
* This function creates a manual link from some parameters.
*
* Available parameters:
* - manual: name of manual file, manual.html if not set
* - chapter: an anchor in the manual file to jump to
* - newwindow: opens the manual in a new window using javascript
* - width: width of the window if newwindow is set, default 600
* - height: height of the window if newwindow is set, default 400
* - title: name of the new window if newwindow is set, default is modulename
* - class: class for use in the <a> tag
* - assign: if set, the results ( array('url', 'link') are assigned to the corresponding variable instead of printed out
*
* Example
* {manuallink newwindow=1 width=400 height=300 title=rtfm }
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return string|void
*/
function smarty_function_manuallink($params, Zikula_View $view)
{
LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated.', array('manuallink')), E_USER_DEPRECATED);
$userlang = ZLanguage::transformFS(ZLanguage::getLanguageCode());
$stdlang = System::getVar('language_i18n');
$title = isset($params['title']) ? $params['title'] : 'Manual';
$manual = isset($params['manual']) ? $params['manual'] : 'manual.html';
$chapter = isset($params['chapter']) ? '#' . $params['chapter'] : '';
$class = isset($params['class']) ? 'class="' . $params['class'] . '"' : '';
$width = isset($params['width']) ? $params['width'] : 600;
$height = isset($params['height']) ? $params['height'] : 400;
$modname = ModUtil::getName();
$possibleplaces = array("modules/{$modname}/docs/{$userlang}/manual/{$manual}", "modules/{$modname}/docs/{$stdlang}/manual/{$manual}", "modules/{$modname}/docs/en/manual/{$manual}", "modules/{$modname}/docs/{$userlang}/{$manual}", "modules/{$modname}/docs/{$stdlang}/{$manual}", "modules/{$modname}/docs/lang/en/{$manual}");
foreach ($possibleplaces as $possibleplace) {
if (file_exists($possibleplace)) {
$url = $possibleplace . $chapter;
break;
}
}
if (isset($params['newwindow'])) {
$link = "<a {$class} href='#' onclick=\"window.open( '" . DataUtil::formatForDisplay($url) . "' , '" . DataUtil::formatForDisplay($modname) . "', 'status=yes,scrollbars=yes,resizable=yes,width={$width},height={$height}'); picwin.focus();\">" . DataUtil::formatForDisplayHTML($title) . "</a>";
} else {
$link = "<a {$class} href=\"" . DataUtil::formatForDisplay($url) . "\">" . DataUtil::formatForDisplayHTML($title) . "</a>";
}
if (isset($params['assign'])) {
$ret = array('url' => $url, 'link' => $link);
$view->assign($params['assign'], $ret);
return;
} else {
return $link;
}
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:55,代码来源:function.manuallink.php
示例5: content_needleapi_content
/**
* Content needle
* @param $args['nid'] needle id
* @return array()
*/
function content_needleapi_content($args)
{
$dom = ZLanguage::getModuleDomain('Content');
// Get arguments from argument array
$nid = $args['nid'];
unset($args);
// cache the results
static $cache;
if (!isset($cache)) {
$cache = array();
}
if (!empty($nid)) {
if (!isset($cache[$nid])) {
// not in cache array
if (ModUtil::available('Content')) {
$contentpage = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $nid, 'includeContent' => false));
if ($contentpage != false) {
$cache[$nid] = '<a href="' . DataUtil::formatForDisplay(ModUtil::url('Content', 'user', 'view', array('pid' => $nid))) . '" title="' . DataUtil::formatForDisplay($contentpage['title']) . '">' . DataUtil::formatForDisplay($contentpage['title']) . '</a>';
} else {
$cache[$nid] = '<em>' . DataUtil::formatForDisplay(__('Unknown id', $dom)) . '</em>';
}
} else {
$cache[$nid] = '<em>' . DataUtil::formatForDisplay(__('Content not available', $dom)) . '</em>';
}
}
$result = $cache[$nid];
} else {
$result = '<em>' . DataUtil::formatForDisplay(__('No needle id', $dom)) . '</em>';
}
return $result;
}
开发者ID:robbrandt,项目名称:Content,代码行数:36,代码来源:content.php
示例6: _configureBase
/**
* Setup internal properties.
*
* @param $bundle
*
* @return void
*/
protected function _configureBase($bundle = null)
{
$this->systemBaseDir = realpath('.');
if (null !== $bundle) {
$this->name = $bundle->getName();
$this->domain = ZLanguage::getModuleDomain($this->name);
$this->baseDir = $bundle->getPath();
$versionClass = $bundle->getVersionClass();
$this->version = new $versionClass($bundle);
} else {
$className = $this->getReflection()->getName();
$separator = false === strpos($className, '_') ? '\\' : '_';
$parts = explode($separator, $className);
$this->name = $parts[0];
$this->baseDir = $this->libBaseDir = realpath(dirname($this->reflection->getFileName()) . '/../..');
if (realpath("{$this->baseDir}/lib/" . $this->name)) {
$this->libBaseDir = realpath("{$this->baseDir}/lib/" . $this->name);
}
$versionClass = "{$this->name}\\{$this->name}Version";
$versionClassOld = "{$this->name}_Version";
$versionClass = class_exists($versionClass) ? $versionClass : $versionClassOld;
$this->version = new $versionClass();
}
$this->modinfo = array('directory' => $this->name, 'type' => ModUtil::getModuleBaseDir($this->name) == 'system' ? ModUtil::TYPE_SYSTEM : ModUtil::TYPE_MODULE);
if ($this->modinfo['type'] == ModUtil::TYPE_MODULE) {
$this->domain = ZLanguage::getModuleDomain($this->name);
}
}
开发者ID:rmaiwald,项目名称:core,代码行数:35,代码来源:AbstractInstaller.php
示例7: smarty_function_contentcolumncount
/**
* Content
*
* @copyright (C) 2007-2010, Content Development Team
* @link http://github.com/zikula-modules/Content
* @license See license.txt
*/
function smarty_function_contentcolumncount($params, $view)
{
$dom = ZLanguage::getModuleDomain('Content');
// input is layout name
$layout = isset($params['layout']) ? $params['layout'] : '';
$columnCount = 1;
// assume 1 if no match can be found
// now start simple matching with a regular expression on the layout name. No science here.
// Looking for the first numbers in the string and stops with text again. Then take the highest single digit.
// Examples:
// layout columnCount
// ---------------------------------
// column21212 2
// column2d2575 2
// column3d502525 3
// column23andtext 3
//
if (preg_match('/[1-9]+/', $layout, $matches)) {
// found first set of numbers
$matchSplit = str_split($matches[0]);
rsort($matchSplit);
$columnCount = $matchSplit[0];
}
if (isset($params['assign'])) {
$smarty->assign($params['assign'], $columnCount);
} else {
return $columnCount;
}
}
开发者ID:robbrandt,项目名称:Content,代码行数:36,代码来源:function.contentcolumncount.php
示例8: smarty_function_contentcodeeditor
/**
* Content
*
* @copyright (C) 2007-2010, Content Development Team
* @link http://github.com/zikula-modules/Content
* @license See license.txt
*/
function smarty_function_contentcodeeditor($params, $view)
{
$dom = ZLanguage::getModuleDomain('Content');
$inputId = $params['inputId'];
$inputType = isset($params['inputType']) ? $params['inputType'] : null;
// Get reference to optional radio button that enables the editor (a hack for the HTML plugin).
// It would have been easier just to read a $var in the template, but this won't work with a
// Forms plugin - you would just get the initial value from when the page was loaded
$htmlRadioButton = isset($params['htmlradioid']) ? $view->getPluginById($params['htmlradioid']) : null;
$textRadioButton = isset($params['textradioid']) ? $view->getPluginById($params['textradioid']) : null;
$html = '';
$useBBCode = $textRadioButton == null && $inputType == 'text' && !$view->isPostBack() || $textRadioButton != null && $textRadioButton->checked;
if ($useBBCode && ModUtil::available('BBCode')) {
$html = "<div class=\"z-formrow\"><em class=\"z-sub\">";
$html .= ModUtil::func('BBCode', 'User', 'bbcodes', array('textfieldid' => $inputId, 'images' => 0));
$html .= "</em></div>";
} else {
if ($useBBCode && !ModUtil::available('BBCode')) {
$html = "<div class=\"z-formrow\"><em class=\"z-sub\">";
$html .= '(' . __("Please install the BBCode module to enable BBCodes display.", $dom) . ')';
$html .= "</em></div>";
}
}
return $html;
}
开发者ID:robbrandt,项目名称:Content,代码行数:32,代码来源:function.contentcodeeditor.php
示例9: validateAll
/**
* Performs all validation rules.
*
* @return mixed either array with error information or true on success
*/
public function validateAll()
{
$errorInfo = array('message' => '', 'code' => 0, 'debugArray' => array());
$dom = ZLanguage::getModuleDomain('MUBoard');
if (!$this->isValidInteger('userid')) {
$errorInfo['message'] = __f('Error! Field value may only contain digits (%s).', array('userid'), $dom);
return $errorInfo;
}
if (!$this->isNumberNotEmpty('userid')) {
$errorInfo['message'] = __f('Error! Field value must not be 0 (%s).', array('userid'), $dom);
return $errorInfo;
}
if (!$this->isNumberNotLongerThan('userid', 11)) {
$errorInfo['message'] = __f('Error! Length of field value must not be higher than %2$s (%1$s).', array('userid', 11), $dom);
return $errorInfo;
}
if (!$this->isValidInteger('numberPostings')) {
$errorInfo['message'] = __f('Error! Field value may only contain digits (%s).', array('numberPostings'), $dom);
return $errorInfo;
}
/* if (!$this->isNumberNotEmpty('numberPostings')) {
$errorInfo['message'] = __f('Error! Field value must not be 0 (%s).', array('numberPostings'), $dom);
return $errorInfo;
}*/
if (!$this->isNumberNotLongerThan('numberPostings', 11)) {
$errorInfo['message'] = __f('Error! Length of field value must not be higher than %2$s (%1$s).', array('numberPostings', 11), $dom);
return $errorInfo;
}
if (!$this->isValidDateTime('lastVisit')) {
$errorInfo['message'] = __f('Error! Field value must be a valid datetime (%s).', array('lastVisit'), $dom);
return $errorInfo;
}
return true;
}
开发者ID:rmaiwald,项目名称:MUBoard,代码行数:39,代码来源:User.php
示例10: Reviews_operation_update
/**
* Update operation.
* @param object $entity The treated object.
* @param array $params Additional arguments.
*
* @return bool False on failure or true if everything worked well.
*/
function Reviews_operation_update(&$entity, $params)
{
$dom = ZLanguage::getModuleDomain('Reviews');
// initialise the result flag
$result = false;
$objectType = $entity['_objectType'];
$currentState = $entity['workflowState'];
// get attributes read from the workflow
if (isset($params['nextstate']) && !empty($params['nextstate'])) {
// assign value to the data object
$entity['workflowState'] = $params['nextstate'];
if ($params['nextstate'] == 'archived') {
// bypass validator (for example an end date could have lost it's "value in future")
$entity['_bypassValidation'] = true;
}
}
// get entity manager
$serviceManager = ServiceUtil::getManager();
$entityManager = $serviceManager->getService('doctrine.entitymanager');
// save entity data
try {
//$this->entityManager->transactional(function($entityManager) {
$entityManager->persist($entity);
$entityManager->flush();
//});
$result = true;
} catch (\Exception $e) {
LogUtil::registerError($e->getMessage());
}
// return result of this operation
return $result;
}
开发者ID:rmaiwald,项目名称:Reviews,代码行数:39,代码来源:function.update.php
示例11: validateAll
/**
* Performs all validation rules.
*
* @return mixed either array with error information or true on success
*/
public function validateAll()
{
$errorInfo = array('message' => '', 'code' => 0, 'debugArray' => array());
$dom = ZLanguage::getModuleDomain('MUBoard');
if (!$this->isStringNotLongerThan('title', 255)) {
$errorInfo['message'] = __f('Error! Length of field value must not be higher than %2$s (%1$s).', array('title', 255), $dom);
return $errorInfo;
}
if (!$this->isStringNotEmpty('title')) {
$errorInfo['message'] = __f('Error! Field value must not be empty (%s).', array('title'), $dom);
return $errorInfo;
}
if (!$this->isStringNotLongerThan('description', 2000)) {
$errorInfo['message'] = __f('Error! Length of field value must not be higher than %2$s (%1$s).', array('description', 2000), $dom);
return $errorInfo;
}
if (!$this->isStringNotEmpty('description')) {
$errorInfo['message'] = __f('Error! Field value must not be empty (%s).', array('description'), $dom);
return $errorInfo;
}
if (!$this->isValidInteger('pos')) {
$errorInfo['message'] = __f('Error! Field value may only contain digits (%s).', array('pos'), $dom);
return $errorInfo;
}
/* if (!$this->isNumberNotEmpty('pos')) {
$errorInfo['message'] = __f('Error! Field value must not be 0 (%s).', array('pos'), $dom);
return $errorInfo;
}*/
if (!$this->isNumberNotLongerThan('pos', 3)) {
$errorInfo['message'] = __f('Error! Length of field value must not be higher than %2$s (%1$s).', array('pos', 3), $dom);
return $errorInfo;
}
return true;
}
开发者ID:rmaiwald,项目名称:MUBoard,代码行数:39,代码来源:Category.php
示例12: mediashare_source_browserapi_addMediaItem
function mediashare_source_browserapi_addMediaItem($args)
{
$dom = ZLanguage::getModuleDomain('mediashare');
if (!isset($args['albumId'])) {
return LogUtil::registerError(__f('Missing [%1$s] in \'%2$s\'', array('albumId', 'source_browserapi.addMediaItem'), $dom));
}
$uploadFilename = $args['uploadFilename'];
// FIXME Required because the globals??
//pnModAPILoad('mediashare', 'edit');
// For OPEN_BASEDIR reasons we move the uploaded file as fast as possible to an accessible place
// MUST remember to remove it afterwards!!!
// Create and check tmpfilename
$tmpDir = pnModGetVar('mediashare', 'tmpDirName');
if (($tmpFilename = tempnam($tmpDir, 'Upload_')) === false) {
return LogUtil::registerError(__f("Unable to create a temporary file in '%s'", $tmpDir, $dom) . ' - ' . __('(uploading image)', $dom));
}
if (is_uploaded_file($uploadFilename)) {
if (move_uploaded_file($uploadFilename, $tmpFilename) === false) {
unlink($tmpFilename);
return LogUtil::registerError(__f('Unable to move uploaded file from \'%1$s\' to \'%2$s\'', array($uploadFilename, $tmpFilename), $dom) . ' - ' . __('(uploading image)', $dom));
}
} else {
if (!copy($uploadFilename, $tmpFilename)) {
unlink($tmpFilename);
return LogUtil::registerError(__f('Unable to copy the file from \'%1$s\' to \'%2$s\'', array($uploadFilename, $tmpFilename), $dom) . ' - ' . __('(adding image)', $dom));
}
}
$args['mediaFilename'] = $tmpFilename;
$result = pnModAPIFunc('mediashare', 'edit', 'addMediaItem', $args);
unlink($tmpFilename);
return $result;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:32,代码来源:pnsource_browserapi.php
示例13: getPluginInstance
/**
* Setup the current instance of the Zikula_View class and return it back to the module.
*
* @param string $moduleName Module name.
* @param string $pluginName Plugin name.
* @param integer|null $caching Whether or not to cache (Zikula_View::CACHE_*) or use config variable (null).
* @param string $cache_id Cache Id.
*
* @return Zikula_View_Plugin instance.
*/
public static function getPluginInstance($moduleName, $pluginName, $caching = null, $cache_id = null)
{
$serviceManager = ServiceUtil::getManager();
$serviceId = strtolower(sprintf('zikula.renderplugin.%s.%s', $moduleName, $pluginName));
if (!$serviceManager->has($serviceId)) {
$view = new self($serviceManager, $moduleName, $pluginName, $caching);
$serviceManager->set($serviceId, $view);
} else {
return $serviceManager->get($serviceId);
}
if (!is_null($caching)) {
$view->caching = $caching;
}
if (!is_null($cache_id)) {
$view->cache_id = $cache_id;
}
if ($moduleName === null) {
$moduleName = $view->toplevelmodule;
}
if (!array_key_exists($moduleName, $view->module)) {
$view->module[$moduleName] = ModUtil::getInfoFromName($moduleName);
//$instance->modinfo = ModUtil::getInfoFromName($module);
$view->_addPluginsDir($moduleName);
}
// for {gt} template plugin to detect gettext domain
if ($view->module[$moduleName]['type'] == ModUtil::TYPE_MODULE || $view->module[$moduleName]['type'] == ModUtil::TYPE_SYSTEM) {
$view->domain = ZLanguage::getModulePluginDomain($view->module[$moduleName]['name'], $view->getPluginName());
} elseif ($view->module[$moduleName]['type'] == ModUtil::TYPE_CORE) {
$view->domain = ZLanguage::getSystemPluginDomain($view->getPluginName());
}
return $view;
}
开发者ID:Silwereth,项目名称:core,代码行数:42,代码来源:Plugin.php
示例14: smarty_function_iwqvuserassignmentactionmenulinks
function smarty_function_iwqvuserassignmentactionmenulinks($params, &$smarty) {
$dom = ZLanguage::getModuleDomain('IWqv');
// set some defaults
if (!isset($params['start'])) {
$params['start'] = '[';
}
if (!isset($params['end'])) {
$params['end'] = ']';
}
if (!isset($params['separator'])) {
$params['separator'] = ' | ';
}
if (!isset($params['class'])) {
$params['class'] = 'pn-sub';
}
$html = '';
if ($params['viewas'] == 'teacher') {
if (SecurityUtil::checkPermission('IWqv::', "::", ACCESS_ADD)) {
$html = "<span class=\"" . $params['class'] . "\">" . $params['start'] . " ";
$html .= "<a onclick=\"iwqvPreviewAssignment('" . $params['url'] . "?skin=" . $params['skin'] . "&lang=" . $params['lang'] . "')\" href=\"javascript:void(0);\">" . __('preview', $dom) . "</a>";
if (isset($params['hidecorrect']) && $params['hidecorrect'] == false)
$html .= $params['separator'] . "<a onclick=\"iwqvShowAssignment(" . $params['qvid'] . ", '" . $params['viewas'] . "')\" href=\"javascript:void(0);\">" . __('correct', $dom) . "</a>";
$html .= $params['separator'] . "<a onclick=\"iwqvEditAssignment(" . $params['qvid'] . ")\" href=\"javascript:void(0);\">" . __('edit', $dom) . "</a>";
if (SecurityUtil::checkPermission('IWqv::', "::", ACCESS_DELETE)) {
if (isset($params['hidecorrect']) && $params['hidecorrect'] == false)
$html .= $params['separator'] . "<a onclick=\"iwqvDeleteAssignment(" . $params['qvid'] . ")\" href=\"javascript:void(0);\">" . __('delete', $dom) . "</a>";
}
$html .= $params['end'] . "</span>\n";
}
}
return $html;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:35,代码来源:function.iwqvuserassignmentactionmenulinks.php
示例15: smarty_function_AddressShowGmap
/**
* AddressBook
*
* @copyright (c) AddressBook Development Team
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @package AddressBook
*/
function smarty_function_AddressShowGmap($params, &$smarty)
{
$dom = ZLanguage::getModuleDomain('AddressBook');
$assign = isset($params['assign']) ? $params['assign'] : null;
$directions = '';
if (isset($params['directions'])) {
$directions = '<a href="http://maps.google.com/maps?f=d&daddr=' . $params['lat_long'];
if (isset($params['zoomlevel'])) {
$directions .= '&z=' . $params['zoomlevel'];
}
$directions .= '" target="_blank">' . __('Get directions to this location', $dom) . '</a>';
}
if (!empty($directions)) {
$directions = '<div>' . $directions . '</div>';
}
include_once 'modules/AddressBook/lib/vendor/GMaps/GoogleMapV3.php';
$map_id = 'googlemap';
if (isset($params['mapid'])) {
$map_id .= $params['mapid'];
}
$app_id = 'ZikulaAddressBook';
$map = new GoogleMapAPI($map_id, $app_id);
if (isset($params['maptype'])) {
$map->setMapType($params['maptype']);
// hybrid, satellite, terrain, roadmap
}
if (isset($params['zoomlevel'])) {
$map->setZoomLevel($params['zoomlevel']);
}
$map->setTypeControlsStyle('dropdown');
$map->setWidth(isset($params['width']) && $params['width'] ? $params['width'] : '100%');
$map->setHeight(isset($params['height']) && $params['height'] ? $params['height'] : '400px');
// handle one (center) point
if (isset($params['lat_long'])) {
$arrLatLong = explode(',', $params['lat_long']);
$map->setCenterCoords($arrLatLong[1], $arrLatLong[0]);
$map->addMarkerByCoords($arrLatLong[1], $arrLatLong[0], $params['title'], $params['html'], $params['tooltip'], $params['icon'], $params['iconshadow']);
}
// API key
if (isset($params['api_key'])) {
$map->setApiKey($params['api_key']);
}
// handle array of points
if (isset($params['points'])) {
foreach ($params['points'] as $point) {
$arrLatLong = explode(',', $point['lat_long']);
$map->addMarkerByCoords($arrLatLong[1], $arrLatLong[0], $point['title'], $point['html'], $point['tooltip'], $point['icon'], $point['iconshadow']);
}
}
// load the map
$map->enableOnLoad();
if ($assign) {
$result = $map->getHeaderJS() . $map->getMapJS() . $directions . $map->printMap() . $map->printOnLoad();
$smarty->assign($assign, $result);
} else {
PageUtil::addVar('rawtext', $map->getHeaderJS());
PageUtil::addVar('rawtext', $map->getMapJS());
return $directions . $map->printMap() . $map->printOnLoad();
}
}
开发者ID:nmpetkov,项目名称:AddressBook,代码行数:67,代码来源:function.AddressShowGmap.php
示例16: smarty_function_html_select_languages
/**
* Zikula_View function to display a drop down list of languages
*
* Available parameters:
* - assign: If set, the results are assigned to the corresponding variable instead of printed out
* - name: Name for the control
* - id: ID for the control
* - selected: Selected value
* - installed: if set only show languages existing in languages folder
* - all: show dummy entry '_ALL' on top of the list with empty value
*
* Example
* {html_select_languages name=language selected=en}
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @deprecated smarty_function_html_select_locales()
* @return string The value of the last status message posted, or void if no status message exists.
*/
function smarty_function_html_select_languages($params, Zikula_View $view)
{
if (!isset($params['name']) || empty($params['name'])) {
$view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('html_select_languages', 'name')));
return false;
}
require_once $view->_get_plugin_filepath('function', 'html_options');
$params['output'] = array();
$params['values'] = array();
if (isset($params['all']) && $params['all']) {
$params['values'][] = '';
$params['output'][] = DataUtil::formatForDisplay(__('All'));
unset($params['all']);
}
if (isset($params['installed']) && $params['installed']) {
$languagelist = ZLanguage::getInstalledLanguageNames();
unset($params['installed']);
} else {
$languagelist = ZLanguage::languageMap();
}
$params['output'] = array_merge($params['output'], DataUtil::formatForDisplay(array_values($languagelist)));
$params['values'] = array_merge($params['values'], DataUtil::formatForDisplay(array_keys($languagelist)));
$assign = isset($params['assign']) ? $params['assign'] : null;
unset($params['assign']);
$html_result = smarty_function_html_options($params, $view);
if (!empty($assign)) {
$view->assign($assign, $html_result);
} else {
return $html_result;
}
}
开发者ID:Silwereth,项目名称:core,代码行数:51,代码来源:function.html_select_languages.php
示例17: moduleSearch
/**
*
*/
public function moduleSearch($args)
{
$dom = ZLanguage::getModuleDomain('MUBoard');
$searchsubmit = $this->request->getPost()->filter('searchsubmit', 'none', FILTER_SANITIZE_STRING);
$searchoptions = $this->request->getPost()->filter('searchoptions', 'all', FILTER_SANITIZE_STRING);
$searchplace = $this->request->getPost()->filter('searchplace', 'title', FILTER_SANITIZE_STRING);
$resultorder = $this->request->getPost()->filter('resultorder', 'none', FILTER_SANITIZE_STRING);
$kind = $this->request->query->filter('kind', 'none', FILTER_SANITIZE_STRING);
// user has not entered a string and there is 'none' as kind of search
if ($searchsubmit == 'none' && $kind == 'none') {
// return search form template
return $this->searchRedirect();
} else {
if ($searchsubmit != 'none' && $kind == 'none') {
$searchstring = $this->request->getPost()->filter('searchstring', '', FILTER_SANITIZE_STRING);
if ($searchstring == '') {
$url = ModUtil::url($this->name, 'search', 'modulesearch');
return LogUtil::registerError(__('You have to enter a string!', $dom), null, $url);
} else {
$args['searchstring'] = $searchstring;
$args['searchoptions'] = $searchoptions;
$args['searchplace'] = $searchplace;
$args['resultorder'] = $resultorder;
$args['kind'] = $kind;
}
}
if ($searchsubmit == 'none' && $kind != 'none') {
$args['kind'] = $kind;
}
}
return ModUtil::apiFunc($this->name, 'search', 'moduleSearch', $args);
}
开发者ID:rmaiwald,项目名称:MUBoard,代码行数:35,代码来源:Search.php
示例18: getDataFromInputPostProcess
public function getDataFromInputPostProcess($data = null)
{
if (!$data) {
$data =& $this->_objData;
}
if (!$data) {
return $data;
}
if (isset($data['status'])) {
$data['status'] = 'A';
} else {
$data['status'] = 'I';
}
if (!isset($data['is_locked'])) {
$data['is_locked'] = 0;
}
if (!isset($data['is_leaf'])) {
$data['is_leaf'] = 0;
}
$languages = ZLanguage::getInstalledLanguages();
foreach ($languages as $lang) {
if (!isset($data['display_name'][$lang]) || !$data['display_name'][$lang]) {
$data['display_name'][$lang] = $data['name'];
}
}
$this->_objData = $data;
return $data;
}
开发者ID:Silwereth,项目名称:core,代码行数:28,代码来源:Category.php
示例19: renderDocument
/**
* Render and display the specified legal document, or redirect to the specified custom URL if it exists.
*
* If a custom URL for the legal document exists, as specified by the module variable identified by $customUrlKey, then
* this function will redirect the user to that URL.
*
* If no custom URL exists, then this function will render and return the appropriate template for the legal document, as
* specified by $documentName. If the legal document
*
* @param string $documentName The "name" of the document, as specified by the names of the user and text template
* files in the format 'legal_user_documentname.tpl' and 'legal_text_documentname.tpl'.
* @param string $accessInstanceKey The string used in the instance_right part of the permission access key for this document.
* @param string $activeFlagKey The string used to name the module variable that indicates whether this legal document is
* active or not; typically this is a constant from {@link Legal_Constant}, such as
* {@link Legal_Constant::MODVAR_LEGALNOTICE_ACTIVE}.
* @param string $customUrlKey The string used to name the module variable that contains a custom static URL for the
* legal document; typically this is a constant from {@link Legal_Constant}, such as
* {@link Legal_Constant::MODVAR_TERMS_URL}.
*
* @return string HTML output string
*
* @throws Zikula_Exception_Forbidden Thrown if the user does not have the appropriate access level for the function.
*/
private function renderDocument($documentName, $accessInstanceKey, $activeFlagKey, $customUrlKey)
{
// Security check
if (!SecurityUtil::checkPermission($this->name . '::' . $accessInstanceKey, '::', ACCESS_OVERVIEW)) {
throw new Zikula_Exception_Forbidden();
}
if (!$this->getVar($activeFlagKey)) {
return $this->view->fetch('legal_user_policynotactive.tpl');
} else {
$customUrl = $this->getVar($customUrlKey, '');
if (empty($customUrl)) {
// work out the template path
$template = "legal_user_{$documentName}.tpl";
// get the current users language
$languageCode = ZLanguage::transformFS(ZLanguage::getLanguageCode());
if (!$this->view->template_exists("{$languageCode}/legal_text_{$documentName}.tpl")) {
$languageCode = 'en';
}
return $this->view->assign('languageCode', $languageCode)
->fetch($template);
} else {
$this->redirect($customUrl);
}
}
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:52,代码来源:User.php
示例20: handleCommand
public function handleCommand(Zikula_Form_View $view, &$args)
{
if (!SecurityUtil::checkPermission('Content:page:', '::', ACCESS_ADD)) {
throw new Zikula_Exception_Forbidden($this->__('Error! You have not been granted access to create pages.'));
}
if ($args['commandName'] == 'create') {
$pageData = $this->view->getValues();
$validators = $this->notifyHooks(new Zikula_ValidationHook('content.ui_hooks.pages.validate_edit', new Zikula_Hook_ValidationProviders()))->getValidators();
if (!$validators->hasErrors() && $this->view->isValid()) {
$id = ModUtil::apiFunc('Content', 'Page', 'newPage', array('page' => $pageData, 'pageId' => $this->pageId, 'location' => $this->location));
if ($id === false) {
return false;
}
// notify any hooks they may now commit the as the original form has been committed.
$objectUrl = new Zikula_ModUrl('Content', 'user', 'view', ZLanguage::getLanguageCode(), array('pid' => $this->pageId));
$this->notifyHooks(new Zikula_ProcessHook('content.ui_hooks.pages.process_edit', $this->pageId, $objectUrl));
} else {
return false;
}
$url = ModUtil::url('Content', 'admin', 'editPage', array('pid' => $id));
} else {
if ($args['commandName'] == 'cancel') {
$id = null;
$url = ModUtil::url('Content', 'admin', 'main');
}
}
return $this->view->redirect($url);
}
开发者ID:robbrandt,项目名称:Content,代码行数:28,代码来源:NewPage.php
注:本文中的ZLanguage类示例整理自Github/MSDocs等源码及文档管理 |
请发表评论