Skip to content

Commit

Permalink
Continuous Integration merge. Feature is usable, but no tests exists …
Browse files Browse the repository at this point in the history
…yet.
  • Loading branch information
TiSiE committed Mar 17, 2015
2 parents 723a271 + c2c2a19 commit 892e4a3
Show file tree
Hide file tree
Showing 31 changed files with 959 additions and 123 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"blueimp/jquery-file-upload": "*",
"ivaynberg/select2": "3.5.*",
"tinymce/tinymce": "*",
"mikemix/zf2htmlpurifier": "0.*"
"mikemix/zf2htmlpurifier": "0.*",
"cross-solution/bootstrap3-dialog": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "4.5.*",
Expand Down
44 changes: 40 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions module/Auth/src/Auth/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Core\Entity\Collection\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Organizations\Entity\OrganizationInterface;
use Settings\Repository\SettingsEntityResolver;

/**
Expand Down Expand Up @@ -118,6 +119,32 @@ class User extends AbstractIdentifiableEntity implements UserInterface
*/
protected $tokens;

/**
* The organization this user belongs to either as owner or as employee.
*
* This is the inversed side of a bi-directional reference, so it is NOT
* mutable. (and not stored in the database.)
*
* @var OrganizationInterface
* @ODM\ReferenceOne(
* targetDocument="\Organizations\Entity\Organization",
* mappedBy="user"
* )
* @since 0.18
*/
protected $organization;

/**
* Collection of organizations this user is employed by.
*
* @var Collection
* @ODM\ReferenceMany(
* targetDocument="\Organizations\Entity\Organization",
* repositoryMethod="getEmployersCursor"
* )
*/
protected $employers;

/**
* @see http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/best-practices.html
* It is recommended best practice to initialize any business collections in documents in the constructor.
Expand Down Expand Up @@ -343,6 +370,7 @@ public function getGroup($name, $create = false)
{
$groups = $this->getGroups();
foreach ($groups as $group) {
/* @var $group GroupInterface */
if ($group->getName() == $name) {
return $group;
}
Expand Down Expand Up @@ -375,4 +403,20 @@ public function setTokens($tokens)
$this->tokens = $tokens;
}

public function hasOrganization()
{
return (bool) $this->organization;
}

public function getOrganization()
{
return $this->organization;
}

public function getEmployers()
{
return $this->employers;
}


}
26 changes: 26 additions & 0 deletions module/Auth/src/Auth/Entity/UserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
namespace Auth\Entity;

use Core\Entity\IdentifiableEntityInterface;
use Doctrine\Common\Collections\Collection;
use Organizations\Entity\OrganizationInterface;
use Zend\Permissions\Acl\Role\RoleInterface;

/**
Expand Down Expand Up @@ -120,4 +122,28 @@ public function getGroups();
*/
public function getTokens();

/**
* Returns true, if this user is assigned to an organization.
*
* @return bool
* @since 0.18
*/
public function hasOrganization();

/**
* Gets the organization the user owns.
*
* @return OrganizationInterface
* @since 0.18
*/
public function getOrganization();

/**
* Returns a collection of organizations the user is employed by
*
* @return Collection
* @since 0.18
*/
public function getEmployers();

}
12 changes: 11 additions & 1 deletion module/Auth/view/auth/index/login-info.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,18 @@
<a href="<?php echo $this->url('lang/my', array('action' => 'password', 'lang' => $lang), true) ?>"><span class="yk-icon yk-icon-password"></span> <?php echo $this->translate('Change password')?></a>
</li>
<?php if ($this->auth('role') == 'recruiter'): ?>
<li>
<?php /*<li>
<a href="<?php echo $this->url('lang/my-groups', array('lang' => $lang)) ?>"><span class="yk-icon yk-icon-group"></span> <?php echo $this->translate('Manage groups') ?></a>
</li>*/?>
<li>
<a href="<?php echo $this->url('lang/my-organization', array('lang' => $lang)) ?>"><span class="yk-icon fa-building"></span> <?php
$user = $this->auth()->getUser(); /* @var $user \Auth\Entity\User */
if ($user->hasOrganization()) {
echo sprintf($this->translate('Edit "%s"'), $user->getOrganization()->getOrganizationName()->getName());
} else {
echo $this->translate('Create my organization');
}
?></a>
</li>
<?php endif ?>
<li class="divider"></li>
Expand Down
2 changes: 2 additions & 0 deletions module/Core/public/js/core.pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
if (typeof event.data.loadingIndicator != 'undefined') {
event.data.loadingIndicator.hide();
}
// Use more verbose event name
$container.trigger('yk-pagination-loaded', {data: data});
$container.trigger('ajax.ready', {'data': data});

});
Expand Down
Loading

0 comments on commit 892e4a3

Please sign in to comment.