コード例 #1
0
ファイル: dashboard.php プロジェクト: sgershen/Projectfork
 /**
  * Returns a list of buttons for the frontend
  *
  * @return    array
  */
 public static function getSiteButtons()
 {
     $user = JFactory::getUser();
     $buttons = array();
     if ($user->authorise('core.create', 'com_pftasks')) {
         $buttons[] = array('title' => 'MOD_PF_DASH_BUTTONS_ADD_TASK', 'link' => PFtasksHelperRoute::getTasksRoute() . '&task=taskform.add', 'icon' => JHtml::image('com_projectfork/projectfork/header/icon-48-taskform.add.png', JText::_('MOD_PF_DASH_BUTTONS_ADD_TASK'), null, true));
         $buttons[] = array('title' => 'MOD_PF_DASH_BUTTONS_ADD_TASKLIST', 'link' => PFtasksHelperRoute::getTasksRoute() . '&task=tasklistform.add', 'icon' => JHtml::image('com_projectfork/projectfork/header/icon-48-tasklistform.add.png', JText::_('MOD_PF_DASH_BUTTONS_ADD_TASKLIST'), null, true));
     }
     return $buttons;
 }
コード例 #2
0
ファイル: default.php プロジェクト: MrJookie/pm
                            <?php 
            $list_open = false;
            $item_order = array();
        }
        ?>
                        <div class="cat-list-row<?php 
        echo $k;
        ?>
">
                        	<?php 
        if ($item->list_title) {
            ?>

                               <h3>
		                          <a class="pull-left" href="<?php 
            echo JRoute::_(PFtasksHelperRoute::getTasksRoute($item->project_slug, $item->milestone_slug, $item->list_slug));
            ?>
">
		                              <?php 
            echo $this->escape($item->list_title);
            ?>
		                          </a>
		                          <?php 
            $this->menu->start(array('class' => 'btn-mini btn-link', 'pull' => 'left'));
            $this->menu->itemEdit('tasklistform', $item->list_id, $can_edit || $can_edit_own);
            $this->menu->itemTrash('tasklists', $x, $can_edit || $can_edit_own);
            $this->menu->end();
            echo $this->menu->render(array('class' => 'btn-mini btn-link', 'pull' => 'left'));
            ?>
		                           <small><?php 
            echo htmlspecialchars_decode($this->escape($item->list_description));
コード例 #3
0
ファイル: default.php プロジェクト: Kontent/Projectfork
        echo (int) $item->tasklists;
        ?>
 <?php 
        echo JText::_('JGRID_HEADING_TASKLISTS');
        ?>
    	    	    			        </a>
    	    	    				</div>
    	    	    			<?php 
    }
    ?>
    	    	    			<?php 
    if ($tasks_enabled) {
        ?>
	    	    	    			<div class="btn-group">
	                                    <a class="btn btn-mini" href="<?php 
        echo JRoute::_(PFtasksHelperRoute::getTasksRoute($item->slug));
        ?>
">
	                                        <span aria-hidden="true" class="icon-checkmark"></span>
	                                        <?php 
        echo (int) $item->tasks;
        ?>
 <?php 
        echo JText::_('JGRID_HEADING_TASKS');
        ?>
	                                    </a>
	    	    	    			</div>
    	    	    			<?php 
    }
    ?>
    	    	    			<?php 
