Example #1
0
 /**
  * Display the specified resource.
  * @TODO pull out menu into its own model with a many to many relationship to
  *   Projects, Pages and Portfolios
  * @param  int  $id
  * @return Response
  */
 public function show($id = null)
 {
     $banner = FALSE;
     $type = "pages.show";
     $settings = $this->settings->first();
     if ($id == null) {
         $page = $this->pageModel->first();
         $pageCtrl = new \PagesController();
         return $pageCtrl->show($page);
     }
     //Try Page
     $page = $this->pageModel->where("slug", 'LIKE', '/' . $id)->first();
     if ($this->checkIfPublishedAndUserState($page)) {
         $page->slug === '/home' ? $banner = TRUE : ($banner = FALSE);
         $pageCtrl = new \PagesController();
         return $pageCtrl->show($page);
     }
     //Try Project
     $project = $this->project->where("slug", 'LIKE', '/' . $id)->first();
     if ($this->checkIfPublishedAndUserState($project)) {
         $projCtrl = new \ProjectsController();
         return $projCtrl->show($project);
     }
     //Try Portfolio
     $portfolio = $this->portfolio->where("slug", 'LIKE', '/' . $id)->first();
     if ($this->checkIfPublishedAndUserState($portfolio)) {
         $portfolioCtrl = new \PortfoliosController();
         return $portfolioCtrl->show($portfolio);
     }
     //Else 404
     return \View::make('404', compact('settings'));
 }
 /**
  * Constructor
  *
  * @param Request $request
  * @return ProjectGroupsController
  */
 function __construct($request)
 {
     parent::__construct($request);
     $this->wireframe->addBreadCrumb(lang('Groups'), assemble_url('project_groups'));
     $group_id = $this->request->get('project_group_id');
     if ($group_id) {
         $this->active_project_group = ProjectGroups::findById($group_id);
     }
     // if
     if (instance_of($this->active_project_group, 'ProjectGroup')) {
         $this->wireframe->addBreadCrumb($this->active_project_group->getName(), $this->active_project_group->getViewUrl());
     } else {
         $this->active_project_group = new ProjectGroup();
     }
     // if
     $this->smarty->assign(array('active_project_group' => $this->active_project_group));
 }
 /**
  * Construct project controller
  *
  * @param Request $request
  * @return ProjectController
  */
 function __construct($request)
 {
     parent::__construct($request);
     $this->wireframe->page_actions = array();
     // Reset page actions
     $project_id = $this->request->get('project_id');
     if ($project_id) {
         $this->active_project = Projects::findById($project_id);
     }
     // if
     if (instance_of($this->active_project, 'Project')) {
         if (!$this->logged_user->isProjectMember($this->active_project)) {
             $this->httpError(HTTP_ERR_FORBIDDEN);
         }
         // if
         if ($this->active_project->getType() == PROJECT_TYPE_SYSTEM) {
             $this->httpError(HTTP_ERR_NOT_FOUND);
         }
         // if
         if ($this->active_project->isCompleted()) {
             $this->wireframe->addBreadCrumb(lang('Archive'), assemble_url('projects_archive'));
         }
         // if
         $this->wireframe->addBreadCrumb($this->active_project->getName(), $this->active_project->getOverviewUrl());
         $tabs = new NamedList();
         $tabs->add('overview', array('text' => str_excerpt($this->active_project->getName(), 25), 'url' => $this->active_project->getOverviewUrl()));
         event_trigger('on_project_tabs', array(&$tabs, &$this->logged_user, &$this->active_project));
         $tabs->add('people', array('text' => lang('People'), 'url' => $this->active_project->getPeopleUrl()));
         $tabs->add('recent_pages', array('text' => lang('Recent Pages'), 'url' => assemble_url('recent_pages') . '&project_id=' . $this->active_project->getId()));
         /*$tabs->add('recent_pages_1', array(
             'text' => lang('Recent Pages'),
             'url' => assemble_url('project_recent_pages_1'),
           ));*/
         //BOF:mod
         /*$tabs->add('attachments', array(
             'text' => lang('Attachments'),
             'url' => assemble_url('attachments_list', array('project_id' => $this->active_project->getId())) ,
           ));*/
         //EOF:mod
         $tabs->add('reminders', array('text' => lang('Notifications'), 'url' => assemble_url('reminders_list', array('project_id' => $this->active_project->getId()))));
         $tabs->add('calendar', array('text' => lang('Calendar'), 'url' => Calendar::getProjectCalendarUrl($this->active_project)));
         js_assign('image_picker_url', assemble_url('image_picker', array('project_id' => $this->active_project->getId())));
         js_assign('active_project_id', $this->active_project->getId());
         $this->smarty->assign('page_tabs', $tabs);
         // ---------------------------------------------------
         //  Set page company and page project
         // ---------------------------------------------------
         $page_company = $this->active_project->getCompany();
         if (instance_of($page_company, 'Company')) {
             $this->wireframe->page_company = $page_company;
         }
         // if
         $this->wireframe->page_project = $this->active_project;
         // New project
     } else {
         if ($this->controller_name == 'project') {
             $this->active_project = new Project();
         } else {
             $this->httpError(HTTP_ERR_NOT_FOUND);
         }
         // if
     }
     // if
     $this->smarty->assign(array('active_project' => $this->active_project, 'page_tab' => 'overview'));
     // -----------------------------------------------------------------------
     //  Do category related voodoo if categories are enabled. Categories are
     //  not initialized if we don't have a loaded project (no project ID)
     // -----------------------------------------------------------------------
     if ($this->active_project->isLoaded() && $this->enable_categories) {
         $category_id = $this->request->get('category_id');
         if ($category_id) {
             $this->active_category = Categories::findById($category_id);
         }
         // if
         if (instance_of($this->active_category, 'Category')) {
             if ($this->active_category->getProjectId() != $this->active_project->getId()) {
                 $this->active_category = new Category();
                 // this category is not part of selected project
             }
             // if
         } else {
             $this->active_category = new Category();
         }
         // if
         $this->smarty->assign(array('active_category' => $this->active_category, 'categories_url' => Category::getSectionUrl($this->active_project, $this->getControllerName(), $this->active_module), 'add_category_url' => Category::getAddUrl($this->active_project, $this->getControllerName(), $this->active_module)));
     }
     // if
 }
