Пример #1
0
            ?>
		<script type="text/javascript">window.addEvent('domready', function() { window.print(); });</script>
	<?php 
        } elseif ($this->params->get('print_behaviour') == 'button') {
            ?>
		<input type='button' id='printBtn' name='printBtn' value='<?php 
            echo JText::_('Print');
            ?>
' class='btn btn-info' onclick='this.style.display="none"; window.print(); return false;'>
	<?php 
        }
    } elseif ($this->params->get('show_print_icon') || $this->params->get('show_email_icon') || $this->params->get('show_feed_icon', 1) || $this->params->get('show_addbutton', 1)) {
        ?>
	<div class="buttons">
		<?php 
        echo flexicontent_html::addbutton($this->params, $this->category);
        ?>
		<?php 
        echo flexicontent_html::printbutton($this->print_link, $this->params);
        ?>
		<?php 
        echo flexicontent_html::mailbutton('category', $this->params, $this->category->slug);
        ?>
		<?php 
        echo flexicontent_html::feedbutton('category', $this->params, $this->category->slug);
        ?>
	</div>
<?php 
    }
    ?>
<!-- EOF buttons -->
Пример #2
0
 function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display')
 {
     if (!in_array($field->field_type, self::$field_types)) {
         return;
     }
     $field->label = JText::_($field->label);
     $field->{$prop} = '';
     $values = $values ? $values : $field->value;
     $show_total_only = $field->parameters->get('show_total_only', 0);
     $total_show_auto_btn = $field->parameters->get('total_show_auto_btn', 0);
     $total_show_list = $field->parameters->get('total_show_list', 0);
     // *******************************************
     // Check for special display : total info only
     // *******************************************
     if ($prop == 'display_total') {
         $display_total = true;
     } else {
         if ($show_total_only == 1 || $show_total_only == 2 && count($values)) {
             $app = JFactory::getApplication();
             $view = JRequest::getVar('view');
             $option = JRequest::getVar('option');
             $isItemsManager = $app->isAdmin() && $view == 'items' && $option == 'com_flexicontent';
             $total_in_view = $field->parameters->get('total_in_view', array('backend'));
             $total_in_view = FLEXIUtilities::paramToArray($total_in_view);
             $display_total = $isItemsManager && in_array('backend', $total_in_view) || in_array($view, $total_in_view);
         } else {
             $display_total = false;
         }
     }
     // ***********************************************************
     // Create total info and terminate if not adding the item list
     // ***********************************************************
     if ($display_total) {
         $total_append_text = $field->parameters->get('total_append_text', '');
         $field->{$prop} .= '<span class="fcrelation_field_total">' . count($values) . ' ' . $total_append_text . '</span>';
         // Terminate if not adding any extra information
         if (!$total_show_list && !$total_show_auto_btn) {
             return;
         }
         // Override the item list HTML parameter ...
         $total_relitem_html = $field->parameters->get('total_relitem_html', '');
         if ($total_relitem_html) {
             $field->parameters->set('relitem_html', $total_relitem_html);
         }
     }
     // ***********************************************************
     // Prepare item list data for rendering the related items list
     // ***********************************************************
     if ($field->field_type == 'relation_reverse') {
         $reverse_field = $field->parameters->get('reverse_field', 0);
         if (!$reverse_field) {
             $field->{$prop} .= 'Field [id:' . $field->id . '] : ' . JText::_('FLEXI_FIELD_NO_FIELD_SELECTED');
             return;
         }
         $_itemids_catids = null;
         // Always ignore passed items, the DB query will determine the items
     } else {
         // Compatibility with old values, we no longer serialize all values to one, this way the field can be reversed !!!
         $values = ($field_data = @unserialize($values)) ? $field_data : $field->value;
         // No related items, just return empty display
         if (!$values || !count($values)) {
             return;
         }
         $_itemids_catids = array();
         foreach ($values as $i => $val) {
             list($itemid, $catid) = explode(":", $val);
             $_itemids_catids[$itemid] = new stdClass();
             $_itemids_catids[$itemid]->itemid = $itemid;
             $_itemids_catids[$itemid]->catid = $catid;
             $_itemids_catids[$itemid]->value = $val;
         }
     }
     // **********************************************
     // Create the submit button for auto related item
     // **********************************************
     $auto_relate_curritem = $field->parameters->get('auto_relate_curritem', 0);
     $auto_relate_menu_itemid = $field->parameters->get('auto_relate_menu_itemid', 0);
     $auto_relate_position = $field->parameters->get('auto_relate_position', 0);
     $auto_rel_btn = '';
     if ($auto_relate_curritem && $auto_relate_menu_itemid && (!$display_total || $total_show_auto_btn)) {
         $_submit_text = $field->parameters->get('auto_relate_submit_text', 'FLEXI_ADD_RELATED');
         $_show_to_unauth = $field->parameters->get('auto_relate_show_to_unauth', 0);
         $auto_relations[0] = new stdClass();
         $auto_relations[0]->itemid = $item->id;
         $auto_relations[0]->fieldid = $field->id;
         $category = null;
         $auto_rel_btn = flexicontent_html::addbutton($field->parameters, $category, $auto_relate_menu_itemid, $_submit_text, $auto_relations, $_show_to_unauth);
     }
     // *****************************
     // Finally, create the item list
     // *****************************
     if (!$display_total || $total_show_list) {
         $add_before = $auto_rel_btn && ($auto_relate_position == 0 || $auto_relate_position == 2);
         $add_after = $auto_rel_btn && ($auto_relate_position == 1 || $auto_relate_position == 2);
         $field->{$prop} .= '' . ($add_before ? $auto_rel_btn : '') . FlexicontentFields::getItemsList($field->parameters, $_itemids_catids, $isform = 0, @$reverse_field, $field, $item) . ($add_after ? $auto_rel_btn : '');
     } else {
         if ($auto_rel_btn) {
             $field->{$prop} .= $auto_rel_btn;
         }
     }
 }