コード例 #4
0
ファイル: view.html.php プロジェクト: eno93/Projectfork
 /**
  * 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();
 }
コード例 #5
0
ファイル: default.php プロジェクト: sgershen/Projectfork
        echo (int) $item->tasklists;
        ?>
 <?php 
        echo JText::_('JGRID_HEADING_TASKLISTS');
        ?>
	    	    			        </a>
	    	    				</div>
	    	    			<?php 
    }
    ?>
	    	    			<?php 
    if ($tasks_enabled) {
        ?>
    	    	    			<div class="btn-group">
                                    <a href="<?php 
        echo JRoute::_(PFtasksHelperRoute::getTasksRoute($item->project_slug, $item->slug));
        ?>
" class="btn btn-mini">
                                        <span aria-hidden="true" class="icon-checkmark"></span>
                                        <?php 
        echo (int) $item->tasks;
        ?>
 <?php 
        echo JText::_('JGRID_HEADING_TASKS');
        ?>
                                    </a>
    	    	    			</div>
	    	    			<?php 
    }
    ?>
	    	    			<?php 
コード例 #6
0
ファイル: index.php プロジェクト: MrJookie/pm
$pid = (int) $app->getUserState('com_projectfork.project.active.id');
// Find the project repo base dir
if ($pid) {
    $db = JFactory::getDbo();
    $query = $db->getQuery(true);
    $query->select('attribs')->from('#__pf_projects')->where('id = ' . $db->quote($pid));
    $db->setQuery($query);
    $project_attribs = $db->loadResult();
    $project_params = new JRegistry();
    $project_params->loadString($project_attribs);
    $repo_dir = (int) $project_params->get('repo_dir');
} else {
    $repo_dir = 1;
}
// Prepare component base links
$link_tasks = class_exists('PFtasksHelperRoute') ? PFtasksHelperRoute::getTasksRoute() : 'index.php?option=com_pftasks';
$link_projects = class_exists('PFprojectsHelperRoute') ? PFprojectsHelperRoute::getProjectsRoute() : 'index.php?option=com_pfprojects';
$link_time = class_exists('PFtimeHelperRoute') ? PFtimeHelperRoute::getTimesheetRoute() : 'index.php?option=com_pftime';
$link_ms = class_exists('PFmilestonesHelperRoute') ? PFmilestonesHelperRoute::getMilestonesRoute() : 'index.php?option=com_pfmilestones';
$link_forum = class_exists('PFforumHelperRoute') ? PFforumHelperRoute::getTopicsRoute() : 'index.php?option=com_pfforum';
$link_repo = class_exists('PFrepoHelperRoute') ? PFrepoHelperRoute::getRepositoryRoute($pid, $repo_dir) : 'index.php?option=com_pfrepo&filter_project=' . $pid . '&parent_id=' . $repo_dir;
// Logout link return
$return = base64_encode($this->baseurl);
?>
<!DOCTYPE html>
<html>
<head>
	<jdoc:include type="head" />
    <?php 
// Detecting Home
$site_app = JFactory::getApplication('Site');
コード例 #7
0
ファイル: helper.php プロジェクト: MrJookie/pm
 /**
  * Method to get a list of items of a project to render in the gantt chart
  *
  * @return    array    $items    The items to render
  */
 protected static function getItemsDetail()
 {
     $data = self::getProjectDetails();
     $user = JFactory::getUser();
     $config = JFactory::getConfig();
     $params = self::$params;
     $items = array();
     $can_edit_m_state = $user->authorise('core.edit.state', 'com_pfmilestones');
     $can_edit_t_state = $user->authorise('core.edit.state', 'com_pftasks');
     $default = array('1', '0', '2');
     $show_ms = $params->get('show_milestones', $default);
     $show_l = $params->get('show_lists', $default);
     $show_t = $params->get('show_tasks', $default);
     $ms_display = (int) $params->get('ms_display');
     $highlight = (int) $params->get('highlight_today');
     $date_now = new JDate('now', 'UTC');
     $date_now->setTimezone(new DateTimeZone($user->getParam('timezone', $config->get('offset'))));
     $today = $date_now->toUnix() * 1000;
     $icons = array('milestone' => 'icon-flag', 'tasklist' => 'icon-list-view', 'task-complete' => 'icon-checkbox', 'task-incomplete' => 'icon-checkbox-unchecked');
     $prev_level = 0;
     $level = 0;
     // Fix "Show Task Lists" setting from older module versions
     if (!is_array($show_l)) {
         if ($show_l == '1') {
             $show_l = array('1', '0', '2');
         } else {
             $show_l = array('-1');
         }
     }
     // Fix empty "Show X" settings
     if (is_array($show_ms) && count($show_ms) == 0) {
         $show_ms = $default;
     }
     if (is_array($show_l) && count($show_l) == 0) {
         $show_l = $default;
     }
     if (is_array($show_t) && count($show_t) == 0) {
         $show_t = $default;
     }
     // Map item keys
     $map_ms = array();
     $map_l = array();
     $map_t = array();
     foreach ($data as $i => $record) {
         if ($record->type == 'milestone') {
             $map_ms[$record->id] = $i;
         }
         if ($record->type == 'tasklist') {
             $map_l[$record->id] = $i;
         }
         if ($record->type == 'task') {
             $map_t[$record->id] = $i;
         }
     }
     foreach ($data as $i => $record) {
         $link = '#';
         $prev_level = $level;
         $dep = array();
         if ($record->type == 'milestone') {
             // Hide milestone?
             if (!in_array($record->state, $show_ms)) {
                 continue;
             }
             $slug = $record->id . ':' . $record->alias;
             $pslug = self::$project . ':' . $record->p_alias;
             $link = JRoute::_(PFmilestonesHelperRoute::getMilestoneRoute($slug, $pslug));
             $level = 0;
             $class = 'gantt-m';
             $bid = 'gantt-m-' . $record->id;
             $can_edit = $can_edit_m_state;
         }
         if ($record->type == 'tasklist') {
             // Hide list?
             if (!in_array($record->state, $show_l)) {
                 continue;
             }
             $slug = $record->id . ':' . $record->alias;
             $pslug = self::$project . ':' . $record->p_alias;
             $mslug = $record->milestone_id . ':' . $record->m_alias;
             $link = JRoute::_(PFtasksHelperRoute::getTasksRoute($pslug, $mslug, $slug));
             $class = 'gantt-l';
             $bid = 'gantt-l-' . $record->id;
             $can_edit = $can_edit_t_state;
             if ($record->milestone_id) {
                 if (isset($map_ms[$record->milestone_id])) {
                     $k = $map_ms[$record->milestone_id];
                     $ms = $data[$k];
                     if (!in_array($ms->state, $show_ms)) {
                         $record->milestone_id = 0;
                     }
                 }
             }
             $level = $record->milestone_id ? 1 : 0;
         }
         if ($record->type == 'task') {
             // Hide task?
             if (!in_array($record->state, $show_t)) {
                 continue;
             }
             $slug = $record->id . ':' . $record->alias;
             $pslug = self::$project . ':' . $record->p_alias;
             $mslug = $record->milestone_id . ':' . $record->m_alias;
             $lslug = $record->list_id . ':' . $record->l_alias;
             $link = JRoute::_(PFtasksHelperRoute::getTaskRoute($slug, $pslug, $mslug, $lslug));
             $bid = 'gantt-t-' . $record->id;
             $record->type .= '-' . ($record->complete ? 'complete' : 'incomplete');
             if ($record->milestone_id) {
                 if (isset($map_ms[$record->milestone_id])) {
                     $k = $map_ms[$record->milestone_id];
                     $ms = $data[$k];
                     if (!in_array($ms->state, $show_ms)) {
                         $record->milestone_id = 0;
                     }
                 }
             }
             if ($record->list_id) {
                 if (isset($map_l[$record->list_id])) {
                     $k = $map_l[$record->list_id];
                     $l = $data[$k];
                     if (!in_array($l->state, $show_l)) {
                         $record->list_id = 0;
                     }
                 }
             }
             if ($record->l_ms) {
                 if (isset($map_l[$record->l_ms])) {
                     $k = $map_l[$record->list_id];
                     $l = $data[$k];
                     if (!in_array($l->state, $show_l)) {
                         $record->l_ms = 0;
                     }
                 }
             }
             if (in_array('-1', $show_l)) {
                 $record->l_ms = 0;
             }
             $level = $record->list_id ? $record->l_ms ? 2 : 1 : ($record->milestone_id ? 1 : 0);
             $class = 'gantt-t';
             $can_edit = $can_edit_t_state;
             // Add task dependencies
             if (count($record->parents)) {
                 foreach ($record->parents as $parent) {
                     $dep[] = 'gantt-t-' . $parent;
                 }
             }
         }
         // Set arrow direction and indentation
         if ($level == 0) {
             $indent = '<i class="icon-arrow-right-3"></i> ';
         } else {
             $indent = '<i class="icon-arrow-' . ($ms_display ? 'down' : 'up') . '-3" style="margin-left:' . 16 * $level . 'px"></i> ';
         }
         if (!$can_edit) {
             $name = '<i class="' . $icons[$record->type] . '"></i> ' . '<span>' . ucfirst(htmlspecialchars($record->title)) . '</span>';
         } else {
             $name = '<i class="' . $icons[$record->type] . '"></i> ' . '<a href="' . $link . '">' . ucfirst(htmlspecialchars($record->title)) . '</a>';
         }
         // Create row object
         $row = new stdClass();
         $row->name = $indent . $name;
         $row->desc = self::formatDuration($record->duration, $record->start_time, $record->end_time, $record->complete);
         $row->values = array();
         // Create row item object
         $item = new stdClass();
         if ($record->type == 'milestone' && $ms_display) {
             $item->label = '<i class="icon-flag"></i>';
             $item->from = '/Date(' . $record->end_year . ', ' . ($record->end_month - 1) . ', ' . $record->end_day . ')/';
         } else {
             $item->label = ucfirst(htmlspecialchars($record->title));
             $item->from = '/Date(' . $record->start_year . ', ' . ($record->start_month - 1) . ', ' . $record->start_day . ')/';
         }
         $item->to = '/Date(' . $record->end_year . ', ' . ($record->end_month - 1) . ', ' . $record->end_day . ')/';
         $item->id = $bid;
         $item->desc = '';
         // Determine custom class
         $item->customClass = $class;
         if ($record->complete) {
             $item->customClass .= '-complete';
         } elseif ($record->start_time > self::$time_today) {
             $item->customClass .= '-notstarted';
         } elseif ($record->end_time < self::$time_today) {
             $item->customClass .= '-behind';
         }
         // Add dependencies
         if (count($dep)) {
             $item->dep = $dep;
         }
         // Highlight today?
         if ($highlight) {
             $hl = new stdClass();
             $hl->label = '';
             $hl->desc = '';
             $hl->from = '/Date()/';
             $hl->to = '/Date()/';
             $hl->customClass = 'gantt-today';
             $row->values[] = $hl;
         }
         $row->values[] = $item;
         $items[] = $row;
     }
     return $items;
 }