Example #4
0
<?php

include "controllers/projects.controller.php";
$pc = new ProjectsController();
$json = array();
switch ($_POST['action']) {
    //we're adding a project
    case "add":
        $postObj = array("project_title" => $_POST['title'], "project_desc" => $_POST['desc'], "project_due" => $_POST['due'], "project_start" => $_POST['start'], "user_id" => $_SESSION['loggedin']);
        $ret = $pc->addProject($postObj);
        $json['status'] = $ret['status'];
        break;
        //we're fetching projects for the dashboard
    //we're fetching projects for the dashboard
    case "dash":
        $json = $pc->getDashProjects($_POST['num']);
        //$json['project_count']=count($json);
        $num = $pc->getNumProjects();
        $json['project_total'] = $num['project_count'];
        $json['project_max'] = $_SESSION['maxprojects'];
        break;
    case "archived":
        $json = $pc->getProjects($_POST['start'], $_POST['num']);
        break;
        //we're fetching an entire project
    //we're fetching an entire project
    case "fetch":
        $json = $pc->getProject($_POST['id']);
        break;
    case "update":
        $postObj = array("project_title" => $_POST['title'], "project_desc" => $_POST['desc'], "project_due" => $_POST['due'], "project_start" => $_POST['start']);
Example #5
0
<?php

include "controllers/projects.controller.php";
$pc = new ProjectsController();
$json = array();
switch ($_POST['action']) {
    //we're adding a project
    case "add":
        $postObj = array("milestone_title" => $_POST['title'], "milestone_desc" => $_POST['desc'], "milestone_due" => $_POST['due'], "project_id" => $_POST['project'], "user_id" => $_SESSION['loggedin']);
        $pc->addMilestone($postObj);
        $json['status'] = "ok";
        break;
        //we're fetching projects for the dashboard
    //we're fetching projects for the dashboard
    case "dash":
        $json = $pc->getDashMilestones($_POST['start'], $_POST['num']);
        //$json['project_count']=count($json);
        $num = $pc->getNumMilestones(NULL, MILESTONE_NOT_ARCHIVED, MILESTONE_NOT_DONE);
        $json['milestone_total'] = $num['milestone_total'];
        break;
    case "fetchall":
        $json = $pc->getMilestones($_POST['project_id']);
        break;
    case "fetch":
        $json = $pc->getMilestone($_POST['id']);
        break;
    case "update":
        $postObj = array("milestone_title" => $_POST['title'], "milestone_desc" => $_POST['desc'], "milestone_due" => $_POST['due']);
        $json["status"] = $pc->updateMilestone($_POST['milestone_id'], $postObj);
        break;
    case "archive":
Example #6
0
<?php

/**
* @version		$Id: projects.php 9764 2007-12-30 07:48:11Z ircmaxell $
* @package		Joomla
* @subpackage	Projects
* @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
/*
 * Make sure the user is authorized to view this page
 */
/*$user = & JFactory::getUser();
if (!$user->authorize( 'com_projects', 'manage' )) {
	$mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') );
}
*/
// Require the base controller
require_once JPATH_COMPONENT . DS . 'controller.php';
define('COM_MEDIA_BASE', JPATH_ROOT . DS . 'images' . DS . 'projects');
$controller = new ProjectsController();
// Perform the Request task
$controller->execute(JRequest::getCmd('task'));
$controller->redirect();