protected function getButtons() { $components = PFapplicationHelper::getComponents(); $buttons = array(); foreach ($components as $component) { if (!PFApplicationHelper::enabled($component->element)) { continue; } $helper = JPATH_ADMINISTRATOR . '/components/' . $component->element . '/helpers/dashboard.php'; $class = str_replace('com_pf', 'PF', $component->element) . 'HelperDashboard'; if (!JFile::exists($helper)) { continue; } JLoader::register($class, $helper); if (class_exists($class)) { if (in_array('getAdminButtons', get_class_methods($class))) { $com_buttons = (array) call_user_func(array($class, 'getAdminButtons')); $buttons[$component->element] = array(); foreach ($com_buttons as $button) { $buttons[$component->element][] = $button; } } } } return $buttons; }
/** * Method to get a list of available buttons * * @return array $buttons The available buttons */ public static function getButtons() { $components = PFApplicationHelper::getComponents(); $buttons = array(); foreach ($components as $component) { if (!PFApplicationHelper::enabled($component->element)) { continue; } // Register component route helper if exists $router = JPATH_SITE . '/components/' . $component->element . '/helpers/route.php'; $class = str_replace('com_pf', 'PF', $component->element) . 'HelperRoute'; if (JFile::exists($router)) { JLoader::register($class, $router); } // Register component dashboard helper if exists $helper = JPATH_ADMINISTRATOR . '/components/' . $component->element . '/helpers/dashboard.php'; $class = str_replace('com_pf', 'PF', $component->element) . 'HelperDashboard'; if (!JFile::exists($helper)) { continue; } JLoader::register($class, $helper); // Get the dashboard button if (class_exists($class)) { if (in_array('getSiteButtons', get_class_methods($class))) { $com_buttons = (array) call_user_func(array($class, 'getSiteButtons')); $buttons[$component->element] = array(); foreach ($com_buttons as $button) { $buttons[$component->element][] = $button; } } } } return $buttons; }
/** * Method to get a list of items. * Overriden to inject convert the attribs field into a JParameter object. * * @return mixed $items An array of objects on success, false on failure. */ public function getItems() { $items = parent::getItems(); $base_path = JPATH_ROOT . '/media/com_projectfork/repo/0/logo'; $base_url = JURI::root(true) . '/media/com_projectfork/repo/0/logo'; $tasks_exists = PFApplicationHelper::enabled('com_pftasks'); $repo_exists = PFApplicationHelper::enabled('com_pfrepo'); $pks = JArrayHelper::getColumn($items, 'id'); // Get aggregate data $progress = array(); $total_tasks = array(); $completed_tasks = array(); $total_files = array(); if ($tasks_exists) { JLoader::register('PFtasksModelTasks', JPATH_SITE . '/components/com_pftasks/models/tasks.php'); $tmodel = JModelLegacy::getInstance('Tasks', 'PFtasksModel', array('ignore_request' => true)); $progress = $tmodel->getAggregatedProgress($pks, 'project_id'); $total_tasks = $tmodel->getAggregatedTotal($pks, 'project_id'); $completed_tasks = $tmodel->getAggregatedTotal($pks, 'project_id', 1); } if ($repo_exists) { JLoader::register('PFrepoModelFiles', JPATH_SITE . '/components/com_pfrepo/models/files.php'); $fmodel = JModelLegacy::getInstance('Files', 'PFrepoModel', array('ignore_request' => true)); $total_files = $fmodel->getProjectCount($pks); } // Loop over each row to inject data foreach ($items as $i => &$item) { $params = new JRegistry(); $params->loadString($item->attribs); // Convert the parameter fields into objects. $items[$i]->params = clone $this->getState('params'); // Create slug $items[$i]->slug = $items[$i]->alias ? $items[$i]->id . ':' . $items[$i]->alias : $items[$i]->id; // Try to find the logo img $items[$i]->logo_img = null; if (JFile::exists($base_path . '/' . $item->id . '.jpg')) { $items[$i]->logo_img = $base_url . '/' . $item->id . '.jpg'; } elseif (JFile::exists($base_path . '/' . $item->id . '.jpeg')) { $items[$i]->logo_img = $base_url . '/' . $item->id . '.jpeg'; } elseif (JFile::exists($base_path . '/' . $item->id . '.png')) { $items[$i]->logo_img = $base_url . '/' . $item->id . '.png'; } elseif (JFile::exists($base_path . '/' . $item->id . '.gif')) { $items[$i]->logo_img = $base_url . '/' . $item->id . '.gif'; } // Inject task count $items[$i]->tasks = isset($total_tasks[$item->id]) ? $total_tasks[$item->id] : 0; // Inject completed task count $items[$i]->completed_tasks = isset($completed_tasks[$item->id]) ? $completed_tasks[$item->id] : 0; // Inject progress $items[$i]->progress = isset($progress[$item->id]) ? $progress[$item->id] : 0; // Inject attached files $items[$i]->attachments = isset($total_files[$item->id]) ? $total_files[$item->id] : 0; } return $items; }
echo $this->form->getLabel('modified'); ?> </div> <div class="controls"> <?php echo $this->form->getInput('modified'); ?> </div> </div> <?php } ?> </fieldset> <?php if (PFApplicationHelper::enabled('com_pfrepo')) { ?> <?php echo JHtml::_('tabs.panel', JText::_('COM_PROJECTFORK_FIELDSET_ATTACHMENTS'), 'reply-attachments'); ?> <fieldset> <div class="formelm control-group"> <?php echo $this->form->getInput('attachment'); ?> </div> </fieldset> <?php } ?>
/** * Method to generate the frontend input markup. * * @return array $html The html field markup */ protected function getSiteHTML($assets) { $html = array(); foreach ($assets as $asset) { list($component, $asset_name) = explode('.', $asset, 2); if (!PFApplicationHelper::enabled($component)) { continue; } $asset_id = str_replace('.', '_', $asset); $html[] = '<ul class="unstyled">'; $html[] = '<li class="well well-small">'; $html[] = '<strong>' . JText::_(strtoupper($asset_id) . '_LABEL_TITLE') . '</strong>'; $html[] = '<hr/>'; $html[] = '<ul id="' . $this->id . '_' . $asset_id . '" class="unstyled">'; if (array_key_exists($asset, $this->items)) { foreach ($this->items[$asset] as $item) { $html[] = '<li><div class="control-group">'; $html[] = '<a class="btn btn-mini" href="javascript:void(0);" onclick="pfRemoveLabel_' . $this->id . '(this)"><i class="icon-remove"></i></a>'; $html[] = '<input type="text" class="inputbox input-medium" onkeyup="pfPreviewLabel_' . $this->id . '(this, \'text\')"'; $html[] = 'name="' . $this->name . '[' . $asset . '][title][]" placeholder="' . JText::_('COM_PROJECTFORK_LABEL_TITLE_PLACEHOLDER') . '"'; $html[] = ' value="' . htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '" maxlength="32"/>'; $html[] = '<select class="inputbox input-medium" name="' . $this->name . '[' . $asset . '][style][]" onchange="pfPreviewLabel_' . $this->id . '(this, \'style\')">'; $html[] = '<option value="">' . JText::_('COM_PROJECTFORK_LABEL_OPTION_LABEL_STYLE_DEFAULT') . '</option>'; $html[] = '<option value="label-success"' . ($item->style == 'label-success' ? ' selected="selected"' : '') . '>' . JText::_('COM_PROJECTFORK_LABEL_OPTION_LABEL_STYLE_SUCCESS') . '</option>'; $html[] = '<option value="label-warning"' . ($item->style == 'label-warning' ? ' selected="selected"' : '') . '>' . JText::_('COM_PROJECTFORK_LABEL_OPTION_LABEL_STYLE_WARNING') . '</option>'; $html[] = '<option value="label-important"' . ($item->style == 'label-important' ? ' selected="selected"' : '') . '>' . JText::_('COM_PROJECTFORK_LABEL_OPTION_LABEL_STYLE_IMPORTANT') . '</option>'; $html[] = '<option value="label-info"' . ($item->style == 'label-info' ? ' selected="selected"' : '') . '>' . JText::_('COM_PROJECTFORK_LABEL_OPTION_LABEL_STYLE_INFO') . '</option>'; $html[] = '<option value="label-inverse"' . ($item->style == 'label-inverse' ? ' selected="selected"' : '') . '>' . JText::_('COM_PROJECTFORK_LABEL_OPTION_LABEL_STYLE_INVERSE') . '</option>'; $html[] = '</select>'; $html[] = JText::_('COM_PROJECTFORK_LABEL_PREVIEW') . ': '; $html[] = '<span class="label ' . $item->style . '"><i class="icon-bookmark"></i> ' . htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</span>'; $html[] = '<input type="hidden" name="' . $this->name . '[' . $asset . '][id][]" value="' . intval($item->id) . '"/>'; $html[] = '</div></li>'; } } $html[] = '</ul>'; $html[] = '<div class="control-group">'; $html[] = '<a class="btn" href="javascript:void(0);" onclick="pfAddLabel_' . $this->id . '(\'' . $asset_id . '\', \'' . $asset . '\');">'; $html[] = JText::_('JACTION_ADD_LABEL'); $html[] = '</a>'; $html[] = '</div>'; $html[] = '</li>'; $html[] = '</ul>'; $html[] = '<input type="hidden" name="' . $this->name . '[]" id="' . $this->id . '" value=""/>'; } return $html; }
/** * Method to get the task select options * * @param integer $project The project id * @return array The options */ protected function getOptions($project) { $app = JFactory::getApplication(); $db = JFactory::getDbo(); $query = $db->getQuery(true); $opts = array(); $ms_exists = PFApplicationHelper::enabled('com_pfmilestones'); $id = (int) $this->form->getValue('id'); $view = $app->input->get('view'); $query->select('a.id AS value, a.title AS t_title')->select('l.title AS l_title')->from('#__pf_tasks AS a')->join('left', '#__pf_task_lists AS l ON l.id = a.list_id'); if ($ms_exists) { $query->select('m.title AS m_title')->join('left', '#__pf_milestones AS m ON m.id = a.milestone_id'); } $query->where('a.project_id = ' . (int) $project); if ($ms_exists) { $query->order('m.title, l.title, a.title ASC'); } else { $query->order('l.title, a.title ASC'); } $db->setQuery($query); $items = $db->loadObjectList(); $opts[] = JHtml::_('select.option', '', JText::_('COM_PROJECTFORK_OPTION_SELECT_TASK')); if (empty($items)) { return $opts; } foreach ($items as $item) { if ($view == 'taskform' && $id == (int) $item->value) { // Skip if the value is the same as the task we're editing continue; } $value = array(); if ($ms_exists) { $value[] = empty($item->m_title) ? '-' : $item->m_title; } $value[] = empty($item->l_title) ? '-' : $item->l_title; $value[] = $item->t_title; $text = implode('/', $value); $opts[] = JHtml::_('select.option', $item->value, $text); } return $opts; }
<?php } ?> <dt class="owner-title"> <?php echo JText::_('JGRID_HEADING_CREATED_BY'); ?> : </dt> <dd class="owner-data"> <?php echo JHtml::_('pfhtml.label.author', $item->author, $item->created); ?> </dd> <?php if (PFApplicationHelper::enabled('com_pfrepo') && count($item->attachments)) { ?> <dt class="attachment-title"> <?php echo JText::_('COM_PROJECTFORK_FIELDSET_ATTACHMENTS'); ?> : </dt> <dd class="attachment-data"> <?php echo JHtml::_('pfrepo.attachments', $item->attachments); ?> </dd> <?php } ?>
<div class="control-label"> <?php echo $this->form->getLabel('project_id'); ?> </div> <div class="controls"> <?php echo $this->form->getInput('project_id'); ?> </div> </div> <?php } ?> <?php if (PFApplicationHelper::enabled('com_pfmilestones')) { ?> <div class="formelm control-group"> <div class="control-label"> <?php echo $this->form->getLabel('milestone_id'); ?> </div> <div class="controls" id="jform_milestone_id_reload"> <?php echo $this->form->getInput('milestone_id'); ?> </div> </div> <?php }
* @license http://www.gnu.org/licenses/gpl.html GNU/GPL, see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('pfhtml.script.jquerysortable'); JHtml::_('pfhtml.script.listform'); JHtml::_('pfhtml.script.task'); $list_order = $this->escape($this->state->get('list.ordering')); $list_dir = $this->escape($this->state->get('list.direction')); $user = JFactory::getUser(); $uid = $user->get('id'); $action_count = count($this->actions); $filter_in = $this->state->get('filter.isset') ? 'in ' : ''; $can_order = $user->authorise('core.edit.state', 'com_pftasks'); $repo_enabled = PFApplicationHelper::enabled('com_pfrepo'); $cmnts_enabled = PFApplicationHelper::enabled('com_pfcomments'); $time_enabled = PFApplicationHelper::enabled('com_pftime'); $can_track = $user->authorise('core.create', 'com_pftime') && $time_enabled; $doc = JFactory::getDocument(); $style = '.complete .task-title > a, .complete .task-description, .complete .caret {' . 'opacity:0.35;' . '}' . '.task-title > a {' . 'margin-left:10px;' . 'margin-right:10px;' . '}' . '.margin-none {' . 'margin: 0;' . '}' . '.priority-1 {' . 'border-left:8px solid #CCC;' . '}' . '.priority-2 {' . 'border-left:8px solid #468847;' . '}' . '.priority-3 {' . 'border-left:8px solid #3a87ad;' . '}' . '.priority-4 {' . 'border-left:8px solid #c09853;' . '}' . '.priority-5 {' . 'border-left:8px solid #b94a48;' . '}' . '.list-striped .dropdown-menu li {' . 'background-color:transparent;' . 'padding: 0;' . 'border-bottom-width: 0;' . '}' . '.list-striped .dropdown-menu li.divider {' . 'background-color: rgba(0, 0, 0, 0.1);' . 'margin: 2px 0;' . '}'; $doc->addStyleDeclaration($style); $print_url = PFtasksHelperRoute::getTasksRoute($this->state->get('filter.project'), $this->state->get('filter.milestone'), $this->state->get('filter.tasklist')) . '&tmpl=component&layout=print'; $print_opt = 'width=1024,height=600,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no'; ?> <script type="text/javascript"> jQuery(document).ready(function() { <?php if ($can_track) { ?> var turl = '<?php echo JRoute::_('index.php?option=com_pftime&task=recorder.add&tmpl=component', false); ?>
/** * Method to save the form data. * * @param array The form data * * @return boolean True on success */ public function save($data) { $table = $this->getTable(); $key = $table->getKeyName(); $pk = !empty($data[$key]) ? $data[$key] : (int) $this->getState($this->getName() . '.id'); $is_new = true; // Include the content plugins for the on save events. JPluginHelper::importPlugin('content'); $dispatcher = JDispatcher::getInstance(); try { if ($pk > 0) { if ($table->load($pk)) { $is_new = false; } } if (!$is_new) { $data['project_id'] = $table->project_id; } if (!PFApplicationHelper::enabled('com_pfmilestones')) { $data['milestone_id'] = $is_new ? 0 : $table->milestone_id; } // Handle task completition meta info if (isset($data['complete'])) { $date = new JDate(); if ($is_new && $data['complete'] == '1') { $data['completed'] = $date->toSql(); $data['completed_by'] = JFactory::getUser()->id; } if (!$is_new) { if ($data['complete'] == '0') { $data['completed'] = JFactory::getDbo()->getNullDate(); $data['completed_by'] = '0'; } else { if (JFactory::getUser()->id != $table->completed_by) { $data['completed'] = $date->toSql(); $data['completed_by'] = JFactory::getUser()->id; } } } } // Make sure the title and alias are always unique $data['alias'] = ''; list($title, $alias) = $this->generateNewTitle($data['title'], $data['project_id'], $data['milestone_id'], $data['list_id'], $data['alias'], $pk); $data['title'] = $title; $data['alias'] = $alias; // Handle permissions and access level if (isset($data['rules'])) { $access = PFAccessHelper::getViewLevelFromRules($data['rules'], intval($data['access'])); if ($access) { $data['access'] = $access; } } else { if ($is_new) { // Let the table class find the correct access level $data['access'] = 0; } else { // Keep the existing access in the table if (isset($data['access'])) { unset($data['access']); } } } // Try to convert estimate string to time if (isset($data['estimate'])) { if (!is_numeric($data['estimate'])) { $estimate_time = strtotime($data['estimate']); if ($estimate_time === false || $estimate_time <= 0) { $data['estimate'] = 1; } else { $data['estimate'] = $estimate_time - time(); } } else { // not a literal time, so convert minutes to secs $data['estimate'] = $data['estimate'] * 60; } } // Make item published by default if new if (!isset($data['state']) && $is_new) { $data['state'] = 1; } // Make item priority 1 by default if not set if (!isset($data['priority']) && $is_new) { $data['priority'] = 1; } // Bind the data. if (!$table->bind($data)) { $this->setError($table->getError()); return false; } // Prepare the row for saving $this->prepareTable($table); // Check the data. if (!$table->check()) { $this->setError($table->getError()); return false; } // Trigger the onContentBeforeSave event. $result = $dispatcher->trigger($this->event_before_save, array($this->option . '.' . $this->name, &$table, $is_new)); if (in_array(false, $result, true)) { $this->setError($table->getError()); return false; } // Store the data. if (!$table->store()) { $this->setError($table->getError()); return false; } $pk_name = $table->getKeyName(); if (isset($table->{$pk_name})) { $this->setState($this->getName() . '.id', $table->{$pk_name}); } $this->setState($this->getName() . '.new', $is_new); $id = $this->getState($this->getName() . '.id'); // Load the just updated row $updated = $this->getTable(); if ($updated->load($id) === false) { return false; } // Set the active project PFApplicationHelper::setActiveProject($updated->project_id); // Store entered rate in session if (isset($data['rate']) && !empty($data['rate']) && $data['rate'] != '0.00') { JFactory::getApplication()->setUserState('com_projectfork.jform_rate', $data['rate']); } // Add to watch list if ($is_new) { $cid = array($id); if (!$this->watch($cid, 1)) { return false; } } // Store the attachments if (isset($data['attachment']) && PFApplicationHelper::exists('com_pfrepo')) { $attachments = $this->getInstance('Attachments', 'PFrepoModel'); if (!$attachments->getState('item.type')) { $attachments->setState('item.type', 'com_pftasks.task'); } if ($attachments->getState('item.id') == 0) { $attachments->setState('item.id', $this->getState($this->getName() . '.id')); } if ((int) $attachments->getState('item.project') == 0) { $attachments->setState('item.project', $updated->project_id); } if (!$attachments->save($data['attachment'])) { $this->setError($attachments->getError()); return false; } } // Store the labels if (isset($data['labels'])) { $labels = $this->getInstance('Labels', 'PFModel'); if ((int) $labels->getState('item.project') == 0) { $labels->setState('item.project', $updated->project_id); } $labels->setState('item.type', 'com_pftasks.task'); $labels->setState('item.id', $id); if (!$labels->saveRefs($data['labels'])) { return false; } } // Store the dependencies if (isset($data['dependency'])) { $taskrefs = $this->getInstance('TaskRefs', 'PFtasksModel'); if ((int) $taskrefs->getState('item.project') == 0) { $taskrefs->setState('item.project', $updated->project_id); } $taskrefs->setState('item.id', $id); if (!$taskrefs->save($data['dependency'])) { return false; } } // Store users if (isset($data['users'])) { $this->saveUsers($id, $data['users']); } // Clean the cache. $this->cleanCache(); // Trigger the onContentAfterSave event. $dispatcher->trigger($this->event_after_save, array($this->option . '.' . $this->name, &$table, $is_new)); } catch (Exception $e) { $this->setError($e->getMessage()); return false; } return true; }
/** * @package pkg_projectfork * @subpackage com_pfforum * * @author Tobias Kuhn (eaxs) * @copyright Copyright (C) 2006-2013 Tobias Kuhn. All rights reserved. * @license http://www.gnu.org/licenses/gpl.html GNU/GPL, see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('pfhtml.script.listform'); $list_order = $this->escape($this->state->get('list.ordering')); $list_dir = $this->escape($this->state->get('list.direction')); $user = JFactory::getUser(); $uid = $user->get('id'); $filter_in = $this->state->get('filter.isset') ? 'in ' : ''; $repo_enabled = PFApplicationHelper::enabled('com_pfrepo'); $doc = JFactory::getDocument(); $style = '.row-topics .well,.row-topics .btn-toolbar {' . 'margin-bottom: 0;' . '}' . '.list-comments img,.collapse-comments img {' . 'margin-right: 10px;' . '}' . '.img-avatar {' . 'max-height: 50px;' . 'max-width: 50px;' . 'margin-right: 10px;' . '}' . '.well-item {' . 'margin-left: 60px;' . '}' . '.collapse-comments blockquote {' . 'margin-left: 50px;' . '}' . '.collapse-comments .btn-toolbar {' . 'margin: 0 0 0 50px;' . '}'; $doc->addStyleDeclaration($style); ?> <div id="projectfork" class="category-list<?php echo $this->pageclass_sfx; ?> view-topics"> <?php if ($this->params->get('show_page_heading', 1)) { ?> <h1><?php echo $this->escape($this->params->get('page_heading')); ?>
/** * Method to get item data. * * @param integer The id of the item. * * @return mixed Record object on success, false on failure. */ public function getItem($pk = null) { // Initialise variables. $pk = !empty($pk) ? $pk : (int) $this->getState($this->getName() . '.id'); if ($this->_item === null) { $this->_item = array(); } if (isset($this->_item[$pk])) { return $this->_item[$pk]; } $cfg = JComponentHelper::getParams('com_pfprojects'); $create_group = (int) $cfg->get('create_group'); $group_location = (int) $cfg->get('group_location'); $inherit = $this->getState($this->getName() . '.inherit'); if (!$group_location) { $group_location = 1; } try { $db = $this->getDbo(); $query = $db->getQuery(true); if (!$inherit && !$pk && $create_group) { $item = new stdClass(); $item->id = 0; $item->parent_id = $group_location; $item->lft = 0; $item->rgt = 0; $item->title = JText::_('COM_PFUSERS_DEFAULT_GROUP'); } else { $query->select('id, parent_id, lft, rgt, title')->from('#__usergroups')->where('id = ' . (int) $pk); $db->setQuery($query); $item = $db->loadObject(); } if ($error = $db->getErrorMsg()) { throw new Exception($error); } $this->_item[$pk] = empty($item) ? false : $item; if ($this->_item[$pk]) { if (!$inherit) { $component = $this->getState($this->getName() . '.component'); $section = $this->getState($this->getName() . '.section'); $this->_item[$pk]->actions = array(); $this->_item[$pk]->actions[$component] = JAccess::getActions($component, $section); $components = PFApplicationHelper::getComponents(); foreach ($components as $name => $item) { if ($name == $component) { continue; } $use_asset = PFApplicationHelper::usesProjectAsset($name); $enabled = PFApplicationHelper::enabled($name); if (!$use_asset || !$enabled) { continue; } $this->_item[$pk]->actions[$name] = JAccess::getActions($name, $section); } // Get child group names if ($this->_item[$pk]->lft && $this->_item[$pk]->rgt) { $this->_item[$pk]->children = $this->getChildGroups($this->_item[$pk]->lft, $this->_item[$pk]->rgt); } else { $this->_item[$pk]->children = array(); } } else { $component = $this->getState($this->getName() . '.component'); $section = $this->getState($this->getName() . '.section'); $this->_item[$pk]->actions = JAccess::getActions($component, $section); // Get child group names if ($this->_item[$pk]->lft && $this->_item[$pk]->rgt) { $this->_item[$pk]->children = $this->getChildGroups($this->_item[$pk]->lft, $this->_item[$pk]->rgt); } else { $this->_item[$pk]->children = array(); } } } } catch (JException $e) { if ($e->getCode() == 404) { // Need to go thru the error handler to allow Redirect to work. JError::raiseError(404, $e->getMessage()); } else { $this->setError($e); $this->_item[$pk] = false; } } return $this->_item[$pk]; }
/** * Generates the toolbar for the top of the view * * @return string Toolbar with buttons */ protected function getToolbar() { $options = array(); $options[] = array('text' => 'JSAVE', 'task' => $this->getName() . '.save'); $options[] = array('text' => 'COM_PROJECTFORK_ACTION_2NEW', 'task' => $this->getName() . '.save2new'); $options[] = array('text' => 'COM_PROJECTFORK_ACTION_2COPY', 'task' => $this->getName() . '.save2copy', 'options' => array('access' => $this->item->id > 0)); if (PFApplicationHelper::enabled('com_pftasks') && JFactory::getUser()->authorise('core.create', 'com_pftasks')) { $options[] = array('text' => 'divider'); $options[] = array('text' => 'COM_PROJECTFORK_ACTION_2TASKLIST', 'task' => $this->getName() . '.save2tasklist'); $options[] = array('text' => 'COM_PROJECTFORK_ACTION_2TASK', 'task' => $this->getName() . '.save2task'); } PFToolbar::dropdownButton($options, array('icon' => 'icon-white icon-ok')); PFToolbar::button('JCANCEL', $this->getName() . '.cancel', false, array('class' => '', 'icon' => '')); return PFToolbar::render(); }
?> </fieldset> <?php echo JHtml::_('tabs.panel', JText::_('COM_PROJECTFORK_FIELDSET_LABELS'), 'project-labels'); ?> <fieldset> <div class="formelm control-group"> <?php echo $this->form->getInput('labels'); ?> </div> </fieldset> <?php if ($this->item->id && PFApplicationHelper::enabled('com_pfrepo')) { ?> <?php echo JHtml::_('tabs.panel', JText::_('COM_PROJECTFORK_FIELDSET_ATTACHMENTS'), 'project-attachments'); ?> <fieldset> <div class="formelm control-group"> <?php echo $this->form->getInput('attachment'); ?> </div> </fieldset> <?php } ?>
*/ defined('_JEXEC') or die; JHtml::_('pfhtml.script.listform'); $list_order = $this->escape($this->state->get('list.ordering')); $list_dir = $this->escape($this->state->get('list.direction')); $user = JFactory::getUser(); $uid = $user->get('id'); $nulldate = JFactory::getDbo()->getNullDate(); $filter_in = $this->state->get('filter.isset') ? 'in ' : ''; $milestones_enabled = PFApplicationHelper::enabled('com_pfmilestones'); $tasks_enabled = PFApplicationHelper::enabled('com_pftasks'); $time_enabled = PFApplicationHelper::enabled('com_pftime'); $repo_enabled = PFApplicationHelper::enabled('com_pfrepo'); $forum_enabled = PFApplicationHelper::enabled('com_pfforum'); $users_enabled = PFApplicationHelper::enabled('com_pfusers'); $cmnts_enabled = PFApplicationHelper::enabled('com_pfcomments'); $is_ssl = JFactory::getURI()->isSSL(); $print_url = PFprojectsHelperRoute::getProjectsRoute() . '&tmpl=component&layout=print'; $print_opt = 'width=1024,height=600,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no'; ?> <div id="projectfork" class="category-list<?php echo $this->pageclass_sfx; ?> view-projects PrintArea all"> <?php if ($this->params->get('show_page_heading', 1)) { ?> <h1><?php echo $this->escape($this->params->get('page_heading')); ?> </h1>
* * @author Tobias Kuhn (eaxs) * @copyright Copyright (C) 2006-2012 Tobias Kuhn. All rights reserved. * @license http://www.gnu.org/licenses/gpl.html GNU/GPL, see LICENSE.txt **/ defined('_JEXEC') or die; if (count($buttons) == 0) { return ''; } ?> <div class="row-fluid"> <?php foreach ($buttons as $component => $btns) { ?> <?php if (PFApplicationHelper::enabled($component)) { ?> <?php foreach ($btns as $btn) { ?> <div class="span3" style="margin: 0 10px 10px 0;"> <a href="<?php echo JRoute::_($btn['link']); ?> " class="thumbnail btn"> <p><?php echo $btn['icon']; ?> </p> <?php echo JText::_($btn['title']);
/** * Method to get a list of items. * Overriden to inject convert the attribs field into a JParameter object. * * @return mixed $items An array of objects on success, false on failure. */ public function getItems() { $items = parent::getItems(); $labels = $this->getInstance('Labels', 'PFModel'); $tasks_exists = PFApplicationHelper::enabled('com_pftasks'); $pks = JArrayHelper::getColumn($items, 'id'); // Get aggregate data $progress = array(); $total_tasks = array(); $completed_tasks = array(); if ($tasks_exists) { JLoader::register('PFtasksModelTasks', JPATH_SITE . '/components/com_pftasks/models/tasks.php'); $tmodel = JModelLegacy::getInstance('Tasks', 'PFtasksModel', array('ignore_request' => true)); $progress = $tmodel->getAggregatedProgress($pks, 'milestone_id'); $total_tasks = $tmodel->getAggregatedTotal($pks, 'milestone_id'); $completed_tasks = $tmodel->getAggregatedTotal($pks, 'milestone_id', 1); } foreach ($items as $i => &$item) { // Convert the parameter fields into objects. $params = new JRegistry(); $params->loadString($item->attribs); $items[$i]->params = clone $this->getState('params'); // Create slugs $items[$i]->slug = $items[$i]->alias ? $items[$i]->id . ':' . $items[$i]->alias : $items[$i]->id; $items[$i]->project_slug = $items[$i]->project_alias ? $items[$i]->project_id . ':' . $items[$i]->project_alias : $items[$i]->project_id; // Get the labels if ($items[$i]->label_count > 0) { $items[$i]->labels = $labels->getConnections('com_pfmilestones.milestone', $items[$i]->id); } if (!isset($items[$i]->watching)) { $items[$i]->watching = 0; } // Inject task count $items[$i]->tasks = isset($total_tasks[$item->id]) ? $total_tasks[$item->id] : 0; // Inject completed task count $items[$i]->completed_tasks = isset($completed_tasks[$item->id]) ? $completed_tasks[$item->id] : 0; // Inject progress $items[$i]->progress = isset($progress[$item->id]) ? $progress[$item->id] : 0; } return $items; }
/** * Generates the toolbar for the top of the view * * @return string Toolbar with buttons */ protected function getToolbar() { $access = PFmilestonesHelper::getActions($this->item->id); $uid = JFactory::getUser()->get('id'); $app = JFactory::getApplication(); if ($this->item->id) { $slug = $this->item->id . ':' . $this->item->alias; $project_slug = $app->input->getCmd('filter_project'); $return = base64_encode(PFmilestonesHelperRoute::getMilestoneRoute($slug, $project_slug)); PFToolbar::button('COM_PROJECTFORK_ACTION_EDIT', '', false, array('access' => $access->get('core.edit') || $access->get('core.edit.own') && $uid == $this->item->created_by, 'href' => JRoute::_(PFmilestonesHelperRoute::getMilestonesRoute() . '&task=form.edit&id=' . $slug . '&return=' . $return))); } if (PFApplicationHelper::enabled('com_pftasks')) { PFToolbar::button(JText::sprintf('JGRID_HEADING_TASKLISTS_AND_TASKS', intval($this->item->lists), intval($this->item->tasks)), '', false, array('href' => JRoute::_(PFtasksHelperRoute::getTasksRoute($this->item->project_id, $this->item->id)), 'icon' => 'icon-chevron-right', 'class' => '')); } return PFToolbar::render(); }
echo $this->form->getLabel('modified'); ?> </div> <div class="controls"> <?php echo $this->form->getInput('modified'); ?> </div> </div> <?php } ?> </fieldset> <?php if (PFApplicationHelper::enabled('com_pfforum')) { ?> <?php echo JHtml::_('tabs.panel', JText::_('COM_PROJECTFORK_FIELDSET_ATTACHMENTS'), 'topic-attachments'); ?> <fieldset> <div class="formelm control-group"> <?php echo $this->form->getInput('attachment'); ?> </div> </fieldset> <?php } ?>
?> </a></li> <?php } if ($user->authorise('core.create', 'com_pfforum') && PFApplicationHelper::enabled('com_pfforum')) { ?> <li><a href="<?php echo JRoute::_($link_forum . '&task=topicform.add'); ?> "><i class="icon-comments-2"></i> <?php echo JText::_('TPL_GOGGLES_NEW_TOPIC'); ?> </a></li> <?php } if ($user->authorise('core.create', 'com_pfrepo') && $app->getUserState('com_projectfork.project.active.id') && PFApplicationHelper::enabled('com_pfrepo')) { ?> <li><a href="<?php echo JRoute::_($link_repo . '&task=fileform.add'); ?> "><i class="icon-upload"></i> <?php echo JText::_('TPL_GOGGLES_NEW_FILE'); ?> </a></li> <?php } ?> </ul> </div> <hr /> </div>