class ProjectController extends AppController {
public function index() {
+ try {
+ $http = new Client();
+ $response = $http->get(MANIVELLE_URL . "softwares/", [], ['type' => 'json']);
+
+ $softwares = $response->body('json_decode');
+
+ } catch (Exception $exception) {
+ $this->log(var_export($exception, true), "debug");
+ }
+
+ $this->set('softwares',$softwares->softwares);
+ }
+
+ public function request() {
try {
$http = new Client();
$response = $http->get(MANIVELLE_URL . "request/" . $this->request->query('id'), [], ['type' => 'json']);
$this->set('project',$software);
$this->set('usersOf', $RelationshipsUsersOf);
- $this->set('relationshipsServicePorviders',$relationshipsServiceProviders);
- }
-
- public function request() {
- //$data contains forge name, forge api url, project name,
+ $this->set('relationshipsServicePorviders',$relationshipsServiceProviders);
+
}
public function alternative() {
}
public function works() {
- //$data contains forge name, forge api url, project name,
+ try {
+
+ $http = new Client();
+ $response = $http->get(MANIVELLE_URL . "RelationshipsSoftwares/getWorkingWellRelationshipsBySoftwareId/" . $this->request->query('id'), [], ['type' => 'json']);
+ $softwares = $response->body('json_decode');
+
+ } catch (Exception $exception) {
+ $this->log(var_export($exception, true), "debug");
+ }
+ $this->set('projectSoftwareRelationship',$softwares);
}
public function reviews() {
$http = new Client();
$response = $http->get(MANIVELLE_URL . "RelationshipsSoftwaresUsers/getUsersOfRelationshipsBySoftwareId/" . $this->request->query('id'), [], ['type' => 'json']);
-
$usersOf = $response->body('json_decode');
} catch (Exception $exception) {
}
public function creator() {
- //$data contains forge name, forge api url, project name,
+
}
public function providers() {
- //$data contains forge name, forge api url, project name,
+ try {
+
+ $http = new Client();
+ $response = $http->get(MANIVELLE_URL . "RelationshipsSoftwaresUsers/getProvidersRelationshipsBySoftwareId/" . $this->request->query('id'), [], ['type' => 'json']);
+ $usersOf = $response->body('json_decode');
+
+ } catch (Exception $exception) {
+ $this->log(var_export($exception, true), "debug");
+ }
+ $this->set('projectUsersrelationship',$usersOf);
}
public function screens() {
--- /dev/null
+<?php
+
+// Dans un controller
+namespace App\Controller;
+
+use App\Controller\AppController;
+use Cake\Network\Http\Client;
+
+
+/**
+ * CakePHP UsersController
+ * @author mpastor
+ */
+class UsersController extends AppController {
+
+ public function index() {
+
+ try {
+ $http = new Client();
+ $response = $http->get(MANIVELLE_URL . "users/", [], ['type' => 'json']);
+
+ $users = $response->body('json_decode');
+
+ } catch (Exception $exception) {
+ $this->log(var_export($exception, true), "debug");
+ }
+
+ $this->set('users',$users->users);
+ }
+
+ public function providers(){
+
+
+ try {
+ $http = new Client();
+
+ $response = $http->get(MANIVELLE_URL . "relationships-softwares-users/getServicesProviders.json?Relationships=ServicesProvider");
+
+ $users = $response->body('json_decode');
+ } catch (Exception $exception) {
+ $this->log(var_export($exception, true), "debug");
+ }
+ $this->set("users",$users);
+ //$this->set('_serialize', ['relationshipsSoftwaresUser']);
+ }
+
+}
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
- <a class="navbar-brand" href="#">Manivelle</a>
+ <?= $this->Html->link(__("Manivelle"),
+ ['controller' => 'Home', 'action' => 'index'],
+ ['escape' => false,"class"=>"navbar-brand"] ) ?>
</div>
+ <ul class="nav navbar-nav">
+ <li class="active">
+ <?= $this->Html->link(__("All softwares"),
+ ['controller' => 'Project', 'action' => 'index'],
+ ['escape' => false] ) ?>
+ </li>
+ <li>
+ <?= $this->Html->link(__("All users"),
+ ['controller' => 'Users', 'action' => 'index'],
+ ['escape' => false] ) ?>
+ </li>
+ <li>
+ <?= $this->Html->link(__("All providers"),
+ ['controller' => 'Users', 'action' => 'providers'],
+ ['escape' => false] ) ?>
+ </li>
+
+ </ul>
<div id="navbar" class="navbar-collapse collapse">
<?= $this->Form->create(null,['url' => ['controller' => 'Request', 'action' => 'index'],'class'=>"navbar-form navbar-right",'title'=>"requestForm"]) ?>
<div class="form-group" >
</section>
<?php endif; ?>
-<?php if (!isset( $project->reviews ) && !isset( $reviews ) ): ?>
+<?php if (empty( $project->reviews ) && !isset( $reviews ) ): ?>
<section class="row">
<h2>
<?= __("Reviews ")?> <?= __($project->softwarename)?>
<?php if (!empty( $serviceProviders ) ): ?>
<section class="row">
<h2>
- <?= __("Service porviders for ")?> <?= __($project->softwarename)?>
+ <?= __("Service providers for ")?> <?= __($project->softwarename)?>
</h2>
<ul class=" list-unstyled ">
<?php foreach ($serviceProviders as $serviceProvider) : ?>
</ul>
</section>
<?php endif; ?>
-<?php if (empty( $serviceProviders ) ): ?>
+<?php if (isset($project) && empty( $serviceProviders ) && !isset($projectUsersrelationship) ): ?>
<section class="row">
<h2>
- <?= __("Service porviders for ")?> <?= __($project->softwarename)?>
+ <?= __("Service providers for ")?> <?= __($project->softwarename)?>
</h2>
<p>
<?php echo __("No service provider for $project->softwarename.");?>
</p>
</section>
+<?php endif; ?>
+
+
+<?php if (!isset( $serviceProviders ) && isset($projectUsersrelationship) && empty($projectUsersrelationship->relationshipsSoftwaresUser)): ?>
+<section class="row">
+ <h2>
+ <?= __("Service providers for ")?> <?php echo $this->cell('SoftwareSummary',[$projectUsersrelationship->id])->render('../../Element/ProjectPage/softwareName')?>
+ </h2>
+ <p>
+ <?php echo __("No service provider for ");?> <?php echo $this->cell('SoftwareSummary',[$projectUsersrelationship->id])->render('../../Element/ProjectPage/softwareName')?>
+ </p>
+</section>
+<?php endif; ?>
+
+<?php
+/**
+ * display all users of the current software.
+ */
+?>
+<?php if (isset ($projectUsersrelationship) && !empty( $projectUsersrelationship->relationshipsSoftwaresUser ) ): ?>
+<section class="row">
+ <h2>
+ <?= __("Service providers for ")?> <?php echo $this->cell('SoftwareSummary',[$projectUsersrelationship->relationshipsSoftwaresUser[0]->software_id])->render('../../Element/ProjectPage/softwareName')?>
+ </h2>
+ <ul class=" list-unstyled ">
+ <?php foreach ($projectUsersrelationship->relationshipsSoftwaresUser as $relationshipsSoftwaresUser) : ?>
+
+ <li>
+ <?php echo $this->cell('UserSummary',[$relationshipsSoftwaresUser->user_id])->render('../../Element/Entity/entitySummary')?>
+ </li>
+
+ <?php endforeach; ?>
+ </ul>
+</section>
<?php endif; ?>
\ No newline at end of file
<?= $this->end('Project') ?>
<?= $this->start('ProjectLink') ?>
<?= $this->Html->link( "<span class='glyphicon glyphicon-plus'> </span>",
- ['controller' => 'Project', 'action' => 'index','?' => ['id' => $project->id]],
+ ['controller' => 'Project', 'action' => 'request','?' => ['id' => $project->id]],
['escape' => false] ) ?>
<?= $this->end('ProjectLink') ?>
<div id="minimal-software">
<?= $this->Html->link( $this->fetch('Project'),
- ['controller' => 'Project', 'action' => 'index','?' => ['id' => $project->id]],
+ ['controller' => 'Project', 'action' => 'request','?' => ['id' => $project->id]],
['escape' => false] ) ?>
<div>
$this->Text->truncate($project->description,100,['ellipsis' => '...','exact' => false] );
?>
<?= $this->Html->link( $this->fetch('ProjectLink'),
- ['controller' => 'Project', 'action' => 'index','?' => ['id' => $project->id]],
+ ['controller' => 'Project', 'action' => 'request','?' => ['id' => $project->id]],
['escape' => false] ) ?>
</p>
</div>
?>
-<?php if (!empty( $usersOf ) ): ?>
+<?php if (!empty( $usersOf ) && !isset($projectUsersrelationship)): ?>
<section class="row">
<h2>
<?= __("Users of ")?> <?= __($project->softwarename)?>
</ul>
</section>
<?php endif; ?>
-<?php if (!isset( $usersOf ) && !isset($projectUsersrelationship)): ?>
+
+
+<?php if ((!isset( $usersOf ) || empty($usersOf)) && !isset($projectUsersrelationship)): ?>
<section class="row">
<h2>
<?= __("Users of ")?> <?= __($project->softwarename)?>
<?php endif; ?>
+<?php if (!isset( $usersOf ) && isset($projectUsersrelationship) && empty($projectUsersrelationship->relationshipsSoftwaresUser)): ?>
+<section class="row">
+ <h2>
+ <?= __("Users of ")?> <?php echo $this->cell('SoftwareSummary',[$projectUsersrelationship->id])->render('../../Element/ProjectPage/softwareName')?>
+ </h2>
+ <p>
+ <?php echo __("No user for ");?> <?php echo $this->cell('SoftwareSummary',[$projectUsersrelationship->id])->render('../../Element/ProjectPage/softwareName')?>
+ </p>
+</section>
+<?php endif; ?>
+
+
<?php
/**
* display all users of the current software.
*/
?>
-<?php if (!empty( $projectUsersrelationship ) ): ?>
+<?php if (isset ($projectUsersrelationship) && !empty( $projectUsersrelationship->relationshipsSoftwaresUser ) ): ?>
<section class="row">
<h2>
<?= __("Users of ")?> <?php echo $this->cell('SoftwareSummary',[$projectUsersrelationship->relationshipsSoftwaresUser[0]->software_id])->render('../../Element/ProjectPage/softwareName')?>
<?php if (!empty( $project->relationships ) ): ?>
<section class="row">
<h2>
- <?= __("Works well with ")?> <?= __($project->softwarename)?>
+ <?= __("Working well with ")?> <?= __($project->softwarename)?>
</h2>
- <ul class=" list-unstyled ">
+ <ul class=" list-unstyled ">
<?php foreach ($project->relationships as $screenshot) : ?>
<?php if ($screenshot->cd =='WorksWellWith') : ?>
<li>
</section>
<?php endif; ?>
-<?php if (empty( $project->relationships ) ) : ?>
+<?php if (isset ($project) && empty( $project->relationships ) ) : ?>
+<section class="row">
+ <h2>
+ <?= __("Working well with ")?> <?= __($project->softwarename)?>
+ </h2>
+ <p>
+ <?php echo __("There are no project for $project->softwarename.");?>
+ </p>
+
+
+</section>
+<?php endif; ?>
+
+
+<?php if (isset ($projectSoftwareRelationship) && !empty( $projectSoftwareRelationship->relationshipsSoftwares ) ): ?>
+<section class="row">
+ <h2>
+ <?= __("Working well with ")?> <?php echo $this->cell('SoftwareSummary',[$projectSoftwareRelationship->relationshipsSoftwares[0]->software_id])->render('../../Element/ProjectPage/softwareName')?>
+ </h2>
+ <ul class=" list-unstyled ">
+ <?php foreach ($projectSoftwareRelationship->relationshipsSoftwares as $relationshipsSoftware) : ?>
+
+ <li>
+ <?php echo $this->cell('SoftwareSummary',[$relationshipsSoftware->recipient_id])->render('../../Element/ProjectPage/softwareSummary')?>
+ </li>
+
+ <?php endforeach; ?>
+ </ul>
+</section>
+<?php endif; ?>
+
+<?php if (empty( $projectSoftwareRelationship->relationshipsSoftwares ) ) : ?>
<section class="row">
<h2>
- <?= __("Works well with ")?> <?= __($project->softwarename)?>
+ <?= __("Working well with ")?> <?php echo $this->cell('SoftwareSummary',[$projectSoftwareRelationship->id])->render('../../Element/ProjectPage/softwareName')?>
</h2>
<p>
- <?php echo __("There are no project for $project->softwarename.");?> s
+ <?php echo __("There are no project for ") ?><?php echo $this->cell('SoftwareSummary',[$projectSoftwareRelationship->id])->render('../../Element/ProjectPage/softwareName')?>
</p>
<?= $this->element("ProjectPage/serviceProviders" , ['serviceProviders'=>$relationshipsServicePorviders,'project' => $project])?>
<?= $this->Html->link( __("All service providers of ").$project->softwarename,
- ['controller' => 'Project', 'action' => 'providers','?' => ['id' => $project->id]],
+ ['controller' => 'Project', 'action' => 'providers','?' => ['id' => $project->id,'kind' => "servicesProvider"]],
['escape' => false] ) ?>
</div>
<div class="row">
<?= $this->element("ProjectPage/usersOfProject" , ['usersOf' => $usersOf,'project' => $project])?>
<?= $this->Html->link( __("All users of ").$project->softwarename,
- ['controller' => 'Project', 'action' => 'users','?' => ['id' => $project->id]],
+ ['controller' => 'Project', 'action' => 'users','?' => ['id' => $project->id,'kind' => "UserOf"]],
['escape' => false] ) ?>
</div>
<div class="row">
<?= $this->element("ProjectPage/alternativeTo" , ['project' => $project])?>
- <?= $this->Html->link( "All alternatives to [ProjectName]",
+ <?= $this->Html->link( "All alternatives to ".$project->softwarename,
['controller' => 'Project', 'action' => 'alternative','?' => ['id' => $project->id]],
['escape' => false] ) ?>
</div>
<div class="row">
<?= $this->element("ProjectPage/worksWellWith" , ['project' => $project])?>
- <?= $this->Html->link( __("All softwares works well with ").$project->softwarename,
+ <?= $this->Html->link( __("All softwares working well with ").$project->softwarename,
['controller' => 'Project', 'action' => 'works','?' => ['id' => $project->id]],
['escape' => false] ) ?>
<?php
-$this->layout = 'project';
+$this->layout = 'base';
?>
+
+<?php if (!empty( $softwares ) ): ?>
+<section class="row">
+ <h2>
+ <?= __("Software list for Manivelle")?>
+ </h2>
+ <ul class=" list-unstyled ">
+ <?php foreach ($softwares as $software) : ?>
+
+ <li>
+ <?php echo $this->cell('SoftwareSummary',[$software->id])->render('../../Element/ProjectPage/softwareSummary')?>
+ </li>
+
+ <?php endforeach; ?>
+ </ul>
+</section>
+<?php endif; ?>
\ No newline at end of file
<section class="row">
- <h2>
- <?= __("Service providers for ")?> <?= __("[ProjectName]")?>
- </h2>
- <?= $this->element("Entity/entitySummary")?>
+ <ul class="list-unstyled">
+ <li>
+ <?= $this->element("ProjectPage/serviceProviders")?>
+ </li>
+ </ul>
+
+
</section>
\ No newline at end of file
--- /dev/null
+<?php
+$this->layout = 'project';
+
+?>
+
+
?>
-<div class="row">
- <h2>
- <?= __("Works well with ")?> <?= __("[ProjectName]")?>
- </h2>
+<section class="row">
+
<ul class="list-unstyled">
<li>
- <?= $this->element("ProjectPage/softwareSummary") ?>
- </li>
- <li>
- <?= $this->element("ProjectPage/softwareSummary") ?>
- </li>
- <li>
- <?= $this->element("ProjectPage/softwareSummary") ?>
- </li>
- <li>
- <?= $this->element("ProjectPage/softwareSummary") ?>
- </li>
- <li>
- <?= $this->element("ProjectPage/softwareSummary") ?>
- </li>
- <li>
- <?= $this->element("ProjectPage/softwareSummary") ?>
- </li>
- <li>
- <?= $this->element("ProjectPage/softwareSummary") ?>
- </li>
- <li>
- <?= $this->element("ProjectPage/softwareSummary") ?>
- </li>
-
+ <?= $this->element("ProjectPage/worksWellWith")?>
+ </li>
</ul>
-</div>
\ No newline at end of file
+
+
+
+</section>
\ No newline at end of file
--- /dev/null
+<?php
+$this->layout = 'base';
+
+?>
+
+<?php if (!empty( $users ) ): ?>
+<section class="row">
+ <h2>
+ <?= __("Users list for Manivelle")?>
+ </h2>
+ <ul class=" list-unstyled ">
+ <?php foreach ($users as $user) : ?>
+
+ <li>
+ <?php echo $this->cell('UserSummary',[$user->id])->render('../../Element/Entity/entitySummary')?>
+ </li>
+
+ <?php endforeach; ?>
+ </ul>
+</section>
+<?php endif; ?>
--- /dev/null
+<?php
+
+$this->layout("base");
+?>
+
+<?php if (isset( $users->relationshipsSoftwaresUsers ) ): ?>
+<section class="row">
+ <h2>
+ <?= __("Service providers list in Manivelle")?>
+ </h2>
+ <ul class=" list-unstyled ">
+ <?php foreach ($users->relationshipsSoftwaresUsers as $relationshipsSoftwaresUsers) : ?>
+
+ <li>
+ <?php echo $this->cell('UserSummary',[$relationshipsSoftwaresUsers->user->id])->render('../../Element/Entity/entitySummary')?>
+ </li>
+
+ <?php endforeach; ?>
+ </ul>
+</section>
+<?php endif; ?>