示例#1
0
 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;
     }
 }
示例#2
0
 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;
 }
示例#3
0
			<div class="control-group">
				<div class="control-label">
					<label for="batch_folder"><?php 
    echo JText::_('COM_CCK_APPEND_VERSION_NUMBER') . '<span class="star"> *</span>';
    ?>
</label>
				</div>
				<div class="controls">
					<?php 
    echo JCckDev::getForm('core_dev_radio', '', $config, array('defaultvalue' => $params->get('filename_version', '0'), 'options' => 'No=0||Yes=1', 'css' => 'btn-group btn-group-yesno app-options', 'storage_field' => 'filename_version'));
    ?>
				</div>
			</div>
			<?php 
    echo '<small class="pull-right"> * ' . JText::_('COM_CCK_NOT_PERMANENTLY_STORED') . '</small>';
    echo JCckDevTabs::end();
    ?>
		</div>
		<div class="modal-footer">
			<button class="btn btn-primary" type="button" onclick="" data-dismiss="modal"><?php 
    echo JText::_('COM_CCK_CLOSE');
    ?>
</button>
		</div>
	</div>
<?php 
} else {
    ?>
	<div class="<?php 
    echo $this->css['batch'] . $this->css['joomla3'];
    ?>
示例#4
0
 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;
     }
 }