コード例 #8
0
 /**
  * Function that allows child controller access to model data after the data has been saved.
  *
  * @param     jmodel    $model        The data model object.
  * @param     array     $validData    The validated data.
  *
  * @return    void
  */
 protected function postSaveHook(&$model, $validData)
 {
     $task = $this->getTask();
     switch ($task) {
         case 'save2copy':
         case 'save2new':
             // No redirect because its already set
             break;
         case 'save2milestone':
             $link = JRoute::_(PFmilestonesHelperRoute::getMilestonesRoute() . '&task=form.add');
             $this->setRedirect($link);
             break;
         case 'save2tasklist':
             $link = JRoute::_(PFtasksHelperRoute::getTasksRoute() . '&task=tasklistform.add');
             $this->setRedirect($link);
             break;
         default:
             $this->setRedirect($this->getReturnPage());
             break;
     }
 }
コード例 #9
0
 /**
  * Generates the toolbar for the top of the view
  *
  * @return    string    Toolbar with buttons
  */
 protected function getToolbar()
 {
     $access = PFtasksHelper::getActions($this->item->id);
     $uid = JFactory::getUser()->get('id');
     $slug = $this->item->id . ':' . $this->item->alias;
     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::_(PFtasksHelperRoute::getTasksRoute() . '&task=taskform.edit&id=' . $slug)));
     return PFToolbar::render();
 }
コード例 #10
0
 /**
  * Function that allows child controller access to model data after the data has been saved.
  *
  * @param     jmodel    $model    The data model object.
  * @param     array     $data     The validated data.
  *
  * @return    void
  */
 protected function postSaveHook(&$model, $data)
 {
     $task = $this->getTask();
     $id = (int) $model->getState('form.id');
     switch ($task) {
         case 'save2copy':
         case 'save2new':
             // No redirect because its already set
             break;
         case 'save2tasklist':
             $link = JRoute::_(PFtasksHelperRoute::getTasksRoute() . '&task=tasklistform.add&milestone_id=' . $id);
             $this->setRedirect($link);
             break;
         case 'save2task':
             $link = JRoute::_(PFtasksHelperRoute::getTasksRoute() . '&task=taskform.add&milestone_id=' . $id);
             $this->setRedirect($link);
             break;
         default:
             $this->setRedirect($this->getReturnPage());
             break;
     }
 }