/**
  * Renders a select2 input field for selecting a project
  *
  * @param     int       $value         The state value
  * @param     bool      $can_change
  *
  * @return    string                   The input field html
  */
 public static function select2($value = 0, $can_change = true)
 {
     JHtml::_('pfhtml.script.jQuerySelect2');
     static $field_id = 0;
     $doc = JFactory::getDocument();
     $app = JFactory::getApplication();
     // Get currently active project data
     $active_id = (int) PFApplicationHelper::getActiveProjectId();
     $active_title = PFApplicationHelper::getActiveProjectTitle();
     $field_id++;
     // Prepare title value
     $title_val = htmlspecialchars($active_title, ENT_COMPAT, 'UTF-8');
     // Prepare field attributes
     $attr_read = $can_change ? '' : ' readonly="readonly"';
     $css_txt = ($can_change ? '' : ' disabled muted') . ($active_id ? ' success' : ' warning');
     $placehold = htmlspecialchars(JText::_('COM_PROJECTFORK_SELECT_PROJECT'), ENT_COMPAT, 'UTF-8');
     // Query url
     $url = 'index.php?option=com_pfprojects&view=projects&tmpl=component&format=json&select2=1';
     // Prepare JS typeahead script
     $js = array();
     $js[] = "jQuery(document).ready(function()";
     $js[] = "{";
     $js[] = "    jQuery('#filter_project_id" . $field_id . "').select2({";
     $js[] = "        placeholder: '" . $placehold . "',";
     if ($active_id) {
         $js[] = "        allowClear: true,";
     }
     $js[] = "        minimumInputLength: 0,";
     $js[] = "        ajax: {";
     $js[] = "            url: '" . $url . "',";
     $js[] = "            dataType: 'json',";
     $js[] = "            quietMillis: 200,";
     $js[] = "            data: function (term, page) {return {filter_search: term, limit: 10, limitstart: ((page - 1) * 10)};},";
     $js[] = "            results: function (data, page) {var more = (page * 10) < data.total;return {results: data.items, more: more};}";
     $js[] = "        },";
     $js[] = "        escapeMarkup:function(markup) { return markup; },";
     $js[] = "        initSelection: function(element, callback) {";
     $js[] = "           callback({id:" . $active_id . ", text: '" . ($active_id ? htmlspecialchars($active_title, ENT_QUOTES) : htmlspecialchars($placehold, ENT_QUOTES)) . "'});";
     $js[] = "        }";
     $js[] = "    });";
     $js[] = "    jQuery('#filter_project_id" . $field_id . "').change(function(){this.form.submit();});";
     $js[] = "});";
     // Prepare html output
     $html = array();
     $html[] = '<input type="hidden" id="filter_project_id' . $field_id . '" name="filter_project" placeholder="' . $placehold . '"';
     $html[] = ' value="' . $active_id . '" autocomplete="off"' . $attr_read . ' class="input-large" tabindex="-1" />';
     if ($can_change) {
         // Add script
         JFactory::getDocument()->addScriptDeclaration(implode("\n", $js));
     }
     return implode("\n", $html);
 }
Beispiel #2
0
    echo JText::_('COM_PROJECTFORK_TIME_TRACKING_ESTIMATED');
    ?>
 (<?php 
    echo JHtml::_('time.format', $this->total_estimated_time, 'decimal');
    ?>
)
                			</div>
                		</fieldset>
                	</div>
                	<div class="span6">
            			<fieldset>
            				<legend><?php 
    echo JText::_('COM_PROJECTFORK_TIME_TRACKING_TOTAL_HOURS');
    ?>
: <?php 
    echo PFApplicationHelper::getActiveProjectTitle();
    ?>
</legend>
        					<div class="progress progress-success">
								<div class="bar" style="width: <?php 
    echo $billable_percent;
    ?>
%;">
									<?php 
    if ($billable_percent) {
        ?>
										<?php 
        echo JHtml::_('time.format', $this->total_time_billable, 'decimal');
        ?>
										<?php 
        echo JText::_('COM_PROJECTFORK_TIME_TRACKING_BILLABLE');
    window.focus();
    window.print();
});
');
?>
<div id="projectfork" class="category-list<?php 
echo $this->pageclass_sfx;
?>
 view-milestones-print">

    <?php 
if ($this->state->get('filter.project')) {
    ?>
        <h2>
            <?php 
    echo $this->escape(PFApplicationHelper::getActiveProjectTitle());
    ?>
        </h2>
    <?php 
}
?>

    <table class="table table-striped cat-items">
        <thead>
            <tr>
                <th><?php 
echo JText::_('JGRID_HEADING_TASK');
?>
</th>
                <th class="nowrap" style="width: 20%"><?php 
echo JText::_('JGRID_HEADING_AUTHOR');