public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false) { if (self::$type != $field->type) { return; } self::$path = parent::g_getPath(self::$type . '/'); parent::g_onCCK_FieldPrepareForm($field, $config); // Init if (count($inherit)) { $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name; } else { $id = $field->name; } // Prepare $form = ''; if ($field->state) { $group_id = $field->location != '' ? $field->location : 'cck_tabs1'; if ($field->bool == 2) { $form = JCckDevTabs::end(); } elseif ($field->bool == 1) { $form = JCckDevTabs::open($group_id, $id, $field->label); } else { $form = JCckDevTabs::start($group_id, $id, $field->label, array('active' => $id)); } } // Set $field->form = $form; $field->value = $field->label; $field->label = ''; // Return if ($return === true) { return $field; } }
protected static function _prepare($target, $process, &$fields) { $id = $process['id']; $label = $process['label']; $name = $process['name']; $group_id = $process['group_id']; $value = $process['value']; static $groups = array(); if (!isset($groups[$group_id])) { $groups[$group_id] = array('active' => $value, 'current' => 0, 'identifier' => $process['identifier'], 'url_actions' => $process['url_actions']); } if ($groups[$group_id]['identifier']) { $id = JCckDev::toSafeID($label); } if ($fields[$name]->bool == 2) { $html = JCckDevTabs::end(); } elseif ($fields[$name]->bool == 1) { $html = JCckDevTabs::open($group_id, $id, $label); if ($target == 'form') { $html = str_replace('class="tab-pane', 'class="tab-pane cck-tab-pane', $html); } $js = ''; if ($groups[$group_id]['current'] == $groups[$group_id]['active']) { $js = '$("#' . $group_id . 'Tabs > li,#' . $group_id . 'Content > div").removeClass("active"); $("#' . $group_id . 'Tabs > li:eq(' . (int) $groups[$group_id]['active'] . '),#' . $id . '").addClass("active");'; } if ($groups[$group_id]['url_actions']) { $js = 'var cur = window.location.hash; if(cur!="" && $(cur).length) { $("a[href=\'"+cur+"\']").tab("show"); }'; if ($groups[$group_id]['url_actions'] == 2) { $js .= ' $("a[data-toggle=\'tab\']").on("shown", function(e) {window.location.hash = e.target.hash;})'; } } if ($js) { $js = '(function($){ $(document).ready(function() { ' . $js . ' }); })(jQuery);'; JFactory::getDocument()->addScriptDeclaration($js); } } else { $html = JCckDevTabs::start($group_id, $id, $label, array('active' => $id)); if ($target == 'form') { $html = str_replace('class="nav nav-tabs"', 'class="nav nav-tabs cck-tabs"', $html); $html = str_replace('class="tab-pane', 'class="tab-pane cck-tab-pane', $html); } } $groups[$group_id]['current']++; $fields[$name]->{$target} = $html; }
?> " id="collapseModal"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">x</button> <h3><?php echo JText::_('COM_CCK_APP_PROCESS'); ?> </h3> </div> <div class="modal-body"> <p><?php echo JText::_('COM_CCK_APP_PROCESS_DESC'); ?> </p> <?php echo JCckDevTabs::start('batch_tabs', 'bt0', JText::_('COM_CCK_ELEMENTS'), array('active' => 'bt0')); ?> <div class="control-group"> <div class="control-label"> <label for="batch_folder"><?php echo JText::_('COM_CCK_SELECT_ELEMENTS') . '<span class="star"> *</span>'; ?> </label> </div> <div class="controls"> <?php echo JCckDev::getForm('core_app_elements', '', $config, array('bool' => 1, 'storage_field' => 'app_elements')); ?> </div> </div> <?php
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false) { if (self::$type != $field->type) { return; } self::$path = parent::g_getPath(self::$type . '/'); parent::g_onCCK_FieldPrepareForm($field, $config); // Init if (count($inherit)) { $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name; } else { $id = $field->name; } $value = $value != '' ? (int) $value : (int) $field->defaultvalue; $value = $value ? $value - 1 : 0; $group_id = $field->location != '' ? $field->location : 'cck_tabs1'; static $groups = array(); if (!isset($groups[$group_id])) { $groups[$group_id] = array('active' => $value, 'current' => 0); } // Prepare $form = ''; if ($field->state) { if ($field->bool == 2) { $form = JCckDevTabs::end(); } elseif ($field->bool == 1) { $form = JCckDevTabs::open($group_id, $id, $field->label); $form = str_replace('class="tab-pane', 'class="tab-pane cck-tab-pane', $form); if ($groups[$group_id]['current'] == $groups[$group_id]['active']) { $js = '(function($){ $(document).ready(function() { $("#' . $group_id . 'Tabs > li,#' . $group_id . 'Content > div").removeClass("active"); $("#' . $group_id . 'Tabs > li:eq(' . (int) $groups[$group_id]['active'] . '),#' . $id . '").addClass("active"); }); })(jQuery);'; JFactory::getDocument()->addScriptDeclaration($js); } } else { $form = JCckDevTabs::start($group_id, $id, $field->label, array('active' => $id)); $form = str_replace('class="nav nav-tabs"', 'class="nav nav-tabs cck-tabs"', $form); $form = str_replace('class="tab-pane', 'class="tab-pane cck-tab-pane', $form); } $groups[$group_id]['current']++; } // Set $field->form = $form; // todo: '<div class="tabbable tabs-left">' $field->value = $field->label; $field->label = ''; // Return if ($return === true) { return $field; } }