Exemplo n.º 1
0
defined('_HZEXEC_') or die;
$this->css()->css('icons', 'com_projects')->css('emocons', 'com_projects');
$this->js();
$li = '';
if (count($this->activities) > 0) {
    $projects = array();
    $i = 1;
    ?>
<div id="latest_activity" class="infofeed">
	<div class="activity-items" id="activity-feed">
		<?php 
    // Loop through activities
    foreach ($this->activities as $activity) {
        $a = $activity['activity'];
        if (!isset($projects[$a->projectid])) {
            $projects[$a->projectid] = \Components\Projects\Models\Project::getInstance($a->projectid);
        }
        // Show activity
        $this->view('_activity')->set('model', $projects[$a->projectid])->set('activity', $activity)->set('uid', $this->uid)->set('edit', false)->set('showProject', true)->display();
        ?>
		<?php 
        $li = 'li_' . $a->id;
        $i++;
    }
    // end foreach
    ?>
	</div>
</div>
<?php 
} else {
    ?>
Exemplo n.º 2
0
 /**
  * Optimize git repo
  *
  * @return  void
  */
 public function gitgcTask()
 {
     $id = Request::getVar('id', 0);
     // Get repo model
     require_once PATH_CORE . DS . 'components' . DS . 'com_projects' . DS . 'models' . DS . 'repo.php';
     $project = new Models\Project($id);
     if (!$project->exists()) {
         App::redirect(Route::url('index.php?option=' . $this->_option, false), Lang::txt('COM_PROJECTS_NOTICE_ID_NOT_FOUND'), 'error');
         return;
     }
     $repo = new \Components\Projects\Models\Repo($project, 'local');
     $params = array('path' => $repo->get('path'), 'adv' => true);
     $repo->call('optimize', $params);
     // Redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&task=edit&id=' . $id, false), Lang::txt('Git repo optimized'));
 }
Exemplo n.º 3
0
 /**
  * Display projects user belongs to
  *
  * @apiMethod GET
  * @apiUri    /projects/list
  * @apiParameter {
  * 		"name":          "limit",
  * 		"description":   "Number of result to return.",
  * 		"type":          "integer",
  * 		"required":      false,
  * 		"default":       0
  * }
  * @apiParameter {
  * 		"name":          "start",
  * 		"description":   "Number of where to start returning results.",
  * 		"type":          "integer",
  * 		"required":      false,
  * 		"default":       0
  * }
  * @apiParameter {
  * 		"name":          "sort",
  * 		"description":   "Field to sort results by.",
  * 		"type":          "string",
  * 		"required":      false,
  *      "default":       "title",
  * 		"allowedValues": "title, created, alias"
  * }
  * @apiParameter {
  * 		"name":          "sort_Dir",
  * 		"description":   "Direction to sort results by.",
  * 		"type":          "string",
  * 		"required":      false,
  * 		"default":       "asc",
  * 		"allowedValues": "asc, desc"
  * }
  * @apiParameter {
  * 		"name":          "verbose",
  * 		"description":   "Receive verbose output for project status, team member role and privacy.",
  * 		"type":          "integer",
  * 		"required":      false,
  * 		"default":       "0",
  * 		"allowedValues": "0, 1"
  * }
  * @return  void
  */
 public function listTask()
 {
     // Incoming
     $verbose = Request::getInt('verbose', 0);
     $model = new Project();
     // Set filters
     $filters = array('limit' => Request::getInt('limit', 0, 'post'), 'start' => Request::getInt('start', 0, 'post'), 'sortby' => Request::getWord('sort', 'title', 'post'), 'sortdir' => strtoupper(Request::getWord('sort_Dir', 'ASC')), 'getowner' => 1, 'updates' => 1, 'mine' => 1);
     $response = new stdClass();
     $response->projects = array();
     $response->total = $model->entries('count', $filters);
     if ($response->total) {
         $base = rtrim(Request::base(), '/');
         foreach ($model->entries('list', $filters) as $i => $entry) {
             $obj = new stdClass();
             $obj->id = $entry->get('id');
             $obj->alias = $entry->get('alias');
             $obj->title = $entry->get('title');
             $obj->description = $entry->get('about');
             $obj->state = $entry->get('state');
             $obj->inSetup = $entry->inSetup();
             $obj->owner = $entry->owner('name');
             $obj->created = $entry->get('created');
             $obj->userRole = $entry->member()->role;
             $obj->thumbUrl = str_replace('/api', '', $base . '/' . ltrim(Route::url($entry->link('thumb')), '/'));
             $obj->privacy = $entry->get('private');
             $obj->provisioned = $entry->isProvisioned();
             $obj->groupOwnerId = $entry->groupOwner('id');
             $obj->userOwnerId = $entry->owner('id');
             $obj->uri = str_replace('/api', '', $base . '/' . ltrim(Route::url($entry->link()), '/'));
             // Explain what status/role means
             if ($verbose) {
                 // Project status
                 switch ($entry->get('state')) {
                     case 0:
                         $obj->state = $entry->inSetup() ? Lang::txt('setup') : Lang::txt('suspended');
                         break;
                     case 1:
                     default:
                         $obj->state = Lang::txt('active');
                         break;
                     case 2:
                         $obj->state = Lang::txt('deleted');
                         break;
                     case 5:
                         $obj->state = Lang::txt('pending approval');
                         break;
                 }
                 // Privacy
                 $obj->privacy = $entry->get('private') == 1 ? Lang::txt('private') : Lang::txt('public');
                 // Team role
                 switch ($obj->userRole) {
                     case 0:
                     default:
                         $obj->userRole = Lang::txt('collaborator');
                         break;
                     case 1:
                         $obj->userRole = Lang::txt('manager');
                         break;
                     case 2:
                         $obj->userRole = Lang::txt('author');
                         break;
                     case 5:
                         $obj->userRole = Lang::txt('reviewer');
                         break;
                 }
             }
             $response->projects[] = $obj;
         }
     }
     $this->send($response);
 }