本文整理汇总了PHP中_resource函数的典型用法代码示例。如果您正苦于以下问题:PHP _resource函数的具体用法?PHP _resource怎么用?PHP _resource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_resource函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processDefault
public function processDefault()
{
$tpl = new CopixTpl();
$tplModule = new CopixTpl();
//if user is not connected :
if (1) {
// S'il y a un blog prevu a l'accueil
$dispBlog = false;
$getKernelLimitsIdBlog = Kernel::getKernelLimits('id_blog');
if ($getKernelLimitsIdBlog) {
_classInclude('blog|kernelblog');
if ($blog = _ioDao('blog|blog')->getBlogById($getKernelLimitsIdBlog)) {
// On v�rifie qu'il y a au moins un article
$stats = KernelBlog::getStats($blog->id_blog);
if ($stats['nbArticles']['value'] > 0) {
$dispBlog = true;
}
}
}
if ($dispBlog) {
//return CopixActionGroup::process ('blog|frontblog::getListArticle', array ('blog'=>$blog->url_blog));
return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('blog||', array('blog' => $blog->url_blog)));
}
if (!CopixConfig::exists('|can_public_rssfeed') || CopixConfig::get('|can_public_rssfeed')) {
CopixHtmlHeader::addOthers('<link rel="alternate" href="' . CopixUrl::get('public||rss', array()) . '" type="application/rss+xml" title="' . htmlentities(CopixI18N::get('public|public.rss.flux.title')) . '" />');
}
CopixHTMLHeader::addCSSLink(_resource("styles/module_fichesecoles.css"));
$tplModule->assign('user', _currentUser());
$result = $tplModule->fetch('welcome|welcome_' . CopixI18N::getLang() . '.tpl');
$tpl->assign('TITLE_PAGE', '' . CopixI18N::get('public|public.welcome.title'));
$tpl->assign('MAIN', $result);
return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
}
}
示例2: process
public function process($pParams)
{
extract($pParams);
if (!isset($tips) && !isset($warning)) {
return '';
}
$toReturn = '';
if (isset($warning)) {
foreach ($warning as $warn) {
$toReturn .= '<li style="color: #FF2222;font-weight:bold;">' . $warn . '</li>';
}
}
if (isset($tips)) {
foreach ($tips as $tip) {
$toReturn .= '<li>' . $tip . '</li>';
}
}
if (strlen($toReturn)) {
$toReturn = '<ul>' . $toReturn . '</ul>';
if (isset($title)) {
$toReturn = '<h2><img src="' . _resource('img/icons/help.gif') . '" /> ' . $title . '</h2>' . $toReturn;
} elseif (isset($titlei18n)) {
$toReturn = '<h2><img src="' . _resource('img/icons/help.gif') . '" /> ' . _i18n($titlei18n) . '</h2>' . $toReturn;
}
}
return $toReturn;
}
示例3: _createContent
public function _createContent(&$toReturn)
{
$arModuleToInstall = CopixSession::get('arModuleToInstall', 'copix');
$arInstalledModule = CopixSession::get('arInstalledModule', 'copix');
$moduleName = array_pop($arModuleToInstall);
$url = $this->getParam('url');
if (($message = CopixModule::installModule($moduleName)) === true) {
$toReturn = _i18n('install.module.install') . ' ' . $moduleName . ' <img src="' . _resource('img/tools/valid.png') . '" />';
if (count($arModuleToInstall) > 0) {
$toReturn .= _tag('copixzone', array('id' => uniqid(), 'process' => 'admin|installmodule', 'url' => $url, 'auto' => true, 'ajax' => true));
} elseif ($url) {
$toReturn .= sprintf('<form action="%s" method="post"><input type="submit" value="%s"/></form>', htmlspecialchars($url), _i18n('copix:common.buttons.next'));
} else {
$toReturn .= "<script>\$('back').setStyle('display','');</script>";
}
array_push($arInstalledModule, $moduleName);
} else {
array_push($arInstalledModule, $moduleName);
$toReturn = _i18n('install.module.install') . ' ' . $moduleName . ' ' . _tag('popupinformation', array('img' => _resource('img/tools/delete.png')), $message);
$toReturn .= '<div class="errorMessage">' . $message . '</div>';
if (count($arInstalledModule) > 0) {
CopixSession::set('arModuleToDelete', $arInstalledModule, 'copix');
CopixSession::set('arInstalledModule', null, 'copix');
CopixSession::set('arModuleToInstall', null, 'copix');
$toReturn .= _tag('copixzone', array('id' => uniqid(), 'process' => 'admin|deletemodule', 'auto' => true, 'ajax' => true));
}
}
CopixSession::set('arModuleToInstall', $arModuleToInstall, 'copix');
CopixSession::set('arInstalledModule', $arInstalledModule, 'copix');
return true;
}
示例4: getMagicMail
/**
* Configuration de MagicMail
*
* @author Frederic Mossmann <fmossmann@cap-tic.fr>
* @since 2006/08/09
*/
public function getMagicMail()
{
$id = _request("id");
if (Kernel::getLevel("MOD_MAGICMAIL", $id) < PROFILE_CCV_ADMIN) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get('||')));
}
$tpl = new CopixTpl();
$tpl->assign('TITLE_PAGE', CopixI18N::get('magicmail.message.title'));
$dao = CopixDAOFactory::create("magicmail|magicmail");
$magic_result = $dao->get($id);
$tplForm = new CopixTpl();
$tplForm->assign('id', $id);
$tplForm->assign('infos', $magic_result);
// $tplForm->assign ('magicmail_mail', CopixConfig::get ('magicmail|magicmail_mail'));
if (_request("return")) {
$tplForm->assign('return', _request("return"));
}
CopixHTMLHeader::addCSSLink(_resource("styles/module_prefs.css"));
$tplForm->assign('msg', array('type' => 'ok', 'image_url' => _resource('img/prefs/smiley_black.png'), 'image_alt' => 'Ok !', 'value' => CopixI18N::get('prefs|prefs.msg.prefsrecorded')));
$result = $tplForm->fetch("login_form.tpl");
$tpl->assign("MAIN", $result);
$menu = array();
$tpl->assign('MENU', $menu);
return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
}
示例5: processGetEdit
/**
* Récupère l'objet en session
* Appelle les zones agendamenu et agendaeditlecon
* @author Audrey Vassal <avassal@sqli.com>
*/
public function processGetEdit()
{
CopixHTMLHeader::addCSSLink(_resource("styles/module_agenda.css"));
require_once COPIX_UTILS_PATH . 'CopixDateTime.class.php';
$serviceAuth = new AgendaAuth();
$serviceType = new AgendaType();
$serviceAgenda = new AgendaService();
$serviceDate = new DateService();
if (!($toEdit = $this->_getSessionLecon())) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('agenda.unableToGetEdited'), 'back' => CopixUrl::get('agenda|agenda|vueSemaine')));
}
$serviceAuth->getCapability($toEdit->id_agenda);
if ($serviceAuth->getCapability($toEdit->id_agenda) < $serviceAuth->getWriteLecon() || $serviceAgenda->getTypeAgendaByIdAgenda($toEdit->id_agenda) != $serviceType->getClassRoom()) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('agenda.error.enableToWrite'), 'back' => CopixUrl::get('agenda|agenda|vueSemaine')));
}
$listAgendas = $serviceAgenda->getAvailableAgenda();
$listAgendasAffiches = $serviceAgenda->getAgendaAffiches();
//template pour agenda
$tplAgenda = new CopixTpl();
$tplAgenda->assign('MAIN_AGENDA', CopixZone::process('agenda|agendaeditlecon', array('e' => _request('e'), 'errors' => _request('errors'), 'toEdit' => $toEdit)));
//template principal
$tpl = new CopixTpl();
$tpl->assign('TITLE_PAGE', CopixI18N::get('agenda|agenda.title.lecon', array('jour' => CopixDateTime::yyyymmddToDate($toEdit->date_lecon))));
$menu = $serviceAgenda->getAgendaMenu('');
$tpl->assign('MENU', $menu);
$tpl->assign('MAIN', $tplAgenda->fetch('agenda|main.agenda.tpl'));
return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
}
示例6: process
public function process($pParams)
{
extract($pParams);
if (!isset($name)) {
throw new CopixTemplateTagException('[AutoComplete] Required parameter name');
}
if (!isset($field)) {
$field = $name;
}
if (!isset($id)) {
$id = $name;
}
if (!isset($value)) {
$value = "";
}
if (!isset($onSelect)) {
$onSelect = "";
}
if (!isset($onRequest)) {
$onRequest = '';
}
if (!isset($extra)) {
$extra = '';
}
if (!isset($pParams['datasource'])) {
$pParams['datasource'] = 'dao';
}
$toMaj = '';
$onSelectTemp = '';
if (isset($maj)) {
$onSelectTemp .= "eleme.selected.id = 'selector_autocomplete';";
foreach ($maj as $key => $field) {
$onSelectTemp .= "\n \$\$('#selector_autocomplete .{$key}').each (function (el) {\n \$('{$field}').value = el.innerHTML;\n });\n ";
$toMaj .= $key . ';';
}
}
$onSelect = $onSelectTemp . $onSelect;
$url = 'generictools|ajax|getAutoComplete';
if (isset($pParams['url'])) {
$url = $pParams['url'];
}
$length = isset($length) ? $length : 1;
$pParams['view'] = isset($pParams['view']) ? $pParams['view'] : $field;
$tab = array();
foreach ($pParams as $key => $param) {
$tab[$key] = $param;
}
$tab['nb'] = 10;
$tab['tomaj'] = $toMaj;
$js = new CopixJSWidget();
$js->tag_autocomplete($id, $name, $length, $tab, _url($url), $js->function_(null, 'el', $onRequest), $js->function_(null, 'el,eleme,element', $onSelect));
CopixHTMLHeader::addJSDOMReadyCode($js);
CopixHTMLHeader::addJSLink(_resource('js/taglib/tag_autocomplete.js'));
_eTag("mootools", array('plugin' => "observer;autocompleter"));
$toReturn = '<input type="text" id="' . $name . '" name="' . $name . '" value="' . $value . '" ' . $extra . ' /><span id="autocompleteload_' . $name . '"><img src="' . CopixUrl::getResource('img/tools/load.gif') . '" /></span>';
return $toReturn;
}
示例7: process
/**
* Génération du code HTML
* @return string
*/
public function process($pParams)
{
//Test si le parametre correspondant au type existe
if (isset($pParams['type'])) {
$type = $pParams['type'];
} else {
//Sinon on génère une exception précisant que le type est manquant
throw new CopixTemplateTagException('CopixImage: missing type parameter');
}
//Si une propriété correspond au type saisi
if (CopixI18N::exists('copix:common.buttons.' . $type)) {
//On récupère le libellé de ce type
$alt = _i18n('copix:common.buttons.' . $type);
} else {
//Sinon on génère une erreur
throw new CopixException('You must enter an existing type');
}
//identifiant sur le href
$idimg = '';
$idhref = '';
if (isset($pParams['id'])) {
$idimg = 'id="' . $pParams['id'] . '_img"';
$idhref = 'id="' . $pParams['id'] . '_href"';
}
//Initialisation du type
if (isset($pParams['title'])) {
$title = $pParams['title'];
} else {
$title = $alt;
}
if (isset($pParams['class'])) {
$class = 'class="' . $pParams['class'] . '"';
} else {
$class = '';
}
//Création du chemin ou se trouve l'image
$fileName = str_replace(CopixUrl::getRequestedBaseUrl(), './', _resource("img/tools/" . $type . ".png"));
//Test si le fichier existe
if (file_exists($fileName)) {
$src = _resource("img/tools/" . $type . ".png");
} else {
throw new CopixException('No icon does not correspond to your application');
}
if (isset($pParams['text'])) {
$text = $pParams['text'];
} else {
$text = '';
}
//si une url a été renseignée
if (isset($pParams['href'])) {
$href = $pParams['href'];
return '<a href="' . $href . '" ' . $idhref . ' title="' . $title . '" ' . $class . '><img src="' . $src . '" ' . $idimg . ' alt="' . $alt . '"/>' . $text . '</a>';
} else {
return '<img src="' . $src . '" ' . $idimg . ' alt="' . $alt . '" title="' . $title . '" ' . $class . ' />' . $text;
}
}
示例8: beforeDisplay
function beforeDisplay(&$display)
{
$HTTP_USER_AGENT = isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : '';
if (preg_match("/MSIE 6.0/", $HTTP_USER_AGENT)) {
CopixHTMLHeader::addCSSLink(_resource("styles/theme_ie.css"));
CopixHTMLHeader::addCSSLink(_resource("styles/theme_ie6.css"));
} elseif (preg_match("/MSIE 7.0/", $HTTP_USER_AGENT)) {
CopixHTMLHeader::addCSSLink(_resource("styles/theme_ie.css"));
CopixHTMLHeader::addCSSLink(_resource("styles/theme_ie7.css"));
}
}
示例9: smarty_function_copixresource
/**
* Plugin smarty type fonction
* Purpose: génération du chemin d'une ressoruce pour les templates
*
* Input: path=le/chemin/de/la/ressource.ext
*/
function smarty_function_copixresource($params, &$me)
{
$toReturn = _resource($params['path']);
$assign = isset($params['assign']) ? $params['assign'] : null;
if (strlen($assign) > 0) {
$me->assign($assign, $toReturn);
return '';
} else {
return $toReturn;
}
}
示例10: _createContent
public function _createContent(&$toReturn)
{
$moduleName = CopixZone::getParam('moduleName');
if (($message = CopixModule::updateModule($moduleName)) === true) {
$toReturn = _i18n('install.module.update') . ' ' . $moduleName . ' <img src="' . _resource('img/tools/valid.png') . '" />';
} else {
$toReturn = _i18n('install.module.update') . ' ' . $moduleName . ' ' . _tag('popupinformation', array('img' => _resource('img/tools/delete.png')), $message);
$toReturn .= '<div class="errorMessage">' . $message . '</div>';
}
return true;
}
示例11: _createContent
public function _createContent(&$toReturn)
{
$tpl = new CopixTpl();
$tpl->assign("prefs", $this->getParam('prefs'));
$msg = $this->getParam('msg');
if ($msg && $msg == 'save') {
$tpl->assign('msg', array('type' => 'ok', 'image_url' => _resource('img/prefs/smiley_black.png'), 'image_alt' => CopixI18N::get('prefs.msg.prefsrecorded_alt'), 'value' => CopixI18N::get('prefs.msg.prefsrecorded')));
}
$toReturn = $tpl->fetch("getprefs.tpl");
return true;
}
示例12: process
/**
* Construction de l'input
* @param mixed $pParams tableau de paramètre ou clef
* @param mixed $pContent
* @return string l'input fabriqué
* Paramètres recommandés :
* id : identifiant utile pour les labels, le javascript..
* name : nom de l'input utile pour récupérer sa valeur avec php
*
* Autres paramètres (liste non exhaustive)
* value : valeur à afficher
* maxlength : nombre de caractères maximals
* size : taille de l'input affiché
* next : zone suivante qui prendra le focus lorsque maxlenght sera atteind
* previous : zone précédente qui prendra le focus lorsque tous les caratères seront effacés
* (ces deux derniers paramètres sont gérés à l'aide de javascript)
*/
public function process($pParams)
{
extract($pParams);
if (!isset($pParams['id']) && !isset($pParams['name'])) {
throw new CopixTagException("[CopixTagInput] Missing id or name parameter");
}
if (!isset($pParams['id'])) {
$pParams['id'] = $pParams['name'];
} elseif (!isset($pParams['name'])) {
$pParams['name'] = $pParams['id'];
}
$readonly = '';
if (isset($pParams['readonly'])) {
if ($pParams['readonly']) {
$readonly = 'readonly="readonly"';
}
unset($pParams['readonly']);
}
if (isset($pParams['value']) && !empty($pParams['value'])) {
$pParams['value'] = htmlspecialchars($pParams['value'], ENT_QUOTES);
}
if (!isset($extra)) {
$extra = '';
} else {
unset($pParams['extra']);
}
$toReturn = '<input type="text" ' . $readonly . ' ' . $extra . ' ';
foreach ($pParams as $key => $param) {
if ($key != 'next' && $key != 'previous') {
$toReturn .= $key . '="' . $param . '" ';
}
}
if (!isset($maxlength)) {
$maxlength = '1';
}
if (isset($next) && $next != null && $maxlength != null || isset($previous) && $previous != null) {
CopixHTMLHeader::addJSLink(_resource('js/taglib/tag_inputtext.js'));
if (!isset($previous)) {
$previous = 'null';
}
if (!isset($next)) {
$next = '';
}
if ($next == 'true') {
$toReturn .= 'onKeyDown="javascript:autofocus(this,' . $maxlength . ',event,\'' . $previous . '\');" ';
} else {
$toReturn .= 'onKeyDown="javascript:focusid(this,' . $maxlength . ',event,\'' . $next . '\',\'' . $previous . '\');" ';
}
}
$toReturn .= ' />';
return $toReturn;
}
示例13: _createContent
/**
* Affiche la série de boutons permettant à l'utilisateur de mettre en forme simplement le texte qu'il saisit dans une zone de texte libre.
*
* @author Christophe Beyer <cbeyer@cap-tic.fr>
* @since 2007/05/22
* @param string $field Nom du champ dans le formulaire.
* @param string $format Format à utiliser (html, wiki...)
* @param string $content Contenu "brut" saisi
* @param array $objet (option) Module dans lequel se trouve la zone d'édition, dans un tableau indexé avec TYPE et ID (exemple: type=>MOD_BLOG, id=>4). Si positionné, on va vérifier si le parent de cet objet a un album photos, et si oui on affiche le lien vers l'album photos en mode popup
* @param integer $width (option) Largeur de la zone de saisie
* @param integer $height (option) Hauteur de la zone de saisie
* @param array $options (option) Options permettant de personnaliser la zone
*/
public function _createContent(&$toReturn)
{
$tpl = new CopixTpl();
$field = $this->getParam('field', NULL);
$format = $this->getParam('format', NULL);
$content = $this->getParam('content', NULL);
$object = $this->getParam('object', array());
$width = $this->getParam('width', 650);
$height = $this->getParam('height', 300);
$class = $this->getParam('class');
$options = $this->getParam('options', array());
$html = '';
if ($field && $format) {
if ('USER' === $object) {
} else {
$object_type = isset($object['type']) ? $object['type'] : null;
$object_id = isset($object['id']) ? $object['id'] : null;
$object = $object_type && $object_id ? array('type' => $object_type, 'id' => $object_id) : null;
}
switch ($format) {
case "wiki":
$tpl->assign('wikibuttons', CopixZone::process('kernel|wikibuttons', array('field' => $field, 'format' => $format, 'object' => $object)));
break;
case "html":
$tpl->assign('wikibuttons', CopixZone::process('kernel|wikibuttons', array('field' => $field, 'format' => $format, 'object' => $object)));
break;
case "htmlnl2br":
$tpl->assign('wikibuttons', CopixZone::process('kernel|wikibuttons', array('field' => $field, 'format' => $format, 'object' => $object)));
break;
case "dokuwiki":
$tpl->assign('wikibuttons', CopixZone::process('kernel|wikibuttons', array('field' => $field, 'format' => $format, 'object' => $object)));
break;
case "fckeditor":
case "ckeditor":
CopixHTMLHeader::addJSLink(_resource('js/ckeditor/ckeditor.js'));
CopixHTMLHeader::addJSLink(_resource('js/ckeditor/config.js'));
$tpl->assign('wikibuttons', CopixZone::process('kernel|wikibuttons', array('field' => $field, 'format' => 'ckeditor', 'object' => $object)));
break;
}
$tpl->assign('field', $field);
$tpl->assign('format', $format);
$tpl->assign('content', $content);
$tpl->assign('width', $width);
$tpl->assign('height', $height);
$tpl->assign('class', $class);
$tpl->assign('options', $options);
}
//_dump($options);
$toReturn = $tpl->fetch('zone.edition.tpl');
return true;
}
示例14: process
/**
* Construction du message
* @param mixed $pParams tableau de paramètre ou clef
* @param mixed $pContent null (ImageProtect n'est pas censé recevoir de contenu)
* @return string balise html contenant le bouton de selection i18n
*/
public function process($pParams, $pContent = null)
{
if (!isset($pParams['name'])) {
throw new CopixTagException("[ImageProtect] Missing name parameter");
}
if (!isset($pParams['id'])) {
throw new CopixTagException("[ImageProtect] Missing id parameter");
}
$caption = isset($pParams['caption']) ? $pParams['caption'] : '';
$listeModules = CopixModule::getList(false);
sort($listeModules);
$winSelecter = '<div id="divpopup_' . $pParams['id'] . '" style="display:none; border:1px; border-style:solid; border-color:#000; background-color:#FFF ;" >' . "\n\n" . ' <div id="divpopup1_' . $pParams['id'] . '" style="float:left;" >' . "\n" . ' ' . _tag('select', array('id' => 'selectmodule1_' . $pParams['id'], 'name' => 'selectmodule_' . $pParams['id'], 'values' => $listeModules, 'extra' => 'style="width:200px;" size="12"', 'emptyShow' => false)) . "\n" . ' </div>' . "\n\n" . ' <div id="divpopup2_' . $pParams['id'] . '" style="display:none;float:left;" >' . "\n" . ' ' . _tag('select', array('id' => 'selectmodule2_' . $pParams['id'], 'name' => 'selectmodule_' . $pParams['id'], 'values' => $listeModules, 'extra' => 'style="width:200px;" size="10"', 'emptyShow' => false)) . "\n" . ' <div id="divtrad_' . $pParams['id'] . '" > ' . "\n" . ' <textarea cols="30" rows="1" readonly="readonly" style="width:200px; overflow:hidden;" >traduction de \'i18n</textarea>' . "\n" . ' </div>' . "\n" . ' </div>' . "\n\n" . '</div>' . "\n";
$javascript = '<script type="text/javascript">' . "\n" . '$("' . $pParams['id'] . '").addEvent("mouseover", function (){' . "\n" . ' $("divpopup_' . $pParams['id'] . '").setStyles({' . "\n" . ' "position":"absolute",' . "\n" . ' "top" : 200+"px",' . "\n" . ' "left" : 200+"px",' . "\n" . ' "zIndex":"1000",' . "\n" . ' "display":"block"' . "\n" . ' });' . "\n" . '});' . "\n\n" . '$("selectmodule1_' . $pParams['id'] . '").addEvent("change", function () {' . "\n" . ' $("divpopup2_' . $pParams['id'] . '").setStyle("display","block");' . "\n" . '});' . "\n" . '</script>' . "\n";
return '<label>' . $caption . '<input type="text" name="' . $pParams['name'] . '" /></label>' . "\n" . '<img src="' . _resource("img/icons/languages.gif") . '" id="' . $pParams['id'] . '" alt="' . _i18n('copix:common.buttons.select') . '" />' . "\n" . $winSelecter . $javascript;
}
示例15: process
public function process($pParams, $pContent = null)
{
$tabGroupId = $this->getParam('id', uniqid('tab'));
$tabs = $this->requireParam('tabs', null, array());
$groupClass = $this->getParam('groupClass', '');
$tabClass = $this->getParam('tabClass', '');
$selectedClass = $this->getParam('selectedClass', 'tabSelected');
$onSelect = $this->getParam('onSelect', null, 'string');
$onUnselect = $this->getParam('onUnselect', null, 'string');
$default = $this->getParam('default');
$this->validateParams();
if ($default && !isset($tabs[$default])) {
_log('[tag tabgroup] invalid default for tabgroup ' . $tabGroupId . ': ' . $default, 'errors');
$default = null;
}
$toReturn = array();
$toReturn[] = sprintf('<div class="tabGroup %s" id="%s">', $groupClass, $tabGroupId);
$tabIds = array();
$tabKeys = array();
$i = 0;
$tabIndexes = array();
foreach ($tabs as $key => $caption) {
$tabId = $tabGroupId . '_tab' . $i;
//preg_replace('/[^\w]/', '_', $key);
//$tabIds[$tabId] = $key;
$elementIds[$key] = $tabId;
$tabIndexes[$key] = $i++;
$toReturn[] = sprintf('<span class="tabCaption %s %s" id="%s">%s</span>', $tabClass, $key == $default ? $selectedClass : '', $tabId, _copix_utf8_htmlentities($caption));
}
$toReturn[] = '</div>';
CopixHTMLHeader::addJSLink(_resource('js/taglib/tabgroup.js'), array('id' => 'taglib_tabgroup_js'));
$params = array('id' => $tabGroupId, 'selectedClass' => $selectedClass, 'tabs' => array_keys($tabs));
if ($default) {
$params['defaultTab'] = $tabIndexes[$default];
}
$js = new CopixJSWidget();
if ($onSelect) {
$params['onSelect'] = $js->function_(null, 'tabId', $onSelect);
}
if ($onUnselect) {
$params['onUnselect'] = $js->function_(null, 'tabId', $onUnselect);
}
$js->Copix->registerTabGroup($params);
CopixHTMLHeader::addJSDOMReadyCode($js);
return implode("\n", $toReturn);
}